mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-27 00:27:06 +08:00
优化怪物手册,状态栏初步
This commit is contained in:
parent
ed4b0fe730
commit
0ecdcbdf34
@ -9277,5 +9277,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
|||||||
ui.prototype._drawEquipbox = function () {
|
ui.prototype._drawEquipbox = function () {
|
||||||
return (core.plugin.equipOpened.value = true);
|
return (core.plugin.equipOpened.value = true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
control.prototype.updateStatusBar_update = function () {
|
||||||
|
if (!core.isPlaying() || core.hasFlag('__statistics__')) return;
|
||||||
|
core.control.controldata.updateStatusBar();
|
||||||
|
if (!core.control.noAutoEvents) core.checkAutoEvents();
|
||||||
|
core.control._updateStatusBar_setToolboxIcon();
|
||||||
|
core.clearRouteFolding();
|
||||||
|
core.control.noAutoEvents = true;
|
||||||
|
// 更新vue状态栏
|
||||||
|
core.plugin.statusBarStatus.value =
|
||||||
|
!core.plugin.statusBarStatus.value;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -543,8 +543,3 @@ p#name {
|
|||||||
overflow: visible;
|
overflow: visible;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: Fira Code;
|
|
||||||
src: url(../src/fonts/FiraCode-Regular.ttf);
|
|
||||||
}
|
|
||||||
|
@ -14,7 +14,7 @@ import { has } from '../plugin/utils';
|
|||||||
const id = (Math.random() * 1e8).toFixed(0);
|
const id = (Math.random() * 1e8).toFixed(0);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
id: string;
|
id: AllIds | 'hero';
|
||||||
noborder?: boolean;
|
noborder?: boolean;
|
||||||
width?: number;
|
width?: number;
|
||||||
height?: number;
|
height?: number;
|
||||||
@ -29,7 +29,7 @@ function draw() {
|
|||||||
if (id === 'none') return;
|
if (id === 'none') return;
|
||||||
if (has(drawFn)) removeAnimate(drawFn);
|
if (has(drawFn)) removeAnimate(drawFn);
|
||||||
|
|
||||||
const cls = core.getClsFromId(props.id);
|
const cls = core.getClsFromId(props.id as AllIds);
|
||||||
const frames = core.getAnimateFrames(cls);
|
const frames = core.getAnimateFrames(cls);
|
||||||
const w = props.width ?? 32;
|
const w = props.width ?? 32;
|
||||||
const h = props.height ?? 32;
|
const h = props.height ?? 32;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
v-for="(text, i) in enemy.toShowSpecial"
|
v-for="(text, i) in enemy.toShowSpecial"
|
||||||
:style="{ color: enemy.toShowColor![i] }"
|
:style="{ color: enemy.toShowColor![i] as string }"
|
||||||
> {{ text }} </span
|
> {{ text }} </span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -93,20 +93,23 @@
|
|||||||
? 'gold'
|
? 'gold'
|
||||||
: 'lightpink'
|
: 'lightpink'
|
||||||
}"
|
}"
|
||||||
|
><span style="font-family: 'Fira Code'">{{
|
||||||
|
enemy.criticalDamage < 0 ? '=>' : ''
|
||||||
|
}}</span
|
||||||
>{{
|
>{{
|
||||||
core.formatBigNumber(
|
core.formatBigNumber(
|
||||||
enemy.criticalDamage,
|
|
||||||
false,
|
|
||||||
enemy.criticalDamage < 0
|
enemy.criticalDamage < 0
|
||||||
|
? -enemy.criticalDamage
|
||||||
|
: enemy.criticalDamage
|
||||||
)
|
)
|
||||||
}}</span
|
}}</span
|
||||||
></span
|
></span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="detail-info">
|
<div class="detail-info">
|
||||||
<span :style="{color: enemy.damageColor!}"
|
<span :style="{color: enemy.damageColor! as string}"
|
||||||
>伤害 {{
|
>伤害 {{
|
||||||
core.formatBigNumber(enemy.damage)
|
core.formatBigNumber(enemy.damage!)
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
@ -122,7 +125,7 @@ import BoxAnimate from '../components/boxAnimate.vue';
|
|||||||
import { isMobile } from '../plugin/use';
|
import { isMobile } from '../plugin/use';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
enemy: Enemy & DetailedEnemy;
|
enemy: DetailedEnemy;
|
||||||
selected?: boolean;
|
selected?: boolean;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
BIN
src/fonts/FiraCode-Regular.ttf
Normal file
BIN
src/fonts/FiraCode-Regular.ttf
Normal file
Binary file not shown.
@ -4,10 +4,11 @@ import ui from './plugin/uiController';
|
|||||||
import use from './plugin/use';
|
import use from './plugin/use';
|
||||||
import animate from './plugin/animateController';
|
import animate from './plugin/animateController';
|
||||||
import utils from './plugin/utils';
|
import utils from './plugin/utils';
|
||||||
|
import status from './plugin/ui/statusBar';
|
||||||
|
|
||||||
window.addEventListener('load', () => {
|
window.addEventListener('load', () => {
|
||||||
// 每个引入的插件都要在这里执行,否则不会被转发
|
// 每个引入的插件都要在这里执行,否则不会被转发
|
||||||
const toForward: any[] = [pop(), ui(), use(), animate(), utils()];
|
const toForward: any[] = [pop(), ui(), use(), animate(), utils(), status()];
|
||||||
|
|
||||||
// 初始化所有插件,并转发到core上
|
// 初始化所有插件,并转发到core上
|
||||||
(async function () {
|
(async function () {
|
||||||
|
@ -61,7 +61,16 @@
|
|||||||
isMobile ? '' : ' '
|
isMobile ? '' : ' '
|
||||||
}}</span
|
}}</span
|
||||||
>
|
>
|
||||||
<span>{{ format(nowDamage[0], false, nowDamage[0] < 0) }}</span>
|
<span
|
||||||
|
><span style="font-family: 'Fira Code'">{{
|
||||||
|
nowDamage[0] < 0 ? '=>' : ''
|
||||||
|
}}</span
|
||||||
|
>{{
|
||||||
|
nowDamage[0] < 0
|
||||||
|
? format(-nowDamage[0])
|
||||||
|
: format(nowDamage[0])
|
||||||
|
}}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span
|
<span
|
||||||
|
@ -20,9 +20,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-for="[atk, dam] of criticals" class="critical">
|
<div v-for="[atk, dam] of criticals" class="critical">
|
||||||
<span class="critical-atk">{{ format(atk) }}</span>
|
<span class="critical-atk">{{ format(atk) }}</span>
|
||||||
<span>{{
|
<span
|
||||||
dam < 0 ? `-> ${format(-dam)}` : format(dam)
|
><span style="font-family: 'Fira Code'">{{
|
||||||
}}</span>
|
dam < 0 ? '=>' : ''
|
||||||
|
}}</span
|
||||||
|
>{{ dam < 0 ? `${format(-dam)}` : format(dam) }}</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -75,7 +75,6 @@ export function getDefDamage(
|
|||||||
if (!has(dam)) continue;
|
if (!has(dam)) continue;
|
||||||
if (dam.damage === origin) continue;
|
if (dam.damage === origin) continue;
|
||||||
if (dam.damage === res.at(-1)?.[1]) continue;
|
if (dam.damage === res.at(-1)?.[1]) continue;
|
||||||
if (last === dam.damage) break;
|
|
||||||
last = dam.damage;
|
last = dam.damage;
|
||||||
res.push([ratio * i + addDef, dam.damage]);
|
res.push([ratio * i + addDef, dam.damage]);
|
||||||
}
|
}
|
||||||
@ -121,7 +120,6 @@ export function getCriticalDamage(
|
|||||||
if (!has(dam)) continue;
|
if (!has(dam)) continue;
|
||||||
if (dam.damage === origin) continue;
|
if (dam.damage === origin) continue;
|
||||||
if (dam.damage === res.at(-1)?.[1]) continue;
|
if (dam.damage === res.at(-1)?.[1]) continue;
|
||||||
if (last === dam.damage) break;
|
|
||||||
last = dam.damage;
|
last = dam.damage;
|
||||||
res.push([ratio * i + addAtk, dam.damage]);
|
res.push([ratio * i + addAtk, dam.damage]);
|
||||||
}
|
}
|
||||||
|
9
src/plugin/ui/statusBar.ts
Normal file
9
src/plugin/ui/statusBar.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
|
const status = ref(false);
|
||||||
|
|
||||||
|
export default function init() {
|
||||||
|
return { statusBarStatus: status };
|
||||||
|
}
|
||||||
|
|
||||||
|
export { status };
|
@ -9,6 +9,7 @@ export const toolOpened = ref(false);
|
|||||||
export const equipOpened = ref(false);
|
export const equipOpened = ref(false);
|
||||||
|
|
||||||
export const transition = ref(true);
|
export const transition = ref(true);
|
||||||
|
export const noClosePanel = ref(false);
|
||||||
|
|
||||||
let app: HTMLDivElement;
|
let app: HTMLDivElement;
|
||||||
|
|
||||||
@ -61,12 +62,14 @@ async function hideApp(index: number) {
|
|||||||
await sleep(600);
|
await sleep(600);
|
||||||
uiStack.value.splice(index, 1);
|
uiStack.value.splice(index, 1);
|
||||||
app.style.display = 'none';
|
app.style.display = 'none';
|
||||||
core.closePanel();
|
if (!noClosePanel.value) core.closePanel();
|
||||||
|
noClosePanel.value = false;
|
||||||
} else {
|
} else {
|
||||||
app.style.transition = '';
|
app.style.transition = '';
|
||||||
app.style.opacity = '0';
|
app.style.opacity = '0';
|
||||||
uiStack.value.splice(index, 1);
|
uiStack.value.splice(index, 1);
|
||||||
app.style.display = 'none';
|
app.style.display = 'none';
|
||||||
core.closePanel();
|
if (!noClosePanel.value) core.closePanel();
|
||||||
|
noClosePanel.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,3 +69,8 @@
|
|||||||
background-color: rgba(255, 0, 0, 0.319);
|
background-color: rgba(255, 0, 0, 0.319);
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-family: Fira Code;
|
||||||
|
src: url(/src/fonts/FiraCode-Regular.ttf);
|
||||||
|
}
|
||||||
|
6
src/types/core.d.ts
vendored
6
src/types/core.d.ts
vendored
@ -97,6 +97,8 @@ type MaterialImages = {
|
|||||||
* 额外素材
|
* 额外素材
|
||||||
*/
|
*/
|
||||||
tilesets: Record<string, HTMLImageElement>;
|
tilesets: Record<string, HTMLImageElement>;
|
||||||
|
|
||||||
|
hero: HTMLImageElement;
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Material {
|
interface Material {
|
||||||
@ -1448,3 +1450,7 @@ declare const maps_90f36752_8815_4be8_b32b_d7fad1d0542e: {
|
|||||||
* 插件信息
|
* 插件信息
|
||||||
*/
|
*/
|
||||||
declare const plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1: PluginDeclaration;
|
declare const plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1: PluginDeclaration;
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
core: CoreMixin;
|
||||||
|
}
|
||||||
|
3
src/types/enemy.d.ts
vendored
3
src/types/enemy.d.ts
vendored
@ -30,6 +30,9 @@ type DetailedEnemy<I extends EnemyIds = EnemyIds> = {
|
|||||||
toShowColor: Color[];
|
toShowColor: Color[];
|
||||||
specialColor: Color[];
|
specialColor: Color[];
|
||||||
damageColor: Color;
|
damageColor: Color;
|
||||||
|
criticalDamage: number;
|
||||||
|
critical: number;
|
||||||
|
defDamage: number;
|
||||||
} & Enemy<I>;
|
} & Enemy<I>;
|
||||||
|
|
||||||
type Enemy<I extends EnemyIds = EnemyIds> = {
|
type Enemy<I extends EnemyIds = EnemyIds> = {
|
||||||
|
2
src/types/event.d.ts
vendored
2
src/types/event.d.ts
vendored
@ -299,7 +299,7 @@ interface Events extends EventData {
|
|||||||
* 恢复一个事件
|
* 恢复一个事件
|
||||||
* @param data 事件信息
|
* @param data 事件信息
|
||||||
*/
|
*/
|
||||||
recoverEvents(data?: any): void;
|
recoverEvents(data?: any): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测自动事件
|
* 检测自动事件
|
||||||
|
6
src/types/icon.d.ts
vendored
6
src/types/icon.d.ts
vendored
@ -66,6 +66,12 @@ interface Icons {
|
|||||||
* @param id 图块数字或id
|
* @param id 图块数字或id
|
||||||
*/
|
*/
|
||||||
getTilesetOffset(id: string | number): IconOffsetInfo | null;
|
getTilesetOffset(id: string | number): IconOffsetInfo | null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取动画帧数
|
||||||
|
* @param cls 类型
|
||||||
|
*/
|
||||||
|
getAnimateFrames<T extends Cls>(cls: T): FrameOf<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const icons: new () => Icons;
|
declare const icons: new () => Icons;
|
||||||
|
3
src/types/plugin.d.ts
vendored
3
src/types/plugin.d.ts
vendored
@ -44,6 +44,9 @@ interface PluginDeclaration extends PluginUtils {
|
|||||||
/** 装备栏是否打开 */
|
/** 装备栏是否打开 */
|
||||||
readonly equipOpened: Ref<boolean>;
|
readonly equipOpened: Ref<boolean>;
|
||||||
|
|
||||||
|
/** 状态栏信息,取反后刷新状态栏 */
|
||||||
|
readonly statusBarStatus: Ref<boolean>;
|
||||||
|
|
||||||
/** ui栈 */
|
/** ui栈 */
|
||||||
readonly uiStack: Ref<Component[]>;
|
readonly uiStack: Ref<Component[]>;
|
||||||
|
|
||||||
|
5
src/types/source.d.ts
vendored
5
src/types/source.d.ts
vendored
@ -10,12 +10,12 @@ type Cls =
|
|||||||
| 'terrains'
|
| 'terrains'
|
||||||
| 'enemy48'
|
| 'enemy48'
|
||||||
| 'npc48'
|
| 'npc48'
|
||||||
| 'tilesets';
|
| 'tileset';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 所有的可动画图块类型
|
* 所有的可动画图块类型
|
||||||
*/
|
*/
|
||||||
type AnimatableCls = Exclude<Cls, 'items' | 'terrains' | 'tilesets'>;
|
type AnimatableCls = Exclude<Cls, 'items' | 'terrains' | 'tileset'>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 道具类型
|
* 道具类型
|
||||||
@ -85,6 +85,7 @@ interface FrameNumbers {
|
|||||||
terrains: 1;
|
terrains: 1;
|
||||||
enemy48: 4;
|
enemy48: 4;
|
||||||
npc48: 4;
|
npc48: 4;
|
||||||
|
tileset: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
2
src/types/ui.d.ts
vendored
2
src/types/ui.d.ts
vendored
@ -592,7 +592,7 @@ interface Ui {
|
|||||||
*/
|
*/
|
||||||
drawIcon(
|
drawIcon(
|
||||||
name: CtxRefer,
|
name: CtxRefer,
|
||||||
id: AllIds,
|
id: AllIds | 'hero',
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
w?: number,
|
w?: number,
|
||||||
|
2
src/types/util.d.ts
vendored
2
src/types/util.d.ts
vendored
@ -249,7 +249,7 @@ interface Utils {
|
|||||||
* @param onMap 显示的字符数
|
* @param onMap 显示的字符数
|
||||||
* @returns 格式化结果
|
* @returns 格式化结果
|
||||||
*/
|
*/
|
||||||
formatBigNumber(x: number, onMap?: number): string;
|
formatBigNumber(x: number | string, onMap?: number): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
@ -39,13 +39,21 @@ import { sleep } from 'mutate-animate';
|
|||||||
import { onMounted, onUnmounted, ref } from 'vue';
|
import { onMounted, onUnmounted, ref } from 'vue';
|
||||||
import EnemyOne from '../components/enemyOne.vue';
|
import EnemyOne from '../components/enemyOne.vue';
|
||||||
import Scroll from '../components/scroll.vue';
|
import Scroll from '../components/scroll.vue';
|
||||||
import { getDamageColor, keycode } from '../plugin/utils';
|
import { getDamageColor, has, keycode } from '../plugin/utils';
|
||||||
import BookDetail from './bookDetail.vue';
|
import BookDetail from './bookDetail.vue';
|
||||||
import { LeftOutlined } from '@ant-design/icons-vue';
|
import { LeftOutlined } from '@ant-design/icons-vue';
|
||||||
import { KeyCode } from '../plugin/keyCodes';
|
import { KeyCode } from '../plugin/keyCodes';
|
||||||
|
import { noClosePanel } from '../plugin/uiController';
|
||||||
|
|
||||||
const floorId =
|
const floorId =
|
||||||
core.floorIds[core.status.event?.ui as number] ?? core.status.floorId;
|
// @ts-ignore
|
||||||
|
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
||||||
|
// 清除浏览地图时的光环缓存
|
||||||
|
if (floorId !== core.status.floorId && core.status.checkBlock) {
|
||||||
|
// @ts-ignore
|
||||||
|
core.status.checkBlock.cache = {};
|
||||||
|
}
|
||||||
|
|
||||||
const enemy = core.getCurrentEnemys(floorId);
|
const enemy = core.getCurrentEnemys(floorId);
|
||||||
|
|
||||||
const scroll = ref(0);
|
const scroll = ref(0);
|
||||||
@ -116,8 +124,17 @@ async function show() {
|
|||||||
/**
|
/**
|
||||||
* 退出怪物手册
|
* 退出怪物手册
|
||||||
*/
|
*/
|
||||||
function exit() {
|
async function exit() {
|
||||||
|
noClosePanel.value = true;
|
||||||
core.plugin.bookOpened.value = false;
|
core.plugin.bookOpened.value = false;
|
||||||
|
if (core.events.recoverEvents(core.status.event.interval)) {
|
||||||
|
return;
|
||||||
|
} else if (has(core.status.event.ui)) {
|
||||||
|
core.status.boxAnimateObjs = [];
|
||||||
|
// @ts-ignore
|
||||||
|
core.ui._drawViewMaps(core.status.event.ui);
|
||||||
|
} else core.ui.closePanel();
|
||||||
|
await sleep(650);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkScroll() {
|
function checkScroll() {
|
||||||
|
49
src/ui/statusBar.vue
Normal file
49
src/ui/statusBar.vue
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<template>
|
||||||
|
<div id="status-bar"></div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, shallowReactive, watch } from 'vue';
|
||||||
|
import { isMobile } from '../plugin/use';
|
||||||
|
import { status } from '../plugin/ui/statusBar';
|
||||||
|
|
||||||
|
const width = ref(isMobile ? window.innerWidth : 300);
|
||||||
|
const height = ref(isMobile ? 300 : window.innerHeight - 100);
|
||||||
|
const left = ref(isMobile ? 0 : 50);
|
||||||
|
const top = ref(50);
|
||||||
|
const hero = shallowReactive<Partial<HeroStatus>>({});
|
||||||
|
const floor = ref<string>();
|
||||||
|
/**
|
||||||
|
* 要展示的勇士属性
|
||||||
|
*/
|
||||||
|
const toShow: (keyof NumbericHeroStatus)[] = [
|
||||||
|
'hp', // 生命
|
||||||
|
'atk', // 攻击
|
||||||
|
'def', // 防御
|
||||||
|
'mdef', // 智力
|
||||||
|
'hpmax', // 生命回复
|
||||||
|
'mana', // 额外攻击
|
||||||
|
'money', // 金币
|
||||||
|
'exp' // 经验
|
||||||
|
];
|
||||||
|
|
||||||
|
watch(status, update);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新显示内容
|
||||||
|
*/
|
||||||
|
function update() {
|
||||||
|
toShow.forEach(v => {
|
||||||
|
hero[v] = core.getRealStatus(v);
|
||||||
|
});
|
||||||
|
floor.value = core.status.thisMap?.title;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
#status-bar {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue
Block a user