diff --git a/game/game.js b/game/game.js index fded4bd11..5def184e0 100644 --- a/game/game.js +++ b/game/game.js @@ -20,10 +20,10 @@ }; var lib={ configprefix:'noname_0.9_', - versionOL:26, + versionOL:26, updateURL:'https://raw.githubusercontent.com/libccy/noname', - mirrorURL:'https://coding.net/u/libccy/p/noname/git/raw', - hallURL:'noname.pub', + mirrorURL:'https://coding.net/u/libccy/p/noname/git/raw', + hallURL:'noname.pub', assetURL:'', changeLog:[], updates:[], @@ -37,31 +37,31 @@ characterFilter:{}, cardPack:{}, onresize:[], - onphase:[], + onphase:[], onwash:[], onover:[], ondb:[], ondb2:[], - chatHistory:[], + chatHistory:[], arenaReady:[], onfree:[], - inpile:[], - extensions:[], - extensionPack:{}, - cardType:{}, - hook:{globaltrigger:{},globalskill:{}}, - hookmap:{}, + inpile:[], + extensions:[], + extensionPack:{}, + cardType:{}, + hook:{globaltrigger:{},globalskill:{}}, + hookmap:{}, imported:{}, - layoutfixed:['chess','tafang','stone'], - characterDialogGroup:{ - '收藏':function(name,capt){ - return lib.config.favouriteCharacter.contains(name)?capt:null; - }, - '最近':function(name,capt){ + layoutfixed:['chess','tafang','stone'], + characterDialogGroup:{ + '收藏':function(name,capt){ + return lib.config.favouriteCharacter.contains(name)?capt:null; + }, + '最近':function(name,capt){ var list=get.config('recentCharacter')||[]; - return list.contains(name)?capt:null; - } - }, + return list.contains(name)?capt:null; + } + }, listenEnd:function(node){ if(!node._listeningEnd){ node._listeningEnd=true; @@ -218,7 +218,7 @@ menu:'打开菜单', pause:'切换暂停', auto:'切换托管', - chat:'显示聊天', + chat:'显示聊天', off:'关闭', }, onclick:function(item){ @@ -236,7 +236,7 @@ menu:'打开菜单', pause:'切换暂停', auto:'切换托管', - chat:'显示聊天', + chat:'显示聊天', off:'关闭', }, onclick:function(item){ @@ -254,7 +254,7 @@ menu:'打开菜单', pause:'切换暂停', auto:'切换托管', - chat:'显示聊天', + chat:'显示聊天', off:'关闭', }, onclick:function(item){ @@ -272,7 +272,7 @@ menu:'打开菜单', pause:'切换暂停', auto:'切换托管', - chat:'显示聊天', + chat:'显示聊天', off:'关闭', }, onclick:function(item){ @@ -454,13 +454,13 @@ intro:'开启后可使用浏览器控制台控制游戏,同时可更新到开发版', init:false, onclick:function(bool){ - game.saveConfig('dev',bool); - if(_status.connectMode) return; + game.saveConfig('dev',bool); + if(_status.connectMode) return; if(bool){ - lib.cheat.i(); + lib.cheat.i(); } else{ - delete window.cheat; + delete window.cheat; delete window.game; delete window.ui; delete window.get; @@ -567,12 +567,12 @@ else{ map.round_menu_func.show(); } - if(!lib.node&&lib.device!='ios'){ - map.confirm_exit.show(); - } - else{ - map.confirm_exit.hide(); - } + if(!lib.node&&lib.device!='ios'){ + map.confirm_exit.show(); + } + else{ + map.confirm_exit.hide(); + } } } }, @@ -616,8 +616,8 @@ default:'旧版', newlayout:'对称', mobile:'默认', - long:'新版', - long2:'手杀', + long:'新版', + long2:'手杀', }, visualMenu:function(node,link){ node.className='button character themebutton '+lib.config.theme; @@ -754,39 +754,39 @@ } } }, - // fewplayer:{ - // name:'启用人数', + // fewplayer:{ + // name:'启用人数', // intro:'设置启用新版布局的最小人数(不足时切换至默认布局)', - // init:'3', - // // unfrequent:true, - // item:{ - // '2':'两人', - // '3':'三人', - // '4':'四人', - // '5':'五人', - // '6':'六人', - // '7':'七人', - // '8':'八人', - // }, - // onclick:function(item){ - // game.saveConfig('fewplayer',item); - // if(ui.arena) ui.arena.setNumber(ui.arena.dataset.number); - // } - // }, - player_height:{ - name:'角色高度', - init:'long', - // unfrequent:true, - item:{ - short:'矮', - default:'中', - long:'高', - }, - onclick:function(item){ - game.saveConfig('player_height',item); - ui.arena.dataset.player_height=item; - } - }, + // init:'3', + // // unfrequent:true, + // item:{ + // '2':'两人', + // '3':'三人', + // '4':'四人', + // '5':'五人', + // '6':'六人', + // '7':'七人', + // '8':'八人', + // }, + // onclick:function(item){ + // game.saveConfig('fewplayer',item); + // if(ui.arena) ui.arena.setNumber(ui.arena.dataset.number); + // } + // }, + player_height:{ + name:'角色高度', + init:'long', + // unfrequent:true, + item:{ + short:'矮', + default:'中', + long:'高', + }, + onclick:function(item){ + game.saveConfig('player_height',item); + ui.arena.dataset.player_height=item; + } + }, // background_color_music:{ // name:'背景色', // init:'black', @@ -847,8 +847,8 @@ case 'ebig':zoom=1.2;break; default:zoom=1; } - game.documentZoom=game.deviceZoom*zoom; - document.documentElement.style.zoom=game.documentZoom; + game.documentZoom=game.deviceZoom*zoom; + document.documentElement.style.zoom=game.documentZoom; } }, image_background:{ @@ -1006,16 +1006,16 @@ ui.background.delete(); ui.background=ui.create.div('.background'); - if(lib.config.image_background_blur){ - ui.background.style.filter='blur(8px)'; - ui.background.style.webkitFilter='blur(8px)'; - ui.background.style.transform='scale(1.05)'; - } - else{ - ui.background.style.filter=''; - ui.background.style.webkitFilter=''; - ui.background.style.transform=''; - } + if(lib.config.image_background_blur){ + ui.background.style.filter='blur(8px)'; + ui.background.style.webkitFilter='blur(8px)'; + ui.background.style.transform='scale(1.05)'; + } + else{ + ui.background.style.filter=''; + ui.background.style.webkitFilter=''; + ui.background.style.transform=''; + } document.body.insertBefore(ui.background,document.body.firstChild); if(animate) ui.background.animate('start'); @@ -1055,34 +1055,34 @@ init:false, onclick:function(bool){ game.saveConfig('image_background_blur',bool); - if(lib.config.image_background_blur){ - ui.background.style.filter='blur(8px)'; - ui.background.style.webkitFilter='blur(8px)'; - ui.background.style.transform='scale(1.05)'; - } - else{ - ui.background.style.filter=''; - ui.background.style.webkitFilter=''; - ui.background.style.transform=''; - } + if(lib.config.image_background_blur){ + ui.background.style.filter='blur(8px)'; + ui.background.style.webkitFilter='blur(8px)'; + ui.background.style.transform='scale(1.05)'; + } + else{ + ui.background.style.filter=''; + ui.background.style.webkitFilter=''; + ui.background.style.transform=''; + } }, }, - phonelayout:{ - name:'触屏布局', - init:false, - onclick:function(bool){ + phonelayout:{ + name:'触屏布局', + init:false, + onclick:function(bool){ if(get.is.nomenu('phonelayout',bool)) return false; - game.saveConfig('phonelayout',bool); - if(get.is.phoneLayout()){ - ui.css.phone.href=lib.assetURL+'layout/default/phone.css'; - ui.arena.classList.add('phone'); - } - else{ - ui.css.phone.href=''; - ui.arena.classList.remove('phone'); - } - } - }, + game.saveConfig('phonelayout',bool); + if(get.is.phoneLayout()){ + ui.css.phone.href=lib.assetURL+'layout/default/phone.css'; + ui.arena.classList.add('phone'); + } + else{ + ui.css.phone.href=''; + ui.arena.classList.remove('phone'); + } + } + }, change_skin:{ name:'开启换肤', init:true, @@ -1100,7 +1100,7 @@ }, intro:'游戏每进行一段时间自动为一个随机角色更换皮肤', onclick:function(item){ - game.saveConfig('change_skin_auto',item); + game.saveConfig('change_skin_auto',item); clearTimeout(_status.skintimeout); if(item!='off'){ _status.skintimeout=setTimeout(ui.click.autoskin,parseInt(item)); @@ -1115,7 +1115,7 @@ wood:'木纹', music:'音乐', simple:'原版', - ol:'手杀', + ol:'手杀', // new:'新版', custom:'自定', default:'默认', @@ -1236,7 +1236,7 @@ item:{ // wood:'木纹', // music:'音乐', - official:'原版', + official:'原版', // new:'新版', // feicheng:'废城', liusha:'流沙', @@ -1843,25 +1843,25 @@ init:'normal', intro:'设置角色的边框宽度', unfrequent:true, - item:{ - slim:'窄', - normal:'中', - wide:'宽' - }, + item:{ + slim:'窄', + normal:'中', + wide:'宽' + }, onclick:function(item){ game.saveConfig('player_border',item); - if(item!='wide'||game.layout=='long'||game.layout=='long2'){ - ui.arena.classList.add('slim_player'); - } - else{ - ui.arena.classList.remove('slim_player'); - } - if(item=='slim'){ - ui.arena.classList.add('uslim_player'); - } - else{ - ui.arena.classList.remove('uslim_player'); - } + if(item!='wide'||game.layout=='long'||game.layout=='long2'){ + ui.arena.classList.add('slim_player'); + } + else{ + ui.arena.classList.remove('slim_player'); + } + if(item=='slim'){ + ui.arena.classList.add('uslim_player'); + } + else{ + ui.arena.classList.remove('uslim_player'); + } if(item=='normal'&&lib.config.mode!='brawl'&&(game.layout=='long'||game.layout=='long2')){ ui.arena.classList.add('lslim_player'); } @@ -2235,21 +2235,21 @@ lib.configMenu.appearence.config.custom_button.onclick('skip'); } }, - radius_size:{ - name:'圆角大小', - init:'default', - item:{ - off:'关闭', - reduce:'减小', - default:'默认', - increase:'增大', - }, - unfrequent:true, - onclick:function(item){ - game.saveConfig('radius_size',item); - ui.window.dataset.radius_size=item; - } - }, + radius_size:{ + name:'圆角大小', + init:'default', + item:{ + off:'关闭', + reduce:'减小', + default:'默认', + increase:'增大', + }, + unfrequent:true, + onclick:function(item){ + game.saveConfig('radius_size',item); + ui.window.dataset.radius_size=item; + } + }, glow_phase:{ name:'当前回合角色高亮', unfrequent:true, @@ -2271,12 +2271,12 @@ init:true, unfrequent:true, }, - fold_mode:{ - name:'折叠模式菜单', + fold_mode:{ + name:'折叠模式菜单', intro:'关闭后模式菜单中“更多”内的项目将直接展开', - init:true, - unfrequent:true, - }, + init:true, + unfrequent:true, + }, seperate_control:{ name:'分离选项条', init:true, @@ -2388,34 +2388,34 @@ } } }, - link_style2:{ - name:'横置样式', + link_style2:{ + name:'横置样式', intro:'设置角色被横置时的样式', - init:'chain', - unfrequent:true, - item:{ + init:'chain', + unfrequent:true, + item:{ chain:'铁索', - rotate:'横置', - mark:'标记' - }, - onclick:function(style){ - var list=[]; - for(var i=0;i1v1', - two:'2v2', + // one:'1v1', + two:'2v2', four:'4v4' }, restart:true, frequent:true, }, - ladder:{ - name:'天梯模式', - init:true, - frequent:true, - restart:true - }, - ladder_monthly:{ - name:'每月重置天梯', - init:true, - frequent:true, - }, + ladder:{ + name:'天梯模式', + init:true, + frequent:true, + restart:true + }, + ladder_monthly:{ + name:'每月重置天梯', + init:true, + frequent:true, + }, enable_all:{ name:'启用全部武将', init:false, @@ -4920,7 +4920,7 @@ name:'自由选择阵型', init:false }, - change_identity:{ + change_identity:{ name:'自由选择座位', init:true, onclick:function(bool){ @@ -4947,10 +4947,10 @@ var dialog; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; else dialog=_status.event.dialog; - if(!_status.brawl||!_status.brawl.noAddSetting){ - if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); - else _status.event.getParent().removeSetting(dialog); - } + if(!_status.brawl||!_status.brawl.noAddSetting){ + if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); + else _status.event.getParent().removeSetting(dialog); + } ui.update(); } } @@ -4974,23 +4974,23 @@ init:false, frequent:true, }, - replace_handcard_two:{ - name:'末位可换牌', - init:true, - frequent:true, + replace_handcard_two:{ + name:'末位可换牌', + init:true, + frequent:true, intro:'最后行动的角色可在开局时重铸一次手牌' - }, - replace_character_two:{ - name:'替补模式', - init:false, - frequent:true, + }, + replace_character_two:{ + name:'替补模式', + init:false, + frequent:true, intro:'每个额外选择一名武将,死亡后用该武将代替重新上场,替补武将用完时失败' - }, - expand_dialog:{ - name:'默认展开选将框', + }, + expand_dialog:{ + name:'默认展开选将框', intro:'选将框打开时直接显示全部武将(可能使游戏在开始时卡顿)', - init:false, - }, + init:false, + }, siguo_character:{ name:'专属武将出场率', init:'increase', @@ -5002,29 +5002,29 @@ frequent:true }, ban_weak:{ - name:'屏蔽弱将', + name:'屏蔽弱将', init:true, restart:true, - }, - ban_strong:{ - name:'屏蔽强将', + }, + ban_strong:{ + name:'屏蔽强将', init:false, restart:true - }, - ladder_reset:{ + }, + ladder_reset:{ name:'重置天梯数据', onclick:function(){ var node=this; if(node._clearing){ game.save('ladder',{ - current:900, - top:900, - month:(new Date()).getMonth() - }); + current:900, + top:900, + month:(new Date()).getMonth() + }); ui.ladder.innerHTML='卫士五'; - clearTimeout(node._clearing); - node.firstChild.innerHTML='重置天梯数据'; - delete node._clearing; + clearTimeout(node._clearing); + node.firstChild.innerHTML='重置天梯数据'; + delete node._clearing; return; } node.firstChild.innerHTML='单击以确认 (3)'; @@ -5043,64 +5043,64 @@ }, } }, - connect:{ - name:'联机', - config:{ - connect_nickname:{ - name:'联机昵称', - input:true, - frequent:true, - }, - connect_avatar:{ - name:'联机头像', - init:'caocao', - item:{}, - frequent:true, - onclick:function(item){ - game.saveConfig('connect_avatar',item); - game.saveConfig('connect_avatar',item,'connect'); - } - }, - hall_ip:{ - name:'联机大厅', - input:true, - frequent:true, - }, - hall_button:{ - name:'联机大厅按钮', - init:true, - frequent:true, - onclick:function(bool){ - game.saveConfig('hall_button',bool,'connect'); - if(ui.hall_button){ - if(bool){ - ui.hall_button.style.display=''; - } - else{ - ui.hall_button.style.display='none'; - } - } - } - }, + connect:{ + name:'联机', + config:{ + connect_nickname:{ + name:'联机昵称', + input:true, + frequent:true, + }, + connect_avatar:{ + name:'联机头像', + init:'caocao', + item:{}, + frequent:true, + onclick:function(item){ + game.saveConfig('connect_avatar',item); + game.saveConfig('connect_avatar',item,'connect'); + } + }, + hall_ip:{ + name:'联机大厅', + input:true, + frequent:true, + }, + hall_button:{ + name:'联机大厅按钮', + init:true, + frequent:true, + onclick:function(bool){ + game.saveConfig('hall_button',bool,'connect'); + if(ui.hall_button){ + if(bool){ + ui.hall_button.style.display=''; + } + else{ + ui.hall_button.style.display='none'; + } + } + } + }, room_button:{ name:'创建服务器按钮', - init:false, - frequent:true, + init:false, + frequent:true, intro:'开启后可创建一个空房间但不加入游戏', - onclick:function(bool){ - game.saveConfig('room_button',bool,'connect'); - if(ui.connectRoom){ - if(bool){ - ui.connectRoom.style.display=''; - } - else{ - ui.connectRoom.style.display='none'; - } - } - } + onclick:function(bool){ + game.saveConfig('room_button',bool,'connect'); + if(ui.connectRoom){ + if(bool){ + ui.connectRoom.style.display=''; + } + else{ + ui.connectRoom.style.display='none'; + } + } + } } - } - }, + } + }, boss:{ name:'挑战', config:{ @@ -5154,11 +5154,11 @@ init:true, restart:true, }, - ban_strong:{ - name:'屏蔽强将', + ban_strong:{ + name:'屏蔽强将', init:false, restart:true, - }, + }, } }, chess:{ @@ -5313,15 +5313,15 @@ }, }, ban_weak:{ - name:'屏蔽弱将', + name:'屏蔽弱将', init:true, restart:true, - }, - ban_strong:{ - name:'屏蔽强将', + }, + ban_strong:{ + name:'屏蔽强将', init:false, restart:true, - }, + }, chessscroll_speed:{ name:'边缘滚动速度', init:'20', @@ -5378,15 +5378,15 @@ init:true, }, ban_weak:{ - name:'屏蔽弱将', + name:'屏蔽弱将', init:true, restart:true, - }, - ban_strong:{ - name:'屏蔽强将', + }, + ban_strong:{ + name:'屏蔽强将', init:false, restart:true, - }, + }, chessscroll_speed:{ name:'边缘滚动速度', intro:'鼠标移至屏幕边缘时自动滚屏', @@ -5400,46 +5400,46 @@ }, } }, - brawl:{ - name:'乱斗', - config:{ - duzhansanguo:{ - name:'毒战三国', - init:true, - frequent:true - }, - daozhiyueying:{ - name:'导师月英', - init:true, - frequent:true - }, - weiwoduzun:{ - name:'唯我独尊', - init:true, - frequent:true - }, - tongxingzhizheng:{ - name:'同姓之争', - init:true, - frequent:true - }, - tongqueduopao:{ - name:'铜雀夺袍', - init:true, - frequent:true - }, - tongjiangmoshi:{ - name:'同将模式', - init:true, - frequent:true - }, - scene:{ - name:'创建场景', - init:true, - frequent:true - } - } - }, + brawl:{ + name:'乱斗', + config:{ + duzhansanguo:{ + name:'毒战三国', + init:true, + frequent:true + }, + daozhiyueying:{ + name:'导师月英', + init:true, + frequent:true + }, + weiwoduzun:{ + name:'唯我独尊', + init:true, + frequent:true + }, + tongxingzhizheng:{ + name:'同姓之争', + init:true, + frequent:true + }, + tongqueduopao:{ + name:'铜雀夺袍', + init:true, + frequent:true + }, + tongjiangmoshi:{ + name:'同将模式', + init:true, + frequent:true + }, + scene:{ + name:'创建场景', + init:true, + frequent:true + } + } + }, stone:{ name:'炉石', config:{ @@ -5534,14 +5534,14 @@ frequent:true, restart:true, }, - double_character:{ - name:'双将模式', - init:false, - frequent:true, + double_character:{ + name:'双将模式', + init:false, + frequent:true, restart:function(){ return _status.event.getParent().name!='chooseCharacter'||_status.event.name!='chooseButton'; } - }, + }, free_choose:{ name:'自由选将', init:true, @@ -5569,15 +5569,15 @@ }, }, ban_weak:{ - name:'屏蔽弱将', + name:'屏蔽弱将', init:true, restart:true, - }, - ban_strong:{ - name:'屏蔽强将', + }, + ban_strong:{ + name:'屏蔽强将', init:false, restart:true, - }, + }, } }, }, @@ -5589,7 +5589,7 @@ delayed:0, frameId:0, videoId:0, - globalId:0, + globalId:0, }, help:{ '游戏操作':'"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'; - } - }; - var dashes={}; - var createCode=function(str1,str2,sub,func,link,str){ - var dash=ui.create.div('.menubutton.large.dashboard'); - dashes[link]=dash; - sub.appendChild(dash); - dash.listen(func); - dash.link=link; - ui.create.div('',str1,dash); - ui.create.div('',str2,dash); - var container=ui.create.div('.popup-container.editor'); - var editorpage=ui.create.div(container); - var discardConfig=ui.create.div('.editbutton','取消',editorpage,function(){ - ui.window.classList.remove('shortcutpaused'); - ui.window.classList.remove('systempaused'); - container.delete(null); - delete window.saveNonameInput; - }); - var saveInput=function(){ - var code; - if(container.editor){ - code=container.editor.getValue(); - } - else if(container.textarea){ - code=container.textarea.value; - } - try{ - if(link=='content'||link=='precontent'){ - var func=null; - eval('func='+code); - if(typeof func!='function'){ - throw('err'); - } - } - else if(link=='config'){ - var config=null; - eval(code); - if(config==null||typeof config!='object'){ - throw('err'); - } - } - else if(link=='help'){ - var help=null; - eval(code); - if(help==null||typeof help!='object'){ - throw('err'); - } - } - } - catch(e){ - if(e=='err'){ - alert('代码格式有错误,请对比示例代码仔细检查'); - } - else{ - alert('代码语法有错误,请仔细检查('+e+')') - } - return; - } - dash4.link.classList.add('active'); - ui.window.classList.remove('shortcutpaused'); - ui.window.classList.remove('systempaused'); - container.delete(); - container.code=code; - page.content[link]=code; - delete window.saveNonameInput; - }; - var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput); - var editor=ui.create.div(editorpage); - container.code=str; - dash.editor=editor; - dash.node=container; - dash.saveInput=saveInput; - page.content[link]=str; - }; - var clickCode=function(){ - var node=this.node; - ui.window.classList.add('shortcutpaused'); - ui.window.classList.add('systempaused'); - window.saveNonameInput=this.saveInput; - if(node.aced){ - ui.window.appendChild(node); - node.editor.setValue(node.code,1); - } - else if(lib.device=='ios'){ - 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 editor=this.editor; - var aceReady=function(){ - ui.window.appendChild(node); - var mirror = window.CodeMirror(editor, { - value:node.code, - mode:"javascript", - lineWrapping:!lib.config.touchscreen&&lib.config.mousewheel, - lineNumbers:true, - indentUnit:4, - autoCloseBrackets:true, - theme:'mdn-like' - }); - lib.setScroll(editor.querySelector('.CodeMirror-scroll')); - node.aced=true; - node.editor=mirror; - } - if(!window.ace){ - lib.init.js(lib.assetURL+'game','codemirror',aceReady); - lib.init.css(lib.assetURL+'layout/default','codemirror'); - } - else{ - aceReady(); - } - } - }; - page.content={} - createCode('主','主代码',page,clickCode,'content','function(config,pack){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之后、界面加载之前\n参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可在此函数中修改)\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); - createCode('启','启动代码',page,clickCode,'precontent','function(){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之前,且不受禁用扩展的限制\n除添加模式外请慎用\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); - createCode('选','选项代码',page,clickCode,'config','config={\n \n}\n\n\/*\n示例:\nconfig={\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','help={\n \n}\n\n\/*\n示例:\nhelp={\n "帮助条目":"
  1. 列表2-条目1
  2. 列表2-条目2"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); + page.content={ + pack:{ + skill:{}, + translate:{} + }, + audio:{} + }; + return page; + }()); + var dash4=(function(){ + var page=ui.create.div('.hidden.menu-buttons'); + ui.create.div('.config.more.margin-bottom','
    返回',page,function(){ + ui.create.templayer(); + page.hide(); + pageboard.show(); + }); + page.reset=function(name){ + page.content={}; + if(lib.extensionPack[name]){ + for(var i in dashes){ + dashes[i].node.code=''; + } + for(var i in lib.extensionPack[name].code){ + switch(typeof lib.extensionPack[name].code[i]){ + case 'function':page.content[i]=lib.extensionPack[name].code[i].toString();break; + case 'object':page.content[i]=i+'='+get.stringify(lib.extensionPack[name].code[i]);break; + } + } + for(var i in page.content){ + dashes[i].node.code=page.content[i]||''; + } + } + else{ + dashes.content.node.code='function(config,pack){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之后、界面加载之前\n参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可在此函数中修改)\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'; + dashes.precontent.node.code='function(){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之前,且不受禁用扩展的限制\n除添加模式外请慎用\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'; + dashes.config.node.code='config={\n \n}\n\n\/*\n示例:\nconfig={\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='help={\n \n}\n\n\/*\n示例:\nhelp={\n "帮助条目":"
    • 列表1-条目1
    • 列表1-条目2
    1. 列表2-条目1
    2. 列表2-条目2"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'; + } + }; + var dashes={}; + var createCode=function(str1,str2,sub,func,link,str){ + var dash=ui.create.div('.menubutton.large.dashboard'); + dashes[link]=dash; + sub.appendChild(dash); + dash.listen(func); + dash.link=link; + ui.create.div('',str1,dash); + ui.create.div('',str2,dash); + var container=ui.create.div('.popup-container.editor'); + var editorpage=ui.create.div(container); + var discardConfig=ui.create.div('.editbutton','取消',editorpage,function(){ + ui.window.classList.remove('shortcutpaused'); + ui.window.classList.remove('systempaused'); + container.delete(null); + delete window.saveNonameInput; + }); + var saveInput=function(){ + var code; + if(container.editor){ + code=container.editor.getValue(); + } + else if(container.textarea){ + code=container.textarea.value; + } + try{ + if(link=='content'||link=='precontent'){ + var func=null; + eval('func='+code); + if(typeof func!='function'){ + throw('err'); + } + } + else if(link=='config'){ + var config=null; + eval(code); + if(config==null||typeof config!='object'){ + throw('err'); + } + } + else if(link=='help'){ + var help=null; + eval(code); + if(help==null||typeof help!='object'){ + throw('err'); + } + } + } + catch(e){ + if(e=='err'){ + alert('代码格式有错误,请对比示例代码仔细检查'); + } + else{ + alert('代码语法有错误,请仔细检查('+e+')') + } + return; + } + dash4.link.classList.add('active'); + ui.window.classList.remove('shortcutpaused'); + ui.window.classList.remove('systempaused'); + container.delete(); + container.code=code; + page.content[link]=code; + delete window.saveNonameInput; + }; + var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput); + var editor=ui.create.div(editorpage); + container.code=str; + dash.editor=editor; + dash.node=container; + dash.saveInput=saveInput; + page.content[link]=str; + }; + var clickCode=function(){ + var node=this.node; + ui.window.classList.add('shortcutpaused'); + ui.window.classList.add('systempaused'); + window.saveNonameInput=this.saveInput; + if(node.aced){ + ui.window.appendChild(node); + node.editor.setValue(node.code,1); + } + else if(lib.device=='ios'){ + 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 editor=this.editor; + var aceReady=function(){ + ui.window.appendChild(node); + var mirror = window.CodeMirror(editor, { + value:node.code, + mode:"javascript", + lineWrapping:!lib.config.touchscreen&&lib.config.mousewheel, + lineNumbers:true, + indentUnit:4, + autoCloseBrackets:true, + theme:'mdn-like' + }); + lib.setScroll(editor.querySelector('.CodeMirror-scroll')); + node.aced=true; + node.editor=mirror; + } + if(!window.ace){ + lib.init.js(lib.assetURL+'game','codemirror',aceReady); + lib.init.css(lib.assetURL+'layout/default','codemirror'); + } + else{ + aceReady(); + } + } + }; + page.content={} + createCode('主','主代码',page,clickCode,'content','function(config,pack){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之后、界面加载之前\n参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可在此函数中修改)\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); + createCode('启','启动代码',page,clickCode,'precontent','function(){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之前,且不受禁用扩展的限制\n除添加模式外请慎用\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); + createCode('选','选项代码',page,clickCode,'config','config={\n \n}\n\n\/*\n示例:\nconfig={\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','help={\n \n}\n\n\/*\n示例:\nhelp={\n "帮助条目":"
      • 列表1-条目1
      • 列表1-条目2
      1. 列表2-条目1
      2. 列表2-条目2"\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); - return page; - }()); - createDash('将','编辑武将',dash1); - createDash('卡','编辑卡牌',dash2); - createDash('技','编辑技能',dash3); - createDash('码','编辑代码',dash4); - }()); - (function(){ - var page=ui.create.div(''); - var node=ui.create.div('.menubutton.large','获取扩展',start.firstChild,clickMode); + return page; + }()); + createDash('将','编辑武将',dash1); + createDash('卡','编辑卡牌',dash2); + createDash('技','编辑技能',dash3); + createDash('码','编辑代码',dash4); + }()); + (function(){ + var page=ui.create.div(''); + var node=ui.create.div('.menubutton.large','获取扩展',start.firstChild,clickMode); node.link=page; node.mode='get'; page.listen(function(){ @@ -35050,82 +35050,82 @@ } } }); - var importextensionexpanded=false; - page.style.paddingBottom='10px'; - var importExtension; - var extensionnode=ui.create.div('.config.more','导入扩展
        >
        ',page,function(){ - if(importextensionexpanded){ - this.classList.remove('on'); - importExtension.style.display='none'; - } - else{ - this.classList.add('on'); - importExtension.style.display=''; - } - importextensionexpanded=!importextensionexpanded; - }); - importExtension=ui.create.div('.new_character.export.import',page); - importExtension.style.marginLeft='5px'; - importExtension.style.marginTop='5px'; - importExtension.style.marginBottom='5px'; - importExtension.style.display='none'; - importExtension.style.width='100%'; - importExtension.style.textAlign='left'; - ui.create.div('','',importExtension); + var importextensionexpanded=false; + page.style.paddingBottom='10px'; + var importExtension; + var extensionnode=ui.create.div('.config.more','导入扩展
        >
        ',page,function(){ + if(importextensionexpanded){ + this.classList.remove('on'); + importExtension.style.display='none'; + } + else{ + this.classList.add('on'); + importExtension.style.display=''; + } + importextensionexpanded=!importextensionexpanded; + }); + importExtension=ui.create.div('.new_character.export.import',page); + importExtension.style.marginLeft='5px'; + importExtension.style.marginTop='5px'; + importExtension.style.marginBottom='5px'; + importExtension.style.display='none'; + importExtension.style.width='100%'; + importExtension.style.textAlign='left'; + ui.create.div('','',importExtension); - var extensionURL=lib.updateURL.replace(/noname/,'noname-extension')+'/master/'; + var extensionURL=lib.updateURL.replace(/noname/,'noname-extension')+'/master/'; - var reloadnode=ui.create.div('.config.toggle.pointerdiv','重新启动',page,game.reload); - reloadnode.style.display='none'; - var placeholder=ui.create.div('.config.toggle',page); - placeholder.style.height=0; - placeholder.style.marginTop='5px'; + var reloadnode=ui.create.div('.config.toggle.pointerdiv','重新启动',page,game.reload); + reloadnode.style.display='none'; + var placeholder=ui.create.div('.config.toggle',page); + placeholder.style.height=0; + placeholder.style.marginTop='5px'; - importExtension.firstChild.lastChild.onclick=function(){ - var fileToLoad=this.previousSibling.files[0]; - if(fileToLoad){ - var fileReader = new FileReader(); - fileReader.onload = function(fileLoadedEvent) - { - var finishLoad=function(){ - extensionnode.innerHTML='导入成功,3秒后将重启'; - setTimeout(function(){ - extensionnode.innerHTML='导入成功,2秒后将重启'; - setTimeout(function(){ - extensionnode.innerHTML='导入成功,1秒后将重启'; - setTimeout(game.reload,1000); - },1000); - },1000); - }; - var data = fileLoadedEvent.target.result; - if(game.importExtension(data,finishLoad)!==false){ - importExtension.style.display='none'; - } - }; - fileReader.readAsArrayBuffer(fileToLoad, "UTF-8"); - } - } + importExtension.firstChild.lastChild.onclick=function(){ + var fileToLoad=this.previousSibling.files[0]; + if(fileToLoad){ + var fileReader = new FileReader(); + fileReader.onload = function(fileLoadedEvent) + { + var finishLoad=function(){ + extensionnode.innerHTML='导入成功,3秒后将重启'; + setTimeout(function(){ + extensionnode.innerHTML='导入成功,2秒后将重启'; + setTimeout(function(){ + extensionnode.innerHTML='导入成功,1秒后将重启'; + setTimeout(game.reload,1000); + },1000); + },1000); + }; + var data = fileLoadedEvent.target.result; + if(game.importExtension(data,finishLoad)!==false){ + importExtension.style.display='none'; + } + }; + fileReader.readAsArrayBuffer(fileToLoad, "UTF-8"); + } + } - var clickExtension=function(){ - var active=this.parentNode.querySelector('.videonode.current'); - if(active&&active!=this){ - active.classList.remove('current'); - } - this.classList.add('current'); + var clickExtension=function(){ + var active=this.parentNode.querySelector('.videonode.current'); + if(active&&active!=this){ + active.classList.remove('current'); + } + this.classList.add('current'); clearTimeout(page.currenttimeout); page.currenttimeout=setTimeout(function(){ delete page.currenttimeout; },200); - }; - var downloadExtension=function(e){ - if((this.innerHTML!='下载扩展'&&this.innerHTML!='更新扩展')||!window.JSZip) return; + }; + var downloadExtension=function(e){ + if((this.innerHTML!='下载扩展'&&this.innerHTML!='更新扩展')||!window.JSZip) return; this.classList.remove('update'); - if(e){ - e.stopPropagation(); - } - node.updated=true; - var that=this; - var list=[]; + if(e){ + e.stopPropagation(); + } + node.updated=true; + var that=this; + var list=[]; var size=parseFloat(this.info.size)||0; if(size){ if(this.info.size.indexOf('MB')!=-1){ @@ -35138,7 +35138,7 @@ this.innerHTML='正在下载
        正在下载
        '; this.classList.add('nopointer'); - this.classList.add('button-downloading'); + this.classList.add('button-downloading'); var progress=ui.create.div('.button-progress',this); ui.create.div(progress); var url=extensionURL+this.info.name+'.zip'; @@ -35175,17 +35175,17 @@ if(game.importedPack){ var extname=game.importedPack.name; if(lib.config.extensions.contains(extname)){ - game.removeExtension(extname,true); - } - lib.config.extensions.add(extname); - game.saveConfig('extensions',lib.config.extensions); - game.saveConfig('extension_'+extname+'_enable',true); + game.removeExtension(extname,true); + } + lib.config.extensions.add(extname); + game.saveConfig('extensions',lib.config.extensions); + game.saveConfig('extension_'+extname+'_enable',true); game.saveConfig('extension_'+extname+'_version',that.info.version); - for(var i in game.importedPack.config){ - if(game.importedPack.config[i]&&game.importedPack.config[i].hasOwnProperty('init')){ - game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init); - } - } + for(var i in game.importedPack.config){ + if(game.importedPack.config[i]&&game.importedPack.config[i].hasOwnProperty('init')){ + game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init); + } + } reloadnode.style.display=''; that.childNodes[0].innerHTML='安装成功'; that.childNodes[1].innerHTML='安装成功'; @@ -35207,24 +35207,24 @@ return 'extension/'+current.slice(extensionURL.length); }); }); - }; + }; - node.update=function(){ - if(this.updated) return; - if(!window.JSZip){ - lib.init.js(lib.assetURL+'game','jszip'); - } - var toremove=[]; - for(var i=0;i('+list[i].size+')',node); - ui.create.div('.text',list[i].intro,node); - var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild); + ui.create.div('.text',list[i].intro,node); + var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild); if(game.download){ if(list[i].netdisk){ var linknode=ui.create.div('.text',node); @@ -35255,25 +35255,25 @@ } } download.listen(downloadExtension); - if(lib.config.extensions.contains(list[i].name)){ - download.classList.remove('active'); + if(lib.config.extensions.contains(list[i].name)){ + download.classList.remove('active'); if(lib.extensionPack[list[i].name]&&lib.extensionPack[list[i].name].version==list[i].version){ download.classList.add('transparent2'); - download.classList.remove('active'); - download.innerHTML='已安装'; + download.classList.remove('active'); + download.innerHTML='已安装'; } - else if(lib.config['extension_'+list[i].name+'_version']!=list[i].version){ - download.innerHTML='更新扩展'; - download.classList.add('highlight'); + else if(lib.config['extension_'+list[i].name+'_version']!=list[i].version){ + download.innerHTML='更新扩展'; + download.classList.add('highlight'); download.classList.add('update'); - } - else{ - download.classList.add('transparent2'); - download.classList.remove('active'); - download.innerHTML='已安装'; - } - } - download.info=list[i]; + } + else{ + download.classList.add('transparent2'); + download.classList.remove('active'); + download.innerHTML='已安装'; + } + } + download.info=list[i]; } else{ if(list[i].forum){ @@ -35316,23 +35316,23 @@ loading.innerHTML='连接失败'; }); } - }; - }()); + }; + }()); var active=start.firstChild.querySelector('.active'); - if(!active){ - active=start.firstChild.firstChild; - active.classList.add('active'); - } + if(!active){ + active=start.firstChild.firstChild; + active.classList.add('active'); + } rightPane.appendChild(active.link); updateNodes(); }()); (function(){ - if(connectMenu) return; + if(connectMenu) return; var start=menuxpages.shift(); var rightPane=start.lastChild; var cheatButton=ui.create.div('.menubutton.round.highlight','作',start); - cheatButton.style.display='none'; + cheatButton.style.display='none'; var runButton=ui.create.div('.menubutton.round.highlight','执',start); runButton.style.display='none'; var clearButton=ui.create.div('.menubutton.round.highlight','清',start); @@ -35394,15 +35394,15 @@ ui.click.menuTab('其它'); clickMode.call(ui.commandnode); }; - (function(){ - var page=ui.create.div(''); - var node=ui.create.div('.menubutton.large','更新',start.firstChild,clickMode); - node.link=page; - page.classList.add('menu-help'); - var ul=document.createElement('ul'); - var li1=document.createElement('li'); - var li2=document.createElement('li'); - var li3=document.createElement('li'); + (function(){ + var page=ui.create.div(''); + var node=ui.create.div('.menubutton.large','更新',start.firstChild,clickMode); + node.link=page; + page.classList.add('menu-help'); + var ul=document.createElement('ul'); + var li1=document.createElement('li'); + var li2=document.createElement('li'); + var li3=document.createElement('li'); var trimurl=function(str){ if(str==lib.updateURL){ return 'GitHub'; @@ -35441,37 +35441,37 @@ } return str; } - li1.innerHTML='游戏版本:'+lib.version+'

        '; - li2.innerHTML='素材版本:'+(lib.config.asset_version||'无')+'

        '; + li1.innerHTML='游戏版本:'+lib.version+'

        '; + li2.innerHTML='素材版本:'+(lib.config.asset_version||'无')+'

        '; li3.innerHTML='更新地址:'+trimurl(lib.config.updateURL||lib.updateURL)+'

        '; li3.style.whiteSpace='nowrap'; // li3.style.display='none';// coding - var button1,button2,button3,button4,button5; + var button1,button2,button3,button4,button5; - game.checkForUpdate=function(forcecheck,dev){ - if(!dev&&button1.disabled){ - return; - } - else if(dev&&button3.disabled){ - return; - } - else if(!game.download){ - alert('此版本不支持游戏内更新,请手动更新'); - return; - } - else{ - if(dev){ - button3.innerHTML='正在检查更新'; - } - else{ - button1.innerHTML='正在检查更新'; - } - button3.disabled=true; - button1.disabled=true; + game.checkForUpdate=function(forcecheck,dev){ + if(!dev&&button1.disabled){ + return; + } + else if(dev&&button3.disabled){ + return; + } + else if(!game.download){ + alert('此版本不支持游戏内更新,请手动更新'); + return; + } + else{ + if(dev){ + button3.innerHTML='正在检查更新'; + } + else{ + button1.innerHTML='正在检查更新'; + } + button3.disabled=true; + button1.disabled=true; - var goupdate=function(files,update){ - lib.version=update.version; + var goupdate=function(files,update){ + lib.version=update.version; if(update.dev&&!lib.config.debug){ dev='nodev'; } @@ -35490,31 +35490,31 @@ var updates=window.noname_source_list; delete window.noname_source_list; - if(Array.isArray(files)){ - files.add('game/update.js'); - var files2=[]; - for(var i=0;iversion1[i]){ - files=false;break; - } - else if(version1[i]>version2[i]){ - files=update.files.slice(0);break; - } - } - if(files===null){ - if(version1.length>=version2.length){ - files=update.files.slice(0); - } - } - } - var str; - if(dev){ - str='开发版仅供测试使用,可能存在风险,是否确定更新?' - } - else{ - str='有新版本'+update.version+'可用,是否下载?'; - } - if(navigator.notification&&navigator.notification.confirm){ - var str2; - if(dev){ - str2=str; - str='更新到开发版'; - } - else{ - str2=update.changeLog[0]; - for(var i=1;iversion1[i]){ + files=false;break; + } + else if(version1[i]>version2[i]){ + files=update.files.slice(0);break; + } + } + if(files===null){ + if(version1.length>=version2.length){ + files=update.files.slice(0); + } + } + } + var str; + if(dev){ + str='开发版仅供测试使用,可能存在风险,是否确定更新?' + } + else{ + str='有新版本'+update.version+'可用,是否下载?'; + } + if(navigator.notification&&navigator.notification.confirm){ + var str2; + if(dev){ + str2=str; + str='更新到开发版'; + } + else{ + str2=update.changeLog[0]; + for(var i=1;i>'); - span1.style.fontSize='small'; - span1.style.display='inline'; + var span1=ui.create.div('.config.more','选项
        >
        '); + span1.style.fontSize='small'; + span1.style.display='inline'; span1.toggle=function(){ - if(!this.classList.toggle('on')){ + if(!this.classList.toggle('on')){ game.saveConfig('asset_toggle_off',true); - span2.style.display='none'; + span2.style.display='none'; span2_br.style.display='none'; - span2_check.style.display='none'; - span3.style.display='none'; + span2_check.style.display='none'; + span3.style.display='none'; span3_br.style.display='none'; - span3_check.style.display='none'; - span4.style.display='none'; + span3_check.style.display='none'; + span4.style.display='none'; span4_br.style.display='none'; - span4_check.style.display='none'; - span5.style.display='none'; + span4_check.style.display='none'; + span5.style.display='none'; span5_br.style.display='none'; - span5_check.style.display='none'; - span6.style.display='none'; + span5_check.style.display='none'; + span6.style.display='none'; span6_br.style.display='none'; - span6_check.style.display='none'; - } - else{ + span6_check.style.display='none'; + } + else{ game.saveConfig('asset_toggle_off'); span2.style.display=''; - span2_br.style.display=''; - span2_check.style.display=''; + span2_br.style.display=''; + span2_check.style.display=''; span3.style.display=''; - span3_br.style.display=''; - span3_check.style.display=''; + span3_br.style.display=''; + span3_check.style.display=''; span4.style.display=''; - span4_br.style.display=''; - span4_check.style.display=''; + span4_br.style.display=''; + span4_check.style.display=''; span5.style.display=''; - span5_br.style.display=''; - span5_check.style.display=''; + span5_br.style.display=''; + span5_check.style.display=''; span6.style.display=''; - span6_br.style.display=''; - span6_check.style.display=''; - } - }; - span1.listen(span1.toggle); - li2.lastChild.appendChild(span1); + span6_br.style.display=''; + span6_check.style.display=''; + } + }; + span1.listen(span1.toggle); + li2.lastChild.appendChild(span1); - var span6_br=ui.create.node('br'); - li2.lastChild.appendChild(span6_br); + var span6_br=ui.create.node('br'); + li2.lastChild.appendChild(span6_br); - var span5=ui.create.div('','图片素材(精简,35MB)'); + var span5=ui.create.div('','图片素材(精简,35MB)'); span5.style.fontSize='small'; - span5.style.lineHeight='16px'; - var span5_check=document.createElement('input'); - span5_check.type='checkbox'; - span5_check.style.marginLeft='5px'; - if(lib.config.asset_image){ - span5_check.checked=true; - } - span5_check.onchange=function(){ - game.saveConfig('asset_image',this.checked); - } - var span2_br=ui.create.node('br'); + span5.style.lineHeight='16px'; + var span5_check=document.createElement('input'); + span5_check.type='checkbox'; + span5_check.style.marginLeft='5px'; + if(lib.config.asset_image){ + span5_check.checked=true; + } + span5_check.onchange=function(){ + game.saveConfig('asset_image',this.checked); + } + var span2_br=ui.create.node('br'); - var span4=ui.create.div('','字体素材(16MB)'); - span4.style.fontSize='small'; - span4.style.lineHeight='16px'; - li2.lastChild.appendChild(span4); - var span4_check=document.createElement('input'); - span4_check.type='checkbox'; - span4_check.style.marginLeft='5px'; - if(lib.config.asset_font){ - span4_check.checked=true; - } - span4_check.onchange=function(){ - game.saveConfig('asset_font',this.checked); - } - li2.lastChild.appendChild(span4_check); - var span3_br=ui.create.node('br'); - li2.lastChild.appendChild(span3_br); + var span4=ui.create.div('','字体素材(16MB)'); + span4.style.fontSize='small'; + span4.style.lineHeight='16px'; + li2.lastChild.appendChild(span4); + var span4_check=document.createElement('input'); + span4_check.type='checkbox'; + span4_check.style.marginLeft='5px'; + if(lib.config.asset_font){ + span4_check.checked=true; + } + span4_check.onchange=function(){ + game.saveConfig('asset_font',this.checked); + } + li2.lastChild.appendChild(span4_check); + var span3_br=ui.create.node('br'); + li2.lastChild.appendChild(span3_br); - var span3=ui.create.div('','音效素材(36MB)'); - span3.style.fontSize='small'; - span3.style.lineHeight='16px'; - li2.lastChild.appendChild(span3); - var span3_check=document.createElement('input'); - span3_check.type='checkbox'; - span3_check.style.marginLeft='5px'; - if(lib.config.asset_audio){ - span3_check.checked=true; - } - span3_check.onchange=function(){ - game.saveConfig('asset_audio',this.checked); - } - li2.lastChild.appendChild(span3_check); - var span4_br=ui.create.node('br'); - li2.lastChild.appendChild(span4_br); + var span3=ui.create.div('','音效素材(36MB)'); + span3.style.fontSize='small'; + span3.style.lineHeight='16px'; + li2.lastChild.appendChild(span3); + var span3_check=document.createElement('input'); + span3_check.type='checkbox'; + span3_check.style.marginLeft='5px'; + if(lib.config.asset_audio){ + span3_check.checked=true; + } + span3_check.onchange=function(){ + game.saveConfig('asset_audio',this.checked); + } + li2.lastChild.appendChild(span3_check); + var span4_br=ui.create.node('br'); + li2.lastChild.appendChild(span4_br); - var span2=ui.create.div('','皮肤素材(23MB)'); - span2.style.fontSize='small'; - span2.style.lineHeight='16px'; - li2.lastChild.appendChild(span2); - var span2_check=document.createElement('input'); - span2_check.type='checkbox'; - span2_check.style.marginLeft='5px'; - if(lib.config.asset_skin){ - span2_check.checked=true; - } - span2_check.onchange=function(){ - game.saveConfig('asset_skin',this.checked); - } - li2.lastChild.appendChild(span2_check); - var span5_br=ui.create.node('br'); - li2.lastChild.appendChild(span5_br); + var span2=ui.create.div('','皮肤素材(23MB)'); + span2.style.fontSize='small'; + span2.style.lineHeight='16px'; + li2.lastChild.appendChild(span2); + var span2_check=document.createElement('input'); + span2_check.type='checkbox'; + span2_check.style.marginLeft='5px'; + if(lib.config.asset_skin){ + span2_check.checked=true; + } + span2_check.onchange=function(){ + game.saveConfig('asset_skin',this.checked); + } + li2.lastChild.appendChild(span2_check); + var span5_br=ui.create.node('br'); + li2.lastChild.appendChild(span5_br); - li2.lastChild.appendChild(span5); - li2.lastChild.appendChild(span5_check); - li2.lastChild.appendChild(span2_br); + li2.lastChild.appendChild(span5); + li2.lastChild.appendChild(span5_check); + li2.lastChild.appendChild(span2_br); - var span6=ui.create.div('','图片素材(完整,96MB)'); - span6.style.fontSize='small'; - span6.style.lineHeight='16px'; - li2.lastChild.appendChild(span6); - var span6_check=document.createElement('input'); - span6_check.type='checkbox'; - span6_check.style.marginLeft='5px'; - if(lib.config.asset_full){ - span6_check.checked=true; - } - span6_check.onchange=function(){ - game.saveConfig('asset_full',this.checked); - } - li2.lastChild.appendChild(span6_check); + var span6=ui.create.div('','图片素材(完整,96MB)'); + span6.style.fontSize='small'; + span6.style.lineHeight='16px'; + li2.lastChild.appendChild(span6); + var span6_check=document.createElement('input'); + span6_check.type='checkbox'; + span6_check.style.marginLeft='5px'; + if(lib.config.asset_full){ + span6_check.checked=true; + } + span6_check.onchange=function(){ + game.saveConfig('asset_full',this.checked); + } + li2.lastChild.appendChild(span6_check); span2.style.display='none'; - span2_br.style.display='none'; - span2_check.style.display='none'; + span2_br.style.display='none'; + span2_check.style.display='none'; span3.style.display='none'; - span3_br.style.display='none'; - span3_check.style.display='none'; + span3_br.style.display='none'; + span3_check.style.display='none'; span4.style.display='none'; - span4_br.style.display='none'; - span4_check.style.display='none'; + span4_br.style.display='none'; + span4_check.style.display='none'; span5.style.display='none'; - span5_br.style.display='none'; - span5_check.style.display='none'; + span5_br.style.display='none'; + span5_check.style.display='none'; span6.style.display='none'; - span6_br.style.display='none'; - span6_check.style.display='none'; + span6_br.style.display='none'; + span6_check.style.display='none'; - ul.appendChild(li1); + ul.appendChild(li1); ul.appendChild(li2); ul.appendChild(li3); - page.appendChild(ul); + page.appendChild(ul); if(!lib.config.asset_toggle_off){ span1.toggle(); } - }()); + }()); (function(){ var norow2=function(){ var node=currentrow1; @@ -36279,13 +36279,13 @@ menuUpdates.push(function(){ if(_status.video||_status.connectMode){ node.classList.add('off'); - if(node.classList.contains('active')){ - node.classList.remove('active'); + if(node.classList.contains('active')){ + node.classList.remove('active'); node.link.remove(); active=start.firstChild.firstChild; active.classList.add('active'); rightPane.appendChild(active.link); - } + } page.remove(); cheatButton.remove(); @@ -36343,129 +36343,129 @@ (function(){ var page=ui.create.div(''); var node=ui.create.div('.menubutton.large','命令',start.firstChild,clickMode); - ui.commandnode=node; + ui.commandnode=node; node.type='cmd'; node.link=page; page.classList.add('menu-sym'); - menuUpdates.push(function(){ + menuUpdates.push(function(){ if(_status.connectMode&&!lib.config.debug){ node.classList.add('off'); - if(node.classList.contains('active')){ - node.classList.remove('active'); + if(node.classList.contains('active')){ + node.classList.remove('active'); node.link.remove(); active=start.firstChild.firstChild; active.classList.add('active'); rightPane.appendChild(active.link); - } - } - }); + } + } + }); var text=document.createElement('div'); text.style.width='194px'; - text.style.height='124px'; + text.style.height='124px'; text.style.padding='3px'; - text.style.borderRadius='2px'; - text.style.boxShadow='rgba(0, 0, 0, 0.2) 0 0 0 1px'; - text.style.textAlign='left'; - text.style.webkitUserSelect='initial'; - text.style.overflow='scroll'; - text.style.position='absolute'; - text.style.left='30px'; - text.style.top='50px'; - text.style.wordBreak='break-all'; + text.style.borderRadius='2px'; + text.style.boxShadow='rgba(0, 0, 0, 0.2) 0 0 0 1px'; + text.style.textAlign='left'; + text.style.webkitUserSelect='initial'; + text.style.overflow='scroll'; + text.style.position='absolute'; + text.style.left='30px'; + text.style.top='50px'; + text.style.wordBreak='break-all'; var pre=ui.create.node('pre.fullsize',text); pre.style.margin=0; pre.style.padding=0; pre.style.position='relative'; - lib.setScroll(pre); + lib.setScroll(pre); page.appendChild(text); // var caption=ui.create.div('','输入命令',page); // caption.style.margin='6px'; - // caption.style.position='absolute'; - // caption.style.width='120px'; - // caption.style.top='129px'; - // caption.style.left='64px'; + // caption.style.position='absolute'; + // caption.style.width='120px'; + // caption.style.top='129px'; + // caption.style.left='64px'; var text2=document.createElement('input'); - text2.style.width='200px'; - text2.style.height='20px'; + text2.style.width='200px'; + text2.style.height='20px'; text2.style.padding='0'; - text2.style.position='absolute'; - text2.style.top='15px'; - text2.style.left='30px'; + text2.style.position='absolute'; + text2.style.top='15px'; + text2.style.left='30px'; text2.style.resize='none'; - text2.style.border='none'; - text2.style.borderRadius='2px'; - text2.style.boxShadow='rgba(0, 0, 0, 0.2) 0 0 0 1px'; - var g={}; - var logs=[]; - var logindex=-1; - var cheat=lib.cheat; - var runCommand=function(e){ - if(text2.value&&!['up','down'].contains(text2.value)){ - logindex=-1; - logs.unshift(text2.value); - } - if(text2.value=='cls'){ - pre.innerHTML=''; - text2.value=''; - } + text2.style.border='none'; + text2.style.borderRadius='2px'; + text2.style.boxShadow='rgba(0, 0, 0, 0.2) 0 0 0 1px'; + var g={}; + var logs=[]; + var logindex=-1; + var cheat=lib.cheat; + var runCommand=function(e){ + if(text2.value&&!['up','down'].contains(text2.value)){ + logindex=-1; + logs.unshift(text2.value); + } + if(text2.value=='cls'){ + pre.innerHTML=''; + text2.value=''; + } else if(text2.value=='up'){ if(logindex+1=0){ - logindex--; - if(logindex<0){ - text2.value=''; - } - else{ - text2.value=logs[logindex]; - } - } + logindex--; + if(logindex<0){ + text2.value=''; + } + else{ + text2.value=logs[logindex]; + } + } else{ - text2.value=''; + text2.value=''; } } - else{ - try{ - var result=eval(text2.value); - game.print(result); - } - catch(e){ - game.print(e); - } - text2.value=''; - } - } - text2.addEventListener('keydown',function(e){ - if(e.keyCode==13){ - runCommand(); - } - else if(e.keyCode==38){ - if(logindex+1=0){ - logindex--; - if(logindex<0){ - text2.value=''; - } - else{ - text2.value=logs[logindex]; - } - } - } - }); + else{ + try{ + var result=eval(text2.value); + game.print(result); + } + catch(e){ + game.print(e); + } + text2.value=''; + } + } + text2.addEventListener('keydown',function(e){ + if(e.keyCode==13){ + runCommand(); + } + else if(e.keyCode==38){ + if(logindex+1=0){ + logindex--; + if(logindex<0){ + text2.value=''; + } + else{ + text2.value=logs[logindex]; + } + } + } + }); page.appendChild(text2); game.print=function(){ - var textstr=''; + var textstr=''; for(var i=0;iposition2){ - position.insertBefore(node,position.childNodes[position2]); - } - else{ - position.appendChild(node); - } - } - return node; + for(var i=0;iposition2){ + position.insertBefore(node,position.childNodes[position2]); + } + else{ + position.appendChild(node); + } + } + return node; }, - giveup:function(){ - if(ui.giveup) return; + giveup:function(){ + if(ui.giveup) return; if(!lib.config.show_giveup) return; - ui.giveup=ui.create.system('投降',function(){ - var player=game.me; - this.remove(); - if(game.online){ - game.send('giveup',player); - } - else{ + ui.giveup=ui.create.system('投降',function(){ + var player=game.me; + this.remove(); + if(game.online){ + game.send('giveup',player); + } + else{ _status.event.next.length=0; game.createEvent('giveup',false).setContent(function(){ game.log(player,'投降'); - player.popup('投降'); + player.popup('投降'); player.die('nosource'); }).player=player; - } - if(_status.paused&&_status.imchoosing&&!_status.auto){ - ui.click.auto(); - } - },true); - }, + } + if(_status.paused&&_status.imchoosing&&!_status.auto){ + ui.click.auto(); + } + },true); + }, groupControl:function(dialog){ return ui.create.control('wei','shu','wu','qun',function(link,node){ if(link=='全部'){ @@ -36926,9 +36926,9 @@ } return ui.create.characterDialog.apply(this,args); }, - characterDialog2:function(filter){ - var list=[]; - for(var i in lib.character){ + characterDialog2:function(filter){ + var list=[]; + for(var i in lib.character){ if(lib.character[i][4].contains('minskin')) continue; if(lib.character[i][4].contains('boss')||lib.character[i][4].contains('hiddenboss')){ if(lib.config.mode=='boss') continue; @@ -36938,32 +36938,32 @@ if(lib.character[i][4].contains('stonehidden')) continue; if(lib.config.banned.contains(i)) continue; if(filter&&filter(i)) continue; - list.push(i); - } + list.push(i); + } var dialog=ui.create.dialog('hidden'); - dialog.classList.add('noupdate'); - dialog.classList.add('scroll1'); + dialog.classList.add('noupdate'); + dialog.classList.add('scroll1'); dialog.classList.add('scroll2'); - dialog.classList.add('scroll3'); - list.sort(lib.sort.character); + dialog.classList.add('scroll3'); + list.sort(lib.sort.character); dialog.classList.add('character'); - dialog.classList.add('choose-character'); - var getPack=function(name){ - for(var i in lib.characterPack){ - if(lib.characterPack[i][name]) return i; - } - return null; - } - var packs={}; - var packnode=ui.create.div('.packnode',dialog); - lib.setScroll(packnode); - var clickCapt=function(){ - var active=this.parentNode.querySelector('.active'); - if(active){ - active.classList.remove('active'); - } - this.classList.add('active'); - for(var i=0;ib?1:-1; }); - if(!thisiscard){ - namecapt.remove('自定义'); - namecapt.push('newline'); - for(var i in lib.characterDialogGroup){ - namecapt.push(i); - } - } - var newlined=false; - var newlined2; - var packsource; + if(!thisiscard){ + namecapt.remove('自定义'); + namecapt.push('newline'); + for(var i in lib.characterDialogGroup){ + namecapt.push(i); + } + } + var newlined=false; + var newlined2; + var packsource; var clickCapt=function(e){ if(_status.dragged) return; - if(dialog.currentcapt2=='最近'&&dialog.currentcaptnode2!=this&&!dialog.currentcaptnode2.inited){ - dialog.currentcapt2=null; - dialog.currentcaptnode2.classList.remove('thundertext'); - dialog.currentcaptnode2.inited=true; - dialog.currentcaptnode2=null; - } - if(this.alphabet){ - if(this.classList.contains('thundertext')){ - dialog.currentcapt=null; - dialog.currentcaptnode=null; - this.classList.remove('thundertext'); + if(dialog.currentcapt2=='最近'&&dialog.currentcaptnode2!=this&&!dialog.currentcaptnode2.inited){ + dialog.currentcapt2=null; + dialog.currentcaptnode2.classList.remove('thundertext'); + dialog.currentcaptnode2.inited=true; + dialog.currentcaptnode2=null; + } + if(this.alphabet){ + if(this.classList.contains('thundertext')){ + dialog.currentcapt=null; + dialog.currentcaptnode=null; + this.classList.remove('thundertext'); if(this.touchlink){ this.touchlink.classList.remove('active'); } - for(var i=0;ibb?1:-1; }); dialog=ui.create.dialog('hidden'); - dialog.classList.add('noupdate'); - dialog.classList.add('scroll1'); + dialog.classList.add('noupdate'); + dialog.classList.add('scroll1'); dialog.classList.add('scroll2'); - dialog.classList.add('scroll3'); - dialog.addEventListener(lib.config.touchscreen?'touchend':'mouseup',function(){ - _status.clicked2=true; - }); + dialog.classList.add('scroll3'); + dialog.addEventListener(lib.config.touchscreen?'touchend':'mouseup',function(){ + _status.clicked2=true; + }); if(heightset){ dialog.style.height=(game.layout=='long2'?380:350)+'px'; dialog._scrollset=true; } - dialog.getCurrentCapt=function(link,capt,noalph){ - var currentcapt=noalph?this.currentcapt2:this.currentcapt; - if(this.seperatelist&&noalph){ - if(this.seperatelist[currentcapt].contains(link)) return capt; - return null; - } - if(lib.characterDialogGroup[currentcapt]){ - return lib.characterDialogGroup[currentcapt](link,capt); - } - if(lib.characterPack[currentcapt]){ - if(lib.characterPack[currentcapt][link]){ - return capt; - } - return null; - } - return this.currentcapt; - } + dialog.getCurrentCapt=function(link,capt,noalph){ + var currentcapt=noalph?this.currentcapt2:this.currentcapt; + if(this.seperatelist&&noalph){ + if(this.seperatelist[currentcapt].contains(link)) return capt; + return null; + } + if(lib.characterDialogGroup[currentcapt]){ + return lib.characterDialogGroup[currentcapt](link,capt); + } + if(lib.characterPack[currentcapt]){ + if(lib.characterPack[currentcapt][link]){ + return capt; + } + return null; + } + return this.currentcapt; + } if(str){ dialog.add(str); } @@ -37572,32 +37572,32 @@ if(seperate){ seperate=seperate(list); dialog.seperate=[]; - dialog.seperatelist=seperate.list; - if(dialog.seperatelist){ - newlined=document.createElement('div'); - newlined.style.marginTop='5px'; - newlined.style.display='block'; - newlined.style.fontFamily='xinwei'; - if(get.is.phoneLayout()){ - newlined.style.fontSize='32px'; - } - else{ - newlined.style.fontSize='22px'; - } - newlined.style.textAlign='center'; - node.appendChild(newlined); - for(var i in dialog.seperatelist){ - var span=document.createElement('span'); - span.style.margin='3px'; - span.innerHTML=i; - span.link=i; - span.seperate=true; - span.addEventListener(lib.config.touchscreen?'touchend':'click',clickCapt); - newlined.appendChild(span); - } - } + dialog.seperatelist=seperate.list; + if(dialog.seperatelist){ + newlined=document.createElement('div'); + newlined.style.marginTop='5px'; + newlined.style.display='block'; + newlined.style.fontFamily='xinwei'; + if(get.is.phoneLayout()){ + newlined.style.fontSize='32px'; + } + else{ + newlined.style.fontSize='22px'; + } + newlined.style.textAlign='center'; + node.appendChild(newlined); + for(var i in dialog.seperatelist){ + var span=document.createElement('span'); + span.style.margin='3px'; + span.innerHTML=i; + span.link=i; + span.seperate=true; + span.addEventListener(lib.config.touchscreen?'touchend':'click',clickCapt); + newlined.appendChild(span); + } + } for(var i in seperate){ - if(i=='list') continue; + if(i=='list') continue; var link=''; var linkcontent=seperate[i]; if(i.indexOf('_link:')!=-1){ @@ -37632,18 +37632,18 @@ dialog.buttons[i].capt=getCapt(dialog.buttons[i].link); } } - if(!expandall){ - if(!thisiscard&&(lib.characterDialogGroup[lib.config.character_dialog_tool]|| - lib.config.character_dialog_tool=='自创')){ - clickCapt.call(node[lib.config.character_dialog_tool]); - } - } + if(!expandall){ + if(!thisiscard&&(lib.characterDialogGroup[lib.config.character_dialog_tool]|| + lib.config.character_dialog_tool=='自创')){ + clickCapt.call(node[lib.config.character_dialog_tool]); + } + } return dialog; }, dialog:function(){ var i; var hidden=false; - var notouchscroll=false; + var notouchscroll=false; var forcebutton=false; var dialog=ui.create.div('.dialog'); dialog.contentContainer=ui.create.div('.content-container',dialog); @@ -37656,7 +37656,7 @@ } for(i=0;i