mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-28 17:37:07 +08:00
feat & fix: 小地图显示剩余怪物 & id优化
This commit is contained in:
parent
020551bd90
commit
59c3b46cfc
1
components.d.ts
vendored
1
components.d.ts
vendored
@ -19,6 +19,7 @@ declare module '@vue/runtime-core' {
|
|||||||
BoxAnimate: typeof import('./src/components/boxAnimate.vue')['default']
|
BoxAnimate: typeof import('./src/components/boxAnimate.vue')['default']
|
||||||
Colomn: typeof import('./src/components/colomn.vue')['default']
|
Colomn: typeof import('./src/components/colomn.vue')['default']
|
||||||
EnemyOne: typeof import('./src/components/enemyOne.vue')['default']
|
EnemyOne: typeof import('./src/components/enemyOne.vue')['default']
|
||||||
|
Minimap: typeof import('./src/components/minimap.vue')['default']
|
||||||
Scroll: typeof import('./src/components/scroll.vue')['default']
|
Scroll: typeof import('./src/components/scroll.vue')['default']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ main.floors.MT22=
|
|||||||
"第二章的加点已开启,可以在技能树的前置技能下方选择",
|
"第二章的加点已开启,可以在技能树的前置技能下方选择",
|
||||||
"如果你玩过上个版本,直接跳到了本章,记得查看背包里面的各种道具,尤其是百科全书,同时注意左边是你来的方向,那里还有些怪物",
|
"如果你玩过上个版本,直接跳到了本章,记得查看背包里面的各种道具,尤其是百科全书,同时注意左边是你来的方向,那里还有些怪物",
|
||||||
"从现在开始,跳跃技能不再消耗生命值,别忘了你还有跳跃技能",
|
"从现在开始,跳跃技能不再消耗生命值,别忘了你还有跳跃技能",
|
||||||
"为了确保平衡与可玩性,从现在开始,无上之盾(第一章终极技能)效果变为1/10"
|
"为了确保平衡与可玩性,从现在开始,无上之盾(第一章终极技能)效果变为1/10,同时每个怪物的最大吸血量限制为攻防和"
|
||||||
],
|
],
|
||||||
"7,9": [
|
"7,9": [
|
||||||
"百科全书中已解锁第二章需要特别说明的怪物属性,你可以在百科全书中查看",
|
"百科全书中已解锁第二章需要特别说明的怪物属性,你可以在百科全书中查看",
|
||||||
|
@ -135,7 +135,7 @@ main.floors.MT42=
|
|||||||
[584,584,584,584,420,491,430,584,602, 0,492,604,604,643,586],
|
[584,584,584,584,420,491,430,584,602, 0,492,604,604,643,586],
|
||||||
[584, 0, 0,584,584,468,585,585, 0, 28,604, 27,604,441,586],
|
[584, 0, 0,584,584,468,585,585, 0, 28,604, 27,604,441,586],
|
||||||
[ 0, 0, 0,584,584,497,585,585, 0, 0,600,403,494, 0, 94],
|
[ 0, 0, 0,584,584,497,585,585, 0, 0,600,403,494, 0, 94],
|
||||||
[ 0, 0, 0,584,584, 93,585,585, 93,584,584,584,584,584,584]
|
[ 0, 0, 0,584, 0, 93, 0,585, 93,584,584,584,584,584,584]
|
||||||
],
|
],
|
||||||
"bgmap": [
|
"bgmap": [
|
||||||
[70073,70073, 0,70073,70073,70073,70073,70073,70073,70073,70073,70073,70073,70097,70073],
|
[70073,70073, 0,70073,70073,70073,70073,70073,70073,70073,70073,70073,70073,70097,70073],
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
import { onMounted, onUnmounted, onUpdated, ref, watch } from 'vue';
|
import { onMounted, onUnmounted, onUpdated, ref, watch } from 'vue';
|
||||||
import { DragOutlined } from '@ant-design/icons-vue';
|
import { DragOutlined } from '@ant-design/icons-vue';
|
||||||
import { isMobile, useDrag, cancelGlobalDrag } from '../plugin/use';
|
import { isMobile, useDrag, cancelGlobalDrag } from '../plugin/use';
|
||||||
import { has } from '../plugin/utils';
|
import { has, requireUniqueSymbol } from '../plugin/utils';
|
||||||
import { sleep } from 'mutate-animate';
|
import { sleep } from 'mutate-animate';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
@ -65,7 +65,7 @@ const emits = defineEmits<{
|
|||||||
(e: 'update:height', data: number): void;
|
(e: 'update:height', data: number): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const id = (1e8 * Math.random()).toFixed(0);
|
const id = requireUniqueSymbol().toFixed(0);
|
||||||
|
|
||||||
const moveSelected = ref(false);
|
const moveSelected = ref(false);
|
||||||
let moveTimeout = 0;
|
let moveTimeout = 0;
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
<script lang="tsx" setup>
|
<script lang="tsx" setup>
|
||||||
import { onMounted, onUnmounted, onUpdated, ref } from 'vue';
|
import { onMounted, onUnmounted, onUpdated, ref } from 'vue';
|
||||||
import { addAnimate, removeAnimate } from '../plugin/animateController';
|
import { addAnimate, removeAnimate } from '../plugin/animateController';
|
||||||
import { has } from '../plugin/utils';
|
import { has, requireUniqueSymbol } from '../plugin/utils';
|
||||||
|
|
||||||
const id = (Math.random() * 1e8).toFixed(0);
|
const id = requireUniqueSymbol().toFixed(0);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
id: AllIds | 'hero' | 'none';
|
id: AllIds | 'hero' | 'none';
|
||||||
|
@ -27,7 +27,7 @@ import { onMounted, onUnmounted, onUpdated, ref } from 'vue';
|
|||||||
import { LeftOutlined } from '@ant-design/icons-vue';
|
import { LeftOutlined } from '@ant-design/icons-vue';
|
||||||
import Scroll from './scroll.vue';
|
import Scroll from './scroll.vue';
|
||||||
import { isMobile } from '../plugin/use';
|
import { isMobile } from '../plugin/use';
|
||||||
import { has } from '../plugin/utils';
|
import { has, requireUniqueSymbol } from '../plugin/utils';
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const emits = defineEmits<{
|
||||||
(e: 'close'): void;
|
(e: 'close'): void;
|
||||||
@ -40,7 +40,7 @@ const props = defineProps<{
|
|||||||
right?: number;
|
right?: number;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const id = (1e8 * Math.random()).toFixed(0);
|
const id = requireUniqueSymbol().toFixed(0);
|
||||||
|
|
||||||
let main: HTMLDivElement;
|
let main: HTMLDivElement;
|
||||||
let left: HTMLDivElement;
|
let left: HTMLDivElement;
|
||||||
|
33
src/components/minimap.vue
Normal file
33
src/components/minimap.vue
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<template>
|
||||||
|
<canvas :id="`minimap-${id}`"></canvas>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
import { requireUniqueSymbol } from '../plugin/utils';
|
||||||
|
import { MinimapDrawer } from '../plugin/ui/fly';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
action?: boolean;
|
||||||
|
scale?: number;
|
||||||
|
noBorder?: boolean;
|
||||||
|
showInfo?: boolean;
|
||||||
|
autoLocate?: boolean;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const id = requireUniqueSymbol().toFixed(0);
|
||||||
|
|
||||||
|
let canvas: HTMLCanvasElement;
|
||||||
|
let drawer: MinimapDrawer;
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
canvas = document.getElementById(`minimap-${id}`) as HTMLCanvasElement;
|
||||||
|
drawer = new MinimapDrawer(canvas);
|
||||||
|
|
||||||
|
drawer.scale = props.scale ?? 3;
|
||||||
|
drawer.noBorder = props.noBorder ?? false;
|
||||||
|
drawer.showInfo = props.showInfo ?? false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
@ -13,6 +13,7 @@
|
|||||||
import { sleep } from 'mutate-animate';
|
import { sleep } from 'mutate-animate';
|
||||||
import { onMounted, onUnmounted, onUpdated } from 'vue';
|
import { onMounted, onUnmounted, onUpdated } from 'vue';
|
||||||
import { cancelGlobalDrag, useDrag, useWheel } from '../plugin/use';
|
import { cancelGlobalDrag, useDrag, useWheel } from '../plugin/use';
|
||||||
|
import { requireUniqueSymbol } from '@/plugin/utils';
|
||||||
|
|
||||||
let main: HTMLDivElement;
|
let main: HTMLDivElement;
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ const emits = defineEmits<{
|
|||||||
let now = 0;
|
let now = 0;
|
||||||
let total = 0;
|
let total = 0;
|
||||||
|
|
||||||
const id = (1e8 * Math.random()).toFixed(0);
|
const id = requireUniqueSymbol().toFixed(0);
|
||||||
const scale = window.devicePixelRatio;
|
const scale = window.devicePixelRatio;
|
||||||
const width = props.width ?? 20;
|
const width = props.width ?? 20;
|
||||||
|
|
||||||
|
@ -46,10 +46,19 @@ interface AssistKeyToolbarItem extends ToolbarItemBase<'assistKey'> {
|
|||||||
assist: KeyCode.Ctrl | KeyCode.Shift | KeyCode.Alt;
|
assist: KeyCode.Ctrl | KeyCode.Shift | KeyCode.Alt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface MinimatToolbar extends ToolbarItemBase<'minimap'> {
|
||||||
|
action: boolean;
|
||||||
|
scale: number;
|
||||||
|
noBorder: boolean;
|
||||||
|
showInfo: boolean;
|
||||||
|
autoLocate: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
interface ToolbarItemMap {
|
interface ToolbarItemMap {
|
||||||
hotkey: HotkeyToolbarItem;
|
hotkey: HotkeyToolbarItem;
|
||||||
item: ItemToolbarItem;
|
item: ItemToolbarItem;
|
||||||
assistKey: AssistKeyToolbarItem;
|
assistKey: AssistKeyToolbarItem;
|
||||||
|
minimap: MinimatToolbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ToolbarSaveData {
|
interface ToolbarSaveData {
|
||||||
|
@ -9,6 +9,7 @@ import { getVitualKeyOnce } from '@/plugin/utils';
|
|||||||
import { cloneDeep } from 'lodash-es';
|
import { cloneDeep } from 'lodash-es';
|
||||||
import { Select, SelectOption } from 'ant-design-vue';
|
import { Select, SelectOption } from 'ant-design-vue';
|
||||||
import { mainSetting } from '../setting';
|
import { mainSetting } from '../setting';
|
||||||
|
import Minimap from '@/components/minimap.vue';
|
||||||
|
|
||||||
// todo: 新增更改设置的ToolItem
|
// todo: 新增更改设置的ToolItem
|
||||||
|
|
||||||
@ -88,6 +89,16 @@ function AssistKeyTool(props: CustomToolbarProps<'assistKey'>) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MinimapToolbar(props: CustomToolbarProps<'minimap'>) {
|
||||||
|
const { item, toolbar } = props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Minimap></Minimap>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function DefaultToolEditor(props: CustomToolbarProps) {
|
function DefaultToolEditor(props: CustomToolbarProps) {
|
||||||
return <span></span>;
|
return <span></span>;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import './system';
|
import './system';
|
||||||
import '../plugin/game/index';
|
import '../plugin/game/index';
|
||||||
import { DamageEnemy, EnemyCollection } from './enemy/damage';
|
import * as damage from './enemy/damage';
|
||||||
import { EventEmitter, IndexedEventEmitter } from '@/core/common/eventEmitter';
|
import { EventEmitter, IndexedEventEmitter } from '@/core/common/eventEmitter';
|
||||||
import { Range } from '@/plugin/game/range';
|
import { Range } from '@/plugin/game/range';
|
||||||
import { specials } from './enemy/special';
|
import { specials } from './enemy/special';
|
||||||
@ -9,8 +9,8 @@ import * as battle from './enemy/battle';
|
|||||||
import * as hero from './hero';
|
import * as hero from './hero';
|
||||||
|
|
||||||
// ----- 类注册
|
// ----- 类注册
|
||||||
Mota.register('class', 'DamageEnemy', DamageEnemy);
|
Mota.register('class', 'DamageEnemy', damage.DamageEnemy);
|
||||||
Mota.register('class', 'EnemyCollection', EnemyCollection);
|
Mota.register('class', 'EnemyCollection', damage.EnemyCollection);
|
||||||
Mota.register('class', 'EventEmitter', EventEmitter);
|
Mota.register('class', 'EventEmitter', EventEmitter);
|
||||||
Mota.register('class', 'IndexedEventEmitter', IndexedEventEmitter);
|
Mota.register('class', 'IndexedEventEmitter', IndexedEventEmitter);
|
||||||
Mota.register('class', 'Range', Range);
|
Mota.register('class', 'Range', Range);
|
||||||
@ -18,6 +18,7 @@ Mota.register('class', 'Range', Range);
|
|||||||
Mota.register('fn', 'getEnemy', battle.getEnemy);
|
Mota.register('fn', 'getEnemy', battle.getEnemy);
|
||||||
Mota.register('fn', 'getHeroStatusOn', hero.getHeroStatusOn);
|
Mota.register('fn', 'getHeroStatusOn', hero.getHeroStatusOn);
|
||||||
Mota.register('fn', 'getHeroStatusOf', hero.getHeroStatusOf);
|
Mota.register('fn', 'getHeroStatusOf', hero.getHeroStatusOf);
|
||||||
|
Mota.register('fn', 'ensureFloorDamage', damage.ensureFloorDamage);
|
||||||
// ----- 变量注册
|
// ----- 变量注册
|
||||||
Mota.register('var', 'enemySpecials', specials);
|
Mota.register('var', 'enemySpecials', specials);
|
||||||
Mota.register('var', 'hook', hook);
|
Mota.register('var', 'hook', hook);
|
||||||
|
@ -21,6 +21,7 @@ import type { KeyCode } from '@/plugin/keyCodes';
|
|||||||
import type { Ref } from 'vue';
|
import type { Ref } from 'vue';
|
||||||
import type * as battle from './enemy/battle';
|
import type * as battle from './enemy/battle';
|
||||||
import type * as hero from './hero';
|
import type * as hero from './hero';
|
||||||
|
import type * as damage from './enemy/damage';
|
||||||
import type { Logger } from '@/core/common/logger';
|
import type { Logger } from '@/core/common/logger';
|
||||||
|
|
||||||
interface ClassInterface {
|
interface ClassInterface {
|
||||||
@ -51,8 +52,9 @@ interface ClassInterface {
|
|||||||
|
|
||||||
type _IBattle = typeof battle;
|
type _IBattle = typeof battle;
|
||||||
type _IHero = typeof hero;
|
type _IHero = typeof hero;
|
||||||
|
type _IDamage = typeof damage;
|
||||||
|
|
||||||
interface FunctionInterface extends _IBattle, _IHero {
|
interface FunctionInterface extends _IBattle, _IHero, _IDamage {
|
||||||
// 定义于渲染进程,录像中会进行polyfill,但是不执行任何内容
|
// 定义于渲染进程,录像中会进行polyfill,但是不执行任何内容
|
||||||
readyAllResource(): void;
|
readyAllResource(): void;
|
||||||
// 定义于游戏进程,渲染进程依然可用
|
// 定义于游戏进程,渲染进程依然可用
|
||||||
|
@ -214,6 +214,7 @@ export class MinimapDrawer {
|
|||||||
ox: number = 0;
|
ox: number = 0;
|
||||||
oy: number = 0;
|
oy: number = 0;
|
||||||
noBorder: boolean = false;
|
noBorder: boolean = false;
|
||||||
|
showInfo: boolean = false;
|
||||||
|
|
||||||
// cache
|
// cache
|
||||||
drawedThumbnail: Partial<Record<FloorIds, boolean>> = {};
|
drawedThumbnail: Partial<Record<FloorIds, boolean>> = {};
|
||||||
@ -437,6 +438,21 @@ export class MinimapDrawer {
|
|||||||
ctx.fillStyle = '#000';
|
ctx.fillStyle = '#000';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.scale > 2) {
|
||||||
|
ctx.save();
|
||||||
|
ctx.textAlign = 'center';
|
||||||
|
ctx.textBaseline = 'middle';
|
||||||
|
ctx.font = `3px "normal"`;
|
||||||
|
ctx.strokeStyle = 'black';
|
||||||
|
Mota.require('fn', 'ensureFloorDamage')(floorId);
|
||||||
|
const enemyNum = core.status.maps[floorId].enemy.list.length;
|
||||||
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.6)';
|
||||||
|
ctx.fillRect(x - 6, y - 2, 12, 4);
|
||||||
|
ctx.fillStyle = 'white';
|
||||||
|
ctx.strokeText(`${enemyNum}怪物`, x, y);
|
||||||
|
ctx.fillText(`${enemyNum}怪物`, x, y);
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,3 +396,8 @@ export function formatSize(size: number) {
|
|||||||
? `${(size / (1 << 20)).toFixed(2)}MB`
|
? `${(size / (1 << 20)).toFixed(2)}MB`
|
||||||
: `${(size / (1 << 30)).toFixed(2)}GB`;
|
: `${(size / (1 << 30)).toFixed(2)}GB`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let num = 0;
|
||||||
|
export function requireUniqueSymbol() {
|
||||||
|
return num++;
|
||||||
|
}
|
||||||
|
@ -401,6 +401,7 @@ onMounted(async () => {
|
|||||||
drawer = new MinimapDrawer(map);
|
drawer = new MinimapDrawer(map);
|
||||||
drawer.scale = scale;
|
drawer.scale = scale;
|
||||||
drawer.noBorder = noBorder.value;
|
drawer.noBorder = noBorder.value;
|
||||||
|
drawer.showInfo = true;
|
||||||
|
|
||||||
const mapStyle = getComputedStyle(map);
|
const mapStyle = getComputedStyle(map);
|
||||||
const thumbStyle = getComputedStyle(thumb);
|
const thumbStyle = getComputedStyle(thumb);
|
||||||
|
Loading…
Reference in New Issue
Block a user