🐛 (viewer) show correct variants during bidding - and add an icon to be able to show faction variants for choose-bid at all
This commit is contained in:
parent
f68689e601
commit
ffe1d29324
7 changed files with 147 additions and 44 deletions
|
|
@ -1,5 +1,10 @@
|
|||
<template>
|
||||
<g>
|
||||
<path
|
||||
:transform="`scale(0.16) translate(-8,-8)`"
|
||||
d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"
|
||||
/>
|
||||
<circle class="rules-button" r="1.6" v-b-modal="'rules'" />
|
||||
<circle :r="r" fill="none" />
|
||||
<g
|
||||
v-for="i in [0, 1, 2, 3, 4, 5, 6]"
|
||||
|
|
@ -29,6 +34,7 @@
|
|||
<script lang="ts">
|
||||
import Vue from "vue";
|
||||
import { Component } from "vue-property-decorator";
|
||||
import { planetFill } from "../graphics/utils";
|
||||
import Engine, { factionPlanet, Planet } from "@gaia-project/engine";
|
||||
|
||||
@Component
|
||||
|
|
@ -82,10 +88,7 @@ export default class FactionWheel extends Vue {
|
|||
}
|
||||
|
||||
planetFill(planet: string) {
|
||||
if (planet === Planet.Titanium || planet === Planet.Swamp) {
|
||||
return "white";
|
||||
}
|
||||
return "black";
|
||||
return planetFill(planet);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -94,4 +97,9 @@ circle {
|
|||
stroke-width: 0.05px;
|
||||
stroke: black;
|
||||
}
|
||||
|
||||
.rules-button {
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
<template>
|
||||
<g
|
||||
:class="['finalScoringTile', { highlighted }]"
|
||||
v-b-tooltip
|
||||
:title="tooltip"
|
||||
v-b-modal="'final-scoring'"
|
||||
role="button"
|
||||
>
|
||||
<g :class="['finalScoringTile', { highlighted }]" v-b-tooltip :title="tooltip" v-b-modal="'rules'" role="button">
|
||||
<rect x="1" y="1" width="75" height="55" />
|
||||
<text class="title" x="5" y="12">{{ content }}</text>
|
||||
<Token
|
||||
|
|
|
|||
|
|
@ -3,25 +3,7 @@
|
|||
<b-modal id="chart-button" title="Victory Points, Resources, and more" size="xl">
|
||||
<Charts />
|
||||
</b-modal>
|
||||
<b-modal id="final-scoring" size="lg" title="Final Scoring" dialog-class="gaia-viewer-modal">
|
||||
<b-table
|
||||
striped
|
||||
bordered
|
||||
small
|
||||
responsive="true"
|
||||
hover
|
||||
:items="finalScoringItems"
|
||||
:fields="finalScoringFields"
|
||||
class="final-store-table"
|
||||
>
|
||||
<template #cell(Name)="data">
|
||||
<span v-html="data.value"></span>
|
||||
</template>
|
||||
<template #cell()="data">
|
||||
<b-checkbox :checked="data.value" disabled />
|
||||
</template>
|
||||
</b-table>
|
||||
</b-modal>
|
||||
<Rules id="rules" />
|
||||
|
||||
<div
|
||||
:class="['row', 'no-gutters', 'justify-content-center', engine.players.length > 2 ? 'medium-map' : 'small-map']"
|
||||
|
|
@ -95,6 +77,7 @@ import AdvancedLog from "./AdvancedLog.vue";
|
|||
import BoardAction from "./BoardAction.vue";
|
||||
import Commands from "./Commands.vue";
|
||||
import Pool from "./Pool.vue";
|
||||
import Rules from "./Rules.vue";
|
||||
import PlayerInfo from "./PlayerInfo.vue";
|
||||
import ResearchBoard from "./ResearchBoard.vue";
|
||||
import ScoringBoard from "./ScoringBoard.vue";
|
||||
|
|
@ -177,12 +160,11 @@ import { UndoPropagation } from "../logic/commands";
|
|||
ScoringBoard,
|
||||
SpaceMap,
|
||||
TurnOrder,
|
||||
Rules,
|
||||
Charts: () => import('./Charts.vue'),
|
||||
},
|
||||
})
|
||||
export default class Game extends Vue {
|
||||
private finalScoringFields: any[] = null
|
||||
private finalScoringItems: any[] = null
|
||||
public currentMove = "";
|
||||
public hideLog = false;
|
||||
public currentMoveWarnings: Map<string, BuildWarning[]> = new Map<string, BuildWarning[]>();
|
||||
|
|
@ -196,9 +178,6 @@ export default class Game extends Vue {
|
|||
options: EngineOptions;
|
||||
|
||||
mounted() {
|
||||
const element = document.getElementById("root");
|
||||
this.finalScoringFields = finalScoringFields(element);
|
||||
this.finalScoringItems = finalScoringItems(element);
|
||||
const undoListener = this.$store.subscribeAction(({ type, payload }) => {
|
||||
if (type === "gaiaViewer/undo") {
|
||||
if (!(payload as UndoPropagation).undoPerformed) {
|
||||
|
|
|
|||
|
|
@ -171,9 +171,7 @@
|
|||
:player="player.player"
|
||||
/>
|
||||
</div>
|
||||
<b-modal :id="player.faction" :title="factionName" size="lg" dialog-class="gaia-viewer-modal">
|
||||
<div v-html="tooltip"></div>
|
||||
</b-modal>
|
||||
<Rules :id="player.faction" :type="player.faction" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -189,7 +187,8 @@ import FederationTile from "./FederationTile.vue";
|
|||
import BuildingGroup from "./PlayerBoard/BuildingGroup.vue";
|
||||
import PlayerBoardInfo from "./PlayerBoard/Info.vue";
|
||||
import PowerBowls from "./PlayerBoard/PowerBowls.vue";
|
||||
import { factionDesc, factionName, planetsWithSteps } from "../data/factions";
|
||||
import Rules from "./Rules.vue";
|
||||
import { factionName, planetsWithSteps } from "../data/factions";
|
||||
|
||||
@Component({
|
||||
components: {
|
||||
|
|
@ -200,6 +199,7 @@ import { factionDesc, factionName, planetsWithSteps } from "../data/factions";
|
|||
BuildingGroup,
|
||||
PowerBowls,
|
||||
PlayerBoardInfo,
|
||||
Rules,
|
||||
},
|
||||
})
|
||||
export default class PlayerInfo extends Vue {
|
||||
|
|
@ -229,10 +229,6 @@ export default class PlayerInfo extends Vue {
|
|||
return this.$store.state.gaiaViewer.data;
|
||||
}
|
||||
|
||||
get tooltip() {
|
||||
return factionDesc(this.faction, this.player.factionVariant);
|
||||
}
|
||||
|
||||
get planet() {
|
||||
return factionPlanet(this.faction);
|
||||
}
|
||||
|
|
|
|||
116
viewer/src/components/Rules.vue
Normal file
116
viewer/src/components/Rules.vue
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
<template>
|
||||
<b-modal :id="id" size="lg" title="Rules and Factions">
|
||||
<div class="gaia-viewer-modal">
|
||||
<div class="d-flex" style="justify-content: center; align-items: center">
|
||||
<b-dropdown size="sm" class="mr-2 mb-2" text="Type">
|
||||
<b-dropdown-item @click="selectRule('scoring')">Final Scoring</b-dropdown-item>
|
||||
<b-dropdown-divider />
|
||||
<b-dropdown-item
|
||||
v-for="(f, i) in factions"
|
||||
:key="`rule${i}`"
|
||||
@click="selectRule(f)"
|
||||
:style="{ 'background-color': backgroundColor(f) }"
|
||||
>
|
||||
<span :style="{ color: color(f) }">{{ factionName(f) }}</span>
|
||||
</b-dropdown-item>
|
||||
</b-dropdown>
|
||||
<h4>
|
||||
<div v-text="'Final Scoring'" v-if="rule === 'scoring'" />
|
||||
<div v-text="factionName(this.rule)" v-else />
|
||||
</h4>
|
||||
</div>
|
||||
<b-table
|
||||
v-if="rule === 'scoring'"
|
||||
striped
|
||||
bordered
|
||||
small
|
||||
responsive="true"
|
||||
hover
|
||||
:items="finalScoringItems"
|
||||
:fields="finalScoringFields"
|
||||
class="final-store-table"
|
||||
>
|
||||
<template #cell(Name)="data">
|
||||
<span v-html="data.value"></span>
|
||||
</template>
|
||||
<template #cell()="data">
|
||||
<b-checkbox :checked="data.value" disabled />
|
||||
</template>
|
||||
</b-table>
|
||||
<div v-else v-html="factionTooltip"></div>
|
||||
</div>
|
||||
</b-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { factionDesc, factionName } from "../data/factions";
|
||||
|
||||
import { Component, Prop, Vue } from "vue-property-decorator";
|
||||
import Engine, { Faction, factionPlanet, factionVariantBoard } from "@gaia-project/engine";
|
||||
import { finalScoringFields, finalScoringItems } from "../logic/final-scoring";
|
||||
import { factionColor, planetFill } from "../graphics/utils";
|
||||
|
||||
|
||||
type Rule = Faction | "scoring";
|
||||
|
||||
@Component
|
||||
export default class Rules extends Vue {
|
||||
|
||||
@Prop()
|
||||
id: string;
|
||||
|
||||
@Prop({ default: "scoring" })
|
||||
type: Rule;
|
||||
|
||||
private rule: Rule = "scoring";
|
||||
|
||||
private finalScoringFields: any[] = null;
|
||||
private finalScoringItems: any[] = null;
|
||||
|
||||
get gameData(): Engine {
|
||||
return this.$store.state.gaiaViewer.data;
|
||||
}
|
||||
|
||||
mounted() {
|
||||
const element = document.getElementById("root");
|
||||
this.finalScoringFields = finalScoringFields(element);
|
||||
this.finalScoringItems = finalScoringItems(element);
|
||||
|
||||
this.selectRule(this.type ?? "scoring");
|
||||
}
|
||||
|
||||
selectRule(rule: Rule) {
|
||||
this.rule = rule;
|
||||
}
|
||||
|
||||
get factions(): Faction[] {
|
||||
return Object.values(Faction);
|
||||
}
|
||||
|
||||
factionName(faction: Rule): string {
|
||||
return factionName(faction as Faction);
|
||||
}
|
||||
|
||||
backgroundColor(rule: Rule): string {
|
||||
return rule === "scoring" ? "white" : factionColor(rule as Faction);
|
||||
}
|
||||
|
||||
color(rule: Rule): string {
|
||||
return rule === "scoring" ? "black" : planetFill(factionPlanet(rule as Faction));
|
||||
}
|
||||
|
||||
get factionTooltip(): string {
|
||||
const faction = this.rule as Faction;
|
||||
|
||||
const player = this.gameData.players.find((p) => p.faction == faction);
|
||||
const variant = player?.factionVariant ?? factionVariantBoard(this.gameData.factionCustomization, faction);
|
||||
return factionDesc(faction, variant);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.gaia-viewer-modal {
|
||||
padding: 1rem;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -9,6 +9,7 @@ import {
|
|||
terraformingStepsRequired,
|
||||
} from "@gaia-project/engine";
|
||||
import { FactionBoardRaw } from "@gaia-project/engine/src/faction-boards";
|
||||
import { factionColor, planetFill } from "../graphics/utils";
|
||||
|
||||
const factionData: { [faction in Faction]: { name: string; ability: string; PI: string; shortcut: string } } = {
|
||||
[Faction.Terrans]: {
|
||||
|
|
@ -162,7 +163,9 @@ export function factionDesc(faction: Faction, variant?: FactionBoardRaw) {
|
|||
const roundIncome = board.income.filter((ev) => ev.operator === Operator.Income);
|
||||
|
||||
return `
|
||||
<div class='faction-desc'>
|
||||
<div class='faction-desc' style='background-color: ${factionColor(faction)}; color: ${planetFill(
|
||||
factionPlanet(faction)
|
||||
)}; padding: 1rem'>
|
||||
<b>Ability: </b> ${factionData[faction].ability} </br>
|
||||
<b>Planetary Institute: </b> ${factionData[faction].PI}<br/>
|
||||
<b>Buildings:</b> ${buildingDesc.replace(/,,/g, ",~,").replace(/,/g, ", ")}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,13 @@ export function planetColor(planet: Exclude<Planet, Planet.Empty>): string {
|
|||
return planets[planet].color;
|
||||
}
|
||||
|
||||
export function planetFill(planet: string) {
|
||||
if (planet === Planet.Titanium || planet === Planet.Swamp) {
|
||||
return "white";
|
||||
}
|
||||
return "black";
|
||||
}
|
||||
|
||||
export function planetClass(faction: string): string {
|
||||
switch (faction as any) {
|
||||
case "wild":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue