-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from saertna/selection-modal-booster-crafting
bring boosters to craft into game
- Loading branch information
Showing
11 changed files
with
1,949 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
{ | ||
"id": "obsidian-gamified-pkm", | ||
"name": "Gamificate your PKM", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"minAppVersion": "0.15.0", | ||
"description": "This plugin gamifies your personal knowledge management (PKM) to bring fun and drive into your PKM", | ||
"author": "Andreas Trebing", | ||
"authorUrl": "", | ||
"fundingUrl": "https://ko-fi.com/andreastrebing", | ||
"isDesktopOnly": false | ||
"isDesktopOnly": false, | ||
"styles": ["styles.css"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { App, Modal } from 'obsidian'; | ||
import gamification from 'main'; | ||
import { MultiSelectModal } from 'MultiSelectModal'; | ||
|
||
export class ModalBooster extends Modal { | ||
private readonly displayText: string; | ||
private readonly gamificationInstance: gamification; | ||
|
||
constructor(app: App, displayText: string, gamificationInstance: gamification) { | ||
super(app); | ||
this.displayText = displayText; | ||
this.gamificationInstance = gamificationInstance; | ||
} | ||
|
||
onOpen() { | ||
const { contentEl } = this; | ||
contentEl.setText(this.displayText); | ||
|
||
const multiSelectModal = new MultiSelectModal(this.app, [], 'Craft Booster Item', this.gamificationInstance); // Create the modal instance | ||
|
||
|
||
// Add a button to open the multi-select modal | ||
const button = document.createElement('button'); | ||
button.innerText = 'Open Crafting Table'; | ||
button.onclick = () => { | ||
multiSelectModal.setUseBooster(false); // Set the flag for crafting table | ||
multiSelectModal.open(); | ||
}; | ||
|
||
|
||
multiSelectModal.readBoostersStock(); | ||
multiSelectModal.readIngrementStock(); | ||
|
||
|
||
const button2 = document.createElement('button'); | ||
button2.innerText = 'Open Booster Board'; | ||
button2.onclick = () => { | ||
multiSelectModal.setUseBooster(true); | ||
multiSelectModal.open(); | ||
}; | ||
|
||
contentEl.appendChild(button); | ||
contentEl.appendChild(button2); | ||
} | ||
|
||
onClose() { | ||
const { contentEl } = this; | ||
contentEl.empty(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { App, Modal } from 'obsidian'; | ||
|
||
export class ModalInformationbox extends Modal { | ||
private readonly displayText: string; // Store the text to be displayed | ||
|
||
constructor(app: App, displayText: string) { | ||
super(app); | ||
this.displayText = displayText; // Store the passed text | ||
} | ||
|
||
onOpen() { | ||
const { contentEl } = this; | ||
contentEl.setText(this.displayText); // Use the stored text | ||
} | ||
|
||
onClose() { | ||
const { contentEl } = this; | ||
contentEl.empty(); | ||
} | ||
} |
Oops, something went wrong.