fix: 统计数据

This commit is contained in:
unanmed 2025-05-27 20:54:36 +08:00
parent 12c289d06a
commit 5ddeed6d19
5 changed files with 43 additions and 13 deletions

View File

@ -73,18 +73,36 @@ export const List = defineComponent<ListProps, ListEmits, keyof ListEmits>(
props.loc[2] ?? 200,
lineHeight.value
];
const selectionLoc: ElementLocator = [
0,
0,
(props.loc[2] ?? 200) - 10,
lineHeight.value
];
const textLoc: ElementLocator = [
10,
lineHeight.value / 2,
void 0,
void 0,
0,
0.5
];
return (
<container onClick={() => select(key)}>
<container loc={loc} onClick={() => select(key)}>
{selected.value === key && (
<Selection
loc={loc}
loc={selectionLoc}
color={props.color}
border={props.border}
winskin={props.winskin}
alphaRange={props.alphaRange}
/>
)}
<text text={value} font={props.font} />
<text
loc={textLoc}
text={value}
font={props.font}
/>
</container>
);
})}
@ -171,7 +189,7 @@ export const ListPage = defineComponent<
};
return () => (
<container>
<container loc={props.loc}>
<List
{...props}
loc={listLoc.value}

View File

@ -1,7 +1,7 @@
import { LayerShadowExtends } from '@motajs/legacy-ui';
import { Props, Font } from '@motajs/render';
import { WeatherController } from '../../weather';
import { defineComponent, onMounted, reactive, ref } from 'vue';
import { defineComponent, onMounted, reactive, ref, watch } from 'vue';
import { Textbox, Tip } from '../components';
import { GameUI } from '@motajs/system-ui';
import {
@ -209,7 +209,8 @@ const MainScene = defineComponent(() => {
)}
<container
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
hidden={mainUIController.showBack.value}
hidden={!mainUIController.showBack.value}
zIndex={200}
>
{mainUIController.render()}
</container>

View File

@ -30,7 +30,7 @@ export interface StatisticsProps extends UIComponentProps, DefaultProps {
}
const statisticsProps = {
props: ['data']
props: ['data', 'controller', 'instance']
} satisfies SetupComponentOptions<StatisticsProps>;
export const Statistics = defineComponent<StatisticsProps>(props => {
@ -52,6 +52,7 @@ export const Statistics = defineComponent<StatisticsProps>(props => {
loc={[180, 0, 480, 480]}
close
onClose={close}
lineHeight={24}
>
{{
total: () => <TotalStatistics data={props.data} />,
@ -67,21 +68,29 @@ interface StatisticsPanelProps extends DefaultProps {
data: StatisticsData;
}
const statisticsPanelProps = {
props: ['data']
} satisfies SetupComponentOptions<StatisticsPanelProps>;
const TotalStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsProps);
return () => (
<container>
<text text="测试"></text>
</container>
);
}, statisticsPanelProps);
const FloorStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsProps);
}, statisticsPanelProps);
const EnemyStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsProps);
}, statisticsPanelProps);
const PotionStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsProps);
}, statisticsPanelProps);
function calculateStatistics(): StatisticsData {
core.setFlag('__statistics__', true);

View File

@ -125,7 +125,7 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
};
this.ensureMap(d.key);
if (d.id in this.data) {
console.warn(`已存在id为${d.id}的按键,已将其覆盖`);
// console.warn(`已存在id为${d.id}的按键,已将其覆盖`);
}
this.data[d.id] = d;
const arr = this.keyMap.get(d.key)!;

View File

@ -194,6 +194,7 @@ export class UIController
break;
}
this.sysShowBack.value = true;
this.emit('open', ui, ins);
return ins;
}
@ -230,6 +231,7 @@ export class UIController
if (!this.keepBack && this.stack.length === 0) {
this.sysShowBack.value = false;
}
this.keepBack = false;
this.emit('close', ui);
}