mirror of
https://github.com/thepaperpilot/Planar-Pioneers.git
synced 2024-11-21 08:12:38 +00:00
Add star to indicate forge/relic status
This commit is contained in:
parent
62b68cab6b
commit
14315932f7
3 changed files with 26 additions and 5 deletions
|
@ -286,7 +286,10 @@ export const resource = {
|
|||
1
|
||||
)
|
||||
}),
|
||||
draggable: true
|
||||
draggable: true,
|
||||
showStar: node => (node.state as unknown as ResourceState).type in main.toolNodes.value,
|
||||
fillStar: node =>
|
||||
`${(node.state as unknown as ResourceState).type}Relic` in main.toolNodes.value
|
||||
} as NodeTypeOptions;
|
||||
|
||||
export const passive = {
|
||||
|
|
|
@ -58,6 +58,14 @@
|
|||
"
|
||||
:stroke="progressColor"
|
||||
/>
|
||||
<path
|
||||
d="m25,1 6,17h18l-14,11 5,17-15-10-15,10 5-17-14-11h18z"
|
||||
v-if="showStar"
|
||||
stroke="var(--bought)"
|
||||
:stroke-width="4"
|
||||
:fill="fillStar ? 'var(--bought)' : 'none'"
|
||||
:transform="`translate(${-size / 4}, ${-size - 10}), scale(0.5)`"
|
||||
/>
|
||||
</g>
|
||||
<g v-else-if="shape === Shape.Diamond" transform="rotate(45, 0, 0)">
|
||||
<rect
|
||||
|
@ -220,7 +228,6 @@ const position = computed(() => {
|
|||
|
||||
const shape = computed(() => getNodeProperty(props.nodeType.value.shape, unref(props.node)));
|
||||
const title = computed(() => getNodeProperty(props.nodeType.value.title, unref(props.node)));
|
||||
const subtitle = computed(() => getNodeProperty(props.nodeType.value.subtitle, unref(props.node)));
|
||||
const otherSubtitle = computed(() =>
|
||||
getNodeProperty(props.nodeType.value.otherSubtitle, unref(props.node))
|
||||
);
|
||||
|
@ -286,6 +293,10 @@ function mouseUp(e: MouseEvent | TouchEvent) {
|
|||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
const subtitle = computed(() => getNodeProperty(props.nodeType.value.subtitle, unref(props.node)));
|
||||
const showStar = computed(() => getNodeProperty(props.nodeType.value.showStar, unref(props.node)));
|
||||
const fillStar = computed(() => getNodeProperty(props.nodeType.value.fillStar, unref(props.node)));
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
@ -92,8 +92,6 @@ export interface NodeTypeOptions {
|
|||
title: NodeComputable<string>;
|
||||
/** The subtitle to display for the node. */
|
||||
subtitle?: NodeComputable<string>;
|
||||
/** The other subtitle to display for the node. */
|
||||
otherSubtitle?: NodeComputable<string>;
|
||||
/** An optional label for the node. */
|
||||
label?: NodeComputable<NodeLabel | null>;
|
||||
/** The size of the node - diameter for circles, width and height for squares. */
|
||||
|
@ -130,6 +128,11 @@ export interface NodeTypeOptions {
|
|||
onDrop?: (node: BoardNode, otherNode: BoardNode) => void;
|
||||
/** A function that is called for each node of this type every tick. */
|
||||
update?: (node: BoardNode, diff: number) => void;
|
||||
|
||||
// Custom properties
|
||||
otherSubtitle?: NodeComputable<string>;
|
||||
showStar?: NodeComputable<boolean>;
|
||||
fillStar?: NodeComputable<boolean>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -427,7 +430,6 @@ export function createBoard<T extends BoardOptions>(
|
|||
|
||||
processComputable(nodeType as NodeTypeOptions, "title");
|
||||
processComputable(nodeType as NodeTypeOptions, "subtitle");
|
||||
processComputable(nodeType as NodeTypeOptions, "otherSubtitle");
|
||||
processComputable(nodeType as NodeTypeOptions, "label");
|
||||
processComputable(nodeType as NodeTypeOptions, "size");
|
||||
setDefault(nodeType, "size", 50);
|
||||
|
@ -449,6 +451,11 @@ export function createBoard<T extends BoardOptions>(
|
|||
processComputable(nodeType as NodeTypeOptions, "titleColor");
|
||||
processComputable(nodeType as NodeTypeOptions, "actionDistance");
|
||||
setDefault(nodeType, "actionDistance", Math.PI / 6);
|
||||
|
||||
processComputable(nodeType as NodeTypeOptions, "otherSubtitle");
|
||||
processComputable(nodeType as NodeTypeOptions, "showStar");
|
||||
processComputable(nodeType as NodeTypeOptions, "fillStar");
|
||||
|
||||
nodeType.nodes = computed(() =>
|
||||
unref(processedBoard.state).nodes.filter(node => node.type === type)
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue