Compare commits

..

No commits in common. "99432d4fd3af3c8fca0fb6e29925690f5a8f27ed" and "5fdeee045dfe41623f4d7f88414cdee820ad72d7" have entirely different histories.

8 changed files with 58 additions and 101 deletions

View File

@ -73,36 +73,18 @@ 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 loc={loc} onClick={() => select(key)}>
<container onClick={() => select(key)}>
{selected.value === key && (
<Selection
loc={selectionLoc}
loc={loc}
color={props.color}
border={props.border}
winskin={props.winskin}
alphaRange={props.alphaRange}
/>
)}
<text
loc={textLoc}
text={value}
font={props.font}
/>
<text text={value} font={props.font} />
</container>
);
})}
@ -121,8 +103,6 @@ export interface ListPageProps extends ListProps {
right?: boolean;
/** 是否显示关闭按钮 */
close?: boolean;
/** 关闭按钮的位置,相对于组件定位 */
closeLoc?: ElementLocator;
}
export type ListPageEmits = {
@ -147,9 +127,7 @@ const listPageProps = {
'winskin',
'color',
'border',
'alphaRange',
'close',
'closeLoc'
'alphaRange'
],
emits: ['update', 'update:selected', 'close']
} satisfies SetupComponentOptions<
@ -193,7 +171,7 @@ export const ListPage = defineComponent<
};
return () => (
<container loc={props.loc}>
<container>
<List
{...props}
loc={listLoc.value}
@ -206,12 +184,7 @@ export const ListPage = defineComponent<
slots.default?.(selected.value)}
</container>
{props.close && (
<text
loc={props.closeLoc}
text="关闭"
cursor="pointer"
font={props.font}
></text>
<text text="关闭" cursor="pointer" font={props.font}></text>
)}
</container>
);

View File

@ -431,7 +431,7 @@ export interface WaitBoxExpose<T> {
}
const waitBoxProps = {
props: ['promise', 'loc', 'winskin', 'color', 'border', 'width'],
props: ['promise', 'loc', 'winskin', 'color', 'border'],
emits: ['resolve']
} satisfies SetupComponentOptions<
WaitBoxProps<unknown>,

View File

@ -180,7 +180,6 @@ export class Winskin extends RenderItem<EWinskinEvent> {
private generatePattern() {
const pattern = this.requireCanvas();
pattern.setScale(1);
const img = this.image;
pattern.size(32, 16);
pattern.setHD(false);

View File

@ -209,8 +209,7 @@ const MainScene = defineComponent(() => {
)}
<container
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
hidden={!mainUIController.active.value}
zIndex={200}
hidden={mainUIController.showBack.value}
>
{mainUIController.render()}
</container>

View File

@ -30,7 +30,7 @@ export interface StatisticsProps extends UIComponentProps, DefaultProps {
}
const statisticsProps = {
props: ['data', 'controller', 'instance']
props: ['data']
} satisfies SetupComponentOptions<StatisticsProps>;
export const Statistics = defineComponent<StatisticsProps>(props => {
@ -52,8 +52,6 @@ export const Statistics = defineComponent<StatisticsProps>(props => {
loc={[180, 0, 480, 480]}
close
onClose={close}
lineHeight={24}
closeLoc={[10, 470, void 0, void 0, 0, 1]}
>
{{
total: () => <TotalStatistics data={props.data} />,
@ -69,29 +67,21 @@ interface StatisticsPanelProps extends DefaultProps {
data: StatisticsData;
}
const statisticsPanelProps = {
props: ['data']
} satisfies SetupComponentOptions<StatisticsPanelProps>;
const TotalStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => (
<container>
<text text="测试"></text>
</container>
);
}, statisticsPanelProps);
return () => <container></container>;
}, statisticsProps);
const FloorStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsPanelProps);
}, statisticsProps);
const EnemyStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsPanelProps);
}, statisticsProps);
const PotionStatistics = defineComponent<StatisticsPanelProps>(props => {
return () => <container></container>;
}, statisticsPanelProps);
}, statisticsProps);
function calculateStatistics(): StatisticsData {
core.setFlag('__statistics__', true);
@ -195,7 +185,7 @@ export async function openStatistics(controller: IUIMountable) {
});
const data = await waitbox(
controller,
[240 + 180, 240, void 0, void 0, 0.5, 0.5],
[240 + 180, void 0, void 0, 240, 0.5, 0.5],
240,
cal,
{

View File

@ -1,4 +1,3 @@
import { debounce } from 'lodash-es';
import logInfo from './logger.json';
export const enum LogLevel {
@ -21,28 +20,28 @@ interface LoggerCatchReturns<T> {
info: LoggerCatchInfo[];
}
let logTip: HTMLSpanElement;
if (!main.replayChecking) {
const tip = document.createElement('span');
logTip = tip;
tip.style.position = 'fixed';
tip.style.right = '0';
tip.style.bottom = '0';
tip.style.height = '20px';
tip.style.width = 'auto';
tip.style.textAlign = 'right';
tip.style.padding = '0 5px';
tip.style.fontSize = '16px';
tip.style.fontFamily = 'Arial';
tip.style.display = 'none';
tip.style.margin = '2px';
document.body.appendChild(tip);
}
// let logTip: HTMLSpanElement;
// if (!main.replayChecking) {
// const tip = document.createElement('span');
// logTip = tip;
// tip.style.position = 'fixed';
// tip.style.right = '0';
// tip.style.bottom = '0';
// tip.style.height = '20px';
// tip.style.width = 'auto';
// tip.style.textAlign = 'right';
// tip.style.padding = '0 5px';
// tip.style.fontSize = '16px';
// tip.style.fontFamily = 'Arial';
// tip.style.display = 'none';
// tip.style.margin = '2px';
// document.body.appendChild(tip);
// }
const hideTipText = debounce(() => {
if (main.replayChecking) return;
logTip.style.display = 'none';
}, 5000);
// const hideTipText = debounce(() => {
// if (main.replayChecking) return;
// logTip.style.display = 'none';
// }, 5000);
const nums = new Set('1234567890');
@ -108,8 +107,7 @@ export class Logger {
logger.error(16, 'error', code.toString());
return;
}
const text = this.parseInfo(info, ...params);
const text = this.parseInfo(info[code], ...params);
if (this.catching) {
this.catchedInfo.push({
level: LogLevel.ERROR,
@ -118,15 +116,15 @@ export class Logger {
});
}
if (this.level <= LogLevel.ERROR && this.enabled) {
if (!main.replayChecking) {
logTip.style.color = 'lightcoral';
logTip.style.display = 'block';
logTip.textContent = `Error thrown, please check in console.`;
hideTipText();
}
// if (!main.replayChecking) {
// logTip.style.color = 'lightcoral';
// logTip.style.display = 'block';
// logTip.textContent = `Error thrown, please check in console.`;
// hideTipText();
// }
const n = Math.floor(code / 50) + 1;
const n2 = code % 50;
const url = `${location.origin}/_docs/logger/error/error${n}.html#error-code-${n2}`;
const url = `/_docs/logger/error/error${n}.html#error-code-${n2}`;
console.error(`[ERROR Code ${code}] ${text}. See ${url}`);
}
}
@ -142,8 +140,7 @@ export class Logger {
logger.error(16, 'warn', code.toString());
return;
}
const text = this.parseInfo(info, ...params);
const text = this.parseInfo(info[code], ...params);
if (this.catching) {
this.catchedInfo.push({
level: LogLevel.ERROR,
@ -152,15 +149,15 @@ export class Logger {
});
}
if (this.level <= LogLevel.WARNING && this.enabled) {
if (!main.replayChecking) {
logTip.style.color = 'gold';
logTip.style.display = 'block';
logTip.textContent = `Warning thrown, please check in console.`;
hideTipText();
}
// if (!main.replayChecking) {
// logTip.style.color = 'gold';
// logTip.style.display = 'block';
// logTip.textContent = `Warning thrown, please check in console.`;
// hideTipText();
// }
const n = Math.floor(code / 50) + 1;
const n2 = code % 50;
const url = `${location.origin}/_docs/logger/warn/warn${n}.html#warn-code-${n2}`;
const url = `/_docs/logger/warn/warn${n}.html#warn-code-${n2}`;
console.warn(`[WARNING Code ${code}] ${text}. See ${url}`);
}
}

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

@ -98,8 +98,11 @@ export class UIController
readonly showBack: ComputedRef<boolean> = computed(
() => this.userShowBack.value && this.sysShowBack.value
);
/** 当前 UI 是否激活 */
readonly active: Ref<boolean> = ref(false);
/** 当前是否显示 UI */
get active() {
return this.sysShowBack.value;
}
/** 自定义显示模式下的配置信息 */
private config?: IUICustomConfig;
@ -191,8 +194,6 @@ export class UIController
break;
}
this.sysShowBack.value = true;
this.active.value = true;
this.emit('open', ui, ins);
return ins;
}
@ -228,9 +229,7 @@ export class UIController
}
if (!this.keepBack && this.stack.length === 0) {
this.sysShowBack.value = false;
this.active.value = false;
}
this.keepBack = false;
this.emit('close', ui);
}