mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-18 17:48:52 +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('var', 'hook').emit('replayStatus', false);
|
||||||
Mota.require('class', 'CustomToolbar').setDefaultTool(true);
|
|
||||||
this.replay();
|
this.replay();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1380,7 +1379,6 @@ control.prototype.stopReplay = function (force) {
|
|||||||
core.updateStatusBar(false, true);
|
core.updateStatusBar(false, true);
|
||||||
core.drawTip('停止播放并恢复游戏');
|
core.drawTip('停止播放并恢复游戏');
|
||||||
Mota.require('var', 'hook').emit('replayStatus', true);
|
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.control._replay_drawProgress();
|
||||||
core.updateStatusBar(false, true);
|
core.updateStatusBar(false, true);
|
||||||
core.drawTip('成功回退到上一个节点');
|
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(
|
const { NightSpecial, HeroSkill } = Mota.require(
|
||||||
'module',
|
'module',
|
||||||
'Mechanism'
|
'Mechanism'
|
||||||
|
@ -411,44 +411,6 @@ export class CustomToolbar extends EventEmitter<CustomToolbarEvent> {
|
|||||||
static closeAll() {
|
static closeAll() {
|
||||||
this.list.forEach(v => v.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', () => {
|
Mota.require('var', 'loading').once('coreInit', () => {
|
||||||
@ -465,8 +427,3 @@ Mota.require('var', 'loading').once('coreInit', () => {
|
|||||||
Mota.require('var', 'hook').on('reset', () => {
|
Mota.require('var', 'hook').on('reset', () => {
|
||||||
CustomToolbar.showAll();
|
CustomToolbar.showAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
Mota.require('var', 'hook').once('reset', () => {
|
|
||||||
CustomToolbar.setDefaultTool(false);
|
|
||||||
CustomToolbar.save();
|
|
||||||
});
|
|
||||||
|
@ -114,6 +114,7 @@ export abstract class GraphicItemBase
|
|||||||
lineCap: CanvasLineCap = 'butt';
|
lineCap: CanvasLineCap = 'butt';
|
||||||
miterLimit: number = 10;
|
miterLimit: number = 10;
|
||||||
fillRule: CanvasFillRule = 'nonzero';
|
fillRule: CanvasFillRule = 'nonzero';
|
||||||
|
enableCache: boolean = false;
|
||||||
|
|
||||||
private propFill: boolean = true;
|
private propFill: boolean = true;
|
||||||
private propStroke: boolean = false;
|
private propStroke: boolean = false;
|
||||||
@ -122,7 +123,7 @@ export abstract class GraphicItemBase
|
|||||||
|
|
||||||
private actionStroke: boolean = false;
|
private actionStroke: boolean = false;
|
||||||
private cachePath?: Path2D;
|
private cachePath?: Path2D;
|
||||||
protected pathDirty: boolean = false;
|
protected pathDirty: boolean = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取这个元素的绘制路径
|
* 获取这个元素的绘制路径
|
||||||
@ -141,6 +142,7 @@ export abstract class GraphicItemBase
|
|||||||
}
|
}
|
||||||
const path = this.cachePath;
|
const path = this.cachePath;
|
||||||
if (!path) return;
|
if (!path) return;
|
||||||
|
|
||||||
switch (this.mode) {
|
switch (this.mode) {
|
||||||
case GraphicMode.Fill:
|
case GraphicMode.Fill:
|
||||||
ctx.fill(path, this.fillRule);
|
ctx.fill(path, this.fillRule);
|
||||||
|
@ -71,6 +71,7 @@ const MainScene = defineComponent(() => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const map = ref<LayerGroup>();
|
const map = ref<LayerGroup>();
|
||||||
|
const hideStatus = ref(false);
|
||||||
const weather = new WeatherController('main');
|
const weather = new WeatherController('main');
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@ -114,6 +115,8 @@ const MainScene = defineComponent(() => {
|
|||||||
|
|
||||||
const updateStatus = () => {
|
const updateStatus = () => {
|
||||||
if (!core.status || !core.status.hero || !core.status.floorId) return;
|
if (!core.status || !core.status.hero || !core.status.floorId) return;
|
||||||
|
hideStatus.value = core.getFlag('hideStatusBar', false);
|
||||||
|
|
||||||
const hero = core.status.hero;
|
const hero = core.status.hero;
|
||||||
const floor = core.status.floorId;
|
const floor = core.status.floorId;
|
||||||
leftStatus.atk = getHeroStatusOn('atk');
|
leftStatus.atk = getHeroStatusOn('atk');
|
||||||
@ -171,6 +174,7 @@ const MainScene = defineComponent(() => {
|
|||||||
<LeftStatusBar
|
<LeftStatusBar
|
||||||
loc={[0, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
|
loc={[0, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
|
||||||
status={leftStatus}
|
status={leftStatus}
|
||||||
|
hidden={hideStatus.value}
|
||||||
></LeftStatusBar>
|
></LeftStatusBar>
|
||||||
)}
|
)}
|
||||||
<g-line line={[180, 0, 180, 480]} lineWidth={1} />
|
<g-line line={[180, 0, 180, 480]} lineWidth={1} />
|
||||||
@ -191,6 +195,7 @@ const MainScene = defineComponent(() => {
|
|||||||
<RightStatusBar
|
<RightStatusBar
|
||||||
loc={[480 + 180, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
|
loc={[480 + 180, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
|
||||||
status={rightStatus}
|
status={rightStatus}
|
||||||
|
hidden={hideStatus.value}
|
||||||
></RightStatusBar>
|
></RightStatusBar>
|
||||||
)}
|
)}
|
||||||
<container
|
<container
|
||||||
@ -201,10 +206,21 @@ const MainScene = defineComponent(() => {
|
|||||||
</container>
|
</container>
|
||||||
<g-rect
|
<g-rect
|
||||||
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
|
loc={[0, 0, MAIN_WIDTH, MAIN_HEIGHT]}
|
||||||
|
hidden={hideStatus.value}
|
||||||
zIndex={100}
|
zIndex={100}
|
||||||
stroke
|
stroke
|
||||||
noevent
|
noevent
|
||||||
></g-rect>
|
></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>
|
</container>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { GameUI } from '@/core/system';
|
import { GameUI } from '@/core/system';
|
||||||
import { computed, defineComponent, ref, watch } from 'vue';
|
import { computed, defineComponent, ref, watch } from 'vue';
|
||||||
import { SetupComponentOptions, TextContent } from '../components';
|
import { SetupComponentOptions, TextContent } from '../components';
|
||||||
import { ElementLocator, Sprite } from '@/core/render';
|
import { DefaultProps, ElementLocator, Sprite } from '@/core/render';
|
||||||
import { transitionedColor } from '../use';
|
import { transitionedColor } from '../use';
|
||||||
import { linear } from 'mutate-animate';
|
import { linear } from 'mutate-animate';
|
||||||
import { Scroll } from '../components/scroll';
|
import { Scroll } from '../components/scroll';
|
||||||
@ -34,13 +34,14 @@ export interface ILeftHeroStatus {
|
|||||||
magicDef: number;
|
magicDef: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StatusBarProps<T> {
|
interface StatusBarProps<T> extends DefaultProps {
|
||||||
loc: ElementLocator;
|
loc: ElementLocator;
|
||||||
status: T;
|
status: T;
|
||||||
|
hidden: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusBarProps = {
|
const statusBarProps = {
|
||||||
props: ['loc', 'status']
|
props: ['loc', 'status', 'hidden']
|
||||||
} satisfies SetupComponentOptions<StatusBarProps<unknown>>;
|
} satisfies SetupComponentOptions<StatusBarProps<unknown>>;
|
||||||
|
|
||||||
export const LeftStatusBar = defineComponent<StatusBarProps<ILeftHeroStatus>>(
|
export const LeftStatusBar = defineComponent<StatusBarProps<ILeftHeroStatus>>(
|
||||||
@ -93,7 +94,7 @@ export const LeftStatusBar = defineComponent<StatusBarProps<ILeftHeroStatus>>(
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
return (
|
return (
|
||||||
<container loc={p.loc}>
|
<container loc={p.loc} hidden={p.hidden}>
|
||||||
<text
|
<text
|
||||||
text={floorName.value}
|
text={floorName.value}
|
||||||
loc={central(24)}
|
loc={central(24)}
|
||||||
@ -310,7 +311,7 @@ export const RightStatusBar = defineComponent<StatusBarProps<IRightHeroStatus>>(
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
return (
|
return (
|
||||||
<container loc={p.loc}>
|
<container loc={p.loc} hidden={p.hidden}>
|
||||||
<g-rectr
|
<g-rectr
|
||||||
loc={[10, 10, 160, 24]}
|
loc={[10, 10, 160, 24]}
|
||||||
circle={[6]}
|
circle={[6]}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
export function init() {
|
export function init() {
|
||||||
if (main.mode === 'editor') return;
|
if (main.mode === 'editor') return;
|
||||||
const { mainUi, fixedUi, mainSetting } = Mota.requireAll('var');
|
const { mainUi, fixedUi, mainSetting } = Mota.requireAll('var');
|
||||||
const CustomToolbar = Mota.require('class', 'CustomToolbar');
|
|
||||||
|
|
||||||
ui.prototype.drawBook = function () {
|
ui.prototype.drawBook = function () {
|
||||||
if (!core.isReplaying()) return mainUi.open('book');
|
if (!core.isReplaying()) return mainUi.open('book');
|
||||||
@ -31,36 +30,27 @@ export function init() {
|
|||||||
Mota.require('var', 'hook').emit('statusBarUpdate');
|
Mota.require('var', 'hook').emit('statusBarUpdate');
|
||||||
};
|
};
|
||||||
|
|
||||||
// todo: 多个状态栏分离与控制
|
|
||||||
control.prototype.showStatusBar = function () {
|
control.prototype.showStatusBar = function () {
|
||||||
if (main.mode == 'editor') return;
|
if (main.mode == 'editor') return;
|
||||||
const defaultsTool = CustomToolbar.get('@defaults');
|
|
||||||
core.removeFlag('hideStatusBar');
|
core.removeFlag('hideStatusBar');
|
||||||
if (!fixedUi.hasName('statusBar')) {
|
|
||||||
fixedUi.open('statusBar');
|
|
||||||
}
|
|
||||||
defaultsTool?.show();
|
|
||||||
if (mainSetting.getValue('ui.tips')) {
|
if (mainSetting.getValue('ui.tips')) {
|
||||||
if (!fixedUi.hasName('tips')) {
|
if (!fixedUi.hasName('tips')) {
|
||||||
fixedUi.open('tips');
|
fixedUi.open('tips');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
core.updateStatusBar();
|
||||||
};
|
};
|
||||||
|
|
||||||
control.prototype.hideStatusBar = function (showToolbox) {
|
control.prototype.hideStatusBar = function (showToolbox) {
|
||||||
if (main.mode == 'editor') return;
|
if (main.mode == 'editor') return;
|
||||||
const defaultsTool = CustomToolbar.get('@defaults');
|
|
||||||
|
|
||||||
// 如果原本就是隐藏的,则先显示
|
// 如果原本就是隐藏的,则先显示
|
||||||
if (!core.domStyle.showStatusBar) this.showStatusBar();
|
if (!core.domStyle.showStatusBar) this.showStatusBar();
|
||||||
if (core.isReplaying()) showToolbox = true;
|
if (core.isReplaying()) showToolbox = true;
|
||||||
fixedUi.closeByName('statusBar');
|
|
||||||
if (!showToolbox) {
|
|
||||||
defaultsTool?.closeAll();
|
|
||||||
}
|
|
||||||
fixedUi.closeByName('tips');
|
fixedUi.closeByName('tips');
|
||||||
|
|
||||||
core.setFlag('hideStatusBar', true);
|
core.setFlag('hideStatusBar', true);
|
||||||
core.setFlag('showToolbox', showToolbox || null);
|
core.setFlag('showToolbox', showToolbox || null);
|
||||||
|
core.updateStatusBar();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
<div id="tool-preview-container">
|
<div id="tool-preview-container">
|
||||||
<div class="tool-preview-item" v-for="item of bar.items">
|
<div class="tool-preview-item" v-for="item of bar.items">
|
||||||
<component
|
<component
|
||||||
:is="(CustomToolbar.info[item.type].show as any)"
|
:is="CustomToolbar.info[item.type].show as any"
|
||||||
:item="item"
|
:item="item"
|
||||||
:toolbar="bar"
|
:toolbar="bar"
|
||||||
></component>
|
></component>
|
||||||
@ -179,7 +179,7 @@
|
|||||||
<div id="tool-preview-container">
|
<div id="tool-preview-container">
|
||||||
<div class="tool-preview-item" v-for="item of bar.items">
|
<div class="tool-preview-item" v-for="item of bar.items">
|
||||||
<component
|
<component
|
||||||
:is="(CustomToolbar.info[item.type].show as any)"
|
:is="CustomToolbar.info[item.type].show as any"
|
||||||
:item="item"
|
:item="item"
|
||||||
:toolbar="bar"
|
:toolbar="bar"
|
||||||
></component>
|
></component>
|
||||||
@ -292,10 +292,6 @@ function exit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteTool(id: string) {
|
function deleteTool(id: string) {
|
||||||
if (id === '@defaults') {
|
|
||||||
tip('warn', '该工具栏不能删除!');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '确定要删除这个自定义工具栏吗?',
|
title: '确定要删除这个自定义工具栏吗?',
|
||||||
onOk() {
|
onOk() {
|
||||||
|
Loading…
Reference in New Issue
Block a user