|
13 | 13 | :class="{'player-user': info == playerInfos.user, 'player-opponent': info != playerInfos.user}"> |
14 | 14 |
|
15 | 15 | <!-- Player information boxes --> |
16 | | - <div class="properties player-info-box"> |
17 | | - <h4 style="text-decoration: underline; font-weight: bold;" @click="selectEntity(info)" |
18 | | - :class="{'selected': info.selected, 'targetable': doingAction && targets.indexOf(info.id) !== -1}">{{info.name}}</h4> |
19 | | - <ul style="list-style: none outside none; margin: 0; padding: 0;"> |
20 | | - <li v-for="(value, name) in info.properties" :key="name"> |
21 | | - <b>{{name | formatResourceName}}</b>: {{value}} |
22 | | - </li> |
23 | | - <li><b>Cards: </b>{{ info.zones.Hand ? info.zones.Hand.length() : "?" }}</li> |
24 | | - </ul> |
25 | | - <!-- Action buttons --> |
26 | | - <div class="player-actions"> |
27 | | - <div v-for="action in actions" v-if="action.isPlayer && action.id == info.id" :key="action.action"> |
28 | | - <input @click="startAction(action)" v-show="!doingAction" type="button" :value="action.action" |
29 | | - class="btn btn-navbar csh-button"/> |
30 | | - </div> |
31 | | - <div v-show="doingAction && info == playerInfos.user"> |
32 | | - <input @click="cancelAction()" type="button" value="Cancel" |
33 | | - class="btn btn-navbar csh-button"/> |
34 | | - <input @click="performAction()" type="button" :value="currentAction ? currentAction.action : '(None)'" |
35 | | - class="btn btn-navbar csh-button"/> |
36 | | - </div> |
37 | | - </div> |
38 | | - </div> |
| 16 | + <PlayerInfo :info="info" :currentAction="currentAction" |
| 17 | + :actions="actions" :selectEntity="selectEntity" :startAction="startAction" :cancelAction="cancelAction" :performAction="performAction" |
| 18 | + :showActions="doingAction && info == playerInfos.user"> |
| 19 | + |
| 20 | + </PlayerInfo> |
39 | 21 |
|
40 | 22 | <!-- Player cards --> |
41 | 23 | <div v-for="(zoneInfo, zoneName) in info.zones" class="zone" :class="'zone-' + zoneName" :key="zoneName"> |
|
59 | 41 | <script> |
60 | 42 | import CardshifterServerAPI from "../server_interface"; |
61 | 43 | import CardModel from "./CardModel" |
| 44 | +import PlayerInfo from "./PlayerInfo" |
62 | 45 |
|
63 | 46 | export default { |
64 | 47 | name: "GameBoard", |
@@ -95,6 +78,7 @@ export default { |
95 | 78 | } |
96 | 79 | }, |
97 | 80 | components: { |
| 81 | + PlayerInfo, |
98 | 82 | CardModel |
99 | 83 | }, |
100 | 84 | methods: { |
@@ -511,12 +495,6 @@ export default { |
511 | 495 | }, |
512 | 496 | computed: { |
513 | 497 |
|
514 | | - }, |
515 | | - filters: { |
516 | | - formatResourceName: function(input) { |
517 | | - input = input.replace(/_/g, ' '); |
518 | | - return input.substring(0, 1).toUpperCase() + input.substring(1).toLowerCase(); |
519 | | - } |
520 | 498 | }, |
521 | 499 | beforeDestroy() { |
522 | 500 | CardshifterServerAPI.$off("type:resetActions", this.resetActions); |
|
0 commit comments