mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 04:19:30 +08:00
优化宝石血瓶显伤,修复resize
This commit is contained in:
parent
427242c430
commit
dede46666f
@ -4312,12 +4312,12 @@ control.prototype._resize_canvas = function (obj) {
|
||||
core.dom.gameCanvas[i].style.height = innerHeight;
|
||||
}
|
||||
} else {
|
||||
requestAnimationFrame(function () {
|
||||
// requestAnimationFrame(function () {
|
||||
for (var i = 0; i < core.dom.gameCanvas.length; ++i) {
|
||||
core.dom.gameCanvas[i].style.width = innerWidth;
|
||||
core.dom.gameCanvas[i].style.height = innerHeight;
|
||||
}
|
||||
});
|
||||
// });
|
||||
}
|
||||
core.dom.gif.style.width = innerWidth;
|
||||
core.dom.gif.style.height = innerHeight;
|
||||
@ -4335,9 +4335,16 @@ control.prototype._resize_canvas = function (obj) {
|
||||
? core.domStyle.ratio
|
||||
: 1;
|
||||
core.canvas[cn].canvas.style.width =
|
||||
(core.canvas[cn].canvas.width / ratio) * core.domStyle.scale + 'px';
|
||||
(core.canvas[cn].canvas.width /
|
||||
devicePixelRatio /
|
||||
core.domStyle.ratio) *
|
||||
core.domStyle.scale +
|
||||
'px';
|
||||
core.canvas[cn].canvas.style.height =
|
||||
(core.canvas[cn].canvas.height / ratio) * core.domStyle.scale +
|
||||
(core.canvas[cn].canvas.height /
|
||||
devicePixelRatio /
|
||||
core.domStyle.ratio) *
|
||||
core.domStyle.scale +
|
||||
'px';
|
||||
});
|
||||
// resize dynamic canvas
|
||||
|
@ -1378,19 +1378,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
||||
* 如有bug在大群或造塔群@古祠
|
||||
*/
|
||||
|
||||
core.bigmap.threshold = 256;
|
||||
// core.bigmap.threshold = 256;
|
||||
|
||||
core.control.updateDamage = function (floorId, ctx) {
|
||||
floorId = floorId || core.status.floorId;
|
||||
if (!floorId || core.status.gameOver || main.mode != 'play') return;
|
||||
var onMap = ctx == null;
|
||||
const onMap = ctx == null;
|
||||
|
||||
// 没有怪物手册
|
||||
if (!core.hasItem('book')) return;
|
||||
core.status.damage.posX = core.bigmap.posX;
|
||||
core.status.damage.posY = core.bigmap.posY;
|
||||
if (!onMap) {
|
||||
var width = core.floors[floorId].width,
|
||||
const width = core.floors[floorId].width,
|
||||
height = core.floors[floorId].height;
|
||||
// 地图过大的缩略图不绘制显伤
|
||||
if (width * height > core.bigmap.threshold) return;
|
||||
@ -1400,10 +1400,22 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
||||
core.getItemDetail(floorId); // 宝石血瓶详细信息
|
||||
this.drawDamage(ctx);
|
||||
};
|
||||
|
||||
// 获取宝石信息 并绘制
|
||||
this.getItemDetail = function (floorId) {
|
||||
if (!core.getFlag('itemDetail')) return;
|
||||
floorId = floorId || core.status.thisMap.floorId;
|
||||
floorId = floorId ?? core.status.thisMap.floorId;
|
||||
let diff = {};
|
||||
const before = core.status.hero;
|
||||
const hero = core.clone(core.status.hero);
|
||||
const handler = {
|
||||
set(target, key, v) {
|
||||
diff[key] = v - (target[key] || 0);
|
||||
if (!diff[key]) diff[key] = void 0;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
core.status.hero = new Proxy(hero, handler);
|
||||
core.status.maps[floorId].blocks.forEach(function (block) {
|
||||
if (
|
||||
block.event.cls !== 'items' ||
|
||||
@ -1411,72 +1423,57 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
||||
block.disable
|
||||
)
|
||||
return;
|
||||
var x = block.x,
|
||||
const x = block.x,
|
||||
y = block.y;
|
||||
// v2优化,只绘制范围内的部分
|
||||
if (core.bigmap.v2) {
|
||||
if (
|
||||
x < core.bigmap.posX - core.bigmap.extend ||
|
||||
x >
|
||||
core.bigmap.posX +
|
||||
core.__SIZE__ +
|
||||
core.bigmap.extend ||
|
||||
x > core.bigmap.posX + core._PX_ + core.bigmap.extend ||
|
||||
y < core.bigmap.posY - core.bigmap.extend ||
|
||||
y >
|
||||
core.bigmap.posY +
|
||||
core.__SIZE__ +
|
||||
core.bigmap.extend
|
||||
y > core.bigmap.posY + core._PY_ + core.bigmap.extend
|
||||
) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
var id = block.event.id;
|
||||
var item = core.material.items[id];
|
||||
diff = {};
|
||||
const id = block.event.id;
|
||||
const item = core.material.items[id];
|
||||
if (item.cls === 'equips') {
|
||||
// 装备也显示
|
||||
var diff = core.clone(item.equip.value || {});
|
||||
var per = item.equip.percentage;
|
||||
for (var name in per) {
|
||||
const diff = item.equip.value ?? {};
|
||||
const per = item.equip.percentage ?? {};
|
||||
for (const name in per) {
|
||||
diff[name + 'per'] = per[name].toString() + '%';
|
||||
}
|
||||
drawItemDetail(diff, x, y);
|
||||
return;
|
||||
}
|
||||
var before = core.clone(core.status.hero);
|
||||
// 跟数据统计原理一样 执行效果 前后比较
|
||||
core.setFlag('__statistics__', true);
|
||||
try {
|
||||
eval(item.itemEffect);
|
||||
} catch (error) {}
|
||||
var diff = compareObject(before, core.status.hero);
|
||||
core.status.hero = hero = before;
|
||||
flags = core.status.hero.flags;
|
||||
drawItemDetail(diff, x, y);
|
||||
});
|
||||
core.status.hero = before;
|
||||
window.hero = before;
|
||||
window.flags = before.flags;
|
||||
};
|
||||
// 比较两个对象之间每一项的数值差异(弱等于) 返回数值差异
|
||||
function compareObject(a, b) {
|
||||
a = a || {};
|
||||
b = b || {};
|
||||
var diff = {}; // 差异
|
||||
for (var name in a) {
|
||||
diff[name] = b[name] - (a[name] || 0);
|
||||
if (!diff[name]) diff[name] = void 0;
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
|
||||
// 绘制
|
||||
function drawItemDetail(diff, x, y) {
|
||||
var px = 32 * x + 2,
|
||||
const px = 32 * x + 2,
|
||||
py = 32 * y + 30;
|
||||
var content = '';
|
||||
let content = '';
|
||||
// 获得数据和颜色
|
||||
var i = 0;
|
||||
for (var name in diff) {
|
||||
let i = 0;
|
||||
for (const name in diff) {
|
||||
if (!diff[name]) continue;
|
||||
var color = '#ffffff';
|
||||
let color = '#fff';
|
||||
|
||||
if (typeof diff[name] === 'number')
|
||||
diff[name] = core.formatBigNumber(diff[name], true);
|
||||
content = core.formatBigNumber(diff[name], true);
|
||||
switch (name) {
|
||||
case 'atk':
|
||||
case 'atkper':
|
||||
@ -1498,7 +1495,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
|
||||
color = '#F9FF00';
|
||||
break;
|
||||
case 'mana':
|
||||
color = '#cc6666';
|
||||
color = '#c66';
|
||||
break;
|
||||
}
|
||||
content = diff[name];
|
||||
|
@ -241,7 +241,7 @@ span#hard {
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
border-radius: 6px;
|
||||
transition: box-shadow 0.3s linear, transform 0.3s linear;
|
||||
transition: box-shadow 0.3s linear, transform 0.2s ease-out;
|
||||
box-shadow: 0px 0px 7px rgba(0, 0, 0, 0.4);
|
||||
transform: scale(1);
|
||||
}
|
||||
|
@ -22,7 +22,11 @@
|
||||
"<br>",
|
||||
"<br>",
|
||||
"4. 对于手机端,可以点击<span style=\"color: gold\">右下角的难度文字</span>来切换工具栏至数字键。",
|
||||
"这样,你可以更加方便地进行使用技能等操作。"
|
||||
"这样,你可以更加方便地进行使用技能等操作。",
|
||||
"<br>",
|
||||
"<br>",
|
||||
"5. 本塔中几乎所有 ui 在打开时都会有一个0.6s的动画,如果不想要,可以在开头捡的系统设置里面关闭(默认关闭)。",
|
||||
"同时,几乎所有 ui 的退出按钮都在左上角。"
|
||||
]
|
||||
},
|
||||
"statusBar": {
|
||||
@ -105,7 +109,10 @@
|
||||
"被关闭后可以通过重新标记来打开。这个盒子会显示标记的怪物的临界与伤害信息等,与状态栏一样,可以纵向滚动。",
|
||||
"<br>",
|
||||
"<br>",
|
||||
"这个功能可以用于标记boss或者较强的挡路怪,当这些怪能够攻击时你可以直接收到信息,不需要再时刻费心注意怪物的伤害。"
|
||||
"这个功能可以用于标记boss或者较强的挡路怪,当这些怪能够攻击时你可以直接收到信息,不需要再时刻费心注意怪物的伤害。",
|
||||
"<br>",
|
||||
"<br>",
|
||||
"注意,标记的怪物是不计入存档的,同时标记的怪物只在本次游戏中有效,刷新页面后便会消失。"
|
||||
]
|
||||
},
|
||||
"book": {
|
||||
@ -115,8 +122,7 @@
|
||||
"本塔的怪物手册功能很多,下面一一介绍。",
|
||||
"<br>",
|
||||
"<br>",
|
||||
"怪物手册打开的时候有一个0.6秒的动画,如果不想要可以在开头捡的系统设置里面关闭。注意,本塔中几乎所有ui的关闭按钮",
|
||||
"都在左上角",
|
||||
"怪物手册打开的时候有一个0.6秒的动画,如果不想要可以在开头捡的系统设置里面关闭(默认关闭)。",
|
||||
"<br>",
|
||||
"<br>",
|
||||
"打开怪物手册后,怪物手册的布局与样板自带的类似。与样板不同的是,这里的怪物手册不再是翻页式结构。",
|
||||
@ -152,7 +158,7 @@
|
||||
"text": "道具栏与装备栏",
|
||||
"condition": "true",
|
||||
"desc": [
|
||||
"道具栏与装备栏打开时会有一个0.6秒的动画,如果不想要可以在开头捡的系统设置里面关闭。",
|
||||
"道具栏与装备栏打开时会有一个0.6秒的动画,如果不想要可以在开头捡的系统设置里面关闭。(默认关闭)",
|
||||
"<br>",
|
||||
"<br>",
|
||||
"本塔的道具栏没有特别之处,这里不需要说明。主要是装备栏。",
|
||||
|
@ -3,7 +3,7 @@ import { ref, watch } from 'vue';
|
||||
/**
|
||||
* 打开和关闭ui时是否展示动画
|
||||
*/
|
||||
export const transition = ref(true);
|
||||
export const transition = ref(false);
|
||||
|
||||
/**
|
||||
* 道具详细信息
|
||||
@ -44,13 +44,14 @@ watch(autoScale, n => {
|
||||
* 重置设置信息,从localStorage读取即可
|
||||
*/
|
||||
function reset() {
|
||||
transition.value = core.getLocalStorage('transition');
|
||||
autoScale.value = core.getLocalStorage('autoScale');
|
||||
transition.value = core.getLocalStorage('transition') ? true : false;
|
||||
core.plugin.transition.value = transition.value;
|
||||
autoScale.value = core.getLocalStorage('autoScale') ? true : false;
|
||||
}
|
||||
|
||||
function resetFlag() {
|
||||
itemDetail.value = flags.itemDetail;
|
||||
autoSkill.value = flags.autoSkill;
|
||||
itemDetail.value = flags.itemDetail ? true : false;
|
||||
autoSkill.value = flags.autoSkill ? true : false;
|
||||
}
|
||||
|
||||
export default function init() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { has } from '../utils';
|
||||
|
||||
export default function init() {
|
||||
return { splitArea };
|
||||
return { splitArea, getMapData };
|
||||
}
|
||||
|
||||
type BFSFromString = `${FloorIds},${number},${number},${Dir}`;
|
||||
@ -23,8 +23,6 @@ const arrow: Partial<Record<AllIds, Dir>> = {
|
||||
|
||||
export function splitArea() {}
|
||||
|
||||
export function getMapData(floorId: FloorIds) {}
|
||||
|
||||
export function getMapDrawData(floorId: FloorIds) {}
|
||||
|
||||
/**
|
||||
@ -32,7 +30,10 @@ export function getMapDrawData(floorId: FloorIds) {}
|
||||
* @param floorId 中心楼层id
|
||||
* @param noCache 是否不使用缓存
|
||||
*/
|
||||
function bfs(floorId: FloorIds, noCache: boolean = false): MapBFSResult {
|
||||
export function getMapData(
|
||||
floorId: FloorIds,
|
||||
noCache: boolean = false
|
||||
): MapBFSResult {
|
||||
if (has(bfsCache[floorId]) && !noCache) return bfsCache[floorId]!;
|
||||
|
||||
const queue = [floorId];
|
||||
|
2
src/types/core.d.ts
vendored
2
src/types/core.d.ts
vendored
@ -616,7 +616,7 @@ interface CoreBigmap {
|
||||
threshold: 1024;
|
||||
|
||||
/**
|
||||
* v2优化下,显示超出的格子数,例如样板是10,那么13*13的样板就是33*33,还用于判断是否进行更新等
|
||||
* v2优化下,显示超出的格子数,例如样板是10,那么13\*13的样板就是33\*33,还用于判断是否进行更新等
|
||||
*/
|
||||
extend: 10;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user