Fix tiny bugs
This commit is contained in:
parent
fd057ee350
commit
e11085f26f
15
_docs/api.md
15
_docs/api.md
@ -261,6 +261,9 @@ addStatus: fn(name: string, value: number)
|
|||||||
name: 属性的英文名
|
name: 属性的英文名
|
||||||
value: 属性的增量
|
value: 属性的增量
|
||||||
|
|
||||||
|
addSwitch: fn(x: number, y: number, floorId?: string, name: string, value: number)
|
||||||
|
增加某个独立开关的值
|
||||||
|
|
||||||
autosave: fn(removeLast?: bool)
|
autosave: fn(removeLast?: bool)
|
||||||
自动存档
|
自动存档
|
||||||
|
|
||||||
@ -379,6 +382,9 @@ getStatusLabel: fn(name: string) -> string
|
|||||||
getStatusOrDefault: fn(status?: ?, name?: string)
|
getStatusOrDefault: fn(status?: ?, name?: string)
|
||||||
从status中获得属性,如果不存在则从勇士属性中获取
|
从status中获得属性,如果不存在则从勇士属性中获取
|
||||||
|
|
||||||
|
getSwitch: fn(x: number, y: number, floorId?: string, name: string, defaultValue?: ?)
|
||||||
|
获得某个独立开关的值
|
||||||
|
|
||||||
hasFlag: fn(name: string) -> bool
|
hasFlag: fn(name: string) -> bool
|
||||||
判定一个flag变量是否存在且不为false、0、''、null、undefined和NaN
|
判定一个flag变量是否存在且不为false、0、''、null、undefined和NaN
|
||||||
例如:core.hasFlag('poison'); // 判断主角当前是否中毒
|
例如:core.hasFlag('poison'); // 判断主角当前是否中毒
|
||||||
@ -388,6 +394,9 @@ name: 变量名,支持中文
|
|||||||
hasSave: fn(index?: number) -> bool
|
hasSave: fn(index?: number) -> bool
|
||||||
判断某个存档位是否存在存档
|
判断某个存档位是否存在存档
|
||||||
|
|
||||||
|
hasSwitch: fn(x: number, y: number, floorId?: string, name: string) -> bool
|
||||||
|
判定某个独立开关的值
|
||||||
|
|
||||||
hideStartAnimate: fn(callback?: fn())
|
hideStartAnimate: fn(callback?: fn())
|
||||||
淡出标题画面
|
淡出标题画面
|
||||||
例如:core.hideStartAnimate(core.startGame); // 淡出标题画面并开始新游戏,跳过难度选择
|
例如:core.hideStartAnimate(core.startGame); // 淡出标题画面并开始新游戏,跳过难度选择
|
||||||
@ -490,6 +499,9 @@ removeFlag: fn(name: string)
|
|||||||
removeSave: fn(index?: number, callback?: fn())
|
removeSave: fn(index?: number, callback?: fn())
|
||||||
删除某个存档
|
删除某个存档
|
||||||
|
|
||||||
|
removeSwitch: fn(x: number, y: number, floorId?: string, name: string)
|
||||||
|
删除某个独立开关
|
||||||
|
|
||||||
replay: fn()
|
replay: fn()
|
||||||
回放下一个操作
|
回放下一个操作
|
||||||
|
|
||||||
@ -579,6 +591,9 @@ setStatus: fn(name: string, value: number)
|
|||||||
name: 属性的英文名,其中'x'、'y'和'direction'会被特殊处理为 core.setHeroLoc(name, value),其他的会直接对 core.status.hero[name] 赋值
|
name: 属性的英文名,其中'x'、'y'和'direction'会被特殊处理为 core.setHeroLoc(name, value),其他的会直接对 core.status.hero[name] 赋值
|
||||||
value: 属性的新值
|
value: 属性的新值
|
||||||
|
|
||||||
|
setSwitch: fn(x: number, y: number, floorId?: string, name: string, value?: ?)
|
||||||
|
设置某个独立开关的值
|
||||||
|
|
||||||
setToolbarButton: fn(useButton?: bool)
|
setToolbarButton: fn(useButton?: bool)
|
||||||
改变工具栏为按钮1-8
|
改变工具栏为按钮1-8
|
||||||
|
|
||||||
|
|||||||
@ -2571,6 +2571,26 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [
|
|||||||
"checkRouteFolding": {
|
"checkRouteFolding": {
|
||||||
"!doc": "检查录像折叠信息",
|
"!doc": "检查录像折叠信息",
|
||||||
"!type": "fn()"
|
"!type": "fn()"
|
||||||
|
},
|
||||||
|
"setSwitch": {
|
||||||
|
"!doc": "设置某个独立开关",
|
||||||
|
"!type": "fn(x: number, y: number, floorId?: string, name: string, value: ?)"
|
||||||
|
},
|
||||||
|
"getSwitch": {
|
||||||
|
"!doc": "获得某个独立开关",
|
||||||
|
"!type": "fn(x: number, y: number, floorId?: string, name: string, defaultValue?: ?)"
|
||||||
|
},
|
||||||
|
"addSwitch": {
|
||||||
|
"!doc": "增加某个独立开关",
|
||||||
|
"!type": "fn(x: number, y: number, floorId?: string, name: string, value: number)"
|
||||||
|
},
|
||||||
|
"removeSwitch": {
|
||||||
|
"!doc": "删除某个独立开关",
|
||||||
|
"!type": "fn(x: number, y: number, floorId?: string, name: string)"
|
||||||
|
},
|
||||||
|
"removeSwitch": {
|
||||||
|
"!doc": "判定某个独立开关",
|
||||||
|
"!type": "fn(x: number, y: number, floorId?: string, name: string) -> bool"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|||||||
@ -108,6 +108,8 @@ dynamicMapEditor.prototype.onKeyUp = function(e) {
|
|||||||
dynamicMapEditor.prototype.onMapClick = function(x, y) {
|
dynamicMapEditor.prototype.onMapClick = function(x, y) {
|
||||||
if (!this.isValid()) return false;
|
if (!this.isValid()) return false;
|
||||||
if (!this.isUsingTool || !this.selectedItem) return false;
|
if (!this.isUsingTool || !this.selectedItem) return false;
|
||||||
|
x += parseInt(core.bigmap.offsetX / 32);
|
||||||
|
y += parseInt(core.bigmap.offsetY / 32);
|
||||||
var number = this.selectedItem.number;
|
var number = this.selectedItem.number;
|
||||||
this.addOperation('put', number, x, y, core.status.floorId);
|
this.addOperation('put', number, x, y, core.status.floorId);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@ -2251,8 +2251,6 @@ control.prototype.getHeroLoc = function (name) {
|
|||||||
return core.status.hero.loc[name];
|
return core.status.hero.loc[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////// 获得某个等级的名称 //////
|
////// 获得某个等级的名称 //////
|
||||||
control.prototype.getLvName = function (lv) {
|
control.prototype.getLvName = function (lv) {
|
||||||
if (!core.status.hero) return null;
|
if (!core.status.hero) return null;
|
||||||
@ -2291,6 +2289,36 @@ control.prototype.removeFlag = function(name) {
|
|||||||
delete core.status.hero.flags[name];
|
delete core.status.hero.flags[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////// 获得某个点的独立开关 //////
|
||||||
|
control.prototype.getSwitch = function (x, y, floorId, name, defaultValue) {
|
||||||
|
var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
|
||||||
|
return this.getFlag(prefix + "@" + name, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 设置某个点的独立开关 //////
|
||||||
|
control.prototype.setSwitch = function (x, y, floorId, name, value) {
|
||||||
|
var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
|
||||||
|
return this.setFlag(prefix + "@" + name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 增加某个点的独立开关 //////
|
||||||
|
control.prototype.addSwitch = function (x, y, floorId, name, value) {
|
||||||
|
var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
|
||||||
|
return this.addFlag(prefix + "@" + name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 判定某个点的独立开关 //////
|
||||||
|
control.prototype.hasSwitch = function (x, y, floorId, name) {
|
||||||
|
var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
|
||||||
|
return this.hasFlag(prefix + "@" + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
////// 删除某个点的独立开关 //////
|
||||||
|
control.prototype.removeSwitch = function (x, y, floorId, name) {
|
||||||
|
var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
|
||||||
|
return this.removeFlag(prefix + "@" + name);
|
||||||
|
}
|
||||||
|
|
||||||
////// 锁定状态栏,常常用于事件处理 //////
|
////// 锁定状态栏,常常用于事件处理 //////
|
||||||
control.prototype.lockControl = function () {
|
control.prototype.lockControl = function () {
|
||||||
core.status.lockControl = true;
|
core.status.lockControl = true;
|
||||||
|
|||||||
@ -113,7 +113,7 @@ maps.prototype.extractBlocksForUI = function (map, flags) {
|
|||||||
for (var j = 0; j < mw; j++) {
|
for (var j = 0; j < mw; j++) {
|
||||||
var number = (decompressed[i] || [])[j] || 0;
|
var number = (decompressed[i] || [])[j] || 0;
|
||||||
if (!number || number == 17 || this.isMapBlockDisabled(floorId, j, i, flags)) continue;
|
if (!number || number == 17 || this.isMapBlockDisabled(floorId, j, i, flags)) continue;
|
||||||
map.blocks.push(this.initBlock(j, i, number));
|
map.blocks.push(Object.assign({}, this.getBlockByNumber(number), {x: j, y: i}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
runtime.d.ts
vendored
15
runtime.d.ts
vendored
@ -277,6 +277,21 @@ declare class control {
|
|||||||
/** 删除某个flag/变量 */
|
/** 删除某个flag/变量 */
|
||||||
removeFlag(name: string): void
|
removeFlag(name: string): void
|
||||||
|
|
||||||
|
/** 设置某个独立开关 */
|
||||||
|
setSwitch(x: number, y: number, floorId?: string, name: string, value: any): void
|
||||||
|
|
||||||
|
/** 获得某个独立开关 */
|
||||||
|
getSwitch(x: number, y: number, floorId?: string, name: string, defaultValue: any): any
|
||||||
|
|
||||||
|
/** 增加某个独立开关 */
|
||||||
|
addSwitch(x: number, y: number, floorId?: string, name: string, value: any): void
|
||||||
|
|
||||||
|
/** 判定某个独立开关 */
|
||||||
|
hasSwitch(x: number, y: number, floorId?: string, name: string): boolean
|
||||||
|
|
||||||
|
/** 删除独立开关 */
|
||||||
|
removeSwitch(x: number, y: number, floorId?: string, name: string): boolean
|
||||||
|
|
||||||
/** 设置大地图的偏移量 */
|
/** 设置大地图的偏移量 */
|
||||||
setGameCanvasTranslate(canvasId: string, x: number, y: number): void
|
setGameCanvasTranslate(canvasId: string, x: number, y: number): void
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user