This commit is contained in:
parent
d713350488
commit
abb6623e98
|
@ -9679,3 +9679,199 @@ CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true
|
|||
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
||||
|
||||
});
|
||||
|
||||
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||
|
||||
(function(mod) {
|
||||
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||
mod(require("../../lib/codemirror"));
|
||||
else if (typeof define == "function" && define.amd) // AMD
|
||||
define(["../../lib/codemirror"], mod);
|
||||
else // Plain browser env
|
||||
mod(CodeMirror);
|
||||
})(function(CodeMirror) {
|
||||
var defaults = {
|
||||
pairs: "()[]{}''\"\"",
|
||||
triples: "",
|
||||
explode: "[]{}"
|
||||
};
|
||||
|
||||
var Pos = CodeMirror.Pos;
|
||||
|
||||
CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
|
||||
if (old && old != CodeMirror.Init) {
|
||||
cm.removeKeyMap(keyMap);
|
||||
cm.state.closeBrackets = null;
|
||||
}
|
||||
if (val) {
|
||||
cm.state.closeBrackets = val;
|
||||
cm.addKeyMap(keyMap);
|
||||
}
|
||||
});
|
||||
|
||||
function getOption(conf, name) {
|
||||
if (name == "pairs" && typeof conf == "string") return conf;
|
||||
if (typeof conf == "object" && conf[name] != null) return conf[name];
|
||||
return defaults[name];
|
||||
}
|
||||
|
||||
var bind = defaults.pairs + "`";
|
||||
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
|
||||
for (var i = 0; i < bind.length; i++)
|
||||
keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i));
|
||||
|
||||
function handler(ch) {
|
||||
return function(cm) { return handleChar(cm, ch); };
|
||||
}
|
||||
|
||||
function getConfig(cm) {
|
||||
var deflt = cm.state.closeBrackets;
|
||||
if (!deflt) return null;
|
||||
var mode = cm.getModeAt(cm.getCursor());
|
||||
return mode.closeBrackets || deflt;
|
||||
}
|
||||
|
||||
function handleBackspace(cm) {
|
||||
var conf = getConfig(cm);
|
||||
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
||||
|
||||
var pairs = getOption(conf, "pairs");
|
||||
var ranges = cm.listSelections();
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
if (!ranges[i].empty()) return CodeMirror.Pass;
|
||||
var around = charsAround(cm, ranges[i].head);
|
||||
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
||||
}
|
||||
for (var i = ranges.length - 1; i >= 0; i--) {
|
||||
var cur = ranges[i].head;
|
||||
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete");
|
||||
}
|
||||
}
|
||||
|
||||
function handleEnter(cm) {
|
||||
var conf = getConfig(cm);
|
||||
var explode = conf && getOption(conf, "explode");
|
||||
if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
|
||||
|
||||
var ranges = cm.listSelections();
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
if (!ranges[i].empty()) return CodeMirror.Pass;
|
||||
var around = charsAround(cm, ranges[i].head);
|
||||
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
|
||||
}
|
||||
cm.operation(function() {
|
||||
cm.replaceSelection("\n\n", null);
|
||||
cm.execCommand("goCharLeft");
|
||||
ranges = cm.listSelections();
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
var line = ranges[i].head.line;
|
||||
cm.indentLine(line, null, true);
|
||||
cm.indentLine(line + 1, null, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function contractSelection(sel) {
|
||||
var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
|
||||
return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
|
||||
head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
|
||||
}
|
||||
|
||||
function handleChar(cm, ch) {
|
||||
var conf = getConfig(cm);
|
||||
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
|
||||
|
||||
var pairs = getOption(conf, "pairs");
|
||||
var pos = pairs.indexOf(ch);
|
||||
if (pos == -1) return CodeMirror.Pass;
|
||||
var triples = getOption(conf, "triples");
|
||||
|
||||
var identical = pairs.charAt(pos + 1) == ch;
|
||||
var ranges = cm.listSelections();
|
||||
var opening = pos % 2 == 0;
|
||||
|
||||
var type;
|
||||
for (var i = 0; i < ranges.length; i++) {
|
||||
var range = ranges[i], cur = range.head, curType;
|
||||
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
|
||||
if (opening && !range.empty()) {
|
||||
curType = "surround";
|
||||
} else if ((identical || !opening) && next == ch) {
|
||||
if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
|
||||
curType = "skipThree";
|
||||
else
|
||||
curType = "skip";
|
||||
} else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
|
||||
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch &&
|
||||
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) {
|
||||
curType = "addFour";
|
||||
} else if (identical) {
|
||||
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both";
|
||||
else return CodeMirror.Pass;
|
||||
} else if (opening && (cm.getLine(cur.line).length == cur.ch ||
|
||||
isClosingBracket(next, pairs) ||
|
||||
/\s/.test(next))) {
|
||||
curType = "both";
|
||||
} else {
|
||||
return CodeMirror.Pass;
|
||||
}
|
||||
if (!type) type = curType;
|
||||
else if (type != curType) return CodeMirror.Pass;
|
||||
}
|
||||
|
||||
var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
|
||||
var right = pos % 2 ? ch : pairs.charAt(pos + 1);
|
||||
cm.operation(function() {
|
||||
if (type == "skip") {
|
||||
cm.execCommand("goCharRight");
|
||||
} else if (type == "skipThree") {
|
||||
for (var i = 0; i < 3; i++)
|
||||
cm.execCommand("goCharRight");
|
||||
} else if (type == "surround") {
|
||||
var sels = cm.getSelections();
|
||||
for (var i = 0; i < sels.length; i++)
|
||||
sels[i] = left + sels[i] + right;
|
||||
cm.replaceSelections(sels, "around");
|
||||
sels = cm.listSelections().slice();
|
||||
for (var i = 0; i < sels.length; i++)
|
||||
sels[i] = contractSelection(sels[i]);
|
||||
cm.setSelections(sels);
|
||||
} else if (type == "both") {
|
||||
cm.replaceSelection(left + right, null);
|
||||
cm.triggerElectric(left + right);
|
||||
cm.execCommand("goCharLeft");
|
||||
} else if (type == "addFour") {
|
||||
cm.replaceSelection(left + left + left + left, "before");
|
||||
cm.execCommand("goCharRight");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isClosingBracket(ch, pairs) {
|
||||
var pos = pairs.lastIndexOf(ch);
|
||||
return pos > -1 && pos % 2 == 1;
|
||||
}
|
||||
|
||||
function charsAround(cm, pos) {
|
||||
var str = cm.getRange(Pos(pos.line, pos.ch - 1),
|
||||
Pos(pos.line, pos.ch + 1));
|
||||
return str.length == 2 ? str : null;
|
||||
}
|
||||
|
||||
// Project the token type that will exists after the given char is
|
||||
// typed, and use it to determine whether it would cause the start
|
||||
// of a string token.
|
||||
function enteringString(cm, pos, ch) {
|
||||
var line = cm.getLine(pos.line);
|
||||
var token = cm.getTokenAt(pos);
|
||||
if (/\bstring2?\b/.test(token.type)) return false;
|
||||
var stream = new CodeMirror.StringStream(line.slice(0, pos.ch) + ch + line.slice(pos.ch), 4);
|
||||
stream.pos = stream.start = token.start;
|
||||
for (;;) {
|
||||
var type1 = cm.getMode().token(stream, token.state);
|
||||
if (stream.pos >= pos.ch + 1) return /\bstring2?\b/.test(type1);
|
||||
stream.start = stream.pos;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
181
game/game.js
181
game/game.js
|
@ -3368,31 +3368,40 @@
|
|||
game.saveConfig('layout','phone');
|
||||
}
|
||||
}
|
||||
|
||||
if(lib.config.extensions.length){
|
||||
window.resetExtension=function(){
|
||||
for(var i=0;i<lib.config.extensions.length;i++){
|
||||
game.saveConfig('extension_'+lib.config.extensions[i]+'_enable',false);
|
||||
}
|
||||
localStorage.setItem(lib.configprefix+'disable_extension',true);
|
||||
}
|
||||
}
|
||||
var extensionlist=lib.config.plays.slice(0);
|
||||
for(var i=0;i<lib.config.extensions.length;i++){
|
||||
var extcontent=localStorage.getItem(lib.configprefix+'extension_'+lib.config.extensions[i]);
|
||||
if(extcontent){
|
||||
_status.evaluatingExtension=true;
|
||||
try{
|
||||
eval(extcontent);
|
||||
}
|
||||
catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
_status.evaluatingExtension=false;
|
||||
var extensionlist;
|
||||
if(!localStorage.getItem(lib.configprefix+'disable_extension')){
|
||||
extensionlist=lib.config.plays.slice(0);
|
||||
for(var i=0;i<lib.config.extensions.length;i++){
|
||||
var extcontent=localStorage.getItem(lib.configprefix+'extension_'+lib.config.extensions[i]);
|
||||
if(extcontent){
|
||||
_status.evaluatingExtension=true;
|
||||
try{
|
||||
eval(extcontent);
|
||||
}
|
||||
catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
_status.evaluatingExtension=false;
|
||||
}
|
||||
else{
|
||||
extensionlist.push(lib.config.extensions[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
extensionlist=[];
|
||||
for(var i=0;i<lib.config.extensions.length;i++){
|
||||
game.import('extension',{name:lib.config.extensions[i]});
|
||||
}
|
||||
else{
|
||||
extensionlist.push(lib.config.extensions[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var loadPack=function(){
|
||||
var toLoad=lib.config.all.cards.length+lib.config.all.characters.length+1;
|
||||
var packLoaded=function(){
|
||||
|
@ -22339,7 +22348,7 @@
|
|||
if(node.nextSibling){
|
||||
node.nextSibling.remove();
|
||||
}
|
||||
container.code='{\n\ttype:"basic",\n\tenable:true,\n\tfilterTarget:true,\n\tcontent:function(){\n\t\ttarget.draw()\n\t},\n\tai:{\n\t\torder:1,\n\t\tresult:{\n\t\t\ttarget:1\n\t\t}\n\t}\n}';
|
||||
container.code='{\n type:"basic",\n enable:true,\n filterTarget:true,\n content:function(){\n target.draw()\n },\n ai:{\n order:1,\n result:{\n target:1\n }\n }\n}';
|
||||
}
|
||||
|
||||
newCard=ui.create.div('.new_character',page);
|
||||
|
@ -22474,40 +22483,26 @@
|
|||
ui.window.appendChild(node);
|
||||
node.editor.setValue(node.code,1);
|
||||
}
|
||||
else if(lib.device=='ios'||lib.device=='android'){
|
||||
ui.window.appendChild(node);
|
||||
if(!node.textarea){
|
||||
var textarea=document.createElement('textarea');
|
||||
editor.appendChild(textarea);
|
||||
node.textarea=textarea;
|
||||
lib.setScroll(textarea);
|
||||
}
|
||||
node.textarea.value=node.code;
|
||||
}
|
||||
else{
|
||||
var aceReady=function(){
|
||||
ui.window.appendChild(node);
|
||||
// var editor=window.ace.edit(id);
|
||||
// editor.$blockScrolling=Infinity;
|
||||
// editor.setTheme("ace/theme/chrome");
|
||||
// editor.getSession().setUseWorker(false);
|
||||
// editor.getSession().setMode("ace/mode/javascript");
|
||||
// node.aced=true;
|
||||
// node.editor=editor;
|
||||
// editor.setValue(node.code,1);
|
||||
|
||||
var myCodeMirror = CodeMirror(editor, {
|
||||
var mirror = window.CodeMirror(editor, {
|
||||
value:node.code,
|
||||
mode:"javascript",
|
||||
lineWrapping:true,
|
||||
lineNumbers:true,
|
||||
indentUnit:4,
|
||||
autoCloseBrackets:true,
|
||||
indentWithTabs:true,
|
||||
theme:'mdn-like'
|
||||
});
|
||||
lib.setScroll(editor.querySelector('.CodeMirror-scroll'));
|
||||
node.aced=true;
|
||||
node.editor=mirror;
|
||||
}
|
||||
if(!window.CodeMirror){
|
||||
lib.init.js('game','codemirror',aceReady);
|
||||
lib.init.css('layout/default','codemirror')
|
||||
lib.init.js(lib.assetURL+'game','codemirror',aceReady);
|
||||
lib.init.css(lib.assetURL+'layout/default','codemirror');
|
||||
}
|
||||
else{
|
||||
aceReady();
|
||||
|
@ -22521,9 +22516,6 @@
|
|||
ui.window.classList.remove('shortcutpaused');
|
||||
ui.window.classList.remove('systempaused');
|
||||
container.delete(null);
|
||||
if(container.code&&container.editor){
|
||||
container.editor.setValue(container.code,1);
|
||||
}
|
||||
delete window.saveNonameInput;
|
||||
});
|
||||
var saveInput=function(){
|
||||
|
@ -22541,7 +22533,7 @@
|
|||
};
|
||||
var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput);
|
||||
var editor=ui.create.div(editorpage);
|
||||
container.code='{\n\ttype:"basic",\n\tenable:true,\n\tfilterTarget:true,\n\tcontent:function(){\n\t\ttarget.draw()\n\t},\n\tai:{\n\t\torder:1,\n\t\tresult:{\n\t\t\ttarget:1\n\t\t}\n\t}\n}';
|
||||
container.code='{\n type:"basic",\n enable:true,\n filterTarget:true,\n content:function(){\n target.draw()\n },\n ai:{\n order:1,\n result:{\n target:1\n }\n }\n}';
|
||||
|
||||
ui.create.div('.menubutton.large.new_card','创建卡牌',newCard,function(){
|
||||
var name=page.querySelector('input.new_name').value;
|
||||
|
@ -22832,7 +22824,7 @@
|
|||
if(node.nextSibling){
|
||||
node.nextSibling.remove();
|
||||
}
|
||||
container.code='{\n\ttrigger:{player:"phaseEnd"},\n\tfrequent:true,\n\tcontent:function(){\n\t\tplayer.draw()\n\t}\n}';
|
||||
container.code='{\n trigger:{player:"phaseEnd"},\n frequent:true,\n content:function(){\n player.draw()\n }\n}';
|
||||
}
|
||||
|
||||
newSkill=ui.create.div('.new_character.new_skill',page);
|
||||
|
@ -22851,31 +22843,26 @@
|
|||
ui.window.appendChild(node);
|
||||
node.editor.setValue(node.code,1);
|
||||
}
|
||||
else if(lib.device=='ios'||lib.device=='android'){
|
||||
ui.window.appendChild(node);
|
||||
if(!node.textarea){
|
||||
var textarea=document.createElement('textarea');
|
||||
editor.appendChild(textarea);
|
||||
node.textarea=textarea;
|
||||
lib.setScroll(textarea);
|
||||
}
|
||||
node.textarea.value=node.code;
|
||||
}
|
||||
else{
|
||||
var id=editor.id;
|
||||
var aceReady=function(){
|
||||
ui.window.appendChild(node);
|
||||
var editor=window.ace.edit(id);
|
||||
editor.$blockScrolling=Infinity;
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
editor.getSession().setUseWorker(false);
|
||||
editor.getSession().setMode("ace/mode/javascript");
|
||||
var mirror = window.CodeMirror(editor, {
|
||||
value:node.code,
|
||||
mode:"javascript",
|
||||
lineWrapping:true,
|
||||
lineNumbers:true,
|
||||
indentUnit:4,
|
||||
autoCloseBrackets:true,
|
||||
indentWithTabs:true,
|
||||
theme:'mdn-like'
|
||||
});
|
||||
lib.setScroll(editor.querySelector('.CodeMirror-scroll'));
|
||||
node.aced=true;
|
||||
node.editor=editor;
|
||||
editor.setValue(node.code,1);
|
||||
node.editor=mirror;
|
||||
}
|
||||
if(!window.ace){
|
||||
lib.init.js('game','ace',aceReady);
|
||||
lib.init.js(lib.assetURL+'game','codemirror',aceReady);
|
||||
lib.init.css(lib.assetURL+'layout/default','codemirror');
|
||||
}
|
||||
else{
|
||||
aceReady();
|
||||
|
@ -22889,9 +22876,6 @@
|
|||
ui.window.classList.remove('shortcutpaused');
|
||||
ui.window.classList.remove('systempaused');
|
||||
container.delete(null);
|
||||
if(container.code&&container.editor){
|
||||
container.editor.setValue(container.code,1);
|
||||
}
|
||||
delete window.saveNonameInput;
|
||||
});
|
||||
var saveInput=function(){
|
||||
|
@ -22908,8 +22892,8 @@
|
|||
delete window.saveNonameInput;
|
||||
};
|
||||
var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput);
|
||||
var editor=ui.create.div('#editor-skill',editorpage);
|
||||
container.code='{\n\ttrigger:{player:"phaseEnd"},\n\tfrequent:true,\n\tcontent:function(){\n\t\tplayer.draw()\n\t}\n}';
|
||||
var editor=ui.create.div(editorpage);
|
||||
container.code='{\n trigger:{player:"phaseEnd"},\n frequent:true,\n content:function(){\n player.draw()\n }\n}';
|
||||
|
||||
var citebutton=document.createElement('button');
|
||||
citebutton.innerHTML='引用代码';
|
||||
|
@ -23059,10 +23043,10 @@
|
|||
}
|
||||
}
|
||||
else{
|
||||
dashes.content.node.code='function(config,pack){\n\t\/\/执行时机为界面加载之后,其它扩展内容加载之前\n\t\/\/参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可修改)\n}';
|
||||
dashes.precontent.node.code='function(){\n\t\/\/执行时机为游戏启动时,游戏包加载之前,且不受禁用扩展的限制\n\t\/\/除添加模式外请慎用\n}';
|
||||
dashes.config.node.code='{\n\t\n}\n\n\/*\n示例:\n{\n\tswitcher_example:{\n\t\tname:"示例列表选项",\n\t\tinit:"3",\n\t\titem:{"1":"一","2":"二","3":"三"}\n\t},\n\ttoggle_example:{\n\t\tname:"示例开关选项",\n\t\tinit:true\n\t}\n}\n此例中传入的主代码函数的默认参数为{switcher_example:"3",toggle_example:true}\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/';
|
||||
dashes.help.node.code='{\n\t\n}\n\n\/*\n示例:\n{\n\t"帮助条目":"<ul><li>列表1-条目1<li>列表1-条目2</ul><ol><li>列表2-条目1<li>列表2-条目2</ul>"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/';
|
||||
dashes.content.node.code='function(config,pack){\n \/\/执行时机为界面加载之后,其它扩展内容加载之前\n \/\/参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可修改)\n}';
|
||||
dashes.precontent.node.code='function(){\n \/\/执行时机为游戏启动时,游戏包加载之前,且不受禁用扩展的限制\n \/\/除添加模式外请慎用\n}';
|
||||
dashes.config.node.code='{\n \n}\n\n\/*\n示例:\n{\n switcher_example:{\n name:"示例列表选项",\n init:"3",\n item:{"1":"一","2":"二","3":"三"}\n },\n toggle_example:{\n name:"示例开关选项",\n init:true\n }\n}\n此例中传入的主代码函数的默认参数为{switcher_example:"3",toggle_example:true}\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/';
|
||||
dashes.help.node.code='{\n \n}\n\n\/*\n示例:\n{\n "帮助条目":"<ul><li>列表1-条目1<li>列表1-条目2</ul><ol><li>列表2-条目1<li>列表2-条目2</ul>"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/';
|
||||
}
|
||||
};
|
||||
var dashes={};
|
||||
|
@ -23080,9 +23064,6 @@
|
|||
ui.window.classList.remove('shortcutpaused');
|
||||
ui.window.classList.remove('systempaused');
|
||||
container.delete(null);
|
||||
if(container.code&&container.editor){
|
||||
container.editor.setValue(container.code,1);
|
||||
}
|
||||
delete window.saveNonameInput;
|
||||
});
|
||||
var saveInput=function(){
|
||||
|
@ -23101,7 +23082,7 @@
|
|||
delete window.saveNonameInput;
|
||||
};
|
||||
var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput);
|
||||
var editor=ui.create.div('#editor-'+link,editorpage);
|
||||
var editor=ui.create.div(editorpage);
|
||||
container.code=str;
|
||||
dash.editor=editor;
|
||||
dash.node=container;
|
||||
|
@ -23117,31 +23098,26 @@
|
|||
ui.window.appendChild(node);
|
||||
node.editor.setValue(node.code,1);
|
||||
}
|
||||
else if(lib.device=='ios'||lib.device=='android'){
|
||||
ui.window.appendChild(node);
|
||||
if(!node.textarea){
|
||||
var textarea=document.createElement('textarea');
|
||||
this.editor.appendChild(textarea);
|
||||
node.textarea=textarea;
|
||||
lib.setScroll(textarea);
|
||||
}
|
||||
node.textarea.value=node.code;
|
||||
}
|
||||
else{
|
||||
var id=this.editor.id;
|
||||
var editor=this.editor;
|
||||
var aceReady=function(){
|
||||
ui.window.appendChild(node);
|
||||
var editor=window.ace.edit(id);
|
||||
editor.$blockScrolling=Infinity;
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
editor.getSession().setUseWorker(false);
|
||||
editor.getSession().setMode("ace/mode/javascript");
|
||||
var mirror = window.CodeMirror(editor, {
|
||||
value:node.code,
|
||||
mode:"javascript",
|
||||
lineWrapping:true,
|
||||
lineNumbers:true,
|
||||
indentUnit:4,
|
||||
autoCloseBrackets:true,
|
||||
theme:'mdn-like'
|
||||
});
|
||||
lib.setScroll(editor.querySelector('.CodeMirror-scroll'));
|
||||
node.aced=true;
|
||||
node.editor=editor;
|
||||
editor.setValue(node.code,1);
|
||||
node.editor=mirror;
|
||||
}
|
||||
if(!window.ace){
|
||||
lib.init.js('game','ace',aceReady);
|
||||
lib.init.js(lib.assetURL+'game','codemirror',aceReady);
|
||||
lib.init.css(lib.assetURL+'layout/default','codemirror');
|
||||
}
|
||||
else{
|
||||
aceReady();
|
||||
|
@ -23149,10 +23125,10 @@
|
|||
}
|
||||
};
|
||||
page.content={}
|
||||
createCode('主','主代码',page,clickCode,'content','function(config,pack){\n\t\/\/执行时机为界面加载之后,其它扩展内容加载之前\n\t\/\/参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可修改)\n}');
|
||||
createCode('启','启动代码',page,clickCode,'precontent','function(){\n\t\/\/执行时机为游戏启动时,游戏包加载之前,且不受禁用扩展的限制\n\t\/\/除添加模式外请慎用\n}');
|
||||
createCode('选','选项代码',page,clickCode,'config','{\n\t\n}\n\n\/*\n示例:\n{\n\tswitcher_example:{\n\t\tname:"示例列表选项",\n\t\tinit:"3",\n\t\titem:{"1":"一","2":"二","3":"三"}\n\t},\n\ttoggle_example:{\n\t\tname:"示例开关选项",\n\t\tinit:true\n\t}\n}\n此例中传入的主代码函数的默认参数为{switcher_example:"3",toggle_example:true}\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/');
|
||||
createCode('帮','帮助代码',page,clickCode,'help','{\n\t\n}\n\n\/*\n示例:\n{\n\t"帮助条目":"<ul><li>列表1-条目1<li>列表1-条目2</ul><ol><li>列表2-条目1<li>列表2-条目2</ul>"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/');
|
||||
createCode('主','主代码',page,clickCode,'content','function(config,pack){\n \/\/执行时机为界面加载之后,其它扩展内容加载之前\n \/\/参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可修改)\n}');
|
||||
createCode('启','启动代码',page,clickCode,'precontent','function(){\n \/\/执行时机为游戏启动时,游戏包加载之前,且不受禁用扩展的限制\n \/\/除添加模式外请慎用\n}');
|
||||
createCode('选','选项代码',page,clickCode,'config','{\n \n}\n\n\/*\n示例:\n{\n switcher_example:{\n name:"示例列表选项",\n init:"3",\n item:{"1":"一","2":"二","3":"三"}\n },\n toggle_example:{\n name:"示例开关选项",\n init:true\n }\n}\n此例中传入的主代码函数的默认参数为{switcher_example:"3",toggle_example:true}\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/');
|
||||
createCode('帮','帮助代码',page,clickCode,'help','{\n \n}\n\n\/*\n示例:\n{\n "帮助条目":"<ul><li>列表1-条目1<li>列表1-条目2</ul><ol><li>列表2-条目1<li>列表2-条目2</ul>"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/');
|
||||
|
||||
return page;
|
||||
}());
|
||||
|
@ -25709,6 +25685,7 @@
|
|||
clearTimeout(window.resetGameTimeout);
|
||||
delete window.resetGameTimeout;
|
||||
delete window.resetExtension;
|
||||
localStorage.removeItem(lib.configprefix+'disable_extension',true);
|
||||
},
|
||||
system:function(str,func,right){
|
||||
var node=ui.create.div(right?ui.system2:ui.system1);
|
||||
|
@ -28680,12 +28657,12 @@
|
|||
var indent='';
|
||||
var str;
|
||||
for(var i=0;i<level;i++){
|
||||
indent+='\t';
|
||||
indent+=' ';
|
||||
}
|
||||
if(get.objtype(obj)=='object'){
|
||||
str='{\n';
|
||||
for(var i in obj){
|
||||
str+=indent+'\t'+i+':'+get.stringify(obj[i],level+1)+',\n';
|
||||
str+=indent+' '+i+':'+get.stringify(obj[i],level+1)+',\n';
|
||||
}
|
||||
str+=indent+'}';
|
||||
return str;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
window.noname_update={
|
||||
version:'1.8.19.3',
|
||||
version:'1.8.19.4',
|
||||
changeLog:[
|
||||
'***注意:更新后将无法使用或导出自定义武将,请自行备份***',
|
||||
'新代码编辑器',
|
||||
'修bug',
|
||||
],
|
||||
files:{
|
||||
|
@ -10,7 +11,7 @@ window.noname_update={
|
|||
'game/source.js',
|
||||
'game/package.js',
|
||||
'game/asset.js',
|
||||
'game/ace.js',
|
||||
'game/codemirror.js',
|
||||
'character/yijiang.js',
|
||||
'character/ow.js',
|
||||
'character/swd.js',
|
||||
|
@ -18,10 +19,12 @@ window.noname_update={
|
|||
'card/swd.js',
|
||||
'layout/default/layout.css',
|
||||
'layout/default/menu.css',
|
||||
'layout/default/codemirror.css',
|
||||
],
|
||||
'1.8.18.1':[],
|
||||
'1.8.19':[],
|
||||
'1.8.19.1':[],
|
||||
'1.8.19.2':[],
|
||||
'1.8.19.3':[],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
/*font-family: inherit;*/
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
|
|
Loading…
Reference in New Issue