Update 264

This commit is contained in:
ckcz123 2019-11-22 00:23:48 +08:00
parent f5c430a56d
commit e8ad81da8d
11 changed files with 34 additions and 32 deletions

View File

@ -2084,7 +2084,7 @@ num如果设置大于0则生成一个[0, num-1]之间的数;否则生成一
即先生成一个真随机数根据该数来推进伪随机的种子这样就可以放心调用core.rand()啦。
core.readFile(success, error)
core.readFile(success, error, accept)
读取一个本地文件内容。success和error分别为读取成功或失败的回调函数。
iOS平台暂不支持读取文件操作。

View File

@ -2102,8 +2102,9 @@ num如果设置大于0则生成一个[0, num-1]之间的数;否则生成一
即先生成一个真随机数根据该数来推进伪随机的种子这样就可以放心调用core.rand()啦。
core.readFile(success, error)
core.readFile(success, error, accept)
读取一个本地文件内容。success和error分别为读取成功或失败的回调函数。
accept如果设置则控制能选择的文件类型。
iOS平台暂不支持读取文件操作。

View File

@ -235,7 +235,7 @@ HTML5的塔都是可以进行控制台调试的。
## 编辑器的基本操作
- **Alt+0~9, Ctrl+0~9** 保存和读取当前选中图块
- **Alt+0~9, 0~9** 保存和读取当前选中图块
- **W/A/S/D** 移动大地图
- **Ctrl+Z** 撤销上次绘图
- **Ctrl+Y** 重做上次绘图

View File

@ -511,7 +511,7 @@ editor_datapanel_wrapper = function (editor) {
editor.dom.selectAppend.onchange();
});
});
}, null, 'img');
}, null, 'image/*', 'img');
return;
}

View File

@ -115,10 +115,12 @@ editor_game_wrapper = function (editor, main, core) {
var img = core.material.images.tilesets[imgName];
var width = Math.floor(img.width / 32), height = Math.floor(img.height / 32);
if (img.width % 32 || img.height % 32) {
alert(imgName + '的长或宽不是32的整数倍, 请修改后刷新页面');
// alert(imgName + '的长或宽不是32的整数倍, 请修改后刷新页面');
console.warn(imgName + '的长或宽不是32的整数倍, 请修改后刷新页面');
}
if (img.width * img.height > 32 * 32 * 3000) {
alert(imgName + '上的图块数量超过了3000请修改后刷新页面');
// alert(imgName + '上的图块数量超过了3000请修改后刷新页面');
console.warn(imgName + '上的图块数量超过了3000请修改后刷新页面');
}
for (var id = startOffset; id < startOffset + width * height; id++) {
var x = (id - startOffset) % width, y = parseInt((id - startOffset) / width);

View File

@ -217,7 +217,8 @@ tip.showHelp = function(value) {
'ESC或点击空白处可以自动保存当前修改',
'H键可以打开操作帮助哦',
'tileset贴图模式下可以按选中tileset素材并在地图上拖动来一次绘制一个区域',
'可以拖动地图上的图块和事件或按Ctrl+C, Ctrl+X和Ctrl+V进行复制剪切和粘贴Delete删除'
'可以拖动地图上的图块和事件或按Ctrl+C, Ctrl+X和Ctrl+V进行复制剪切和粘贴Delete删除',
'Alt+数字键保存图块,数字键读取保存的图块',
];
if (value == null) value = Math.floor(Math.random() * tips.length);
printf('tips: ' + tips[value])

View File

@ -111,11 +111,6 @@ editor_ui_wrapper = function (editor) {
if (editor_multi.id != "" || editor_blockly.id != "")
return;
// 禁止快捷键的默认行为
if (e.ctrlKey && [89, 90, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
e.preventDefault();
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1)
e.preventDefault();
//Ctrl+z 撤销上一步undo
if (e.keyCode == 90 && e.ctrlKey && editor.uivalues.preMapData && editor.uivalues.currDrawData.pos.length && selectBox.isSelected()) {
editor.map = JSON.parse(JSON.stringify(editor.uivalues.preMapData.map));
@ -153,22 +148,10 @@ editor_ui_wrapper = function (editor) {
}
return;
}
//ctrl + 0~9 切换到快捷图块
if (e.ctrlKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1) {
editor.setSelectBoxFromInfo(JSON.parse(JSON.stringify(editor.uivalues.shortcut[e.keyCode] || 0)));
return;
}
//alt + 0~9 改变快捷图块
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1) {
var infoToSave = JSON.stringify(editor.info || 0);
if (infoToSave == JSON.stringify({})) return;
editor.uivalues.shortcut[e.keyCode] = JSON.parse(infoToSave);
printf('已保存该快捷图块, ctrl + ' + (e.keyCode - 48) + ' 使用.')
core.setLocalStorage('shortcut', editor.uivalues.shortcut);
return;
}
var focusElement = document.activeElement;
if (!focusElement || focusElement.tagName.toLowerCase() == 'body') {
if (!focusElement || focusElement.tagName.toLowerCase() == 'body'
|| focusElement.id == 'selectFloor') {
// Ctrl+C, Ctrl+X, Ctrl+V
if (e.ctrlKey && e.keyCode == 67 && !selectBox.isSelected()) {
e.preventDefault();
@ -223,6 +206,20 @@ editor_ui_wrapper = function (editor) {
editor.info = {};
return;
}
//alt + 0~9 改变快捷图块
if (e.altKey && [48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1) {
var infoToSave = JSON.stringify(editor.info || 0);
if (infoToSave == JSON.stringify({})) return;
editor.uivalues.shortcut[e.keyCode] = JSON.parse(infoToSave);
printf('已保存该快捷图块, 数字键 ' + (e.keyCode - 48) + ' 使用.')
core.setLocalStorage('shortcut', editor.uivalues.shortcut);
return;
}
//ctrl + 0~9 切换到快捷图块
if ([48, 49, 50, 51, 52, 53, 54, 55, 56, 57].indexOf(e.keyCode) !== -1) {
editor.setSelectBoxFromInfo(JSON.parse(JSON.stringify(editor.uivalues.shortcut[e.keyCode] || 0)));
return;
}
switch (e.keyCode) {
// WASD
case 87: editor.moveViewport(0, -1); break;
@ -256,7 +253,7 @@ editor_ui_wrapper = function (editor) {
"双击地图:选中对应点的素材\n" +
"右键地图:弹出菜单栏\n" +
"Alt+0~9保存当前使用的图块\n" +
"Ctrl+0~9选中保存的图块\n" +
"0~9选中保存的图块\n" +
"Ctrl+Z / Ctrl+Y撤销/重做上次绘制\n" +
"Ctrl+S事件与脚本编辑器的保存并退出\n" +
"双击事件编辑器:长文本编辑/脚本编辑/地图选点/UI绘制预览"

View File

@ -2103,7 +2103,7 @@ actions.prototype._clickSyncSave_readFile = function () {
if (obj.version != core.firstData.version) return alert("游戏版本不一致!");
if (!obj.data) return alert("无效的存档!");
core.control._syncLoad_write(obj.data);
});
}, null, ".h5save");
}
actions.prototype._clickSyncSave_replay = function () {

View File

@ -1122,7 +1122,7 @@ control.prototype.chooseReplayFile = function () {
return;
}
_replay();
});
}, null, ".h5route");
}
////// 开始播放 //////

View File

@ -459,7 +459,7 @@ ui.prototype.clearUI = function () {
////// 左上角绘制一段提示 //////
ui.prototype.drawTip = function (text, id, clear) {
if (clear) this.clearTip();
this.clearTip();
var one = {
text: text,
textX: 21,

View File

@ -761,7 +761,7 @@ utils.prototype.__next_rand = function (_rand) {
}
////// 读取一个本地文件内容 //////
utils.prototype.readFile = function (success, error, readType) {
utils.prototype.readFile = function (success, error, accept, readType) {
core.platform.successCallback = success;
core.platform.errorCallback = error;
@ -800,6 +800,7 @@ utils.prototype.readFile = function (success, error, readType) {
else core.platform.fileReader.readAsDataURL(core.platform.fileInput.files[0]);
core.platform.fileInput.value = '';
}
if (accept) core.platform.fileInput.accept = accept;
}
core.platform.fileInput.click();