diff --git a/card/ex.js b/card/ex.js
index 64dadeb50..1f1c24404 100755
--- a/card/ex.js
+++ b/card/ex.js
@@ -1,5 +1,6 @@
'use strict';
card.ex={
+ connect:true,
card:{
hanbing:{
fullskin:true,
diff --git a/card/extra.js b/card/extra.js
index ba6bef7f7..3e726e46b 100755
--- a/card/extra.js
+++ b/card/extra.js
@@ -1,4 +1,5 @@
card.extra={
+ connect:true,
card:{
jiu:{
audio:true,
diff --git a/card/hearth.js b/card/hearth.js
index b6036e894..dfefdb243 100644
--- a/card/hearth.js
+++ b/card/hearth.js
@@ -1,6 +1,5 @@
'use strict';
card.hearth={
- // forbid:['stone'],
card:{
linghunzhihuo:{
fullskin:true,
diff --git a/card/mingzhong.js b/card/mingzhong.js
index 3bf53c588..a736d1b19 100644
--- a/card/mingzhong.js
+++ b/card/mingzhong.js
@@ -1,5 +1,6 @@
'use strict';
card.mingzhong={
+ connect:true,
card:{
shengdong:{
fullskin:true,
diff --git a/card/refresh.js b/card/refresh.js
index 3b5cf330c..e3dadd33d 100755
--- a/card/refresh.js
+++ b/card/refresh.js
@@ -1,5 +1,6 @@
'use strict';
card.refresh={
+ connect:true,
card:{
muniu:{
fullskin:true,
diff --git a/card/standard.js b/card/standard.js
index 98d96519c..d570db5c4 100755
--- a/card/standard.js
+++ b/card/standard.js
@@ -1,5 +1,6 @@
'use strict';
card.standard={
+ connect:true,
card:{
damage:{
ai:{
diff --git a/character/refresh.js b/character/refresh.js
index c882388a8..08dd922fb 100755
--- a/character/refresh.js
+++ b/character/refresh.js
@@ -155,7 +155,9 @@ character.refresh={
}
ui.discardPile.appendChild(trigger.player.judging[0]);
trigger.player.judging[0]=result.cards[0];
- trigger.position.appendChild(result.cards[0]);
+ if(!get.owner(result.cards[0],'judge')){
+ trigger.position.appendChild(result.cards[0]);
+ }
game.log(trigger.player,'的判定牌改为',result.cards[0]);
game.delay(2);
}
diff --git a/character/shenhua.js b/character/shenhua.js
index 7511f869c..d5ba9245d 100644
--- a/character/shenhua.js
+++ b/character/shenhua.js
@@ -1,5 +1,6 @@
'use strict';
character.shenhua={
+ connect:true,
character:{
xiahouyuan:['male','wei',4,['shensu']],
caoren:['male','wei',4,['jushou','jiewei']],
@@ -708,7 +709,7 @@ character.shenhua={
return (player!=zhu&&player.group=='wu'&&player.num('h')>0&&zhu.num('h')>0);
},
filterTarget:function(card,player,target){
- return target.isZhu&&target.get('s').contains('zhiba');
+ return player!=target&&target.isZhu&&target.get('s').contains('zhiba');
},
usable:1,
content:function(){
@@ -2895,7 +2896,9 @@ character.shenhua={
player.$gain2(trigger.player.judging[0]);
player.gain(trigger.player.judging[0]);
trigger.player.judging[0]=result.cards[0];
- trigger.position.appendChild(result.cards[0]);
+ if(!get.owner(result.cards[0],'judge')){
+ trigger.position.appendChild(result.cards[0]);
+ }
game.log(trigger.player,'的判定牌改为',result.cards[0]);
}
"step 3"
@@ -2944,7 +2947,7 @@ character.shenhua={
return (card.name=='shan'||card.name=='shandian')
},
filterTarget:function(card,player,target){
- return target.isZhu&&target.get('s').contains('huangtian');
+ return player!=target&&target.isZhu&&target.get('s').contains('huangtian');
},
usable:1,
forceaudio:true,
diff --git a/character/standard.js b/character/standard.js
index 6ad65d5f6..4eda9b08e 100755
--- a/character/standard.js
+++ b/character/standard.js
@@ -1,5 +1,6 @@
'use strict';
character.standard={
+ connect:true,
character:{
caocao:['male','wei',4,['hujia','jianxiong'],['zhu']],
simayi:['male','wei',3,['fankui','guicai']],
@@ -183,7 +184,9 @@ character.standard={
}
ui.discardPile.appendChild(trigger.player.judging[0]);
trigger.player.judging[0]=result.cards[0];
- trigger.position.appendChild(result.cards[0]);
+ if(!get.owner(result.cards[0],'judge')){
+ trigger.position.appendChild(result.cards[0]);
+ }
game.log(trigger.player,'的判定牌改为',result.cards[0]);
game.delay(2);
}
diff --git a/character/swd.js b/character/swd.js
index dba0947b6..64e093ec8 100755
--- a/character/swd.js
+++ b/character/swd.js
@@ -1261,6 +1261,14 @@ character.swd={
}
}
else{
+ var hasFriend=false;
+ for(var i=0;i1&&
+ player!=game.players[i]&&ai.get.attitude(player,game.players[i]>0)){
+ hasFriend=true;break;
+ }
+ }
+ if(!hasFriend) return;
var hs=target.num('h');
if(get.tag(card,'respondShan')){
var shans=target.num('h','shan');
diff --git a/game/config.js b/game/config.js
index d0beecebf..64dba6032 100755
--- a/game/config.js
+++ b/game/config.js
@@ -259,6 +259,8 @@ window.config={
cards:['standard','ex','extra','refresh'],
characters:['standard','shenhua','refresh','sp','yijiang'],
+ connect_characters:[],
+ connect_cards:[],
plays:[],
extensions:[],
banned:[],
diff --git a/game/game.js b/game/game.js
index 8cb2e8f33..5df100266 100755
--- a/game/game.js
+++ b/game/game.js
@@ -1642,28 +1642,79 @@
mode:{
identity:{
name:'身份',
- connect:true,
+ connect:{
+ update:function(config,map){
+ if(config.connect_identity_mode=='zhong'){
+ map.connect_player_number.hide();
+ map.connect_enhance_zhu.hide();
+ map.connect_double_nei.hide();
+ }
+ else{
+ map.connect_player_number.show();
+ map.connect_enhance_zhu.show();
+ if(config.connect_player_number!='2'){
+ map.connect_double_nei.show();
+ }
+ else{
+ map.connect_double_nei.hide();
+ }
+ }
+ },
+ connect_identity_mode:{
+ name:'游戏模式',
+ init:'normal',
+ item:{
+ normal:'普通',
+ zhong:'明忠'
+ },
+ restart:true,
+ frequent:true,
+ },
+ connect_player_number:{
+ name:'游戏人数',
+ init:'8',
+ item:{
+ '2':'两人',
+ '3':'三人',
+ '4':'四人',
+ '5':'五人',
+ '6':'六人',
+ '7':'七人',
+ '8':'八人'
+ },
+ frequent:true,
+ restart:true,
+ },
+ connect_double_nei:{
+ name:'双内奸',
+ init:false,
+ restart:true,
+ frequent:true,
+ },
+ connect_double_character:{
+ name:'双将模式',
+ init:false,
+ frequent:true,
+ restart:true,
+ },
+ connect_ban_weak:{
+ name:'屏蔽弱将',
+ init:true,
+ restart:true,
+ },
+ connect_ban_strong:{
+ name:'屏蔽强将',
+ init:false,
+ restart:true,
+ },
+ connect_enhance_zhu:{
+ name:'加强主公',
+ init:false,
+ restart:true,
+ },
+ },
config:{
update:function(config,map){
- if(ui.connectButton.classList.contains('glow')){
- for(var i in map){
- if(map[i]._link.config.connect){
- map[i].style.display='';
- }
- else{
- map[i].style.display='none';
- }
- }
- map.observe.show();
- map.choose_timeout.show();
- }
- else{
- for(var i in map){
- map[i].style.display='';
- }
- map.observe.hide();
- map.choose_timeout.hide();
- }
if(config.identity_mode=='zhong'){
map.player_number.hide();
map.enhance_zhu.hide();
@@ -1699,21 +1750,7 @@
},
restart:true,
frequent:true,
- connect:true
},
- choose_timeout:{
- name:'出牌时限',
- init:'30',
- item:{
- '10':'10秒',
- '15':'15秒',
- '30':'30秒',
- '60':'60秒',
- '90':'90秒',
- },
- connect:true,
- frequent:true
- },
player_number:{
name:'游戏人数',
init:'8',
@@ -1728,26 +1765,18 @@
},
frequent:true,
restart:true,
- connect:true
},
- observe:{
- name:'允许旁观',
- init:false,
- connect:true
- },
double_nei:{
name:'双内奸',
init:false,
restart:true,
frequent:true,
- connect:true
},
double_character:{
name:'双将模式',
init:false,
frequent:true,
restart:true,
- connect:true
},
double_hp:{
name:'双将体力上限',
@@ -1760,7 +1789,6 @@
zonghe:'相加',
},
restart:true,
- connect:true
},
auto_identity:{
name:'自动显示身份',
@@ -1794,21 +1822,18 @@
},
ban_weak:{
name:'屏蔽弱将',
- init:false,
+ init:true,
restart:true,
- connect:true
},
ban_strong:{
name:'屏蔽强将',
init:false,
restart:true,
- connect:true
},
enhance_zhu:{
name:'加强主公',
init:false,
restart:true,
- connect:true
},
free_choose:{
name:'自由选将',
@@ -1989,6 +2014,7 @@
},
guozhan:{
name:'国战',
+ connect:{},
config:{
guozhan_mode:{
name:'游戏模式',
@@ -2042,8 +2068,8 @@
restart:true,
},
ban_weak:{
- name:'屏蔽强将',
- init:false,
+ name:'屏蔽弱将',
+ init:true,
restart:true,
},
ban_strong:{
@@ -2259,7 +2285,7 @@
},
ban_weak:{
name:'屏蔽弱将',
- init:false,
+ init:true,
restart:true,
// frequent:true,
},
@@ -2271,6 +2297,49 @@
},
}
},
+ connect:{
+ name:'联机',
+ config:{
+ connect_nickname:{
+ name:'联机昵称',
+ input:true,
+ frequent:true,
+ init:'无名玩家'
+ },
+ 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,
+ init:'23.105.208.119'
+ },
+ 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';
+ }
+ }
+ }
+ },
+ }
+ },
boss:{
name:'挑战',
config:{
@@ -2324,15 +2393,13 @@
},
ban_weak:{
name:'屏蔽弱将',
- init:false,
+ init:true,
restart:true,
- frequent:true,
},
ban_strong:{
name:'屏蔽强将',
init:false,
restart:true,
- frequent:true,
},
}
},
@@ -2467,7 +2534,7 @@
},
chess_treasure:{
name:'战场机关',
- init:'0.2',
+ init:'0',
frequent:true,
item:{
'0':'关闭',
@@ -2479,7 +2546,7 @@
},
chess_obstacle:{
name:'随机路障',
- init:'0',
+ init:'0.2',
item:{
'0':'关闭',
'0.2':'少量',
@@ -2544,7 +2611,7 @@
},
ban_weak:{
name:'屏蔽弱将',
- init:false,
+ init:true,
restart:true,
},
ban_strong:{
@@ -2698,7 +2765,7 @@
},
ban_weak:{
name:'屏蔽弱将',
- init:false,
+ init:true,
restart:true,
},
ban_strong:{
@@ -2708,68 +2775,6 @@
},
}
},
- connect:{
- name:'联机',
- config:{
- connect_nickname:{
- name:'联机昵称',
- input:true,
- frequent:true,
- init:'无名玩家'
- },
- connect_avatar:{
- name:'联机头像',
- init:'caocao',
- item:{},
- frequent:true,
- onclick:function(item){
- game.saveConfig('connect_avatar',item);
- game.saveConfig('connect_avatar',item,'connect');
- }
- },
- connect_start:{
- name:'启动服务器',
- clear:true,
- frequent:true,
- onclick:function(){
- game.saveConfig('connectMode',true);
- game.saveConfig('mode','identity');
- localStorage.setItem(lib.configprefix+'directstart',true);
- game.reload();
- }
- },
- hall_ip:{
- name:'联机大厅',
- input:true,
- frequent:true,
- init:'23.105.208.119'
- },
- 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';
- }
- }
- }
- },
- update:function(config,map){
- if(lib.node){
- map.connect_start.show();
- }
- else{
- map.connect_start.hide();
- }
- }
- }
- }
},
status:{
running:false,
@@ -3550,15 +3555,20 @@
lib[i][j]=lib.init.eval(mode[lib.config.mode][i][j]);
}
}
+
+ lib.connectCharacterPack=[];
+ lib.connectCardPack=[];
for(i in character){
if(character[i].character){
lib.characterPack[i]=character[i].character
}
- if(character[i].forbid&&character[i].forbid.contains(lib.config.mode)) continue;
- if(character[i].mode&&character[i].mode.contains(lib.config.mode)==false) continue;
for(j in character[i]){
if(j=='mode'||j=='forbid') continue;
- if(j=='character'&&!lib.config.characters.contains(i)){
+ if(j=='connect'){
+ lib.connectCharacterPack.push(i);
+ continue;
+ }
+ if(j=='character'&&!lib.config.characters.contains(i)&&lib.config.mode!='connect'){
if(lib.config.mode=='chess'&&get.config('chess_mode')=='leader'){
for(k in character[i][j]){
lib.hiddenCharacters.push(k);
@@ -3577,7 +3587,7 @@
character[i][j][k][4].contains('hiddenboss')){
lib.config.forbidai.add(k);
}
- if(lib.config.banned.contains(k)){
+ if(lib.config.banned.contains(k)&&lib.config.mode!='connect'){
if(lib.config.mode=='chess'&&get.config('chess_mode')=='leader'){
lib.hiddenCharacters.push(k);
}
@@ -3630,12 +3640,16 @@
delete lib.cardPack.mode_derivation;
}
}
-
- var pilecfg=lib.config.customcardpile[get.config('cardpilename')];
- if(pilecfg){
- lib.config.bannedpile=pilecfg[0]||{};
- lib.config.addedpile=pilecfg[1]||{};
- }
+ if(lib.config.mode!='connect'){
+ var pilecfg=lib.config.customcardpile[get.config('cardpilename')];
+ if(pilecfg){
+ lib.config.bannedpile=pilecfg[0]||{};
+ lib.config.addedpile=pilecfg[1]||{};
+ }
+ }
+ else{
+ lib.cardPackList={};
+ }
for(i in card){
lib.cardPack[i]=[];
if(card[i].card){
@@ -3647,35 +3661,42 @@
}
for(j in card[i]){
if(j=='mode'||j=='forbid') continue;
+ if(j=='connect'){
+ lib.connectCardPack.push(i);
+ continue;
+ }
if(j=='list'){
- if(card[i].forbid&&card[i].forbid.contains(lib.config.mode)) continue;
- if(card[i].mode&&card[i].mode.contains(lib.config.mode)==false) continue;
- if(lib.config.cards.contains(i)){
- var pile;
- if(typeof card[i][j]=='function'){
- pile=lib.init.eval(card[i][j])();
- }
- else{
- pile=card[i][j];
- }
- lib.cardPile[i]=pile.slice(0);
- if(lib.config.bannedpile[i]){
- for(var k=0;k10){
+ openMenu(this._link.menu,{
+ x:pos1.left+pos1.width+5-pos2.left,
+ y:Math.min((ui.window.offsetHeight-400)/2,pos1.top-pos2.top)
+ },function(){
+ node.classList.remove('on');
+ });
+ lib.setScroll(this._link.menu);
+ }
+ else{
+ openMenu(this._link.menu,{
+ x:pos1.left+pos1.width+5-pos2.left,
+ y:pos1.top-pos2.top
+ },function(){
+ node.classList.remove('on');
+ });
+ }
+ }
+ };
+ var clickContainer=function(){
+ menuContainer.classList.add('hidden');
+
+ if(connectMenu){
+ if(_status.enteringroom){
+ _status.enteringroom=false;
+ }
+ ui.window.classList.remove('shortcutpaused');
+ }
+ else{
+ game.resume2();
+ if(game.onresume2){
+ game.onresume2();
+ }
+ ui.arena.classList.remove('menupaused');
+ ui.config2.classList.remove('pressdown2');
+ }
+ };
+ var clickMenuItem=function(){
+ var node=this.parentNode._link;
+ var config=node._link.config;
+ node._link.current=this.link;
+ node.lastChild.innerHTML=config.item[this._link];
+ if(config.onclick){
+ config.onclick.call(node,this._link);
+ }
+ if(config.update){
+ config.update();
+ }
+ };
+ var createMenu=function(tabs,config){
+ var createPage=function(position){
+ var node=ui.create.div(position);
+ lib.setScroll(ui.create.div('.left.pane',node));
+ lib.setScroll(ui.create.div('.right.pane',node));
+ return node;
+ };
+ var menu=ui.create.div('.main.menu.dialog.popped.static',config.position,function(e){
+ e.stopPropagation();
+ });
+ if(connectMenu){
+ menu.classList.add('center');
+ menuContainer.classList.add('centermenu');
+ }
+ var menuTab=ui.create.div('.menu-tab',menu);
+ var menuTabBar=ui.create.div('.menu-tab-bar',menu);
+ menuTabBar.style.left=(config.bar||0)+'px';
+ var menuContent=ui.create.div('.menu-content',menu);
+ var clickTab=function(){
+ if(this.classList.contains('disabled')) return;
+ var active=this.parentNode.querySelector('.active');
+ if(active){
+ active.classList.remove('active');
+ active._link.remove();
+ }
+ this.classList.add('active');
+ menuTabBar.style.left=this.offsetLeft+'px';
+ menuContent.appendChild(this._link);
+ };
+ ui.click.menuTab=function(tab){
+ for(var i=0;i/g,'');
+ if(!input.innerHTML){
+ input.innerHTML='无名玩家';
+ }
+ game.saveConfig('connect_nickname',input.innerHTML);
+ game.saveConfig('connect_nickname',input.innerHTML,'connect');
+ }
+ }
+ else if(config.name=='联机大厅'){
+ input.innerHTML=config.init||lib.hallURL;
+ input.onblur=function(){
+ if(!input.innerHTML){
+ input.innerHTML=lib.hallURL;
+ }
+ input.innerHTML=input.innerHTML.replace(/\
/g,'');
+ game.saveConfig('hall_ip',input.innerHTML,'connect');
+ }
+ }
+ }
+ else{
+ node.classList.add('toggle');
+ node.listen(clickToggle);
+ ui.create.div(ui.create.div(node));
+ if(config.init==true){
+ node.classList.add('on');
+ }
+ }
+ if(position){
+ position.appendChild(node);
+ }
+ return node;
+ };
+ var updateBanned=function(mode){
+ var list;
+ if(connectMenu){
+ list=lib.config['connect_'+mode+'_banned'];
+ }
+ else{
+ list=lib.config.banned;
+ }
+ var buttons=updateBanned._buttons;
+ for(var i=0;i上移↑下移↓
');
+ move.firstChild.listen(function(){
+ if(node.previousSibling){
+ node.parentNode.insertBefore(node,node.previousSibling);
+ var order=[];
+ for(var i=0;i>',page,function(){
+ if(expanded){
+ this.classList.remove('on');
+ this.parentNode.classList.remove('expanded');
+ }
+ else{
+ this.classList.add('on');
+ this.parentNode.classList.add('expanded');
+ }
+ expanded=!expanded;
+ });
+ for(var k=0;k>',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.display='none';
+ ui.create.div('','',importExtension);
+
+ importExtension.firstChild.lastChild.onclick=function(){
+ var fileToLoad=this.previousSibling.files[0];
+ if(fileToLoad){
+ var zipReady=function(){
+ var fileReader = new FileReader();
+ fileReader.onload = function(fileLoadedEvent)
+ {
+ var data = fileLoadedEvent.target.result;
+ var zip=new JSZip();
+ zip.load(data);
+ var str=zip.file('extension.js').asText();
+ try{
+ eval(str);
+ if(!game.importedPack) throw('err');
+ var extname=game.importedPack.name;
+ localStorage.setItem(lib.configprefix+'extension_'+extname,str);
+ lib.config.extensions.add(extname);
+ game.saveConfig('extensions',lib.config.extensions);
+ game.saveConfig('extension_'+extname,true);
+ 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);
+ }
+ }
+ if(game.importedPack.image&&lib.db){
+ for(var i=0;i>',page,function(){
+ if(autoskillexpanded){
+ this.classList.remove('on');
+ for(var k=0;k>',page,function(){
+ if(banskillexpanded){
+ this.classList.remove('on');
+ for(var k=0;kbb?1:-1;
+ }
+ return a>b?1:-1;
+ });
+
+ var list2=[];
+ var skills=lib.character[list[0][0]][3];
+ for(var i=0;i>',page,function(){
+ // if(expanded){
+ // this.classList.remove('on');
+ // this.parentNode.classList.remove('expanded');
+ // }
+ // else{
+ // this.classList.add('on');
+ // this.parentNode.classList.add('expanded');
+ // }
+ // expanded=!expanded;
+ // });
+ page.classList.add('morenodes');
+ for(var k=0;k>',page,function(){
+ this.classList.toggle('on');
+ if(this.classList.contains('on')){
+ importCharacter.style.display='';
+ resetEditor();
+ resetExport();
+ currentEditing=null;
+ }
+ else{
+ importCharacter.style.display='none';
+ }
+ });
+ var resetImport=function(){
+ importCharacter.style.display='none';
+ toggle3.classList.remove('on')
+ }
+ importCharacter=ui.create.div('.new_character.export.import',page);
+ importCharacter.style.display='none';
+ ui.create.div('','',importCharacter);
+ importCharacter.firstChild.lastChild.onclick=function(){
+ var fileToLoad=this.previousSibling.files[0];
+ if(fileToLoad){
+ var zipReady=function(){
+ var fileReader = new FileReader();
+ fileReader.onload = function(fileLoadedEvent)
+ {
+ var data = fileLoadedEvent.target.result;
+ var zip=new JSZip();
+ zip.load(data);
+ var str=zip.file('pack.js').asText();
+ try{
+ eval(str);
+ if(!game.importedPack) throw('err');
+ for(var i in game.importedPack.character){
+ var buttons=page.querySelectorAll('.button.character');
+ for(var j=0;j>',page,function(){
+ this.classList.toggle('on');
+ if(this.classList.contains('on')){
+ exportCharacter.style.display='';
+ resetEditor();
+ resetImport();
+ currentEditing=null;
+ packExporting=true;
+ }
+ else{
+ resetExport();
+ }
+ });
+ var resetExport=function(){
+ packExporting=false;
+ exportCharacter.style.display='none';
+ toggle2.classList.remove('on');
+ var selected=page.querySelectorAll('.button.character.selected');
+ var list=[];
+ for(var i=0;i',exportCharacter);
+ exportCharacter.firstChild.lastChild.onclick=function(){
+ var name=this.previousSibling.value;
+ var selected=page.querySelectorAll('.button.character.selected');
+ var list=[];
+ var list2=[];
+ for(var i=0;i>',page,function(){
+ this.classList.toggle('on');
+ if(this.classList.contains('on')){
+ newCharacter.style.display='';
+ resetExport();
+ resetImport();
+ }
+ else{
+ newCharacter.style.display='none';
+ }
+ });
+ var resetEditor=function(){
+ toggle.classList.remove('on');
+ newCharacter.style.display='none';
+ fakeme.classList.remove('inited');
+ delete fakeme.image;
+ fakeme.style.backgroundImage='';
+ var inputs=newCharacter.querySelectorAll('input');
+ for(var i=0;i',newCharacter).style.paddingTop='10px';
+ ui.create.div('.indent','体力:',newCharacter).style.paddingTop='10px';
+ var sexes=ui.create.selectlist([
+ ['male','男'],
+ ['female','女'],
+ ['none','无'],
+ ],null,ui.create.div('.indent','性别:',newCharacter));
+ var groups=ui.create.selectlist([
+ ['wei','魏'],
+ ['shu','蜀'],
+ ['wu','吴'],
+ ['qun','群'],
+ ],null,ui.create.div('.indent','势力:',newCharacter));
+ var options=ui.create.div('.add_skill.options','主公BOSSAI禁选
',newCharacter);
+ var addSkill=ui.create.div('.add_skill','添加技能
',newCharacter);
+ var list=[];
+ for(var i in lib.character){
+ if(!lib.customCharacters.contains(i)&&lib.character[i][3].length)
+ list.push([i,lib.translate[i]]);
+ }
+ list.sort(function(a,b){
+ a=a[0];b=b[0];
+ var aa=a,bb=b;
+ if(aa.indexOf('_')!=-1){
+ aa=aa.slice(aa.indexOf('_')+1);
+ }
+ if(bb.indexOf('_')!=-1){
+ bb=bb.slice(bb.indexOf('_')+1);
+ }
+ if(aa!=bb){
+ return aa>bb?1:-1;
+ }
+ return a>b?1:-1;
+ });
+ var list2=[];
+ var skills=lib.character[list[0][0]][3];
+ for(var i=0;i创建技能...
',newCharacter);
+ createSkill.firstChild.listen(function(){
+ createSkill.lastChild.classList.toggle('hidden');
+ if(createSkill.lastChild.classList.contains('hidden')){
+ this.innerHTML='创建技能...';
+ skillList.style.top='';
+ }
+ else{
+ this.innerHTML='创建技能';
+ skillList.style.top='435px';
+ }
+ });
+ var newSkill=document.createElement('textarea');
+ createSkill.lastChild.appendChild(newSkill);
+ createSkill.lastChild.innerHTML+='
';
+ ui.create.div('','技能名称:',createSkill.lastChild);
+ createSkill.lastChild.innerHTML+='
';
+ ui.create.div('','技能描述:
',createSkill.lastChild);
+ createSkill.lastChild.lastChild.lastChild.previousSibling.style.marginTop='5px';
+ createSkill.lastChild.lastChild.lastChild.previousSibling.style.marginRight='3px';
+ createSkill.lastChild.lastChild.lastChild.previousSibling.onclick=function(){
+ var node;
+ var name=createSkill.lastChild.querySelector('.skillname').value;
+ var description=createSkill.lastChild.querySelector('.skilldescription').value;
+ var content=createSkill.lastChild.querySelector('textarea').value;
+ if(!name||!description) return;
+ if(lib.checkSkillName(name)){
+ alert('技能名重复');
+ return;
+ }
+ for(var i=0;iname2.indexOf('|')){
+ name2=name2.slice(name2.indexOf('|')+1,name2.lastIndexOf('|'));
+ }
+ else{
+ name2=name2.slice(name2.indexOf('|')+1);
+ }
+ }
+ ui.create.div('',name2,node,editnode);
+ ui.create.div('','×',node,deletenode);
+ }
+ node.createInfo={
+ name:name,
+ description:description,
+ content:content
+ }
+ createSkill.lastChild.querySelector('.skillname').value='';
+ createSkill.lastChild.querySelector('.skilldescription').value='';
+ createSkill.lastChild.querySelector('textarea').value='';
+
+ createSkill.lastChild.classList.add('hidden');
+ createSkill.firstChild.innerHTML='创建技能...';
+ skillList.style.top='';
+ }
+ createSkill.lastChild.lastChild.lastChild.onclick=function(){
+ createSkill.lastChild.querySelector('.skillname').value='';
+ createSkill.lastChild.querySelector('.skilldescription').value='';
+ createSkill.lastChild.querySelector('textarea').value='';
+
+ createSkill.lastChild.classList.add('hidden');
+ createSkill.firstChild.innerHTML='创建技能...';
+ skillList.style.top='';
+ };
+ var skillList=ui.create.div('.skill_list',newCharacter);
+ ui.create.div(skillList);
+ ui.create.div('.menubutton.large','创建武将',ui.create.div(skillList),function(){
+ var image=fakeme.image;if(!image&&this.innerHTML!='编辑武将') return;
+ var name=newCharacter.querySelector('.new_name').value;if(!name) return;
+ if(lib.checkCharacterName(name)){
+ alert('武将名重复');return;
+ }
+ var hp=newCharacter.querySelector('.new_hp').value;
+ hp=parseInt(hp);
+ if(!hp) hp=1;
+ var skills=[];
+ var dontcreate=false;
+ if(this.innerHTML=='编辑武将'&&this._origin&&this._origin.link!=name){
+ dontcreate=true;
+ var origin=this._origin;
+ game.getDB('image','character:'+this._origin.link,function(data){
+ if(data){
+ game.putDB('image','character:'+name,data);
+ origin.remove();
+ lib.customCharacters.remove(origin.link);
+ game.deleteDB('character',origin.link);
+ game.deleteDB('image','character:'+origin.link);
+ if(lib.character[origin.link]){
+ var skills=lib.character[origin.link][3];
+ delete lib.character[origin.link];
+ for(var i=0;i>',page,function(){
+ if(cardpileexpanded){
+ this.classList.remove('on');
+ for(var k=0;k>',page,function(){
+ this.classList.toggle('on');
+ if(this.classList.contains('on')){
+ exportCardPile.classList.remove('hidden');
+ }
+ else{
+ exportCardPile.classList.add('hidden');
+ }
+ });
+ exportCardPile=ui.create.div('.config.cardpileadd.indent',page);
+ exportCardPile.classList.add('hidden');
+ ui.create.div('','名称:',exportCardPile);
+ var input=exportCardPile.firstChild.lastChild.previousSibling;
+ input.value='自定义牌堆';
+ input.style.marginRight='3px';
+ input.style.width='120px';
+ exportCardPile.firstChild.lastChild.onclick=function(){
+ var name=input.value;
+ var ok=true;
+ if(lib.config.customcardpile[name]){
+ for(var i=1;i<=1000;i++){
+ if(!lib.config.customcardpile[name+'('+i+')']){
+ name=name+'('+i+')';
+ break;
+ }
+ }
+ }
+ lib.config.customcardpile[name]=[lib.config.bannedpile,lib.config.addedpile];
+ game.saveConfig('cardpilename',name,true);
+ game.saveConfig('customcardpile',lib.config.customcardpile);
+ game.saveConfig('bannedpile');
+ game.saveConfig('addedpile');
+ createPileNode(name);
+ updatePileConfig();
+ };
+ }());
+
+ if(!lib.connectMenu){
+ var node1=ui.create.div('.lefttext','全部开启',start.firstChild,function(){
+ game.saveConfig('cards',lib.config.all.cards);
+ updateNodes();
+ });
+ var node2=ui.create.div('.lefttext','恢复默认',start.firstChild,function(){
+ game.saveConfig('cards',lib.config.defaultcards);
+ updateNodes();
+ });
+ node1.style.marginTop='12px';
+ node2.style.marginTop='7px';
+ }
+
+ updateNodes();
+ }());
+
+ (function(){
+ if(connectMenu) return;
+ var start=menuxpages.shift();
+ var rightPane=start.lastChild;
+ var cheatButton=ui.create.div('.menubutton.round.highlight','作',start);
+ var runButton=ui.create.div('.menubutton.round.highlight','执',start);
+ runButton.style.display='none';
+ var playButton=ui.create.div('.menubutton.round.highlight','播',start);
+ playButton.style.display='none';
+ playButton.style.left='215px';
+ var deleteButton=ui.create.div('.menubutton.round.highlight','删',start);
+ deleteButton.style.display='none';
+ deleteButton.style.left='275px';
+ var saveButton=ui.create.div('.menubutton.round.highlight','存',start);
+ saveButton.style.display='none';
+
+ var clickMode=function(){
+ if(this.classList.contains('off')) return;
+ var active=this.parentNode.querySelector('.active');
+ if(active===this){
+ return;
+ }
+ active.classList.remove('active');
+ active.link.remove();
+ active=this;
+ this.classList.add('active');
+ rightPane.appendChild(this.link);
+ if(this.type=='cheat'){
+ cheatButton.style.display='';
+ }
+ else{
+ cheatButton.style.display='none';
+ }
+ if(this.type=='cmd'){
+ runButton.style.display='';
+ }
+ else{
+ runButton.style.display='none';
+ }
+ if(this.type=='video'){
+ playButton.style.display='';
+ saveButton.style.display='';
+ deleteButton.style.display='';
+ }
+ else{
+ playButton.style.display='none';
+ saveButton.style.display='none';
+ deleteButton.style.display='none';
+ }
+ };
+ (function(){
+ var checkCheat=function(){
+ if(currentrow1&¤trow2&&row3.querySelector('.glow')){
+ cheatButton.classList.add('glowing');
+ return true;
+ }
+ else{
+ cheatButton.classList.remove('glowing');
+ return false;
+ }
+ }
+ cheatButton.listen(function(){
+ if(checkCheat()){
+ var num;
+ switch(currentrow2.innerHTML){
+ case '一':num=1;break;
+ case '二':num=2;break;
+ case '三':num=3;break;
+ case '四':num=4;break;
+ case '五':num=5;break;
+ }
+ var targets=[];
+ var buttons=row3.querySelectorAll('.glow');
+ for(var i=0;i=0){
+ logindex--;
+ if(logindex<0){
+ text2.value='';
+ }
+ else{
+ text2.value=logs[logindex];
+ }
+ }
+ }
+ });
+ page.appendChild(text2);
+ game.print=function(){
+ var textstr='';
+ for(var i=0;i';
+ text.innerHTML+=textstr;
+ text.scrollTop=text.scrollHeight;
+ }
+ runButton.listen(runCommand);
+ }());
+ (function(){
+ var page=ui.create.div('');
+ var node=ui.create.div('.menubutton.large','战绩',start.firstChild,clickMode);
+ node.type='rec';
+ node.link=page;
+ page.style.paddingBottom='10px';
+ var reset=function(){
+ if(this.innerHTML=='重置'){
+ this.innerHTML='确定';
+ var that=this;
+ setTimeout(function(){
+ that.innerHTML='重置';
+ },1000);
+ }
+ else{
+ this.parentNode.previousSibling.remove();
+ this.parentNode.remove();
+ delete lib.config.gameRecord[this.parentNode.link];
+ game.saveConfig('gameRecord',lib.config.gameRecord);
+ }
+ }
+ for(var i=0;i重置',page);
+ item.style.height='auto';
+ item.lastChild.addEventListener('click',reset);
+ item.link=lib.config.all.mode[i];
+ }
+ }
+ }());
+ (function(){
+ if(!window.indexedDB) return;
+ var page=ui.create.div('');
+ var node=ui.create.div('.menubutton.large','录像',start.firstChild,clickMode);
+ node.type='video';
+ node.link=page;
+
+ lib.onDB(function(){
+ var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
+ lib.videos=[];
+ store.openCursor().onsuccess=function(e){
+ var cursor=e.target.result;
+ if(cursor){
+ lib.videos.push(cursor.value);
+ cursor.continue();
+ }
+ else{
+ lib.videos.sort(function(a,b){
+ return parseInt(b.time)-parseInt(a.time);
+ });
+ var clickcapt=function(){
+ var current=this.parentNode.querySelector('.videonode.active');
+ if(current&¤t!=this){
+ current.classList.remove('active');
+ }
+ this.classList.toggle('active');
+ };
+ var staritem=function(){
+ this.parentNode.classList.toggle('starred');
+ var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
+ if(this.parentNode.classList.contains('starred')){
+ this.parentNode.link.starred=true;
+ }
+ else{
+ this.parentNode.link.starred=false;
+ }
+ store.put(this.parentNode.link);
+ }
+ var createNode=function(video,before){
+ var node=ui.create.div('.videonode.menubutton.large',clickcapt);
+ node.link=video;
+ ui.create.div('.menubutton.videoavatar',node).setBackground(video.name1,'character');
+ if(video.name2){
+ ui.create.div('.menubutton.videoavatar2',node).setBackground(video.name2,'character');
+ }
+ var date=new Date(video.time);
+ var str=date.getFullYear()+'.'+(date.getMonth()+2)+'.'+(date.getDay()+1)+' '+
+ date.getHours()+':';
+ var minutes=date.getMinutes();
+ if(minutes<10){
+ str+='0';
+ }
+ str+=minutes;
+ ui.create.div('.caption',video.name[0],node);
+ ui.create.div('.text',str+'
'+video.name[1],node);
+ if(video.win){
+ ui.create.div('.victory','胜',node);
+ }
+
+ if(before){
+ page.insertBefore(node,page.firstChild);
+ }
+ else{
+ page.appendChild(node);
+ }
+ ui.create.div('.video_star','★',node,staritem);
+ if(video.starred){
+ node.classList.add('starred');
+ }
+ }
+ for(var i=0;i导入录像...',function(){
+ this.nextSibling.classList.toggle('hidden');
+ },page);
+ importVideoNode.style.marginLeft='12px';
+ importVideoNode.style.marginTop='3px';
+ var importVideo=ui.create.div('.config.hidden',page);
+ importVideo.style.whiteSpace='nowrap';
+ importVideo.style.marginBottom='80px';
+ importVideo.style.marginLeft='13px';
+ importVideo.style.width='calc(100% - 30px)';
+ importVideo.innerHTML=''+
+ '';
+ importVideo.lastChild.onclick=function(){
+ var fileToLoad = importVideo.firstChild.files[0];
+ var fileReader = new FileReader();
+ fileReader.onload = function(fileLoadedEvent)
+ {
+ var data = fileLoadedEvent.target.result;
+ if(!data) return;
+ try{
+ data=JSON.parse(lib.init.decode(data));
+ }
+ catch(e){
+ console.log(e);
+ alert('导入失败');
+ return;
+ }
+ var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
+ var videos=lib.videos.slice(0);
+ for(var i=0;i=parseInt(lib.config.video)&&videos.length){
+ var toremove=videos.pop();
+ lib.videos.remove(toremove);
+ store.delete(toremove.time);
+ for(var i=0;i
';
+ li2.innerHTML='素材版本:'+(lib.config.asset_version||'无')+'';
+ li3.innerHTML='更新源
';
+ li3.querySelector('button').onclick=function(){
+ lib.updateURL=this.previousSibling.value;
+ localStorage.setItem('noname_download_source',lib.updateURL);
+ }
+
+ var button1,button2;
+
+ game.checkForUpdate=function(forcecheck){
+ if(button1.disabled){
+ return;
+ }
+ else{
+ button1.innerHTML='正在检查更新';
+ button1.disabled=true;
+
+ var goupdate=function(){
+ if(game.download){
+ var script=lib.init.js(lib.updateURL,'game/source',function(){
+ script.remove();
+ var updates=window.noname_source_list;
+ delete window.noname_source_list;
+ for(var i=0;i10){
- openMenu(this._link.menu,{
- x:pos1.left+pos1.width+5-pos2.left,
- y:Math.min((ui.window.offsetHeight-400)/2,pos1.top-pos2.top)
- },function(){
- node.classList.remove('on');
- });
- lib.setScroll(this._link.menu);
- }
- else{
- openMenu(this._link.menu,{
- x:pos1.left+pos1.width+5-pos2.left,
- y:pos1.top-pos2.top
- },function(){
- node.classList.remove('on');
- });
- }
- }
- };
- var clickContainer=function(){
- menuContainer.classList.add('hidden');
-
- game.resume2();
- if(game.onresume2){
- game.onresume2();
- }
- ui.arena.classList.remove('menupaused');
- ui.config2.classList.remove('pressdown2');
- };
- var clickMenuItem=function(){
- var node=this.parentNode._link;
- var config=node._link.config;
- node._link.current=this.link;
- node.lastChild.innerHTML=config.item[this._link];
- if(config.onclick){
- config.onclick.call(node,this._link);
- }
- if(config.update){
- config.update();
- }
- };
- var createMenu=function(tabs,config){
- var createPage=function(position){
- var node=ui.create.div(position);
- lib.setScroll(ui.create.div('.left.pane',node));
- lib.setScroll(ui.create.div('.right.pane',node));
- return node;
- };
- var menu=ui.create.div('.main.menu.dialog.popped.static',config.position,function(e){
- e.stopPropagation();
- });
- var menuTab=ui.create.div('.menu-tab',menu);
- var menuTabBar=ui.create.div('.menu-tab-bar',menu);
- menuTabBar.style.left=(config.bar||0)+'px';
- var menuContent=ui.create.div('.menu-content',menu);
- var clickTab=function(){
- if(this.classList.contains('disabled')) return;
- var active=this.parentNode.querySelector('.active');
- if(active){
- active.classList.remove('active');
- active._link.remove();
- }
- this.classList.add('active');
- menuTabBar.style.left=this.offsetLeft+'px';
- menuContent.appendChild(this._link);
- };
- ui.click.menuTab=function(tab){
- for(var i=0;i/g,'');
- if(!input.innerHTML){
- input.innerHTML='无名玩家';
- }
- game.saveConfig('connect_nickname',input.innerHTML);
- game.saveConfig('connect_nickname',input.innerHTML,'connect');
- }
- }
- else if(config.name=='联机大厅'){
- input.innerHTML=config.init||lib.hallURL;
- input.onblur=function(){
- if(!input.innerHTML){
- input.innerHTML=lib.hallURL;
- }
- input.innerHTML=input.innerHTML.replace(/\
/g,'');
- game.saveConfig('hall_ip',input.innerHTML,'connect');
- }
- }
- }
- else{
- node.classList.add('toggle');
- node.listen(clickToggle);
- ui.create.div(ui.create.div(node));
- if(config.init==true){
- node.classList.add('on');
- }
- }
- if(position){
- position.appendChild(node);
- }
- return node;
- };
- var menuUpdates=[];
- menuContainer=ui.create.div('.menu-container.hidden',ui.window,clickContainer);
- ui.menuContainer=menuContainer;
- ui.click.configMenu=function(){
- ui.click.shortcut(false)
- if(menuContainer.classList.contains('hidden')){
- ui.config2.classList.add('pressdown2');
- ui.arena.classList.add('menupaused');
- menuContainer.classList.remove('hidden');
- for(var i=0;i>',page,function(){
- if(expanded){
- this.classList.remove('on');
- this.parentNode.classList.remove('expanded');
- }
- else{
- this.classList.add('on');
- this.parentNode.classList.add('expanded');
- }
- expanded=!expanded;
- });
- for(var k=0;k>',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.display='none';
- ui.create.div('','',importExtension);
-
- importExtension.firstChild.lastChild.onclick=function(){
- var fileToLoad=this.previousSibling.files[0];
- if(fileToLoad){
- var zipReady=function(){
- var fileReader = new FileReader();
- fileReader.onload = function(fileLoadedEvent)
- {
- var data = fileLoadedEvent.target.result;
- var zip=new JSZip();
- zip.load(data);
- var str=zip.file('extension.js').asText();
- try{
- eval(str);
- if(!game.importedPack) throw('err');
- var extname=game.importedPack.name;
- localStorage.setItem(lib.configprefix+'extension_'+extname,str);
- lib.config.extensions.add(extname);
- game.saveConfig('extensions',lib.config.extensions);
- game.saveConfig('extension_'+extname,true);
- 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);
- }
- }
- if(game.importedPack.image&&lib.db){
- for(var i=0;i>',page,function(){
- if(autoskillexpanded){
- this.classList.remove('on');
- for(var k=0;k>',page,function(){
- if(banskillexpanded){
- this.classList.remove('on');
- for(var k=0;kbb?1:-1;
- }
- return a>b?1:-1;
- });
-
- var list2=[];
- var skills=lib.character[list[0][0]][3];
- for(var i=0;i>',page,function(){
- // if(expanded){
- // this.classList.remove('on');
- // this.parentNode.classList.remove('expanded');
- // }
- // else{
- // this.classList.add('on');
- // this.parentNode.classList.add('expanded');
- // }
- // expanded=!expanded;
- // });
- page.classList.add('morenodes');
- for(var k=0;k>',page,function(){
- this.classList.toggle('on');
- if(this.classList.contains('on')){
- importCharacter.style.display='';
- resetEditor();
- resetExport();
- currentEditing=null;
- }
- else{
- importCharacter.style.display='none';
- }
- });
- var resetImport=function(){
- importCharacter.style.display='none';
- toggle3.classList.remove('on')
- }
- importCharacter=ui.create.div('.new_character.export.import',page);
- importCharacter.style.display='none';
- ui.create.div('','',importCharacter);
- importCharacter.firstChild.lastChild.onclick=function(){
- var fileToLoad=this.previousSibling.files[0];
- if(fileToLoad){
- var zipReady=function(){
- var fileReader = new FileReader();
- fileReader.onload = function(fileLoadedEvent)
- {
- var data = fileLoadedEvent.target.result;
- var zip=new JSZip();
- zip.load(data);
- var str=zip.file('pack.js').asText();
- try{
- eval(str);
- if(!game.importedPack) throw('err');
- for(var i in game.importedPack.character){
- var buttons=page.querySelectorAll('.button.character');
- for(var j=0;j>',page,function(){
- this.classList.toggle('on');
- if(this.classList.contains('on')){
- exportCharacter.style.display='';
- resetEditor();
- resetImport();
- currentEditing=null;
- packExporting=true;
- }
- else{
- resetExport();
- }
- });
- var resetExport=function(){
- packExporting=false;
- exportCharacter.style.display='none';
- toggle2.classList.remove('on');
- var selected=page.querySelectorAll('.button.character.selected');
- var list=[];
- for(var i=0;i',exportCharacter);
- exportCharacter.firstChild.lastChild.onclick=function(){
- var name=this.previousSibling.value;
- var selected=page.querySelectorAll('.button.character.selected');
- var list=[];
- var list2=[];
- for(var i=0;i>',page,function(){
- this.classList.toggle('on');
- if(this.classList.contains('on')){
- newCharacter.style.display='';
- resetExport();
- resetImport();
- }
- else{
- newCharacter.style.display='none';
- }
- });
- var resetEditor=function(){
- toggle.classList.remove('on');
- newCharacter.style.display='none';
- fakeme.classList.remove('inited');
- delete fakeme.image;
- fakeme.style.backgroundImage='';
- var inputs=newCharacter.querySelectorAll('input');
- for(var i=0;i',newCharacter).style.paddingTop='10px';
- ui.create.div('.indent','体力:',newCharacter).style.paddingTop='10px';
- var sexes=ui.create.selectlist([
- ['male','男'],
- ['female','女'],
- ['none','无'],
- ],null,ui.create.div('.indent','性别:',newCharacter));
- var groups=ui.create.selectlist([
- ['wei','魏'],
- ['shu','蜀'],
- ['wu','吴'],
- ['qun','群'],
- ],null,ui.create.div('.indent','势力:',newCharacter));
- var options=ui.create.div('.add_skill.options','主公BOSSAI禁选
',newCharacter);
- var addSkill=ui.create.div('.add_skill','添加技能
',newCharacter);
- var list=[];
- for(var i in lib.character){
- if(!lib.customCharacters.contains(i)&&lib.character[i][3].length)
- list.push([i,lib.translate[i]]);
- }
- list.sort(function(a,b){
- a=a[0];b=b[0];
- var aa=a,bb=b;
- if(aa.indexOf('_')!=-1){
- aa=aa.slice(aa.indexOf('_')+1);
- }
- if(bb.indexOf('_')!=-1){
- bb=bb.slice(bb.indexOf('_')+1);
- }
- if(aa!=bb){
- return aa>bb?1:-1;
- }
- return a>b?1:-1;
- });
- var list2=[];
- var skills=lib.character[list[0][0]][3];
- for(var i=0;i创建技能...
',newCharacter);
- createSkill.firstChild.listen(function(){
- createSkill.lastChild.classList.toggle('hidden');
- if(createSkill.lastChild.classList.contains('hidden')){
- this.innerHTML='创建技能...';
- skillList.style.top='';
- }
- else{
- this.innerHTML='创建技能';
- skillList.style.top='435px';
- }
- });
- var newSkill=document.createElement('textarea');
- createSkill.lastChild.appendChild(newSkill);
- createSkill.lastChild.innerHTML+='
';
- ui.create.div('','技能名称:',createSkill.lastChild);
- createSkill.lastChild.innerHTML+='
';
- ui.create.div('','技能描述:
',createSkill.lastChild);
- createSkill.lastChild.lastChild.lastChild.previousSibling.style.marginTop='5px';
- createSkill.lastChild.lastChild.lastChild.previousSibling.style.marginRight='3px';
- createSkill.lastChild.lastChild.lastChild.previousSibling.onclick=function(){
- var node;
- var name=createSkill.lastChild.querySelector('.skillname').value;
- var description=createSkill.lastChild.querySelector('.skilldescription').value;
- var content=createSkill.lastChild.querySelector('textarea').value;
- if(!name||!description) return;
- if(lib.checkSkillName(name)){
- alert('技能名重复');
- return;
- }
- for(var i=0;iname2.indexOf('|')){
- name2=name2.slice(name2.indexOf('|')+1,name2.lastIndexOf('|'));
- }
- else{
- name2=name2.slice(name2.indexOf('|')+1);
- }
- }
- ui.create.div('',name2,node,editnode);
- ui.create.div('','×',node,deletenode);
- }
- node.createInfo={
- name:name,
- description:description,
- content:content
- }
- createSkill.lastChild.querySelector('.skillname').value='';
- createSkill.lastChild.querySelector('.skilldescription').value='';
- createSkill.lastChild.querySelector('textarea').value='';
-
- createSkill.lastChild.classList.add('hidden');
- createSkill.firstChild.innerHTML='创建技能...';
- skillList.style.top='';
- }
- createSkill.lastChild.lastChild.lastChild.onclick=function(){
- createSkill.lastChild.querySelector('.skillname').value='';
- createSkill.lastChild.querySelector('.skilldescription').value='';
- createSkill.lastChild.querySelector('textarea').value='';
-
- createSkill.lastChild.classList.add('hidden');
- createSkill.firstChild.innerHTML='创建技能...';
- skillList.style.top='';
- };
- var skillList=ui.create.div('.skill_list',newCharacter);
- ui.create.div(skillList);
- ui.create.div('.menubutton.large','创建武将',ui.create.div(skillList),function(){
- var image=fakeme.image;if(!image&&this.innerHTML!='编辑武将') return;
- var name=newCharacter.querySelector('.new_name').value;if(!name) return;
- if(lib.checkCharacterName(name)){
- alert('武将名重复');return;
- }
- var hp=newCharacter.querySelector('.new_hp').value;
- hp=parseInt(hp);
- if(!hp) hp=1;
- var skills=[];
- var dontcreate=false;
- if(this.innerHTML=='编辑武将'&&this._origin&&this._origin.link!=name){
- dontcreate=true;
- var origin=this._origin;
- game.getDB('image','character:'+this._origin.link,function(data){
- if(data){
- game.putDB('image','character:'+name,data);
- origin.remove();
- lib.customCharacters.remove(origin.link);
- game.deleteDB('character',origin.link);
- game.deleteDB('image','character:'+origin.link);
- if(lib.character[origin.link]){
- var skills=lib.character[origin.link][3];
- delete lib.character[origin.link];
- for(var i=0;i>',page,function(){
- if(cardpileexpanded){
- this.classList.remove('on');
- for(var k=0;k>',page,function(){
- this.classList.toggle('on');
- if(this.classList.contains('on')){
- exportCardPile.classList.remove('hidden');
- }
- else{
- exportCardPile.classList.add('hidden');
- }
- });
- exportCardPile=ui.create.div('.config.cardpileadd.indent',page);
- exportCardPile.classList.add('hidden');
- ui.create.div('','名称:',exportCardPile);
- var input=exportCardPile.firstChild.lastChild.previousSibling;
- input.value='自定义牌堆';
- input.style.marginRight='3px';
- input.style.width='120px';
- exportCardPile.firstChild.lastChild.onclick=function(){
- var name=input.value;
- var ok=true;
- if(lib.config.customcardpile[name]){
- for(var i=1;i<=1000;i++){
- if(!lib.config.customcardpile[name+'('+i+')']){
- name=name+'('+i+')';
- break;
- }
- }
- }
- lib.config.customcardpile[name]=[lib.config.bannedpile,lib.config.addedpile];
- game.saveConfig('cardpilename',name,true);
- game.saveConfig('customcardpile',lib.config.customcardpile);
- game.saveConfig('bannedpile');
- game.saveConfig('addedpile');
- createPileNode(name);
- updatePileConfig();
- };
- }());
-
- var node1=ui.create.div('.lefttext','全部开启',start.firstChild,function(){
- game.saveConfig('cards',lib.config.all.cards);
- updateNodes();
- });
- var node2=ui.create.div('.lefttext','恢复默认',start.firstChild,function(){
- game.saveConfig('cards',lib.config.defaultcards);
- updateNodes();
- });
- node1.style.marginTop='12px';
- node2.style.marginTop='7px';
-
- updateNodes();
- }());
-
- (function(){
- var start=menux.pages[4];
- var rightPane=start.lastChild;
- var cheatButton=ui.create.div('.menubutton.round.highlight','作',start);
- var runButton=ui.create.div('.menubutton.round.highlight','执',start);
- runButton.style.display='none';
- var playButton=ui.create.div('.menubutton.round.highlight','播',start);
- playButton.style.display='none';
- playButton.style.left='215px';
- var deleteButton=ui.create.div('.menubutton.round.highlight','删',start);
- deleteButton.style.display='none';
- deleteButton.style.left='275px';
- var saveButton=ui.create.div('.menubutton.round.highlight','存',start);
- saveButton.style.display='none';
-
- var clickMode=function(){
- if(this.classList.contains('off')) return;
- var active=this.parentNode.querySelector('.active');
- if(active===this){
- return;
- }
- active.classList.remove('active');
- active.link.remove();
- active=this;
- this.classList.add('active');
- rightPane.appendChild(this.link);
- if(this.type=='cheat'){
- cheatButton.style.display='';
- }
- else{
- cheatButton.style.display='none';
- }
- if(this.type=='cmd'){
- runButton.style.display='';
- }
- else{
- runButton.style.display='none';
- }
- if(this.type=='video'){
- playButton.style.display='';
- saveButton.style.display='';
- deleteButton.style.display='';
- }
- else{
- playButton.style.display='none';
- saveButton.style.display='none';
- deleteButton.style.display='none';
- }
- };
- (function(){
- var checkCheat=function(){
- if(currentrow1&¤trow2&&row3.querySelector('.glow')){
- cheatButton.classList.add('glowing');
- return true;
- }
- else{
- cheatButton.classList.remove('glowing');
- return false;
- }
- }
- cheatButton.listen(function(){
- if(checkCheat()){
- var num;
- switch(currentrow2.innerHTML){
- case '一':num=1;break;
- case '二':num=2;break;
- case '三':num=3;break;
- case '四':num=4;break;
- case '五':num=5;break;
- }
- var targets=[];
- var buttons=row3.querySelectorAll('.glow');
- for(var i=0;i=0){
- logindex--;
- if(logindex<0){
- text2.value='';
- }
- else{
- text2.value=logs[logindex];
- }
- }
- }
- });
- page.appendChild(text2);
- game.print=function(){
- var textstr='';
- for(var i=0;i';
- text.innerHTML+=textstr;
- text.scrollTop=text.scrollHeight;
- }
- runButton.listen(runCommand);
- }());
- (function(){
- var page=ui.create.div('');
- var node=ui.create.div('.menubutton.large','战绩',start.firstChild,clickMode);
- node.type='rec';
- node.link=page;
- page.style.paddingBottom='10px';
- var reset=function(){
- if(this.innerHTML=='重置'){
- this.innerHTML='确定';
- var that=this;
- setTimeout(function(){
- that.innerHTML='重置';
- },1000);
- }
- else{
- this.parentNode.previousSibling.remove();
- this.parentNode.remove();
- delete lib.config.gameRecord[this.parentNode.link];
- game.saveConfig('gameRecord',lib.config.gameRecord);
- }
- }
- for(var i=0;i重置',page);
- item.style.height='auto';
- item.lastChild.addEventListener('click',reset);
- item.link=lib.config.all.mode[i];
- }
- }
- }());
- (function(){
- if(!window.indexedDB) return;
- var page=ui.create.div('');
- var node=ui.create.div('.menubutton.large','录像',start.firstChild,clickMode);
- node.type='video';
- node.link=page;
-
- lib.onDB(function(){
- var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
- lib.videos=[];
- store.openCursor().onsuccess=function(e){
- var cursor=e.target.result;
- if(cursor){
- lib.videos.push(cursor.value);
- cursor.continue();
- }
- else{
- lib.videos.sort(function(a,b){
- return parseInt(b.time)-parseInt(a.time);
- });
- var clickcapt=function(){
- var current=this.parentNode.querySelector('.videonode.active');
- if(current&¤t!=this){
- current.classList.remove('active');
- }
- this.classList.toggle('active');
- };
- var staritem=function(){
- this.parentNode.classList.toggle('starred');
- var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
- if(this.parentNode.classList.contains('starred')){
- this.parentNode.link.starred=true;
- }
- else{
- this.parentNode.link.starred=false;
- }
- store.put(this.parentNode.link);
- }
- var createNode=function(video,before){
- var node=ui.create.div('.videonode.menubutton.large',clickcapt);
- node.link=video;
- ui.create.div('.menubutton.videoavatar',node).setBackground(video.name1,'character');
- if(video.name2){
- ui.create.div('.menubutton.videoavatar2',node).setBackground(video.name2,'character');
- }
- var date=new Date(video.time);
- var str=date.getFullYear()+'.'+(date.getMonth()+2)+'.'+(date.getDay()+1)+' '+
- date.getHours()+':';
- var minutes=date.getMinutes();
- if(minutes<10){
- str+='0';
- }
- str+=minutes;
- ui.create.div('.caption',video.name[0],node);
- ui.create.div('.text',str+'
'+video.name[1],node);
- if(video.win){
- ui.create.div('.victory','胜',node);
- }
-
- if(before){
- page.insertBefore(node,page.firstChild);
- }
- else{
- page.appendChild(node);
- }
- ui.create.div('.video_star','★',node,staritem);
- if(video.starred){
- node.classList.add('starred');
- }
- }
- for(var i=0;i导入录像...',function(){
- this.nextSibling.classList.toggle('hidden');
- },page);
- importVideoNode.style.marginLeft='12px';
- importVideoNode.style.marginTop='3px';
- var importVideo=ui.create.div('.config.hidden',page);
- importVideo.style.whiteSpace='nowrap';
- importVideo.style.marginBottom='80px';
- importVideo.style.marginLeft='13px';
- importVideo.style.width='calc(100% - 30px)';
- importVideo.innerHTML=''+
- '';
- importVideo.lastChild.onclick=function(){
- var fileToLoad = importVideo.firstChild.files[0];
- var fileReader = new FileReader();
- fileReader.onload = function(fileLoadedEvent)
- {
- var data = fileLoadedEvent.target.result;
- if(!data) return;
- try{
- data=JSON.parse(lib.init.decode(data));
- }
- catch(e){
- console.log(e);
- alert('导入失败');
- return;
- }
- var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
- var videos=lib.videos.slice(0);
- for(var i=0;i=parseInt(lib.config.video)&&videos.length){
- var toremove=videos.pop();
- lib.videos.remove(toremove);
- store.delete(toremove.time);
- for(var i=0;i';
- li2.innerHTML='素材版本:'+(lib.config.asset_version||'无')+'';
- li3.innerHTML='更新源
';
- li3.querySelector('button').onclick=function(){
- lib.updateURL=this.previousSibling.value;
- localStorage.setItem('noname_download_source',lib.updateURL);
- }
-
- var button1,button2;
-
- game.checkForUpdate=function(forcecheck){
- if(button1.disabled){
- return;
- }
- else{
- button1.innerHTML='正在检查更新';
- button1.disabled=true;
-
- var goupdate=function(){
- if(game.download){
- var script=lib.init.js(lib.updateURL,'game/source',function(){
- script.remove();
- var updates=window.noname_source_list;
- delete window.noname_source_list;
- for(var i=0;idiv:not(.background):not(#shortcut):not(#system):not(#arena):not(.hidden):not(.removing):not(.dialog){opacity: 0.3 !important}
+#window.shortcutpaused>div:not(.background):not(#shortcut):not(#system):not(#arena):not(.hidden):not(.removing):not(.dialog):not(.centermenu):not(.popup-container){opacity: 0.3 !important}
#window.shortcutpaused>#arena>div:not(#timer):not(.removing):not(.hidden){opacity: 0.3 !important}
#window.noclick_important *{pointer-events: none !important;}
#window.noclick_important .noclick_click_important div{pointer-events: auto !important}
diff --git a/layout/default/menu.css b/layout/default/menu.css
index 79eb4af88..359b38440 100644
--- a/layout/default/menu.css
+++ b/layout/default/menu.css
@@ -95,14 +95,6 @@
left:calc(50% - 200px);
top:calc(50% - 150px);
}
-/*.menu.main.slideup{
- animation:menuslideup 0.5s forwards;
- -webkit-animation:menuslideup 0.5s forwards;
-}
-.menu.main.slidedown{
- animation:menuslidedown 0.5s forwards;
- -webkit-animation:menuslidedown 0.5s forwards;
-}*/
.menu-container.hidden>.menu.main{
transform:scale(0.5);
transform-origin:2px -35px;
@@ -112,20 +104,13 @@
transition: all 0.3s;
transform-origin:2px -35px;
}
-/*.menu.main.zoomin{
- animation:menuzoomin 0.3s forwards;
- -webkit-animation:menuzoomin 0.3s forwards;
- transform:scale(0.5);
- transform-origin:2px -35px;
- opacity:0;
+.menu-container.hidden>.menu.main.center{
+ /*transform:translateY(300px);*/
+ transform-origin: center center;
+}
+.menu-container>.menu.main.center{
+ transform-origin: center center;
}
-.menu.main.zoomout{
- animation:menuzoomout 0.3s forwards;
- -webkit-animation:menuzoomout 0.3s forwards;
- transform:scale(0.5);
- transform-origin:2px -35px;
- opacity:0;
-}*/
.menu.main{
width: 400px;
height:300px;
diff --git a/layout/phone/layout.css b/layout/phone/layout.css
index 8931fa49c..9179f1356 100644
--- a/layout/phone/layout.css
+++ b/layout/phone/layout.css
@@ -57,17 +57,13 @@
#pausebutton,#autobutton,#restartbutton{
display: none !important;
}
-/*#system1>div:first-child{
- display: none !important;
-}
-#system1>div:last-child{
- display: none !important;
-}*/
-.menu-container>.menu.main {
+.menu-container>.menu.main{
+ zoom:1.3;
+}
+.menu-container>.menu.main:not(.center){
top: 12px !important;
left: 10px !important;
- zoom:1.3;
}
#arena.phonetop{
diff --git a/mode/connect.js b/mode/connect.js
index 45f58b06b..7d0522676 100644
--- a/mode/connect.js
+++ b/mode/connect.js
@@ -1,8 +1,22 @@
'use strict';
mode.connect={
start:function(){
+ var directstartmode=lib.config.directstartmode;
+ game.saveConfig('directstartmode');
+ ui.create.menu(true);
var createNode=function(){
if(event.created) return;
+ if(directstartmode){
+ game.switchMode(directstartmode);
+ return;
+ }
+ if(lib.node&&window.require){
+ ui.startServer=ui.create.system('启动服务器',function(e){
+ e.stopPropagation();
+ ui.click.connectMenu();
+ },true);
+ }
+
event.created=true;
var node=ui.create.div('.shadowed');
node.style.width='400px';
@@ -11,7 +25,7 @@ mode.connect={
node.style.fontFamily='xinwei';
node.style.fontSize='30px';
node.style.padding='10px';
- node.style.left='calc(50% - 200px)';
+ node.style.left='calc(50% - 210px)';
node.style.top='calc(50% - 20px)';
node.style.whiteSpace='nowrap';
node.innerHTML=lib.config.last_ip||'';
diff --git a/mode/identity.js b/mode/identity.js
index bb872fed8..3c0be45bf 100755
--- a/mode/identity.js
+++ b/mode/identity.js
@@ -146,29 +146,12 @@ mode.identity={
}
if(_status.connectMode){
game.waitForPlayer(function(){
- for(var i in lib.mode.identity.config){
- if(lib.mode.identity.config[i].connect){
- lib.configOL[i]=get.config(i);
- }
- }
if(_status.mode=='zhong'){
lib.configOL.number=8;
}
else{
lib.configOL.number=lib.configOL.player_number;
}
- lib.configOL.characterPack=['standard','shenhua'];
- lib.configOL.cardPack=['standard','ex','extra','refresh','mingzhong'];
- lib.configOL.mode='identity';
- var cardPackList=[];
- for(var i=0;i0;
},
content:function(){
- target.hp*=2;
- target.maxHp*=2;
- target.update();
+ target.draw(target.num('h'));
},
ai:{
order:4,
@@ -2213,7 +2211,7 @@ mode.stone={
useful:2,
result:{
target:function(player,target){
- return Math.max(0,target.hp-1);
+ return Math.max(0,target.num('h')-1);
}
}
}