mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 20:59:37 +08:00
feat: 勇士显伤
This commit is contained in:
parent
c242018ee8
commit
b3e3ae5f8e
@ -289,6 +289,11 @@ function handleScreenSetting<T extends number | boolean>(
|
|||||||
} else if (key === 'itemDetail') {
|
} else if (key === 'itemDetail') {
|
||||||
// 宝石血瓶显伤
|
// 宝石血瓶显伤
|
||||||
core.setLocalStorage('itemDetail', n);
|
core.setLocalStorage('itemDetail', n);
|
||||||
|
} else if (key === 'heroDetail') {
|
||||||
|
// 勇士显伤
|
||||||
|
core.setLocalStorage('heroDetail', n);
|
||||||
|
core.drawHero();
|
||||||
|
// storage.setValue('heroDetail', n as boolean);
|
||||||
} else if (key === 'transition') {
|
} else if (key === 'transition') {
|
||||||
// 界面动画
|
// 界面动画
|
||||||
core.setLocalStorage('transition', n);
|
core.setLocalStorage('transition', n);
|
||||||
@ -352,6 +357,7 @@ mainSetting
|
|||||||
.register('fullscreen', '全屏游戏', false)
|
.register('fullscreen', '全屏游戏', false)
|
||||||
.register('halo', '光环显示', true)
|
.register('halo', '光环显示', true)
|
||||||
.register('itemDetail', '宝石血瓶显伤', true)
|
.register('itemDetail', '宝石血瓶显伤', true)
|
||||||
|
.register('heroDetail', '勇士显伤', false)
|
||||||
.register('transition', '界面动画', false)
|
.register('transition', '界面动画', false)
|
||||||
.register('antiAlias', '抗锯齿', false)
|
.register('antiAlias', '抗锯齿', false)
|
||||||
.register('fontSize', '字体大小', 16, [8, 28, 1])
|
.register('fontSize', '字体大小', 16, [8, 28, 1])
|
||||||
@ -400,6 +406,7 @@ interface SettingStorage {
|
|||||||
betterLoad: boolean;
|
betterLoad: boolean;
|
||||||
autoScale: boolean;
|
autoScale: boolean;
|
||||||
paraLight: boolean;
|
paraLight: boolean;
|
||||||
|
heroDetail: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const storage = new GameStorage<SettingStorage>(
|
const storage = new GameStorage<SettingStorage>(
|
||||||
@ -411,6 +418,7 @@ loading.once('coreInit', () => {
|
|||||||
'screen.fullscreen': !!document.fullscreenElement,
|
'screen.fullscreen': !!document.fullscreenElement,
|
||||||
'screen.halo': !!storage.getValue('showHalo', true),
|
'screen.halo': !!storage.getValue('showHalo', true),
|
||||||
'screen.itemDetail': !!storage.getValue('itemDetail', true),
|
'screen.itemDetail': !!storage.getValue('itemDetail', true),
|
||||||
|
'screen.heroDetail': !!storage.getValue('heroDetail', false),
|
||||||
'screen.transition': !!storage.getValue('transition', false),
|
'screen.transition': !!storage.getValue('transition', false),
|
||||||
'screen.antiAlias': !!storage.getValue('antiAlias', false),
|
'screen.antiAlias': !!storage.getValue('antiAlias', false),
|
||||||
'screen.fontSize': storage.getValue('fontSize', 16),
|
'screen.fontSize': storage.getValue('fontSize', 16),
|
||||||
|
33
src/plugin/game/fx/heroDetail.ts
Normal file
33
src/plugin/game/fx/heroDetail.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
function drawHeroDetail(px: number, py: number) {
|
||||||
|
if (!core.getLocalStorage('heroDetail', false)) return;
|
||||||
|
const { hp, atk, def } = core.status.hero;
|
||||||
|
const toDraw = {
|
||||||
|
atk: {
|
||||||
|
value: atk,
|
||||||
|
color: '#FF7A7A'
|
||||||
|
},
|
||||||
|
def: {
|
||||||
|
value: def,
|
||||||
|
color: '#00E6F1'
|
||||||
|
},
|
||||||
|
hp: {
|
||||||
|
value: hp,
|
||||||
|
color: '#F9FFFF0'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
for (const [key, value] of Object.entries(toDraw)) {
|
||||||
|
const ctx = core.canvas['hero'].canvas;
|
||||||
|
core.fillBoldText(
|
||||||
|
ctx,
|
||||||
|
value.value.toString(),
|
||||||
|
px,
|
||||||
|
py - 10 * i,
|
||||||
|
value.color as string
|
||||||
|
);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { drawHeroDetail };
|
@ -13,11 +13,17 @@ import {
|
|||||||
setShadowNodes
|
setShadowNodes
|
||||||
} from './shadow';
|
} from './shadow';
|
||||||
import { pColor } from '../utils';
|
import { pColor } from '../utils';
|
||||||
|
import { drawHeroDetail } from '../game/fx/heroDetail';
|
||||||
|
|
||||||
export default function init() {
|
export default function init() {
|
||||||
const origin4 = control.prototype.drawHero;
|
const origin4 = control.prototype.drawHero;
|
||||||
control.prototype.drawHero = function () {
|
control.prototype.drawHero = function () {
|
||||||
origin4.apply(core.control, arguments);
|
origin4.apply(core.control, arguments);
|
||||||
|
drawHeroDetail(
|
||||||
|
core.status.heroCenter.px - 16,
|
||||||
|
core.status.heroCenter.py + 20
|
||||||
|
);
|
||||||
|
|
||||||
if (core.getFlag('__heroOpacity__') !== 0) {
|
if (core.getFlag('__heroOpacity__') !== 0) {
|
||||||
getAllLights().forEach(v => {
|
getAllLights().forEach(v => {
|
||||||
if (!v.followHero) return;
|
if (!v.followHero) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user