-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a way for the inventory to be opened from the character card
- Loading branch information
Showing
14 changed files
with
347 additions
and
238 deletions.
There are no files selected for viewing
18 changes: 4 additions & 14 deletions
18
resources/js/game/components/actions/partials/actions/actions.tsx
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
3 changes: 3 additions & 0 deletions
3
resources/js/game/components/actions/partials/actions/types/actions-props.ts
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,3 @@ | ||
export default interface ActionsProps { | ||
showMonsterStats: () => void; | ||
} |
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
3 changes: 3 additions & 0 deletions
3
...ng-cards/character-details/hooks/definitions/use-manage-character-inventory-visibility.ts
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,3 @@ | ||
export default interface UseManageCharacterInventoryVisibility { | ||
openCharacterInventory: () => void; | ||
} |
45 changes: 45 additions & 0 deletions
45
...tials/floating-cards/character-details/hooks/use-manage-character-inventory-visibility.ts
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,45 @@ | ||
import { useEventSystem } from 'event-system/hooks/use-event-system'; | ||
|
||
import UseManageCharacterInventoryVisibility from './definitions/use-manage-character-inventory-visibility'; | ||
import { CharacterSheet } from '../../../../../character-sheet/event-types/character-sheet'; | ||
import { ActionCardEvents } from '../../event-types/action-cards'; | ||
|
||
export const useManageCharacterInventoryVisibility = | ||
(): UseManageCharacterInventoryVisibility => { | ||
const eventSystem = useEventSystem(); | ||
|
||
const manageCharacterInventoryEmitter = eventSystem.isEventRegistered( | ||
CharacterSheet.OPEN_INVENTORY_SECTION | ||
) | ||
? eventSystem.getEventEmitter<{ [key: string]: boolean }>( | ||
CharacterSheet.OPEN_INVENTORY_SECTION | ||
) | ||
: eventSystem.registerEvent<{ [key: string]: boolean }>( | ||
CharacterSheet.OPEN_INVENTORY_SECTION | ||
); | ||
|
||
const openCharacterInventory = () => { | ||
const closeCraftingCardEvent = eventSystem.getEventEmitter<{ | ||
[key: string]: boolean; | ||
}>(ActionCardEvents.OPEN_CRATING_CARD); | ||
const closeChatCardEvent = eventSystem.getEventEmitter<{ | ||
[key: string]: boolean; | ||
}>(ActionCardEvents.OPEN_CHAT_CARD); | ||
const closeCharacterCardEvent = eventSystem.getEventEmitter<{ | ||
[key: string]: boolean; | ||
}>(ActionCardEvents.OPEN_CHARACTER_CARD); | ||
|
||
closeCraftingCardEvent.emit(ActionCardEvents.OPEN_CRATING_CARD, false); | ||
closeChatCardEvent.emit(ActionCardEvents.OPEN_CHAT_CARD, false); | ||
closeCharacterCardEvent.emit(ActionCardEvents.OPEN_CHARACTER_CARD, false); | ||
|
||
manageCharacterInventoryEmitter.emit( | ||
CharacterSheet.OPEN_INVENTORY_SECTION, | ||
true | ||
); | ||
}; | ||
|
||
return { | ||
openCharacterInventory, | ||
}; | ||
}; |
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
Oops, something went wrong.