diff --git a/lootalot_front/src/App.vue b/lootalot_front/src/App.vue index 05a182b..cd7c52d 100644 --- a/lootalot_front/src/App.vue +++ b/lootalot_front/src/App.vue @@ -19,6 +19,13 @@ export const store = { state: { player_id: 0, show_player_chest: false, + // methods + isPlayer () { + this.player_id != 0 + }, + isGroup () { + this.player_id == 0 + }, }, setActivePlayer (newPlayerId) { if (this.debug) console.log('setActivePlayer to ', newPlayerId) diff --git a/lootalot_front/src/components/Chest.vue b/lootalot_front/src/components/Chest.vue index f520b7d..a23a738 100644 --- a/lootalot_front/src/components/Chest.vue +++ b/lootalot_front/src/components/Chest.vue @@ -1,22 +1,54 @@ diff --git a/lootalot_front/src/components/GroupChest.vue b/lootalot_front/src/components/GroupChest.vue index ceb009b..9022e4f 100644 --- a/lootalot_front/src/components/GroupChest.vue +++ b/lootalot_front/src/components/GroupChest.vue @@ -1,14 +1,14 @@ diff --git a/lootalot_front/src/components/Player.vue b/lootalot_front/src/components/Player.vue index e614f67..ac9d2bd 100644 --- a/lootalot_front/src/components/Player.vue +++ b/lootalot_front/src/components/Player.vue @@ -2,7 +2,7 @@
- +
@@ -55,15 +60,42 @@ return { app_state: store.state, player: { - name: "Player name", + name: "Groupe", wealth: [1000,100,10,1], + debt: 0, }, + player_list: [ + {id: 0, name: "Groupe"}, + {id: 1, name: "Lomion"}, + {id: 4, name: "Oilosse"}, + {id: 3, name: "Fefi"}, + ], show_dropdown: false, }; }, + computed: { + name () { + return this.player.name; + }, + // Check if the active player is the special 'Group' player + playerIsGroup () { + return this.app_state.player_id == 0; + } + }, methods: { switchPlayerChestVisibility () { - store.switchPlayerChestVisibility() + store.switchPlayerChestVisibility(); + }, + hidePlayerChest () { + if (this.app_state.show_player_chest) { + this.switchPlayerChestVisibility(); + } + }, + setActivePlayer (playerIdx) { + const newId = this.player_list[playerIdx].id; + store.setActivePlayer(newId); + if (newId == 0) { this.hidePlayerChest() } + this.player.name = this.player_list[playerIdx].name }, closeDropdown () { this.show_dropdown = false @@ -84,7 +116,7 @@ } }); - if (!el.contains(e.target) && !excludedElClicked) { + if (!excludedElClicked) { console.log('outsideCloseDropdown'); vnode.context[handler]() } diff --git a/lootalot_front/src/components/Wealth.vue b/lootalot_front/src/components/Wealth.vue index 5dc8e68..c23cdb9 100644 --- a/lootalot_front/src/components/Wealth.vue +++ b/lootalot_front/src/components/Wealth.vue @@ -1,5 +1,5 @@