feat:refactor:新版道具栏 重构中
This commit is contained in:
parent
60f531d602
commit
067a2ad772
@ -495,6 +495,7 @@ core.prototype._init_plugins = function () {
|
|||||||
core._forwardFunc("plugin");
|
core._forwardFunc("plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
core.prototype._forwardFuncs = function () {
|
core.prototype._forwardFuncs = function () {
|
||||||
for (var i = 0; i < main.loadList.length; ++i) {
|
for (var i = 0; i < main.loadList.length; ++i) {
|
||||||
var name = main.loadList[i];
|
var name = main.loadList[i];
|
||||||
@ -502,7 +503,10 @@ core.prototype._forwardFuncs = function () {
|
|||||||
this._forwardFunc(name);
|
this._forwardFunc(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** 将core[name][funcname] 转发到 core[name]中
|
||||||
|
* @param {string} name 模块名,例如events, ui, plugin
|
||||||
|
* @param {string} funcname 函数名,例如drawTextBox
|
||||||
|
*/
|
||||||
core.prototype._forwardFunc = function (name, funcname) {
|
core.prototype._forwardFunc = function (name, funcname) {
|
||||||
if (funcname == null) {
|
if (funcname == null) {
|
||||||
for (funcname in core[name]) {
|
for (funcname in core[name]) {
|
||||||
|
|||||||
@ -279,7 +279,7 @@ items.prototype.getEquipTypeById = function (equipId) {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当前能否撞上某装备
|
// 当前能否装上某装备
|
||||||
items.prototype.canEquip = function (equipId, hint) {
|
items.prototype.canEquip = function (equipId, hint) {
|
||||||
// 装备是否合法
|
// 装备是否合法
|
||||||
var equip = core.material.items[equipId] || {};
|
var equip = core.material.items[equipId] || {};
|
||||||
|
|||||||
10
libs/ui.js
10
libs/ui.js
@ -2743,26 +2743,20 @@ ui.prototype._drawToolbox = function (index) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
////// 获得所有应该在道具栏显示的某个类型道具 //////
|
////// 获得所有应该在道具栏显示的某个类型道具 //////
|
||||||
ui.prototype.getToolboxItems = function (cls, showHide) {
|
ui.prototype.getToolboxItems = function (cls) {
|
||||||
let list = Object.keys(core.status.hero.items[cls] || {});;
|
let list = Object.keys(core.status.hero.items[cls] || {});;
|
||||||
if (cls === 'all') {
|
if (cls === 'all') {
|
||||||
for (let name in core.status.hero.items) {
|
for (let name in core.status.hero.items) {
|
||||||
if (name == "equips") continue;
|
if (name == "equips") continue;
|
||||||
list = list.concat(Object.keys(core.status.hero.items[name])); // 获取'constants'和'tools'整体的列表
|
list = list.concat(Object.keys(core.status.hero.items[name])); // 获取'constants'和'tools'整体的列表
|
||||||
}
|
}
|
||||||
if (!showHide) list = list.filter(function (id) {
|
|
||||||
return !core.material.items[id].hideInToolbox;
|
|
||||||
})
|
|
||||||
list = list.sort();
|
list = list.sort();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.uidata.getToolboxItems) {
|
if (this.uidata.getToolboxItems) {
|
||||||
return this.uidata.getToolboxItems(cls, showHide);
|
return this.uidata.getToolboxItems(cls);
|
||||||
}
|
}
|
||||||
if (!showHide) list = list.filter(function (id) {
|
|
||||||
return !core.material.items[id].hideInToolbox;
|
|
||||||
})
|
|
||||||
list = list.sort();
|
list = list.sort();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,19 +53,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
// 隐藏右下角的音乐按钮
|
// 隐藏右下角的音乐按钮
|
||||||
core.dom.musicBtn.style.display = 'none';
|
core.dom.musicBtn.style.display = 'none';
|
||||||
|
|
||||||
/** 以下为新增 */
|
/** 以下为2.92样板新增内容的处理 */
|
||||||
// 同步剧情跳过设置
|
// 同步剧情跳过设置
|
||||||
switch (core.getFlag('skip')) {
|
core.plugin.checkSkipFuncs();
|
||||||
case 'text':
|
|
||||||
core.plugin.skipTextOn();
|
|
||||||
break;
|
|
||||||
case 'perform':
|
|
||||||
core.plugin.skipPerformOn();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
core.plugin.skipPerformOff();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清空录像暂停点
|
// 清空录像暂停点
|
||||||
core.setFlag('replayValve', null);
|
core.setFlag('replayValve', null);
|
||||||
@ -1707,19 +1697,13 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ui": {
|
"ui": {
|
||||||
"getToolboxItems": function (cls, showHide) {
|
"getToolboxItems": function (cls) {
|
||||||
// 获得道具栏中当前某类型道具的显示项和显示顺序
|
// 获得道具栏中当前某类型道具的显示项和显示顺序
|
||||||
// cls为道具类型,只可能是 tools, constants 和 equips
|
// cls为道具类型,只可能是 tools, constants 和 equips
|
||||||
// 返回一个数组,代表当前某类型道具的显示内容和顺序
|
// 返回一个数组,代表当前某类型道具的显示内容和顺序
|
||||||
// 默认按id升序排列,您可以取消下面的注释改为按名称排列
|
// 默认按id升序排列,您可以取消下面的注释改为按名称排列
|
||||||
// showHide 是否显示隐藏的道具
|
|
||||||
|
|
||||||
let list = Object.keys(core.status.hero.items[cls] || {});
|
let list = Object.keys(core.status.hero.items[cls] || {});
|
||||||
if (!showHide) list = list.filter(function (id) {
|
|
||||||
const hideInfo = core.getFlag('hideInfo', {});
|
|
||||||
if (hideInfo[id]) return false;
|
|
||||||
return !core.material.items[id].hideInToolbox;
|
|
||||||
})
|
|
||||||
list = list.sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/);
|
list = list.sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/);
|
||||||
return list;
|
return list;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -222,7 +222,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",攻击+20"
|
"itemEffectTip": ",攻击+20"
|
||||||
},
|
},
|
||||||
"sword3": {
|
"sword3": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "骑士剑",
|
"name": "骑士剑",
|
||||||
"text": "一把很普通的骑士剑",
|
"text": "一把很普通的骑士剑",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -236,7 +236,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",攻击+40"
|
"itemEffectTip": ",攻击+40"
|
||||||
},
|
},
|
||||||
"sword4": {
|
"sword4": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "圣剑",
|
"name": "圣剑",
|
||||||
"text": "一把很普通的圣剑",
|
"text": "一把很普通的圣剑",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -250,7 +250,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",攻击+80"
|
"itemEffectTip": ",攻击+80"
|
||||||
},
|
},
|
||||||
"sword5": {
|
"sword5": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "神圣剑",
|
"name": "神圣剑",
|
||||||
"text": "一把很普通的神圣剑",
|
"text": "一把很普通的神圣剑",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -277,7 +277,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",防御+0"
|
"itemEffectTip": ",防御+0"
|
||||||
},
|
},
|
||||||
"shield1": {
|
"shield1": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "铁盾",
|
"name": "铁盾",
|
||||||
"text": "一个很普通的铁盾",
|
"text": "一个很普通的铁盾",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -290,7 +290,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",防御+10"
|
"itemEffectTip": ",防御+10"
|
||||||
},
|
},
|
||||||
"shield2": {
|
"shield2": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "银盾",
|
"name": "银盾",
|
||||||
"text": "一个很普通的银盾",
|
"text": "一个很普通的银盾",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -303,7 +303,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",防御+20"
|
"itemEffectTip": ",防御+20"
|
||||||
},
|
},
|
||||||
"shield3": {
|
"shield3": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "骑士盾",
|
"name": "骑士盾",
|
||||||
"text": "一个很普通的骑士盾",
|
"text": "一个很普通的骑士盾",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -316,7 +316,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",防御+40"
|
"itemEffectTip": ",防御+40"
|
||||||
},
|
},
|
||||||
"shield4": {
|
"shield4": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "圣盾",
|
"name": "圣盾",
|
||||||
"text": "一个很普通的圣盾",
|
"text": "一个很普通的圣盾",
|
||||||
"equip": {
|
"equip": {
|
||||||
@ -329,7 +329,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"itemEffectTip": ",防御+80"
|
"itemEffectTip": ",防御+80"
|
||||||
},
|
},
|
||||||
"shield5": {
|
"shield5": {
|
||||||
"cls": "items",
|
"cls": "equips",
|
||||||
"name": "神圣盾",
|
"name": "神圣盾",
|
||||||
"text": "一个很普通的神圣盾",
|
"text": "一个很普通的神圣盾",
|
||||||
"equip": {
|
"equip": {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
17
runtime.d.ts
vendored
17
runtime.d.ts
vendored
@ -2309,7 +2309,7 @@ interface items {
|
|||||||
* @param beComparedEquipId 装备乙的id
|
* @param beComparedEquipId 装备乙的id
|
||||||
* @returns 两装备的各属性差,甲减乙,0省略
|
* @returns 两装备的各属性差,甲减乙,0省略
|
||||||
*/
|
*/
|
||||||
compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number }
|
compareEquipment(compareEquipId?: string | null, beComparedEquipId?: string | null): { [key: string]: number }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存当前套装
|
* 保存当前套装
|
||||||
@ -2590,7 +2590,7 @@ interface ui {
|
|||||||
* @param cls 道具类型
|
* @param cls 道具类型
|
||||||
* @param cls 是否显示隐藏的道具
|
* @param cls 是否显示隐藏的道具
|
||||||
*/
|
*/
|
||||||
getToolboxItems(cls: 'tools' | 'constants' | 'all', showHide: boolean): string[]
|
getToolboxItems(cls: 'equips' | 'tools' | 'constants' | 'all', showHide?: boolean): string[]
|
||||||
|
|
||||||
/** 绘制状态栏 */
|
/** 绘制状态栏 */
|
||||||
drawStatusBar(): void
|
drawStatusBar(): void
|
||||||
@ -2749,7 +2749,7 @@ interface utils {
|
|||||||
* @param onMap 可选,true表示用于地图显伤,结果总字符数最多为5,否则最多为6
|
* @param onMap 可选,true表示用于地图显伤,结果总字符数最多为5,否则最多为6
|
||||||
* @returns 格式化结果
|
* @returns 格式化结果
|
||||||
*/
|
*/
|
||||||
formatBigNumber(x: number, onMap?: boolean): string
|
formatBigNumber(x: number, onMap?: boolean | number): string
|
||||||
|
|
||||||
/** 变速移动 */
|
/** 变速移动 */
|
||||||
applyEasing(mode?: string): (number) => number;
|
applyEasing(mode?: string): (number) => number;
|
||||||
@ -3281,3 +3281,14 @@ declare let flags: { [x: string]: any }
|
|||||||
declare let hero: CoreMixin['status']['hero']
|
declare let hero: CoreMixin['status']['hero']
|
||||||
declare let editor: editor
|
declare let editor: editor
|
||||||
|
|
||||||
|
declare let control: () => control
|
||||||
|
declare let events: () => events
|
||||||
|
declare let loader: () => loader
|
||||||
|
declare let enemys: () => enemys
|
||||||
|
declare let items: () => items
|
||||||
|
declare let maps: () => maps
|
||||||
|
declare let ui: () => ui
|
||||||
|
declare let utils: () => utils
|
||||||
|
declare let icons: () => icons
|
||||||
|
declare let actions: () => actions
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user