commit
f95e5403fc
18
README.md
18
README.md
@ -55,6 +55,24 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏!
|
||||
|
||||
## 更新说明
|
||||
|
||||
### 2019.4.13 V2.6
|
||||
|
||||
* [x] 拆分整个项目,大幅重构代码,新增大量API
|
||||
* [x] 重写文档,尤其是脚本和API列表
|
||||
* [x] 现在可以对编辑器的表格的结构进行配置
|
||||
* [x] 可以收藏和高亮存档
|
||||
* [x] 独立出来的插件编写
|
||||
* [x] 新增事件:关门、显示确认框、后置循环处理
|
||||
* [x] 剧情文本的绘制可以设置居中选项
|
||||
* [x] 选项框的绘制可以增加图标
|
||||
* [x] 增加公共事件版的全局商店
|
||||
* [x] 公共事件现在可以传入参数
|
||||
* [x] 重写滑冰事件,现在滑冰在背景层了
|
||||
* [x] 将输入框改成自定义实现,避免部分设备不支持
|
||||
* [x] 状态栏文字可以自动放缩
|
||||
* [x] 显示图片和对话框立绘可以裁剪图片
|
||||
* [x] 修复所有已知bug,大量细节优化
|
||||
|
||||
### 2019.2.19 V2.5.5
|
||||
|
||||
* [x] 现在编辑器修改地图后可以直接读档生效,无需再重置地图或回放录像
|
||||
|
||||
@ -199,7 +199,7 @@ core.onkeyDown(e)
|
||||
|
||||
core.onkeyUp(e)
|
||||
当放开某个键时的操作,e为KeyboardEvent。
|
||||
请勿直接覆盖或调用此函数,如有需要请注册一个"onkeyDown"的交互函数。
|
||||
请勿直接覆盖或调用此函数,如有需要请注册一个"onkeyUp"的交互函数。
|
||||
|
||||
|
||||
core.pressKey(keyCode)
|
||||
|
||||
@ -228,7 +228,8 @@ default : [null,"MT1",null,0,0,null,500,null]
|
||||
var toFloorId = IdString_0;
|
||||
if (Floor_List_0!='floorId') toFloorId = Floor_List_0;
|
||||
var loc = ', "loc": ['+Number_0+', '+Number_1+']';
|
||||
if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
|
||||
if (Stair_List_0==='now')loc = '';
|
||||
else if (Stair_List_0!=='loc')loc = ', "stair": "'+Stair_List_0+'"';
|
||||
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
|
||||
Int_0 = (Int_0!=='') ?(', "time": '+Int_0):'';
|
||||
Bool_0 = Bool_0 ?'':(', "ignoreChangeFloor": false');
|
||||
@ -1982,8 +1983,8 @@ Floor_List
|
||||
/*Floor_List ['floorId',':before',':next']*/;
|
||||
|
||||
Stair_List
|
||||
: '坐标'|'上楼梯'|'下楼梯'
|
||||
/*Stair_List ['loc','upFloor','downFloor']*/;
|
||||
: '坐标'|'上楼梯'|'下楼梯'|'保持不变'
|
||||
/*Stair_List ['loc','upFloor','downFloor','now']*/;
|
||||
|
||||
SetTextPosition_List
|
||||
: '不改变'|'距离顶部'|'居中'|'距离底部'
|
||||
@ -2167,7 +2168,10 @@ ActionParser.prototype.parse = function (obj,type) {
|
||||
|
||||
case 'changeFloor':
|
||||
if(!obj)obj={};
|
||||
if(!this.isset(obj.loc))obj.loc=[0,0];
|
||||
if(!this.isset(obj.loc)) {
|
||||
obj.loc=[0,0];
|
||||
if (!this.isset(obj.stair)) obj.stair='now';
|
||||
}
|
||||
if (obj.floorId==':before'||obj.floorId==':next') {
|
||||
obj.floorType=obj.floorId;
|
||||
delete obj.floorId;
|
||||
|
||||
@ -68,6 +68,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['tip_s'].xmlText(),
|
||||
MotaActionBlocks['win_s'].xmlText(),
|
||||
MotaActionBlocks['lose_s'].xmlText(),
|
||||
MotaActionBlocks['confirm_s'].xmlText(),
|
||||
MotaActionBlocks['choices_s'].xmlText([
|
||||
'选择剑或者盾','流浪者','man',MotaActionBlocks['choicesContext'].xmlText([
|
||||
'剑','','',null,MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
|
||||
@ -76,7 +77,6 @@ editor_blockly = function () {
|
||||
])
|
||||
])
|
||||
]),
|
||||
MotaActionBlocks['confirm_s'].xmlText(),
|
||||
],
|
||||
'数据相关':[
|
||||
MotaActionBlocks['setValue_s'].xmlText([
|
||||
|
||||
@ -777,9 +777,8 @@ actions.prototype._sys_longClick = function (x, y, fromEvent) {
|
||||
|
||||
// 数字键快速选择选项
|
||||
actions.prototype._selectChoices = function (length, keycode, callback) {
|
||||
var topIndex = this.HSIZE - parseInt((length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (keycode == 13 || keycode == 32 || keycode == 67) {
|
||||
core.status.event.ui.sep = 0;
|
||||
callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
|
||||
}
|
||||
if (keycode >= 49 && keycode <= 57) {
|
||||
@ -884,7 +883,7 @@ actions.prototype._clickAction = function (x, y) {
|
||||
var choices = data.choices;
|
||||
if (choices.length == 0) return;
|
||||
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.sep || 0);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
// 选择
|
||||
core.status.route.push("choices:" + (y - topIndex));
|
||||
@ -1208,7 +1207,7 @@ actions.prototype._clickShop = function (x, y) {
|
||||
var shop = core.status.event.data.shop;
|
||||
var choices = shop.choices;
|
||||
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
|
||||
var topIndex = this.HSIZE - parseInt(choices.length / 2);
|
||||
var topIndex = this.HSIZE - parseInt(choices.length / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
return core.events._useShop(shop, y - topIndex);
|
||||
}
|
||||
@ -1238,7 +1237,7 @@ actions.prototype._clickQuickShop = function (x, y) {
|
||||
});
|
||||
|
||||
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
|
||||
var topIndex = this.HSIZE - parseInt(keys.length / 2);
|
||||
var topIndex = this.HSIZE - parseInt(keys.length / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + keys.length) {
|
||||
var reason = core.events.canUseQuickShop(keys[y - topIndex]);
|
||||
if (!core.flags.enableDisabledShop && reason) {
|
||||
@ -1831,7 +1830,7 @@ actions.prototype._keyUpSL = function (keycode) {
|
||||
actions.prototype._clickSwitchs = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
core.status.event.selection = selection;
|
||||
@ -1928,7 +1927,7 @@ actions.prototype._keyUpSwitchs = function (keycode) {
|
||||
actions.prototype._clickSettings = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
core.status.event.selection = selection;
|
||||
@ -1979,7 +1978,7 @@ actions.prototype._keyUpSettings = function (keycode) {
|
||||
actions.prototype._clickSyncSave = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
core.status.event.selection = selection;
|
||||
@ -2062,7 +2061,7 @@ actions.prototype._clickSyncSelect = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
core.status.event.selection = selection;
|
||||
@ -2096,7 +2095,7 @@ actions.prototype._clickLocalSaveSelect = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
@ -2136,7 +2135,7 @@ actions.prototype._clickStorageRemove = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
@ -2225,7 +2224,7 @@ actions.prototype._clickReplay = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
@ -2279,7 +2278,7 @@ actions.prototype._clickGameInfo = function (x, y) {
|
||||
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) return;
|
||||
var choices = core.status.event.ui.choices;
|
||||
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2);
|
||||
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
|
||||
|
||||
if (y >= topIndex && y < topIndex + choices.length) {
|
||||
var selection = y - topIndex;
|
||||
|
||||
26
libs/ui.js
26
libs/ui.js
@ -555,9 +555,8 @@ ui.prototype._calTextBoxWidth = function (ctx, content, min_width, max_width, fo
|
||||
|
||||
////// 处理 \i[xxx] 的问题
|
||||
ui.prototype._getDrawableIconInfo = function (id) {
|
||||
var splt = id.split(':');
|
||||
if (splt[0] == 'flag' && splt.length > 1) { // 使用变量表示图标
|
||||
id = core.getFlag(splt[1], id);
|
||||
if (id && id.indexOf('flag:') === 0) {
|
||||
id = core.getFlag(id.substring(5), id);
|
||||
}
|
||||
var image = null, icon = null;
|
||||
["terrains","animates","items","npcs","enemys"].forEach(function (v) {
|
||||
@ -974,6 +973,7 @@ ui.prototype.drawChoices = function(content, choices) {
|
||||
var titleInfo = this._getTitleAndIcon(content);
|
||||
var hPos = this._drawChoices_getHorizontalPosition(titleInfo, choices);
|
||||
var vPos = this._drawChoices_getVerticalPosition(titleInfo, choices, hPos);
|
||||
core.status.event.ui.offset = vPos.offset;
|
||||
|
||||
var isWindowSkin = this.drawBackground(hPos.left, vPos.top, hPos.right, vPos.bottom);
|
||||
this._drawChoices_drawTitle(titleInfo, hPos, vPos);
|
||||
@ -1002,20 +1002,22 @@ ui.prototype._drawChoices_getVerticalPosition = function (titleInfo, choices, hP
|
||||
var length = choices.length;
|
||||
var height = 32 * (length + 2), bottom = this.HPIXEL + height / 2;
|
||||
if (length % 2 == 0) bottom += 16;
|
||||
var offset = 0;
|
||||
var choice_top = bottom - height + 56;
|
||||
if (titleInfo.content) {
|
||||
var headHeight = 0;
|
||||
var realContent = this._getRealContent(titleInfo.content);
|
||||
var lines = core.splitLines('ui', realContent, hPos.validWidth, this._buildFont(15, true));
|
||||
if (titleInfo.title) height += 25;
|
||||
height += lines.length * 20;
|
||||
if (titleInfo.title) headHeight += 25;
|
||||
headHeight += lines.length * 20;
|
||||
height += headHeight;
|
||||
if (bottom - height <= 32) {
|
||||
offset = Math.floor(headHeight / 64);
|
||||
bottom += 32 * offset;
|
||||
choice_top += 32 * offset;
|
||||
}
|
||||
}
|
||||
if(bottom-height<0){
|
||||
var sep = Math.ceil((height-bottom)/32);
|
||||
choice_top += sep * 32;
|
||||
bottom += sep*32;
|
||||
core.status.event.ui.sep = sep;
|
||||
}
|
||||
return {top: bottom - height, height: height, bottom: bottom, choice_top: choice_top };
|
||||
return {top: bottom - height, height: height, bottom: bottom, choice_top: choice_top, offset: offset };
|
||||
}
|
||||
|
||||
ui.prototype._drawChoices_drawTitle = function (titleInfo, hPos, vPos) {
|
||||
|
||||
@ -1205,7 +1205,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
var leftHp = core.status.hero.hp - (damage[x + "," + y] || 0);
|
||||
if (leftHp > 1) {
|
||||
// 上整/下整
|
||||
var value = Math.floor((leftHp + (core.flags.betweenAttackCeil ? 0 : 1)) / 2);
|
||||
var value = Math.floor((leftHp + (core.flags.betweenAttackCeil ? 1 : 0)) / 2);
|
||||
damage[loc] = (damage[loc] || 0) + value;
|
||||
type[loc] = "夹击伤害";
|
||||
}
|
||||
|
||||
22
更新说明.txt
22
更新说明.txt
@ -1,4 +1,24 @@
|
||||
HTML5魔塔样板V2.5.5
|
||||
HTML5魔塔样板V2.6
|
||||
|
||||
拆分整个项目,大幅重构代码,新增大量API
|
||||
重写文档,尤其是脚本和API列表
|
||||
现在可以对编辑器的表格的结构进行配置
|
||||
可以收藏和高亮存档
|
||||
独立出来的插件编写
|
||||
新增事件:关门、显示确认框、后置循环处理
|
||||
剧情文本的绘制可以设置居中选项
|
||||
选项框的绘制可以增加图标
|
||||
增加公共事件版的全局商店
|
||||
公共事件现在可以传入参数
|
||||
重写滑冰事件,现在滑冰在背景层了
|
||||
将输入框改成自定义实现,避免部分设备不支持
|
||||
状态栏文字可以自动放缩
|
||||
显示图片和对话框立绘可以裁剪图片
|
||||
修复所有已知bug,大量细节优化
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
HTML5魔塔样板V2.5.5
|
||||
|
||||
现在编辑器修改地图后可以直接读档生效,无需再重置地图或回放录像
|
||||
存档方式优化,大幅降低单个存档的占用空间
|
||||
|
||||
Loading…
Reference in New Issue
Block a user