mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-07-18 11:01:48 +08:00
Compare commits
7 Commits
5fdeee045d
...
99432d4fd3
Author | SHA1 | Date | |
---|---|---|---|
99432d4fd3 | |||
dd0f596e21 | |||
046d136b5a | |||
5ddeed6d19 | |||
12c289d06a | |||
6a7b58cb5e | |||
7d94f6026c |
@ -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>
|
||||
);
|
||||
})}
|
||||
@ -103,6 +121,8 @@ export interface ListPageProps extends ListProps {
|
||||
right?: boolean;
|
||||
/** 是否显示关闭按钮 */
|
||||
close?: boolean;
|
||||
/** 关闭按钮的位置,相对于组件定位 */
|
||||
closeLoc?: ElementLocator;
|
||||
}
|
||||
|
||||
export type ListPageEmits = {
|
||||
@ -127,7 +147,9 @@ const listPageProps = {
|
||||
'winskin',
|
||||
'color',
|
||||
'border',
|
||||
'alphaRange'
|
||||
'alphaRange',
|
||||
'close',
|
||||
'closeLoc'
|
||||
],
|
||||
emits: ['update', 'update:selected', 'close']
|
||||
} satisfies SetupComponentOptions<
|
||||
@ -171,7 +193,7 @@ export const ListPage = defineComponent<
|
||||
};
|
||||
|
||||
return () => (
|
||||
<container>
|
||||
<container loc={props.loc}>
|
||||
<List
|
||||
{...props}
|
||||
loc={listLoc.value}
|
||||
@ -184,7 +206,12 @@ export const ListPage = defineComponent<
|
||||
slots.default?.(selected.value)}
|
||||
</container>
|
||||
{props.close && (
|
||||
<text text="关闭" cursor="pointer" font={props.font}></text>
|
||||
<text
|
||||
loc={props.closeLoc}
|
||||
text="关闭"
|
||||
cursor="pointer"
|
||||
font={props.font}
|
||||
></text>
|
||||
)}
|
||||
</container>
|
||||
);
|
||||
|
@ -431,7 +431,7 @@ export interface WaitBoxExpose<T> {
|
||||
}
|
||||
|
||||
const waitBoxProps = {
|
||||
props: ['promise', 'loc', 'winskin', 'color', 'border'],
|
||||
props: ['promise', 'loc', 'winskin', 'color', 'border', 'width'],
|
||||
emits: ['resolve']
|
||||
} satisfies SetupComponentOptions<
|
||||
WaitBoxProps<unknown>,
|
||||
|
@ -180,6 +180,7 @@ 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);
|
||||
|
@ -209,7 +209,8 @@ const MainScene = defineComponent(() => {
|
||||
)}
|
||||
<container
|
||||
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
|
||||
hidden={mainUIController.showBack.value}
|
||||
hidden={!mainUIController.active.value}
|
||||
zIndex={200}
|
||||
>
|
||||
{mainUIController.render()}
|
||||
</container>
|
||||
|
@ -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,8 @@ 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} />,
|
||||
@ -67,21 +69,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);
|
||||
@ -185,7 +195,7 @@ export async function openStatistics(controller: IUIMountable) {
|
||||
});
|
||||
const data = await waitbox(
|
||||
controller,
|
||||
[240 + 180, void 0, void 0, 240, 0.5, 0.5],
|
||||
[240 + 180, 240, void 0, void 0, 0.5, 0.5],
|
||||
240,
|
||||
cal,
|
||||
{
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { debounce } from 'lodash-es';
|
||||
import logInfo from './logger.json';
|
||||
|
||||
export const enum LogLevel {
|
||||
@ -20,28 +21,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');
|
||||
|
||||
@ -107,7 +108,8 @@ export class Logger {
|
||||
logger.error(16, 'error', code.toString());
|
||||
return;
|
||||
}
|
||||
const text = this.parseInfo(info[code], ...params);
|
||||
|
||||
const text = this.parseInfo(info, ...params);
|
||||
if (this.catching) {
|
||||
this.catchedInfo.push({
|
||||
level: LogLevel.ERROR,
|
||||
@ -116,15 +118,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 = `/_docs/logger/error/error${n}.html#error-code-${n2}`;
|
||||
const url = `${location.origin}/_docs/logger/error/error${n}.html#error-code-${n2}`;
|
||||
console.error(`[ERROR Code ${code}] ${text}. See ${url}`);
|
||||
}
|
||||
}
|
||||
@ -140,7 +142,8 @@ export class Logger {
|
||||
logger.error(16, 'warn', code.toString());
|
||||
return;
|
||||
}
|
||||
const text = this.parseInfo(info[code], ...params);
|
||||
const text = this.parseInfo(info, ...params);
|
||||
|
||||
if (this.catching) {
|
||||
this.catchedInfo.push({
|
||||
level: LogLevel.ERROR,
|
||||
@ -149,15 +152,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 = `/_docs/logger/warn/warn${n}.html#warn-code-${n2}`;
|
||||
const url = `${location.origin}/_docs/logger/warn/warn${n}.html#warn-code-${n2}`;
|
||||
console.warn(`[WARNING Code ${code}] ${text}. See ${url}`);
|
||||
}
|
||||
}
|
||||
|
@ -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)!;
|
||||
|
@ -98,11 +98,8 @@ export class UIController
|
||||
readonly showBack: ComputedRef<boolean> = computed(
|
||||
() => this.userShowBack.value && this.sysShowBack.value
|
||||
);
|
||||
|
||||
/** 当前是否显示 UI */
|
||||
get active() {
|
||||
return this.sysShowBack.value;
|
||||
}
|
||||
/** 当前 UI 是否激活 */
|
||||
readonly active: Ref<boolean> = ref(false);
|
||||
|
||||
/** 自定义显示模式下的配置信息 */
|
||||
private config?: IUICustomConfig;
|
||||
@ -194,6 +191,8 @@ export class UIController
|
||||
break;
|
||||
}
|
||||
this.sysShowBack.value = true;
|
||||
this.active.value = true;
|
||||
|
||||
this.emit('open', ui, ins);
|
||||
return ins;
|
||||
}
|
||||
@ -229,7 +228,9 @@ 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user