Merge branch 'v2.0' of https://github.com/ckcz123/mota-js into v2.0
This commit is contained in:
commit
a1b26b8a6d
@ -104,6 +104,7 @@ editor_file = function (editor, callback) {
|
|||||||
}
|
}
|
||||||
datastr = datastr.concat(['\n}']);
|
datastr = datastr.concat(['\n}']);
|
||||||
datastr = datastr.join('');
|
datastr = datastr.join('');
|
||||||
|
alertWhenCompress();
|
||||||
fs.writeFile(filename, encode(datastr), 'base64', function (err, data) {
|
fs.writeFile(filename, encode(datastr), 'base64', function (err, data) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
@ -717,9 +718,17 @@ editor_file = function (editor, callback) {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var alertWhenCompress = function(){
|
||||||
|
if(editor.useCompress===true){
|
||||||
|
editor.useCompress=null;
|
||||||
|
setTimeout("alert('当前游戏使用的是压缩文件,修改完成后请重新压缩')",1000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var saveSetting = function (file, actionList, callback) {
|
var saveSetting = function (file, actionList, callback) {
|
||||||
//console.log(file);
|
//console.log(file);
|
||||||
//console.log(actionList);
|
//console.log(actionList);
|
||||||
|
alertWhenCompress();
|
||||||
|
|
||||||
if (file == 'icons') {
|
if (file == 'icons') {
|
||||||
actionList.forEach(function (value) {
|
actionList.forEach(function (value) {
|
||||||
|
|||||||
@ -2,37 +2,44 @@
|
|||||||
fs = {};
|
fs = {};
|
||||||
|
|
||||||
|
|
||||||
|
var _isset = function (val) {
|
||||||
|
if (val == undefined || val == null || (typeof val=='number' && isNaN(val))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
var _http = function (type, url, formData, success, error, mimeType, responseType) {
|
var _http = function (type, url, formData, success, error, mimeType, responseType) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open(type, url, true);
|
xhr.open(type, url, true);
|
||||||
if (core.isset(mimeType))
|
if (_isset(mimeType))
|
||||||
xhr.overrideMimeType(mimeType);
|
xhr.overrideMimeType(mimeType);
|
||||||
if (core.isset(responseType))
|
if (_isset(responseType))
|
||||||
xhr.responseType = responseType;
|
xhr.responseType = responseType;
|
||||||
xhr.onload = function(e) {
|
xhr.onload = function(e) {
|
||||||
if (xhr.status==200) {
|
if (xhr.status==200) {
|
||||||
if (core.isset(success)) {
|
if (_isset(success)) {
|
||||||
success(xhr.response);
|
success(xhr.response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (core.isset(error))
|
if (_isset(error))
|
||||||
error("HTTP "+xhr.status);
|
error("HTTP "+xhr.status);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.onabort = function () {
|
xhr.onabort = function () {
|
||||||
if (core.isset(error))
|
if (_isset(error))
|
||||||
error("Abort");
|
error("Abort");
|
||||||
}
|
}
|
||||||
xhr.ontimeout = function() {
|
xhr.ontimeout = function() {
|
||||||
if (core.isset(error))
|
if (_isset(error))
|
||||||
error("Timeout");
|
error("Timeout");
|
||||||
}
|
}
|
||||||
xhr.onerror = function() {
|
xhr.onerror = function() {
|
||||||
if (core.isset(error))
|
if (_isset(error))
|
||||||
error("Error on Connection");
|
error("Error on Connection");
|
||||||
}
|
}
|
||||||
if (core.isset(formData))
|
if (_isset(formData))
|
||||||
xhr.send(formData);
|
xhr.send(formData);
|
||||||
else xhr.send();
|
else xhr.send();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -429,6 +429,8 @@ if (location.protocol.indexOf("http")!=0) {
|
|||||||
</script>
|
</script>
|
||||||
<script src='_server/editor.js'></script>
|
<script src='_server/editor.js'></script>
|
||||||
<script>
|
<script>
|
||||||
|
var useCompress = main.useCompress;
|
||||||
|
main.useCompress = false;
|
||||||
main.init('editor', function () {
|
main.init('editor', function () {
|
||||||
editor.init(function () {
|
editor.init(function () {
|
||||||
editor.pos = {x: 0, y: 0};
|
editor.pos = {x: 0, y: 0};
|
||||||
@ -442,6 +444,8 @@ if (location.protocol.indexOf("http")!=0) {
|
|||||||
editor.mode.listen();
|
editor.mode.listen();
|
||||||
editor_multi = editor_multi();
|
editor_multi = editor_multi();
|
||||||
editor_blockly = editor_blockly();
|
editor_blockly = editor_blockly();
|
||||||
|
editor.useCompress = useCompress;
|
||||||
|
delete(useCompress);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user