mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-11 15:47:06 +08:00
chore: 删除之前的状态栏和工具栏
This commit is contained in:
parent
ea7ede3748
commit
b0e420c167
@ -1284,7 +1284,6 @@ control.prototype.startReplay = function (list) {
|
||||
// '由于不可抗力,录像播放过程中将没有勇士移动动画'
|
||||
// );
|
||||
Mota.require('var', 'hook').emit('replayStatus', false);
|
||||
Mota.require('class', 'CustomToolbar').setDefaultTool(true);
|
||||
this.replay();
|
||||
};
|
||||
|
||||
@ -1380,7 +1379,6 @@ control.prototype.stopReplay = function (force) {
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip('停止播放并恢复游戏');
|
||||
Mota.require('var', 'hook').emit('replayStatus', true);
|
||||
Mota.require('class', 'CustomToolbar').setDefaultTool(false);
|
||||
};
|
||||
|
||||
////// 回退 //////
|
||||
@ -1417,7 +1415,6 @@ control.prototype.rewindReplay = function () {
|
||||
core.control._replay_drawProgress();
|
||||
core.updateStatusBar(false, true);
|
||||
core.drawTip('成功回退到上一个节点');
|
||||
Mota.require('class', 'CustomToolbar').setDefaultTool(true);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -78,9 +78,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
|
||||
});
|
||||
}
|
||||
|
||||
Mota.r(() => {
|
||||
Mota.require('class', 'CustomToolbar').setDefaultTool(false);
|
||||
});
|
||||
const { NightSpecial, HeroSkill } = Mota.require(
|
||||
'module',
|
||||
'Mechanism'
|
||||
|
@ -411,44 +411,6 @@ export class CustomToolbar extends EventEmitter<CustomToolbarEvent> {
|
||||
static closeAll() {
|
||||
this.list.forEach(v => v.closeAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置默认工具栏的内容
|
||||
*/
|
||||
static setDefaultTool(replaying: boolean) {
|
||||
const mainStorage = GameStorage.for(GameStorage.fromGame('main'));
|
||||
mainStorage.read();
|
||||
let defaultsTool = CustomToolbar.list.find(v => v.id === '@defaults');
|
||||
const hasDefaults = !!defaultsTool;
|
||||
if (!defaultsTool) {
|
||||
defaultsTool = new CustomToolbar('@defaults', true);
|
||||
}
|
||||
defaultsTool.closeAll();
|
||||
defaultsTool.items.splice(0);
|
||||
defaultsTool.add(replaying ? replayingDefaultTool : playingDefaultTool);
|
||||
if (!mainStorage.getValue('played', false)) {
|
||||
mainStorage.setValue('played', true);
|
||||
|
||||
// 计算位置,显示在游戏画面下方
|
||||
if (!hasDefaults) {
|
||||
const game = core.dom.gameDraw;
|
||||
const bottom = game.offsetTop + game.offsetHeight;
|
||||
const left = game.offsetLeft;
|
||||
const width = game.offsetWidth;
|
||||
|
||||
if (isMobile) {
|
||||
// 手机端显示在最下方
|
||||
defaultsTool.setPos(16, bottom);
|
||||
defaultsTool.setSize(window.innerWidth - 32, 85);
|
||||
} else {
|
||||
// 电脑显示在屏幕右方
|
||||
defaultsTool.setPos(left, bottom);
|
||||
defaultsTool.setSize(width, 70);
|
||||
}
|
||||
}
|
||||
}
|
||||
defaultsTool.show();
|
||||
}
|
||||
}
|
||||
|
||||
Mota.require('var', 'loading').once('coreInit', () => {
|
||||
@ -465,8 +427,3 @@ Mota.require('var', 'loading').once('coreInit', () => {
|
||||
Mota.require('var', 'hook').on('reset', () => {
|
||||
CustomToolbar.showAll();
|
||||
});
|
||||
|
||||
Mota.require('var', 'hook').once('reset', () => {
|
||||
CustomToolbar.setDefaultTool(false);
|
||||
CustomToolbar.save();
|
||||
});
|
||||
|
@ -114,6 +114,7 @@ export abstract class GraphicItemBase
|
||||
lineCap: CanvasLineCap = 'butt';
|
||||
miterLimit: number = 10;
|
||||
fillRule: CanvasFillRule = 'nonzero';
|
||||
enableCache: boolean = false;
|
||||
|
||||
private propFill: boolean = true;
|
||||
private propStroke: boolean = false;
|
||||
@ -122,7 +123,7 @@ export abstract class GraphicItemBase
|
||||
|
||||
private actionStroke: boolean = false;
|
||||
private cachePath?: Path2D;
|
||||
protected pathDirty: boolean = false;
|
||||
protected pathDirty: boolean = true;
|
||||
|
||||
/**
|
||||
* 获取这个元素的绘制路径
|
||||
@ -141,6 +142,7 @@ export abstract class GraphicItemBase
|
||||
}
|
||||
const path = this.cachePath;
|
||||
if (!path) return;
|
||||
|
||||
switch (this.mode) {
|
||||
case GraphicMode.Fill:
|
||||
ctx.fill(path, this.fillRule);
|
||||
|
@ -71,6 +71,7 @@ const MainScene = defineComponent(() => {
|
||||
};
|
||||
|
||||
const map = ref<LayerGroup>();
|
||||
const hideStatus = ref(false);
|
||||
const weather = new WeatherController('main');
|
||||
|
||||
onMounted(() => {
|
||||
@ -114,6 +115,8 @@ const MainScene = defineComponent(() => {
|
||||
|
||||
const updateStatus = () => {
|
||||
if (!core.status || !core.status.hero || !core.status.floorId) return;
|
||||
hideStatus.value = core.getFlag('hideStatusBar', false);
|
||||
|
||||
const hero = core.status.hero;
|
||||
const floor = core.status.floorId;
|
||||
leftStatus.atk = getHeroStatusOn('atk');
|
||||
@ -171,6 +174,7 @@ const MainScene = defineComponent(() => {
|
||||
<LeftStatusBar
|
||||
loc={[0, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
|
||||
status={leftStatus}
|
||||
hidden={hideStatus.value}
|
||||
></LeftStatusBar>
|
||||
)}
|
||||
<g-line line={[180, 0, 180, 480]} lineWidth={1} />
|
||||
@ -191,6 +195,7 @@ const MainScene = defineComponent(() => {
|
||||
<RightStatusBar
|
||||
loc={[480 + 180, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
|
||||
status={rightStatus}
|
||||
hidden={hideStatus.value}
|
||||
></RightStatusBar>
|
||||
)}
|
||||
<container
|
||||
@ -201,10 +206,21 @@ const MainScene = defineComponent(() => {
|
||||
</container>
|
||||
<g-rect
|
||||
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
|
||||
hidden={hideStatus.value}
|
||||
zIndex={100}
|
||||
stroke
|
||||
noevent
|
||||
></g-rect>
|
||||
<g-line
|
||||
line={[180, 0, 480 + 180, 0]}
|
||||
hidden={!hideStatus.value}
|
||||
zIndex={100}
|
||||
/>
|
||||
<g-line
|
||||
line={[180, 480, 480 + 180, 480]}
|
||||
hidden={!hideStatus.value}
|
||||
zIndex={100}
|
||||
/>
|
||||
</container>
|
||||
);
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { GameUI } from '@/core/system';
|
||||
import { computed, defineComponent, ref, watch } from 'vue';
|
||||
import { SetupComponentOptions, TextContent } from '../components';
|
||||
import { ElementLocator, Sprite } from '@/core/render';
|
||||
import { DefaultProps, ElementLocator, Sprite } from '@/core/render';
|
||||
import { transitionedColor } from '../use';
|
||||
import { linear } from 'mutate-animate';
|
||||
import { Scroll } from '../components/scroll';
|
||||
@ -34,13 +34,14 @@ export interface ILeftHeroStatus {
|
||||
magicDef: number;
|
||||
}
|
||||
|
||||
interface StatusBarProps<T> {
|
||||
interface StatusBarProps<T> extends DefaultProps {
|
||||
loc: ElementLocator;
|
||||
status: T;
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
const statusBarProps = {
|
||||
props: ['loc', 'status']
|
||||
props: ['loc', 'status', 'hidden']
|
||||
} satisfies SetupComponentOptions<StatusBarProps<unknown>>;
|
||||
|
||||
export const LeftStatusBar = defineComponent<StatusBarProps<ILeftHeroStatus>>(
|
||||
@ -93,7 +94,7 @@ export const LeftStatusBar = defineComponent<StatusBarProps<ILeftHeroStatus>>(
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<container loc={p.loc}>
|
||||
<container loc={p.loc} hidden={p.hidden}>
|
||||
<text
|
||||
text={floorName.value}
|
||||
loc={central(24)}
|
||||
@ -310,7 +311,7 @@ export const RightStatusBar = defineComponent<StatusBarProps<IRightHeroStatus>>(
|
||||
|
||||
return () => {
|
||||
return (
|
||||
<container loc={p.loc}>
|
||||
<container loc={p.loc} hidden={p.hidden}>
|
||||
<g-rectr
|
||||
loc={[10, 10, 160, 24]}
|
||||
circle={[6]}
|
||||
|
@ -3,7 +3,6 @@
|
||||
export function init() {
|
||||
if (main.mode === 'editor') return;
|
||||
const { mainUi, fixedUi, mainSetting } = Mota.requireAll('var');
|
||||
const CustomToolbar = Mota.require('class', 'CustomToolbar');
|
||||
|
||||
ui.prototype.drawBook = function () {
|
||||
if (!core.isReplaying()) return mainUi.open('book');
|
||||
@ -31,36 +30,27 @@ export function init() {
|
||||
Mota.require('var', 'hook').emit('statusBarUpdate');
|
||||
};
|
||||
|
||||
// todo: 多个状态栏分离与控制
|
||||
control.prototype.showStatusBar = function () {
|
||||
if (main.mode == 'editor') return;
|
||||
const defaultsTool = CustomToolbar.get('@defaults');
|
||||
core.removeFlag('hideStatusBar');
|
||||
if (!fixedUi.hasName('statusBar')) {
|
||||
fixedUi.open('statusBar');
|
||||
}
|
||||
defaultsTool?.show();
|
||||
if (mainSetting.getValue('ui.tips')) {
|
||||
if (!fixedUi.hasName('tips')) {
|
||||
fixedUi.open('tips');
|
||||
}
|
||||
}
|
||||
core.updateStatusBar();
|
||||
};
|
||||
|
||||
control.prototype.hideStatusBar = function (showToolbox) {
|
||||
if (main.mode == 'editor') return;
|
||||
const defaultsTool = CustomToolbar.get('@defaults');
|
||||
|
||||
// 如果原本就是隐藏的,则先显示
|
||||
if (!core.domStyle.showStatusBar) this.showStatusBar();
|
||||
if (core.isReplaying()) showToolbox = true;
|
||||
fixedUi.closeByName('statusBar');
|
||||
if (!showToolbox) {
|
||||
defaultsTool?.closeAll();
|
||||
}
|
||||
fixedUi.closeByName('tips');
|
||||
|
||||
core.setFlag('hideStatusBar', true);
|
||||
core.setFlag('showToolbox', showToolbox || null);
|
||||
core.updateStatusBar();
|
||||
};
|
||||
}
|
||||
|
@ -53,7 +53,7 @@
|
||||
<div id="tool-preview-container">
|
||||
<div class="tool-preview-item" v-for="item of bar.items">
|
||||
<component
|
||||
:is="(CustomToolbar.info[item.type].show as any)"
|
||||
:is="CustomToolbar.info[item.type].show as any"
|
||||
:item="item"
|
||||
:toolbar="bar"
|
||||
></component>
|
||||
@ -179,7 +179,7 @@
|
||||
<div id="tool-preview-container">
|
||||
<div class="tool-preview-item" v-for="item of bar.items">
|
||||
<component
|
||||
:is="(CustomToolbar.info[item.type].show as any)"
|
||||
:is="CustomToolbar.info[item.type].show as any"
|
||||
:item="item"
|
||||
:toolbar="bar"
|
||||
></component>
|
||||
@ -292,10 +292,6 @@ function exit() {
|
||||
}
|
||||
|
||||
function deleteTool(id: string) {
|
||||
if (id === '@defaults') {
|
||||
tip('warn', '该工具栏不能删除!');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '确定要删除这个自定义工具栏吗?',
|
||||
onOk() {
|
||||
|
Loading…
Reference in New Issue
Block a user