basic management layer

This commit is contained in:
circle-gon 2022-12-11 01:10:25 +00:00
parent 3128e2d290
commit 6911f6c1f0
2 changed files with 44 additions and 7 deletions

View file

@ -22,7 +22,6 @@ import { NonPersistent, noPersist, Persistent } from "game/persistence";
import Decimal, { DecimalSource, format, formatWhole } from "util/bignum"; import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { WithRequired } from "util/common"; import { WithRequired } from "util/common";
import { Computable, convertComputable } from "util/computed"; import { Computable, convertComputable } from "util/computed";
import { createLazyProxy } from "util/proxies";
import { render, renderCol, renderRow } from "util/vue"; import { render, renderCol, renderRow } from "util/vue";
import { computed, ComputedRef, ref, Ref, unref } from "vue"; import { computed, ComputedRef, ref, Ref, unref } from "vue";
import coal from "./coal"; import coal from "./coal";

View file

@ -11,6 +11,8 @@ import Decimal, { DecimalSource, format, formatWhole } from "util/bignum";
import { Direction } from "util/common"; import { Direction } from "util/common";
import { render, renderGrid } from "util/vue"; import { render, renderGrid } from "util/vue";
import { computed } from "vue"; import { computed } from "vue";
import { createTabFamily } from "features/tabs/tabFamily";
import { createTab } from "features/tabs/tab";
import elves from "./elves"; import elves from "./elves";
const id = "management"; const id = "management";
@ -30,6 +32,13 @@ const layer = createLayer(id, () => {
display: jsx(() => (main.day.value === day ? <>0 / 10</> : "")) display: jsx(() => (main.day.value === day ? <>0 / 10</> : ""))
})) as GenericBar; })) as GenericBar;
const totalElfLevels = computed(() => {
let elfLevel = 0;
for (const elf of Object.values(elfTraining)) {
elfLevel += elf.level.value;
}
return elfLevel;
});
// Training core function // Training core function
function createElfTraining( function createElfTraining(
elf: { elf: {
@ -58,7 +67,7 @@ const layer = createLayer(id, () => {
description: jsx(() => ( description: jsx(() => (
<> <>
{elf.name} is currently at level {formatWhole(level.value)}! They have{" "} {elf.name} is currently at level {formatWhole(level.value)}! They have{" "}
{format(exp.value)}/{format(exp.value)} experience points.{" "} {format(exp.value)}/{format(exp.value)} experience points (XP).{" "}
{currentShown.value !== elf.name {currentShown.value !== elf.name
? "Click to see this elf's milestones." ? "Click to see this elf's milestones."
: undefined} : undefined}
@ -218,7 +227,18 @@ const layer = createLayer(id, () => {
fertilizerElfTraining, fertilizerElfTraining,
smallfireElfTraining, smallfireElfTraining,
bonfireElfTraining, bonfireElfTraining,
fireElfTraining kilnElfTraining
};
const elfMilestones = {
cutterElfMilestones,
planterElfMilestones,
expanderElfMilestones,
heatedCutterElfMilestones,
heatedPlanterElfMilestones,
fertilizerElfMilestones,
smallfireElfMilestones,
bonfireElfMilestones,
kilnElfMilestones
}; };
const msDisplay = jsx(() => ( const msDisplay = jsx(() => (
@ -226,6 +246,27 @@ const layer = createLayer(id, () => {
{currentElfDisplay.value.name}'s milestones: {currentElfDisplay.value.disp()} {currentElfDisplay.value.name}'s milestones: {currentElfDisplay.value.disp()}
</> </>
)); ));
const tabs = createTabFamily({
training: () => ({
tab: createTab(() => ({
display: jsx(() => (
<>
<Spacer />
{renderGrid(treeElfTraining, coalElfTraining, fireElfTraining)}
<Spacer />
{msDisplay()}
</>
))
})),
display: "Elf Training"
}),
info: () => ({
tab: createTab(() => ({
display: jsx(() => <>1</>)
})),
display: "Info"
})
});
return { return {
name, name,
day, day,
@ -237,10 +278,7 @@ const layer = createLayer(id, () => {
<> <>
{main.day.value === day ? `Get all elves to level 10.` : `${name} Complete!`} {main.day.value === day ? `Get all elves to level 10.` : `${name} Complete!`}
{render(dayProgress)} {render(dayProgress)}
<Spacer /> {render(tabs)}
{renderGrid(treeElfTraining, coalElfTraining, fireElfTraining)}
<Spacer />
{msDisplay()}
</> </>
)) ))
}; };