Merge pull request #238 from nonameShijian/PR-Branch
修复ui.create.menu的一些bug
This commit is contained in:
commit
51122bfbc9
118
game/game.js
118
game/game.js
|
@ -39212,11 +39212,12 @@
|
|||
if(start.childNodes[i].mode!=lib.configOL.mode){
|
||||
start.childNodes[i].classList.add('unselectable');
|
||||
start.childNodes[i].classList.remove('active');
|
||||
start.childNodes[i].link.remove();
|
||||
if(start.childNodes[i].link) start.childNodes[i].link.remove();
|
||||
}
|
||||
else{
|
||||
start.childNodes[i].classList.add('active');
|
||||
start.nextSibling.appendChild(start.childNodes[i].link);
|
||||
if(start.childNodes[i].link) start.nextSibling.appendChild(start.childNodes[i].link);
|
||||
else console.log(start.nextSibling, start.childNodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39355,9 +39356,24 @@
|
|||
var info=lib.mode[mode];
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large',info.name,position,clickMode);
|
||||
node.mode=mode;
|
||||
var connectDisplayMap={
|
||||
connect_player_number: null,
|
||||
connect_versus_mode: null,
|
||||
}
|
||||
var updateConnectDisplayMap=function(){
|
||||
if(_status.waitingForPlayer){
|
||||
if(connectDisplayMap.connect_player_number){
|
||||
connectDisplayMap.connect_player_number.style.display='none';
|
||||
}
|
||||
if(connectDisplayMap.connect_versus_mode){
|
||||
connectDisplayMap.connect_versus_mode.style.display='none';
|
||||
}
|
||||
}
|
||||
};
|
||||
if(connectMenu) menuUpdates.push(updateConnectDisplayMap);
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
node.mode=mode;
|
||||
if(connectMenu){
|
||||
if(mode==lib.config.connect_mode){
|
||||
node.classList.add('active');
|
||||
|
@ -39538,16 +39554,9 @@
|
|||
}
|
||||
}
|
||||
if(connectMenu){
|
||||
menuUpdates.push(function(){
|
||||
if(_status.waitingForPlayer){
|
||||
if(map.connect_player_number){
|
||||
map.connect_player_number.style.display='none';
|
||||
}
|
||||
if(map.connect_versus_mode){
|
||||
map.connect_versus_mode.style.display='none';
|
||||
}
|
||||
}
|
||||
})
|
||||
connectDisplayMap.connect_player_number=map.connect_player_number;
|
||||
connectDisplayMap.connect_versus_mode=map.connect_versus_mode;
|
||||
updateConnectDisplayMap();
|
||||
}
|
||||
};
|
||||
return node;
|
||||
|
@ -39688,9 +39697,9 @@
|
|||
var info=lib.configMenu[mode];
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large',info.name,position,clickMode);
|
||||
node.mode=mode;
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
node.mode=mode;
|
||||
var map={};
|
||||
if(info.config){
|
||||
var hiddenNodes=[];
|
||||
|
@ -40684,27 +40693,27 @@
|
|||
var updateNodes=function(){
|
||||
for(var i=0;i<start.firstChild.childNodes.length;i++){
|
||||
var node=start.firstChild.childNodes[i];
|
||||
if(node.link){
|
||||
if(node.mode){
|
||||
if(node.mode.indexOf('mode_')==0) continue;
|
||||
if(node.mode=='custom') continue;
|
||||
if(connectMenu){
|
||||
if(!lib.config.connect_characters.contains(node.mode)){
|
||||
node.classList.remove('off');
|
||||
node.link.firstChild.classList.add('on');
|
||||
if(node.link) node.link.firstChild.classList.add('on');
|
||||
}
|
||||
else{
|
||||
node.classList.add('off');
|
||||
node.link.firstChild.classList.remove('on');
|
||||
if(node.link) node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(lib.config.characters.contains(node.mode)){
|
||||
node.classList.remove('off');
|
||||
node.link.firstChild.classList.add('on');
|
||||
if(node.link) node.link.firstChild.classList.add('on');
|
||||
}
|
||||
else{
|
||||
node.classList.add('off');
|
||||
node.link.firstChild.classList.remove('on');
|
||||
if(node.link) node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40734,6 +40743,7 @@
|
|||
};
|
||||
|
||||
var createModeConfig=function(mode,position,position2){
|
||||
var _info=lib.characterPack[mode];
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large',lib.translate[mode+'_character_config'],position,clickMode);
|
||||
if(node.innerHTML.length>=5){
|
||||
|
@ -40742,29 +40752,28 @@
|
|||
if(position2){
|
||||
position.insertBefore(node,position2);
|
||||
}
|
||||
node._initLink=function(){
|
||||
var info=lib.characterPack[mode];
|
||||
node.link=page;
|
||||
node.mode=mode;
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
page.node=node;
|
||||
var list=[];
|
||||
var boolAI=true;
|
||||
var alterableSkills=[];
|
||||
var alterableCharacters=[];
|
||||
var charactersToAlter=[];
|
||||
for(var i in info){
|
||||
if(info[i][4]&&info[i][4].contains('unseen')) continue;
|
||||
for(var i in _info){
|
||||
if(_info[i][4]&&_info[i][4].contains('unseen')) continue;
|
||||
if(connectMenu&&lib.connectBanned.contains(i)) continue;
|
||||
list.push(i);
|
||||
if(boolAI&&!lib.config.forbidai_user.contains(i)) boolAI=false;
|
||||
for(var j=0;j<info[i][3].length;j++){
|
||||
if(!lib.skill[info[i][3][j]]){
|
||||
for(var j=0;j<_info[i][3].length;j++){
|
||||
if(!lib.skill[_info[i][3][j]]){
|
||||
continue;
|
||||
}
|
||||
if(lib.skill[info[i][3][j]].alter){
|
||||
alterableSkills.add(info[i][3][j]);
|
||||
if(lib.skill[_info[i][3][j]].alter){
|
||||
alterableSkills.add(_info[i][3][j]);
|
||||
alterableCharacters.add(i);
|
||||
if(lib.config.vintageSkills.contains(info[i][3][j])){
|
||||
if(lib.config.vintageSkills.contains(_info[i][3][j])){
|
||||
charactersToAlter.add(i);
|
||||
}
|
||||
}
|
||||
|
@ -41163,28 +41172,28 @@
|
|||
var updateNodes=function(){
|
||||
for(var i=0;i<start.firstChild.childNodes.length;i++){
|
||||
var node=start.firstChild.childNodes[i];
|
||||
if(node.link){
|
||||
if(node.mode){
|
||||
if(node.mode.indexOf('mode_')==0) continue;
|
||||
if(node.mode=='custom') continue;
|
||||
if(node.mode=='cardpile') continue;
|
||||
if(connectMenu){
|
||||
if(!lib.config.connect_cards.contains(node.mode)){
|
||||
node.classList.remove('off');
|
||||
node.link.firstChild.classList.add('on');
|
||||
if(node.link) node.link.firstChild.classList.add('on');
|
||||
}
|
||||
else{
|
||||
node.classList.add('off');
|
||||
node.link.firstChild.classList.remove('on');
|
||||
if(node.link) node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(lib.config.cards.contains(node.mode)){
|
||||
node.classList.remove('off');
|
||||
node.link.firstChild.classList.add('on');
|
||||
if(node.link) node.link.firstChild.classList.add('on');
|
||||
}
|
||||
else{
|
||||
node.classList.add('off');
|
||||
node.link.firstChild.classList.remove('on');
|
||||
if(node.link) node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41234,9 +41243,9 @@
|
|||
if(node.innerHTML.length>=5){
|
||||
node.classList.add('smallfont');
|
||||
}
|
||||
node.mode=mode;
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
node.mode=mode;
|
||||
var list=[];
|
||||
for(var i=0;i<info.length;i++){
|
||||
if(!lib.card[info[i]]||(lib.card[info[i]].derivation&&mode!='mode_derivation')) continue;
|
||||
|
@ -41709,6 +41718,7 @@
|
|||
this._initLink();
|
||||
rightPane.appendChild(this.link);
|
||||
}
|
||||
updateNodes();
|
||||
};
|
||||
ui.click.extensionTab=function(name){
|
||||
ui.click.menuTab('扩展');
|
||||
|
@ -41722,28 +41732,26 @@
|
|||
var updateNodes=function(){
|
||||
for(var i=0;i<start.firstChild.childNodes.length;i++){
|
||||
var node=start.firstChild.childNodes[i];
|
||||
if(node.link){
|
||||
if(node.mode=='get') continue;
|
||||
if(node.mode=='create') continue;
|
||||
if(node.mode.indexOf('extension_')==0){
|
||||
if(node.mode&&node.mode.indexOf('extension_')==0){
|
||||
if(lib.config[node.mode+'_enable']){
|
||||
node.classList.remove('off');
|
||||
node.link.firstChild.classList.add('on');
|
||||
if(node.link) node.link.firstChild.classList.add('on');
|
||||
}
|
||||
else{
|
||||
node.classList.add('off');
|
||||
node.link.firstChild.classList.remove('on');
|
||||
if(node.link) node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(lib.config.plays.contains(node.mode)){
|
||||
node.classList.remove('off');
|
||||
node.link.firstChild.classList.add('on');
|
||||
if(node.link) node.link.firstChild.classList.add('on');
|
||||
}
|
||||
else{
|
||||
node.classList.add('off');
|
||||
node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
if(node.link) node.link.firstChild.classList.remove('on');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41787,9 +41795,9 @@
|
|||
if(node.innerHTML.length>=5){
|
||||
node.classList.add('smallfont');
|
||||
}
|
||||
node.mode=mode;
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
node.mode=mode;
|
||||
for(var i in lib.extensionMenu[mode]){
|
||||
if(i=='game') continue;
|
||||
var cfg=copyObj(lib.extensionMenu[mode][i]);
|
||||
|
@ -41836,9 +41844,9 @@
|
|||
if(lib.config.show_extensionmaker==false) return;
|
||||
var page=ui.create.div('#create-extension');
|
||||
var node=ui.create.div('.menubutton.large','制作扩展',start.firstChild,clickMode);
|
||||
node.mode='create';
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
node.mode='create';
|
||||
var pageboard=ui.create.div(page);
|
||||
var inputExtLine=ui.create.div(pageboard);
|
||||
inputExtLine.style.transition='all 0s';
|
||||
|
@ -43954,9 +43962,13 @@
|
|||
(function(){
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large','获取扩展',start.firstChild,clickMode);
|
||||
node.mode='get';
|
||||
var _thisUpdate=false;
|
||||
node.update=function(){
|
||||
_thisUpdate=true;
|
||||
};
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
node.mode='get';
|
||||
page.listen(function(){
|
||||
if(!page.currenttimeout){
|
||||
var active=page.querySelector('.videonode.current');
|
||||
|
@ -44254,6 +44266,7 @@
|
|||
});
|
||||
}
|
||||
};
|
||||
if(_thisUpdate) node.update();
|
||||
};
|
||||
}());
|
||||
var active=start.firstChild.querySelector('.active');
|
||||
|
@ -45033,9 +45046,6 @@
|
|||
}
|
||||
}());
|
||||
(function(){
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large','控制',start.firstChild,clickMode);
|
||||
node._initLink=function(){
|
||||
var norow2=function(){
|
||||
var node=currentrow1;
|
||||
if(!node) return false;
|
||||
|
@ -45143,6 +45153,9 @@
|
|||
clickContainer.call(menuContainer);
|
||||
}
|
||||
});
|
||||
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large','控制',start.firstChild,clickMode);
|
||||
node.link=page;
|
||||
node.type='cheat';
|
||||
page.classList.add('menu-sym');
|
||||
|
@ -45286,28 +45299,27 @@
|
|||
}
|
||||
checkCheat();
|
||||
});
|
||||
};
|
||||
}());
|
||||
(function(){
|
||||
var page=ui.create.div('');
|
||||
var node=ui.create.div('.menubutton.large','命令',start.firstChild,clickMode);
|
||||
ui.commandnode=node;
|
||||
node.type='cmd';
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
page.classList.add('menu-sym');
|
||||
menuUpdates.push(function(){
|
||||
if(_status.connectMode){
|
||||
node.classList.add('off');
|
||||
if(node.classList.contains('active')){
|
||||
node.classList.remove('active');
|
||||
node.link.remove();
|
||||
if(node.link) node.link.remove();
|
||||
active=start.firstChild.firstChild;
|
||||
active.classList.add('active');
|
||||
rightPane.appendChild(active.link);
|
||||
}
|
||||
}
|
||||
});
|
||||
node._initLink=function(){
|
||||
node.link=page;
|
||||
page.classList.add('menu-sym');
|
||||
var text=document.createElement('div');
|
||||
text.style.width='194px';
|
||||
text.style.height='124px';
|
||||
|
|
Loading…
Reference in New Issue