2016-08-15 14:19:58 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
mode.brawl={
|
|
|
|
|
start:function(){
|
2016-10-05 06:03:57 +00:00
|
|
|
|
ui.auto.hide();
|
2016-08-20 04:17:33 +00:00
|
|
|
|
if(!lib.storage.scene){
|
|
|
|
|
lib.storage.scene={};
|
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
if(!lib.storage.stage){
|
|
|
|
|
lib.storage.stage={};
|
|
|
|
|
}
|
2016-10-07 07:23:50 +00:00
|
|
|
|
if(!_status.extensionmade){
|
|
|
|
|
_status.extensionmade=[];
|
|
|
|
|
}
|
|
|
|
|
if(_status.extensionscene){
|
|
|
|
|
game.save('scene',lib.storage.scene);
|
|
|
|
|
}
|
|
|
|
|
if(_status.extensionstage){
|
|
|
|
|
game.save('stage',lib.storage.stage);
|
|
|
|
|
}
|
2016-08-29 11:00:45 +00:00
|
|
|
|
var dialog=ui.create.dialog('hidden');
|
2016-08-16 10:56:29 +00:00
|
|
|
|
dialog.classList.add('fixed');
|
|
|
|
|
dialog.classList.add('scroll1');
|
|
|
|
|
dialog.classList.add('scroll2');
|
|
|
|
|
dialog.classList.add('fullwidth');
|
|
|
|
|
dialog.classList.add('fullheight');
|
|
|
|
|
dialog.classList.add('noupdate');
|
|
|
|
|
dialog.classList.add('character');
|
|
|
|
|
dialog.contentContainer.style.overflow='visible';
|
|
|
|
|
dialog.style.overflow='hidden';
|
|
|
|
|
dialog.content.style.height='100%';
|
|
|
|
|
dialog.contentContainer.style.transition='all 0s';
|
2016-10-07 07:23:50 +00:00
|
|
|
|
if(!lib.storage.directStage) dialog.open();
|
2016-08-16 10:56:29 +00:00
|
|
|
|
var packnode=ui.create.div('.packnode',dialog);
|
|
|
|
|
lib.setScroll(packnode);
|
|
|
|
|
var clickCapt=function(){
|
|
|
|
|
var active=this.parentNode.querySelector('.active');
|
2016-10-01 06:07:17 +00:00
|
|
|
|
if(this.link=='stage'){
|
2016-10-07 07:23:50 +00:00
|
|
|
|
if(get.is.empty(lib.storage.scene)){
|
|
|
|
|
alert('请创建至少1个场景');
|
2016-10-01 06:07:17 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
if(active){
|
2016-08-18 10:51:06 +00:00
|
|
|
|
if(active==this) return;
|
2016-08-16 10:56:29 +00:00
|
|
|
|
for(var i=0;i<active.nodes.length;i++){
|
|
|
|
|
active.nodes[i].remove();
|
|
|
|
|
if(active.nodes[i].showcaseinterval){
|
|
|
|
|
clearInterval(active.nodes[i].showcaseinterval);
|
|
|
|
|
delete active.nodes[i].showcaseinterval;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
active.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
this.classList.add('active');
|
|
|
|
|
for(var i=0;i<this.nodes.length;i++){
|
|
|
|
|
dialog.content.appendChild(this.nodes[i]);
|
|
|
|
|
}
|
|
|
|
|
var showcase=this.nodes[this.nodes.length-1];
|
|
|
|
|
showcase.style.height=(dialog.content.offsetHeight-showcase.offsetTop)+'px';
|
|
|
|
|
if(typeof showcase.action=='function'){
|
2016-09-01 10:36:59 +00:00
|
|
|
|
if(showcase.action(showcase._showcased?false:true)!==false){
|
|
|
|
|
showcase._showcased=true;
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
}
|
2016-08-18 10:51:06 +00:00
|
|
|
|
if(this._nostart) start.style.display='none';
|
|
|
|
|
else start.style.display='';
|
2016-08-16 11:58:30 +00:00
|
|
|
|
game.save('currentBrawl',this.link);
|
2016-08-16 10:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
var createNode=function(name){
|
|
|
|
|
var info=lib.brawl[name];
|
|
|
|
|
var node=ui.create.div('.dialogbutton.menubutton.large',info.name,packnode,clickCapt);
|
2016-08-20 04:17:33 +00:00
|
|
|
|
node.style.transition='all 0s';
|
2016-10-01 06:07:17 +00:00
|
|
|
|
var caption=info.name;
|
2016-10-05 06:03:57 +00:00
|
|
|
|
var modeinfo='';
|
|
|
|
|
if(info.mode){
|
|
|
|
|
modeinfo=get.translation(info.mode)+'模式';
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
if(info.submode){
|
2016-10-05 06:03:57 +00:00
|
|
|
|
if(modeinfo){
|
|
|
|
|
modeinfo+=' - ';
|
|
|
|
|
}
|
|
|
|
|
modeinfo+=info.submode;
|
2016-08-16 10:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
var intro;
|
|
|
|
|
if(Array.isArray(info.intro)){
|
|
|
|
|
intro='<ul style="text-align:left;margin-top:0;width:450px">';
|
2016-10-05 06:03:57 +00:00
|
|
|
|
if(modeinfo){
|
|
|
|
|
intro+='<li>'+modeinfo;
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
for(var i=0;i<info.intro.length;i++){
|
|
|
|
|
intro+='<li>'+info.intro[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
2016-10-05 06:03:57 +00:00
|
|
|
|
intro='';
|
|
|
|
|
if(modeinfo){
|
|
|
|
|
intro+='('+modeinfo+')';
|
|
|
|
|
}
|
|
|
|
|
intro+=info.intro;
|
2016-08-16 10:56:29 +00:00
|
|
|
|
}
|
|
|
|
|
var showcase=ui.create.div();
|
|
|
|
|
showcase.style.margin='0px';
|
|
|
|
|
showcase.style.padding='0px';
|
|
|
|
|
showcase.style.width='100%';
|
|
|
|
|
showcase.style.display='block'
|
|
|
|
|
showcase.action=info.showcase;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
showcase.link=name;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
if(info.fullshow){
|
|
|
|
|
node.nodes=[showcase];
|
|
|
|
|
showcase.style.height='100%';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
node.nodes=[
|
|
|
|
|
ui.create.div('.caption',caption),
|
|
|
|
|
ui.create.div('.text center',intro),
|
|
|
|
|
showcase
|
|
|
|
|
];
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
node.link=name;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
node._nostart=info.nostart;
|
2016-08-16 11:58:30 +00:00
|
|
|
|
if(lib.storage.currentBrawl==name){
|
|
|
|
|
clickCapt.call(node);
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
return node;
|
|
|
|
|
}
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var clickStart=function(){
|
2016-08-16 10:56:29 +00:00
|
|
|
|
var active=packnode.querySelector('.active');
|
|
|
|
|
if(active){
|
|
|
|
|
for(var i=0;i<active.nodes.length;i++){
|
|
|
|
|
if(active.nodes[i].showcaseinterval){
|
|
|
|
|
clearInterval(active.nodes[i].showcaseinterval);
|
|
|
|
|
delete active.nodes[i].showcaseinterval;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var info;
|
|
|
|
|
if(active.link.indexOf('stage_')==0){
|
|
|
|
|
var level;
|
|
|
|
|
if(Array.isArray(arguments[0])){
|
|
|
|
|
level={index:arguments[0][1]};
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
level=dialog.content.querySelector('.menubutton.large.active');
|
|
|
|
|
}
|
|
|
|
|
if(level){
|
|
|
|
|
var stagesave=lib.storage.stage;
|
|
|
|
|
var stage=stagesave[active.link.slice(6)];
|
|
|
|
|
game.save('lastStage',level.index);
|
|
|
|
|
lib.onover.push(function(bool){
|
|
|
|
|
_status.createControl=ui.controls[0];
|
|
|
|
|
if(bool&&level.index+1<stage.scenes.length){
|
|
|
|
|
ui.create.control('下一关',function(){
|
|
|
|
|
game.save('directStage',[stage.name,level.index+1],'brawl');
|
|
|
|
|
game.reload();
|
|
|
|
|
});
|
|
|
|
|
if(level.index+1>stage.level){
|
|
|
|
|
stage.level=level.index+1;
|
|
|
|
|
game.save('stage',stagesave,'brawl');
|
|
|
|
|
}
|
|
|
|
|
if(stage.mode!='sequal'){
|
|
|
|
|
game.save('lastStage',level.index+1,'brawl');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.create.control('重新开始',function(){
|
|
|
|
|
if(stage.mode=='sequal'&&bool&&level.index==stage.scenes.length-1){
|
|
|
|
|
game.save('directStage',[stage.name,0],'brawl');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.save('directStage',[stage.name,level.index],'brawl');
|
|
|
|
|
}
|
|
|
|
|
game.reload();
|
|
|
|
|
});
|
|
|
|
|
if(stage.mode=='sequal'&&level.index==stage.scenes.length-1){
|
|
|
|
|
stage.level=0;
|
|
|
|
|
game.save('stage',stagesave,'brawl');
|
|
|
|
|
}
|
|
|
|
|
if(stage.mode!='sequal'){
|
|
|
|
|
game.save('lastStage',level.index,'brawl');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
delete _status.createControl;
|
|
|
|
|
});
|
|
|
|
|
var scene=stage.scenes[level.index];
|
|
|
|
|
info={
|
|
|
|
|
name:scene.name,
|
|
|
|
|
intro:scene.intro,
|
|
|
|
|
};
|
|
|
|
|
for(var i in lib.brawl.scene.template){
|
|
|
|
|
info[i]=get.copy(lib.brawl.scene.template[i]);
|
|
|
|
|
}
|
|
|
|
|
if(!scene.gameDraw){
|
|
|
|
|
info.content.noGameDraw=true;
|
|
|
|
|
}
|
|
|
|
|
info.content.scene=scene;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info=lib.brawl[active.link];
|
|
|
|
|
}
|
|
|
|
|
lib.translate.restart='返回';
|
2016-08-16 10:56:29 +00:00
|
|
|
|
dialog.delete();
|
|
|
|
|
ui.brawlinfo=ui.create.system('乱斗',null,true);
|
|
|
|
|
lib.setPopped(ui.brawlinfo,function(){
|
|
|
|
|
var uiintro=ui.create.dialog('hidden');
|
|
|
|
|
uiintro.add(info.name);
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var intro;
|
|
|
|
|
if(Array.isArray(info.intro)){
|
|
|
|
|
intro='<ul style="text-align:left;margin-top:0;width:450px">';
|
|
|
|
|
for(var i=0;i<info.intro.length;i++){
|
|
|
|
|
intro+='<li>'+info.intro[i];
|
|
|
|
|
}
|
|
|
|
|
intro+='</ul>'
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
intro=info.intro;
|
|
|
|
|
}
|
|
|
|
|
uiintro.add('<div class="text center">'+intro+'</div>');
|
2016-08-16 10:56:29 +00:00
|
|
|
|
var ul=uiintro.querySelector('ul');
|
|
|
|
|
if(ul){
|
|
|
|
|
ul.style.width='180px';
|
|
|
|
|
}
|
|
|
|
|
uiintro.add(ui.create.div('.placeholder'));
|
|
|
|
|
return uiintro;
|
|
|
|
|
},250);
|
2016-10-05 06:03:57 +00:00
|
|
|
|
ui.auto.show();
|
2016-08-16 10:56:29 +00:00
|
|
|
|
_status.brawl=info.content;
|
|
|
|
|
game.switchMode(info.mode);
|
|
|
|
|
if(info.init){
|
|
|
|
|
info.init();
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-07 07:23:50 +00:00
|
|
|
|
};
|
|
|
|
|
var start=ui.create.div('.menubutton.round.highlight','斗',dialog.content,clickStart);
|
2016-08-16 10:56:29 +00:00
|
|
|
|
start.style.position='absolute';
|
|
|
|
|
start.style.left='auto';
|
|
|
|
|
start.style.right='10px';
|
|
|
|
|
start.style.top='auto';
|
|
|
|
|
start.style.bottom='10px';
|
|
|
|
|
start.style.width='80px';
|
|
|
|
|
start.style.height='80px';
|
|
|
|
|
start.style.lineHeight='80px';
|
2016-08-16 16:25:34 +00:00
|
|
|
|
start.style.margin='0';
|
|
|
|
|
start.style.padding='5px';
|
2016-08-16 10:56:29 +00:00
|
|
|
|
start.style.fontSize='72px';
|
2016-08-16 16:25:34 +00:00
|
|
|
|
start.style.zIndex=3;
|
|
|
|
|
start.style.transition='all 0s';
|
2016-08-28 00:30:25 +00:00
|
|
|
|
game.addScene=function(name,clear){
|
2016-08-20 04:17:33 +00:00
|
|
|
|
var scene=lib.storage.scene[name];
|
|
|
|
|
var brawl={
|
|
|
|
|
name:name,
|
|
|
|
|
intro:scene.intro,
|
|
|
|
|
};
|
|
|
|
|
for(var i in lib.brawl.scene.template){
|
2016-09-01 10:36:59 +00:00
|
|
|
|
brawl[i]=get.copy(lib.brawl.scene.template[i]);
|
|
|
|
|
}
|
|
|
|
|
if(!scene.gameDraw){
|
|
|
|
|
brawl.content.noGameDraw=true;
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
|
|
|
|
brawl.content.scene=scene;
|
|
|
|
|
lib.brawl['scene_'+name]=brawl;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var node=createNode('scene_'+name);
|
2016-10-01 06:07:17 +00:00
|
|
|
|
if(clear){
|
|
|
|
|
game.addSceneClear();
|
|
|
|
|
clickCapt.call(node);
|
|
|
|
|
_status.sceneChanged=true;
|
|
|
|
|
}
|
2016-08-20 04:17:33 +00:00
|
|
|
|
};
|
2016-10-05 06:03:57 +00:00
|
|
|
|
game.addStage=function(name,clear){
|
|
|
|
|
var stage=lib.storage.stage[name];
|
|
|
|
|
var brawl={
|
|
|
|
|
name:name,
|
|
|
|
|
intro:stage.intro,
|
|
|
|
|
content:{}
|
|
|
|
|
};
|
|
|
|
|
for(var i in lib.brawl.stage.template){
|
|
|
|
|
brawl[i]=get.copy(lib.brawl.stage.template[i]);
|
|
|
|
|
}
|
|
|
|
|
brawl.content.stage=stage;
|
|
|
|
|
lib.brawl['stage_'+name]=brawl;
|
|
|
|
|
var node=createNode('stage_'+name);
|
|
|
|
|
if(clear){
|
|
|
|
|
game.addStageClear();
|
|
|
|
|
clickCapt.call(node);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-20 04:17:33 +00:00
|
|
|
|
game.removeScene=function(name){
|
|
|
|
|
delete lib.storage.scene[name];
|
|
|
|
|
game.save('scene',lib.storage.scene);
|
2016-10-01 06:07:17 +00:00
|
|
|
|
_status.sceneChanged=true;
|
2016-08-20 04:17:33 +00:00
|
|
|
|
for(var i=0;i<packnode.childElementCount;i++){
|
|
|
|
|
if(packnode.childNodes[i].link=='scene_'+name){
|
|
|
|
|
if(packnode.childNodes[i].classList.contains('active')){
|
2016-10-05 06:03:57 +00:00
|
|
|
|
for(var j=0;j<packnode.childElementCount;j++){
|
|
|
|
|
if(packnode.childNodes[j].link=='scene'){
|
|
|
|
|
clickCapt.call(packnode.childNodes[j]);
|
|
|
|
|
}
|
2016-10-01 06:07:17 +00:00
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
packnode.childNodes[i].remove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.removeStage=function(name){
|
|
|
|
|
delete lib.storage.stage[name];
|
|
|
|
|
game.save('stage',lib.storage.stage);
|
|
|
|
|
for(var i=0;i<packnode.childElementCount;i++){
|
|
|
|
|
if(packnode.childNodes[i].link=='stage_'+name){
|
|
|
|
|
if(packnode.childNodes[i].classList.contains('active')){
|
|
|
|
|
for(var j=0;j<packnode.childElementCount;j++){
|
2016-10-07 07:45:02 +00:00
|
|
|
|
if(get.is.empty(lib.storage.scene)){
|
|
|
|
|
if(packnode.childNodes[j].link=='scene'){
|
|
|
|
|
clickCapt.call(packnode.childNodes[j]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(packnode.childNodes[j].link=='stage'){
|
|
|
|
|
clickCapt.call(packnode.childNodes[j]);
|
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
}
|
2016-10-01 06:07:17 +00:00
|
|
|
|
}
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
|
|
|
|
packnode.childNodes[i].remove();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var sceneNode;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
for(var i in lib.brawl){
|
2016-09-26 06:42:05 +00:00
|
|
|
|
if(get.config(i)===false) continue;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(i=='scene'){
|
|
|
|
|
sceneNode=createNode(i);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
createNode(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(sceneNode){
|
|
|
|
|
game.switchScene=function(){
|
|
|
|
|
clickCapt.call(sceneNode);
|
|
|
|
|
}
|
2016-08-18 10:51:06 +00:00
|
|
|
|
}
|
2016-08-20 04:17:33 +00:00
|
|
|
|
for(var i in lib.storage.scene){
|
|
|
|
|
game.addScene(i);
|
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
for(var i in lib.storage.stage){
|
|
|
|
|
game.addStage(i);
|
|
|
|
|
}
|
2016-08-18 10:51:06 +00:00
|
|
|
|
if(!lib.storage.currentBrawl){
|
|
|
|
|
clickCapt.call(packnode.firstChild);
|
|
|
|
|
}
|
2016-10-07 07:23:50 +00:00
|
|
|
|
game.save('lastStage');
|
|
|
|
|
if(lib.storage.directStage){
|
|
|
|
|
var directStage=lib.storage.directStage;
|
|
|
|
|
game.save('directStage');
|
|
|
|
|
clickStart(directStage);
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
|
|
|
|
brawl:{
|
|
|
|
|
duzhansanguo:{
|
|
|
|
|
name:'毒战三国',
|
|
|
|
|
mode:'identity',
|
|
|
|
|
intro:'牌堆中额外添加10%的毒',
|
2016-08-16 16:25:34 +00:00
|
|
|
|
showcase:function(init){
|
2016-08-16 10:56:29 +00:00
|
|
|
|
var node=this;
|
2016-08-16 16:25:34 +00:00
|
|
|
|
var func=function(){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var card=game.createCard('du','noclick');
|
2016-08-16 10:56:29 +00:00
|
|
|
|
node.nodes.push(card);
|
|
|
|
|
card.style.position='absolute';
|
|
|
|
|
var rand1=Math.round(Math.random()*100);
|
|
|
|
|
var rand2=Math.round(Math.random()*100);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
var rand3=Math.round(Math.random()*40)-20;
|
2016-08-16 10:56:29 +00:00
|
|
|
|
card.style.left='calc('+rand1+'% - '+rand1+'px)';
|
|
|
|
|
card.style.top='calc('+rand2+'% - '+rand2+'px)';
|
2016-08-16 11:58:30 +00:00
|
|
|
|
card.style.transform='scale(0.8) rotate('+rand3+'deg)';
|
2016-08-16 10:56:29 +00:00
|
|
|
|
card.style.opacity=0;
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.opacity=1;
|
2016-08-16 11:58:30 +00:00
|
|
|
|
card.style.transform='scale(1) rotate('+rand3+'deg)';
|
2016-08-16 10:56:29 +00:00
|
|
|
|
if(node.nodes.length>7){
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
while(node.nodes.length>5){
|
|
|
|
|
node.nodes.shift().delete();
|
|
|
|
|
}
|
|
|
|
|
},500);
|
|
|
|
|
}
|
2016-08-16 16:25:34 +00:00
|
|
|
|
};
|
|
|
|
|
if(init){
|
|
|
|
|
node.nodes=[];
|
|
|
|
|
for(var i=0;i<5;i++){
|
|
|
|
|
func();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
node.showcaseinterval=setInterval(func,1000);
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
cardPile:function(list){
|
|
|
|
|
var num=Math.ceil(list.length/10);
|
|
|
|
|
while(num--){
|
|
|
|
|
list.push([['heart','diamond','club','spade'].randomGet(),Math.ceil(Math.random()*13),'du']);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
daozhiyueying:{
|
|
|
|
|
name:'导师月英',
|
|
|
|
|
mode:'identity',
|
|
|
|
|
intro:'牌堆中所有非延时锦囊牌数量翻倍;移除拥有集智技能的角色',
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
var node=this;
|
|
|
|
|
var player1,player2;
|
|
|
|
|
if(init){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
player1=ui.create.player(null,true).init('huangyueying');
|
|
|
|
|
player2=ui.create.player(null,true).init('re_huangyueying');
|
2016-08-16 10:56:29 +00:00
|
|
|
|
player1.style.left='20px';
|
|
|
|
|
player1.style.top='20px';
|
|
|
|
|
player1.style.transform='scale(0.9)';
|
2016-08-16 11:58:30 +00:00
|
|
|
|
player1.node.count.innerHTML='2';
|
|
|
|
|
player1.node.count.dataset.condition='mid';
|
2016-08-16 10:56:29 +00:00
|
|
|
|
player2.style.left='auto';
|
|
|
|
|
player2.style.right='20px';
|
|
|
|
|
player2.style.top='20px';
|
|
|
|
|
player2.style.transform='scale(0.9)';
|
2016-08-16 11:58:30 +00:00
|
|
|
|
player2.node.count.innerHTML='2';
|
|
|
|
|
player2.node.count.dataset.condition='mid';
|
2016-08-16 10:56:29 +00:00
|
|
|
|
this.appendChild(player1);
|
|
|
|
|
this.appendChild(player2);
|
|
|
|
|
this.player1=player1;
|
|
|
|
|
this.player2=player2;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
player1=this.player1;
|
|
|
|
|
player2=this.player2;
|
|
|
|
|
}
|
|
|
|
|
var rect1=player1.getBoundingClientRect();
|
|
|
|
|
var rect2=player2.getBoundingClientRect();
|
|
|
|
|
var left1=rect1.left+rect1.width/2-ui.arena.offsetLeft;
|
|
|
|
|
var left2=rect2.left+rect2.width/2-ui.arena.offsetLeft;
|
|
|
|
|
var top1=rect1.top+rect1.height/2-ui.arena.offsetTop;
|
|
|
|
|
var top2=rect2.top+rect2.height/2-ui.arena.offsetTop;
|
2016-08-16 11:58:30 +00:00
|
|
|
|
|
|
|
|
|
var createCard=function(wuxie){
|
|
|
|
|
var card;
|
|
|
|
|
if(wuxie){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
card=game.createCard('wuxie','noclick');
|
2016-08-16 11:58:30 +00:00
|
|
|
|
card.style.transform='scale(0.9)';
|
|
|
|
|
}
|
|
|
|
|
else{
|
2016-08-18 13:48:50 +00:00
|
|
|
|
card=ui.create.card(null,'noclick',true);
|
2016-08-16 11:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
card.style.opacity=0;
|
|
|
|
|
card.style.position='absolute';
|
|
|
|
|
card.style.zIndex=2;
|
|
|
|
|
card.style.margin=0;
|
|
|
|
|
return card;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var func=function(){
|
2016-08-16 10:56:29 +00:00
|
|
|
|
game.linexy([left1,top1,left2,top2]);
|
2016-08-16 11:58:30 +00:00
|
|
|
|
var card=createCard(true);
|
|
|
|
|
card.style.left='43px';
|
|
|
|
|
card.style.top='58px';
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.opacity=1;
|
|
|
|
|
card.style.transform='scale(0.9) translate(137px,152px)';
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
card.delete();
|
|
|
|
|
},1000);
|
|
|
|
|
player1.node.count.innerHTML='1';
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
if(!node.showcaseinterval) return;
|
|
|
|
|
player1.node.count.innerHTML='2';
|
|
|
|
|
var card=createCard();
|
|
|
|
|
card.style.left='43px';
|
|
|
|
|
card.style.top='58px';
|
|
|
|
|
card.style.transform='scale(0.9) translate(137px,152px)';
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.opacity=1;
|
|
|
|
|
card.style.transform='scale(0.9)';
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
card.delete();
|
|
|
|
|
},1000);
|
|
|
|
|
},300);
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
if(!node.showcaseinterval) return;
|
|
|
|
|
player2.node.count.innerHTML='1';
|
|
|
|
|
game.linexy([left2,top2,left1,top1]);
|
|
|
|
|
var card=createCard(true);
|
|
|
|
|
card.style.left='auto';
|
|
|
|
|
card.style.right='43px';
|
|
|
|
|
card.style.top='58px';
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.opacity=1;
|
|
|
|
|
card.style.transform='scale(0.9) translate(-137px,152px)';
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
card.delete();
|
|
|
|
|
},700);
|
|
|
|
|
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
if(!node.showcaseinterval) return;
|
|
|
|
|
player2.node.count.innerHTML='2';
|
|
|
|
|
var card=createCard();
|
|
|
|
|
card.style.left='auto';
|
|
|
|
|
card.style.right='43px';
|
|
|
|
|
card.style.top='58px';
|
|
|
|
|
card.style.transform='scale(0.9) translate(-137px,152px)';
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.opacity=1;
|
|
|
|
|
card.style.transform='scale(0.9)';
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
card.delete();
|
|
|
|
|
},700);
|
|
|
|
|
},300);
|
|
|
|
|
},1000);
|
|
|
|
|
};
|
|
|
|
|
node.showcaseinterval=setInterval(func,2200);
|
|
|
|
|
func();
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
|
|
|
|
init:function(){
|
|
|
|
|
for(var i in lib.character){
|
|
|
|
|
var skills=lib.character[i][3]
|
|
|
|
|
if(skills.contains('jizhi')||skills.contains('rejizhi')||skills.contains('lingzhou')){
|
|
|
|
|
delete lib.character[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
cardPile:function(list){
|
|
|
|
|
var list2=[];
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
list2.push(list[i]);
|
|
|
|
|
if(get.type(list[i][2])=='trick'){
|
|
|
|
|
list2.push(list[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return list2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
weiwoduzun:{
|
|
|
|
|
name:'唯我独尊',
|
|
|
|
|
mode:'identity',
|
|
|
|
|
intro:[
|
2016-08-16 16:25:34 +00:00
|
|
|
|
'牌堆中杀的数量增加30%',
|
2016-08-16 10:56:29 +00:00
|
|
|
|
'游戏开始时,主公获得一枚战神标记',
|
|
|
|
|
'拥有战神标记的角色杀造成的伤害+1',
|
|
|
|
|
'受到杀造成的伤害后战神印记将移到伤害来源的武将牌上'
|
2016-08-16 16:25:34 +00:00
|
|
|
|
],
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
var node=this;
|
|
|
|
|
var player;
|
|
|
|
|
if(init){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
player=ui.create.player(null,true);
|
2016-10-01 06:07:17 +00:00
|
|
|
|
player.node.avatar.style.backgroundSize='cover';
|
|
|
|
|
player.node.avatar.setBackgroundImage('image/mode/boss/character/boss_lvbu2.jpg');
|
2016-08-28 00:30:25 +00:00
|
|
|
|
player.node.avatar.show();
|
2016-08-16 16:25:34 +00:00
|
|
|
|
player.style.left='calc(50% - 75px)';
|
|
|
|
|
player.style.top='20px';
|
|
|
|
|
player.node.count.remove();
|
|
|
|
|
player.node.hp.remove();
|
|
|
|
|
player.style.transition='all 0.5s';
|
|
|
|
|
node.appendChild(player);
|
|
|
|
|
node.playernode=player;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
player=node.playernode;
|
|
|
|
|
}
|
|
|
|
|
var num=0;
|
|
|
|
|
var num2=0;
|
|
|
|
|
this.showcaseinterval=setInterval(function(){
|
|
|
|
|
var dx,dy
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(num2%5==0){
|
|
|
|
|
// player.animate('target');
|
|
|
|
|
// player.animate('zoomin');
|
|
|
|
|
player.classList.add('zoomin3');
|
|
|
|
|
player.hide();
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
player.style.transitionProperty='none';
|
|
|
|
|
player.classList.remove('zoomin3');
|
|
|
|
|
player.classList.add('zoomout2');
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
player.style.transitionProperty='';
|
|
|
|
|
player.classList.remove('zoomout2');
|
|
|
|
|
player.show();
|
|
|
|
|
},500);
|
|
|
|
|
},700);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
}
|
|
|
|
|
num2++;
|
|
|
|
|
switch(num++){
|
2016-08-18 10:51:06 +00:00
|
|
|
|
case 0:dx=-180;dy=0;break;
|
|
|
|
|
case 1:dx=-140;dy=100;break;
|
2016-08-16 16:25:34 +00:00
|
|
|
|
case 2:dx=0;dy=155;break;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
case 3:dx=140;dy=100;break;
|
|
|
|
|
case 4:dx=180;dy=0;break;
|
2016-08-16 16:25:34 +00:00
|
|
|
|
}
|
|
|
|
|
if(num>=5){
|
|
|
|
|
num=0;
|
|
|
|
|
}
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var card=game.createCard('sha','noclick');
|
2016-08-16 16:25:34 +00:00
|
|
|
|
card.style.left='calc(50% - 52px)';
|
|
|
|
|
card.style.top='68px';
|
|
|
|
|
card.style.position='absolute';
|
|
|
|
|
card.style.margin=0;
|
|
|
|
|
card.style.zIndex=2;
|
|
|
|
|
card.style.opacity=0;
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.opacity=1;
|
|
|
|
|
card.style.transform='translate('+dx+'px,'+dy+'px)';
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
card.delete();
|
|
|
|
|
},700);
|
|
|
|
|
},700);
|
|
|
|
|
},
|
|
|
|
|
init:function(){
|
|
|
|
|
lib.skill.weiwoduzun={
|
|
|
|
|
mark:true,
|
|
|
|
|
intro:{
|
|
|
|
|
content:'杀造成的伤害+1'
|
|
|
|
|
},
|
|
|
|
|
group:['weiwoduzun_damage','weiwoduzun_lose'],
|
|
|
|
|
subSkill:{
|
|
|
|
|
damage:{
|
|
|
|
|
trigger:{source:'damageBegin'},
|
|
|
|
|
forced:true,
|
|
|
|
|
filter:function(event){
|
|
|
|
|
return event.card&&event.card.name=='sha'&&event.notLink();
|
|
|
|
|
},
|
|
|
|
|
content:function(){
|
|
|
|
|
trigger.num++;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
lose:{
|
|
|
|
|
trigger:{player:'damageEnd'},
|
|
|
|
|
forced:true,
|
|
|
|
|
filter:function(event){
|
|
|
|
|
return event.source&&event.source.isAlive();
|
|
|
|
|
},
|
|
|
|
|
content:function(){
|
|
|
|
|
player.removeSkill('weiwoduzun');
|
|
|
|
|
trigger.source.addSkill('weiwoduzun');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
lib.translate.weiwoduzun='战神';
|
|
|
|
|
lib.translate.weiwoduzun_bg='尊';
|
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
cardPile:function(list){
|
|
|
|
|
var num=0;
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
if(list[i][2]=='sha') num++;
|
|
|
|
|
}
|
|
|
|
|
num=Math.round(num*0.3);
|
|
|
|
|
if(num<=0) return list;
|
|
|
|
|
while(num--){
|
|
|
|
|
var nature='';
|
|
|
|
|
var rand=Math.random();
|
|
|
|
|
if(rand<0.15){
|
|
|
|
|
nature='fire';
|
|
|
|
|
}
|
|
|
|
|
else if(rand<0.3){
|
|
|
|
|
nature='thunder';
|
|
|
|
|
}
|
|
|
|
|
var suit=['heart','spade','club','diamond'].randomGet();
|
|
|
|
|
var number=Math.ceil(Math.random()*13);
|
|
|
|
|
if(nature){
|
|
|
|
|
list.push([suit,number,'sha',nature]);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
list.push([suit,number,'sha']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
},
|
|
|
|
|
gameStart:function(){
|
|
|
|
|
if(_status.mode=='zhong'){
|
|
|
|
|
game.zhong.addSkill('weiwoduzun');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.zhu.addSkill('weiwoduzun');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
|
|
|
|
tongxingzhizheng:{
|
|
|
|
|
name:'同姓之争',
|
|
|
|
|
mode:'versus',
|
|
|
|
|
submode:'2v2',
|
2016-08-16 16:25:34 +00:00
|
|
|
|
intro:'姓氏相同的武将组合一队',
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
var node=this;
|
|
|
|
|
var getList=function(){
|
|
|
|
|
var list=[['guanyu','guanping','guansuo','guanyinping'],
|
|
|
|
|
['caocao','caopi','caozhi','caorui'],['liubei','liushan','liuchen'],
|
|
|
|
|
['xiahouyuan','xiahouba','xiahoushi'],['sunjian','sunquan','sunce'],
|
|
|
|
|
['zhangjiao','zhangliang','zhangbao'],['zhugeliang','zhugeguo','zhugejin','zhugeke'],
|
|
|
|
|
['mateng','machao','madai','mayunlu']];
|
|
|
|
|
list.randomSort();
|
|
|
|
|
var list2=[];
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
list2=list2.concat(list[i]);
|
|
|
|
|
}
|
|
|
|
|
node.list=list2;
|
|
|
|
|
};
|
|
|
|
|
var func=function(){
|
|
|
|
|
if(!node.list.length){
|
|
|
|
|
getList();
|
|
|
|
|
}
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var card=ui.create.player(null,true);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
card.init(node.list.shift());
|
|
|
|
|
card.node.marks.remove();
|
|
|
|
|
card.node.count.remove();
|
|
|
|
|
card.node.hp.remove();
|
|
|
|
|
node.nodes.push(card);
|
|
|
|
|
card.style.position='absolute';
|
|
|
|
|
var rand1=Math.round(Math.random()*100);
|
|
|
|
|
var rand2=Math.round(Math.random()*100);
|
|
|
|
|
var rand3=Math.round(Math.random()*40)-20;
|
|
|
|
|
card.style.left='calc('+rand1+'% - '+(rand1*1.5)+'px)';
|
|
|
|
|
card.style.top='calc('+rand2+'% - '+(rand2*1.8)+'px)';
|
|
|
|
|
card.style.transform='scale(1.2) rotate('+rand3+'deg)';
|
|
|
|
|
card.style.opacity=0;
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
|
|
|
|
card.style.transform='scale(0.9) rotate('+rand3+'deg)';
|
|
|
|
|
card.style.opacity=1;
|
|
|
|
|
if(node.nodes.length>4){
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
while(node.nodes.length>3){
|
|
|
|
|
node.nodes.shift().delete();
|
|
|
|
|
}
|
|
|
|
|
},500);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
node.list=[];
|
|
|
|
|
if(init){
|
|
|
|
|
node.nodes=[];
|
|
|
|
|
for(var i=0;i<3;i++){
|
|
|
|
|
func();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
node.showcaseinterval=setInterval(func,1000);
|
|
|
|
|
},
|
|
|
|
|
init:function(){
|
|
|
|
|
var map={};
|
|
|
|
|
var map3=[];
|
|
|
|
|
var list1=['司','夏','诸'];
|
|
|
|
|
var list2=['马','侯','葛'];
|
|
|
|
|
var exclude=['界','新','大'];
|
|
|
|
|
for(var i in lib.character){
|
|
|
|
|
if(lib.filter.characterDisabled(i)) continue;
|
|
|
|
|
var surname=lib.translate[i];
|
|
|
|
|
for(var j=0;j<surname.length;j++){
|
|
|
|
|
if(exclude.contains(surname[j])) continue;
|
|
|
|
|
if(!/[a-z]/i.test(surname[j])){
|
|
|
|
|
var index=list1.indexOf(surname[j]);
|
|
|
|
|
if(index!=-1&&surname[j+1]==list2[index]){
|
|
|
|
|
surname=surname[j]+surname[j+1];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
surname=surname[j];
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!map[surname]){
|
|
|
|
|
map[surname]=[];
|
|
|
|
|
}
|
|
|
|
|
map[surname].push(i);
|
|
|
|
|
}
|
|
|
|
|
for(var i in map){
|
|
|
|
|
if(map[i].length<4){
|
|
|
|
|
delete map[i];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
map3.push(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_status.brawl.map=map;
|
|
|
|
|
_status.brawl.map3=map3;
|
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
submode:'two',
|
|
|
|
|
chooseCharacterFixed:true,
|
|
|
|
|
chooseCharacter:function(list,player){
|
|
|
|
|
if(player.side==game.me.side){
|
|
|
|
|
if(_status.brawl.mylist){
|
|
|
|
|
return _status.brawl.mylist.randomGets(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(_status.brawl.enemylist){
|
|
|
|
|
return _status.brawl.enemylist.randomGets(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var surname=_status.brawl.map3.randomRemove();
|
|
|
|
|
var list=_status.brawl.map[surname];
|
|
|
|
|
if(player==game.me){
|
|
|
|
|
_status.brawl.mylist=list;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
_status.brawl.enemylist=list;
|
|
|
|
|
}
|
|
|
|
|
return list.randomRemove(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
|
|
|
|
tongqueduopao:{
|
|
|
|
|
name:'铜雀夺袍',
|
|
|
|
|
mode:'identity',
|
|
|
|
|
intro:[
|
|
|
|
|
'主公必选曹操',
|
|
|
|
|
'其余玩家从曹休、文聘、曹洪、张郃、夏侯渊、徐晃、许褚这些武将中随机选中一个',
|
|
|
|
|
'游戏开始时将麒麟弓和爪黄飞电各置于每名角色的装备区内,大宛马洗入牌堆,移除其他的武器牌和坐骑牌'
|
2016-08-16 16:25:34 +00:00
|
|
|
|
],
|
|
|
|
|
init:function(){
|
|
|
|
|
game.saveConfig('player_number','8','identity');
|
|
|
|
|
game.saveConfig('double_character',false,'identity');
|
|
|
|
|
},
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
var node=this;
|
|
|
|
|
var list=['caoxiu','wenpin','caohong','zhanghe','xiahouyuan','xuhuang','re_xuzhu'];
|
|
|
|
|
list.randomSort();
|
|
|
|
|
list.push('re_caocao');
|
|
|
|
|
var func=function(){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var card=ui.create.player(null,true);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
card.init(list.shift());
|
|
|
|
|
card.node.marks.remove();
|
|
|
|
|
card.node.count.remove();
|
|
|
|
|
card.node.hp.remove();
|
|
|
|
|
node.nodes.push(card);
|
|
|
|
|
card.style.position='absolute';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
card.style.zIndex=2;
|
|
|
|
|
card.style.transition='all 2s';
|
2016-08-16 16:25:34 +00:00
|
|
|
|
var rand1=Math.round(Math.random()*100);
|
|
|
|
|
var rand2=Math.round(Math.random()*100);
|
|
|
|
|
var rand3=Math.round(Math.random()*40)-20;
|
|
|
|
|
card.style.left='calc('+rand1+'% - '+(rand1*1.5)+'px)';
|
|
|
|
|
card.style.top='calc('+rand2+'% - '+(rand2*1.8)+'px)';
|
|
|
|
|
card.style.transform='scale(0.8) rotate('+rand3+'deg)';
|
|
|
|
|
node.appendChild(card);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
ui.refresh(card);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var list2=['qilin','dawan','zhuahuang'];
|
|
|
|
|
var func2=function(){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var card=game.createCard(list2.shift(),'noclick');
|
2016-08-18 10:51:06 +00:00
|
|
|
|
node.nodes.push(card);
|
|
|
|
|
card.style.position='absolute';
|
|
|
|
|
card.style.zIndex=2;
|
|
|
|
|
card.style.transition='all 2s';
|
|
|
|
|
var rand1=Math.round(Math.random()*100);
|
|
|
|
|
var rand2=Math.round(Math.random()*100);
|
|
|
|
|
var rand3=Math.round(Math.random()*40)-20;
|
|
|
|
|
card.style.left='calc('+rand1+'% - '+rand1+'px)';
|
|
|
|
|
card.style.top='calc('+rand2+'% - '+rand2+'px)';
|
|
|
|
|
card.style.transform='rotate('+rand3+'deg)';
|
|
|
|
|
node.appendChild(card);
|
|
|
|
|
ui.refresh(card);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
};
|
2016-08-18 10:51:06 +00:00
|
|
|
|
|
2016-08-16 16:25:34 +00:00
|
|
|
|
if(init){
|
|
|
|
|
node.nodes=[];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
while(node.nodes.length){
|
|
|
|
|
node.nodes.shift().remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-18 10:51:06 +00:00
|
|
|
|
for(var i=0;i<5;i++){
|
|
|
|
|
func();
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<3;i++){
|
|
|
|
|
func2();
|
2016-08-16 16:25:34 +00:00
|
|
|
|
func();
|
|
|
|
|
}
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var func3=function(){
|
|
|
|
|
for(var i=0;i<node.nodes.length;i++){
|
|
|
|
|
var card=node.nodes[i];
|
|
|
|
|
if(card.classList.contains('player')){
|
|
|
|
|
var rand1=Math.round(Math.random()*100);
|
|
|
|
|
var rand2=Math.round(Math.random()*100);
|
|
|
|
|
var rand3=Math.round(Math.random()*40)-20;
|
|
|
|
|
card.style.left='calc('+rand1+'% - '+(rand1*1.5)+'px)';
|
|
|
|
|
card.style.top='calc('+rand2+'% - '+(rand2*1.8)+'px)';
|
|
|
|
|
card.style.transform='scale(0.8) rotate('+rand3+'deg)';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var rand1=Math.round(Math.random()*100);
|
|
|
|
|
var rand2=Math.round(Math.random()*100);
|
|
|
|
|
var rand3=Math.round(Math.random()*40)-20;
|
|
|
|
|
card.style.left='calc('+rand1+'% - '+rand1+'px)';
|
|
|
|
|
card.style.top='calc('+rand2+'% - '+rand2+'px)';
|
|
|
|
|
card.style.transform='rotate('+rand3+'deg)';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
func3();
|
|
|
|
|
node.showcaseinterval=setInterval(func3,5000);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
cardPile:function(list){
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
var subtype=get.subtype(list[i][2]);
|
|
|
|
|
if(subtype=='equip1'||subtype=='equip3'||subtype=='equip4'){
|
|
|
|
|
list.splice(i--,1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<8;i++){
|
|
|
|
|
list.push([['heart','diamond','club','spade'].randomGet(),Math.ceil(Math.random()*13),'dawan']);
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
},
|
|
|
|
|
gameStart:function(){
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
game.players[i].$equip(game.createCard('qilin'));
|
|
|
|
|
game.players[i].$equip(game.createCard('zhuahuang'));
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
submode:'normal',
|
|
|
|
|
list:['caoxiu','wenpin','caohong','zhanghe','xiahouyuan','xuhuang','re_xuzhu'],
|
|
|
|
|
chooseCharacterFixed:true,
|
|
|
|
|
chooseCharacterAi:function(player){
|
|
|
|
|
if(player==game.zhu){
|
|
|
|
|
player.init('re_caocao');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
_status.brawl.list.remove(game.me.name);
|
|
|
|
|
player.init(_status.brawl.list.randomRemove());
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
chooseCharacter:function(){
|
|
|
|
|
if(game.me==game.zhu){
|
|
|
|
|
return ['re_caocao'];
|
|
|
|
|
}
|
|
|
|
|
else{
|
2016-08-18 10:51:06 +00:00
|
|
|
|
_status.brawl.list.randomSort();
|
|
|
|
|
return _status.brawl.list;
|
|
|
|
|
// return _status.brawl.list.randomGets(1);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
|
|
|
|
// shenrudihou:{
|
|
|
|
|
// name:'深入敌后',
|
|
|
|
|
// mode:'versus',
|
|
|
|
|
// submode:'1v1',
|
|
|
|
|
// intro:'选将阶段选择武将和对战阶段选择上场的武将都由对手替你选择,而且你不知道对手为你选择了什么武将'
|
|
|
|
|
// },
|
|
|
|
|
tongjiangmoshi:{
|
|
|
|
|
name:'同将模式',
|
|
|
|
|
mode:'identity',
|
2016-08-16 16:25:34 +00:00
|
|
|
|
intro:'玩家选择一个武将,所有角色均使用此武将',
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
if(init){
|
|
|
|
|
this.nodes=[];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
while(this.nodes.length){
|
|
|
|
|
this.nodes.shift().remove();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var lx=this.offsetWidth/2-120;
|
|
|
|
|
var ly=Math.min(lx,this.offsetHeight/2-60);
|
|
|
|
|
var setPos=function(node){
|
|
|
|
|
var i=node.index;
|
|
|
|
|
var deg=Math.PI/4*i;
|
2016-08-19 15:34:01 +00:00
|
|
|
|
var dx=Math.round(lx*Math.cos(deg));
|
|
|
|
|
var dy=Math.round(ly*Math.sin(deg));
|
2016-08-16 16:25:34 +00:00
|
|
|
|
node.style.transform='translate('+dx+'px,'+dy+'px)';
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<8;i++){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var node=ui.create.player(null,true);
|
2016-08-16 16:25:34 +00:00
|
|
|
|
this.nodes.push(node);
|
|
|
|
|
node.init('zuoci');
|
|
|
|
|
node.classList.add('minskin');
|
|
|
|
|
node.node.marks.remove();
|
|
|
|
|
node.node.hp.remove();
|
|
|
|
|
node.node.count.remove();
|
|
|
|
|
node.style.left='calc(50% - 60px)';
|
|
|
|
|
node.style.top='calc(50% - 60px)';
|
|
|
|
|
node.index=i;
|
|
|
|
|
setPos(node);
|
|
|
|
|
this.appendChild(node);
|
|
|
|
|
}
|
|
|
|
|
var nodes=this.nodes;
|
|
|
|
|
this.showcaseinterval=setInterval(function(){
|
|
|
|
|
for(var i=0;i<nodes.length;i++){
|
|
|
|
|
nodes[i].index++;
|
|
|
|
|
if(nodes[i].index>7){
|
|
|
|
|
nodes[i].index=0;
|
|
|
|
|
}
|
|
|
|
|
setPos(nodes[i]);
|
|
|
|
|
}
|
|
|
|
|
},1000);
|
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
gameStart:function(){
|
|
|
|
|
var target=(_status.mode=='zhong')?game.zhong:game.zhu;
|
|
|
|
|
if(get.config('double_character')){
|
|
|
|
|
target.init(game.me.name,game.me.name2);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
target.init(game.me.name);
|
|
|
|
|
}
|
|
|
|
|
target.hp++;
|
|
|
|
|
target.maxHp++;
|
|
|
|
|
target.update();
|
|
|
|
|
},
|
|
|
|
|
chooseCharacterAi:function(player,list,list2,back){
|
|
|
|
|
if(player==game.zhu){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(get.config('double_character')){
|
|
|
|
|
player.init(game.me.name,game.me.name2);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
player.init(game.me.name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
chooseCharacter:function(list,list2,num){
|
|
|
|
|
if(game.me!=game.zhu){
|
|
|
|
|
return list.slice(0,list2);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(_status.event.zhongmode){
|
|
|
|
|
return list.slice(0,6);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
return list.concat(list2.slice(0,num));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-16 10:56:29 +00:00
|
|
|
|
},
|
2016-08-16 16:25:34 +00:00
|
|
|
|
// baiyudujiang:{
|
|
|
|
|
// name:'白衣渡江',
|
|
|
|
|
// mode:'versus',
|
|
|
|
|
// submode:'2v2',
|
|
|
|
|
// intro:[
|
|
|
|
|
// '玩家在选将时可从6-8张的武将牌里选择两张武将牌,一张面向大家可见(加入游戏),另一张是隐藏面孔(暗置)',
|
|
|
|
|
// '选择的两张武将牌需满足以下至少两个条件:1.性别相同;2.体力上限相同;3.技能数量相同',
|
|
|
|
|
// '每名玩家在其回合开始或回合结束时,可以选择将自己的武将牌弃置,然后使用暗置的武将牌进行剩余的游戏'
|
2016-08-18 10:51:06 +00:00
|
|
|
|
// ],
|
|
|
|
|
// content:{
|
|
|
|
|
// submode:'two',
|
|
|
|
|
// chooseCharacterNum:2,
|
|
|
|
|
// chooseCharacterAfter:function(){
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2016-08-16 16:25:34 +00:00
|
|
|
|
// }
|
2016-08-18 10:51:06 +00:00
|
|
|
|
scene:{
|
2016-08-28 00:30:25 +00:00
|
|
|
|
name:'创建场景',
|
2016-08-18 10:51:06 +00:00
|
|
|
|
content:{
|
|
|
|
|
submode:'normal'
|
|
|
|
|
},
|
|
|
|
|
nostart:true,
|
2016-08-19 10:33:20 +00:00
|
|
|
|
fullshow:true,
|
2016-08-20 04:17:33 +00:00
|
|
|
|
template:{
|
2016-10-07 07:23:50 +00:00
|
|
|
|
mode:'identity',
|
2016-08-20 04:17:33 +00:00
|
|
|
|
init:function(){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
game.saveConfig('double_character',false,'identity');
|
|
|
|
|
_status.brawl.playerNumber=_status.brawl.scene.players.length;
|
|
|
|
|
},
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
if(init){
|
|
|
|
|
var name=lib.brawl[this.link].name;
|
|
|
|
|
var scene=lib.storage.scene[name];
|
|
|
|
|
ui.create.node('button','编辑场景',this,function(){
|
|
|
|
|
_status.sceneToLoad=scene;
|
|
|
|
|
game.switchScene();
|
|
|
|
|
});
|
2016-10-07 07:23:50 +00:00
|
|
|
|
if(_status.extensionmade.contains(name)){
|
|
|
|
|
ui.create.node('button','管理扩展',this,function(){
|
|
|
|
|
ui.click.configMenu();
|
|
|
|
|
ui.click.extensionTab(name);
|
|
|
|
|
},{marginLeft:'6px'});
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.create.node('button','删除场景',this,function(){
|
|
|
|
|
if(confirm('确定删除'+name+'?')){
|
|
|
|
|
game.removeScene(name);
|
|
|
|
|
}
|
|
|
|
|
},{marginLeft:'6px'});
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
ui.create.node('button','导出扩展',this,function(){
|
|
|
|
|
var str='{name:"'+name+'",content:function(){\nif(lib.config.mode=="brawl"){\n'+
|
|
|
|
|
'if(!lib.storage.scene) lib.storage.scene={};\n'+
|
2016-10-07 07:23:50 +00:00
|
|
|
|
'if(!lib.storage.scene["'+name+'"]){\nlib.storage.scene["'+name+'"]='+get.stringify(scene)+';\n_status.extensionscene=true;}\n'+
|
|
|
|
|
'if(!_status.extensionmade) _status.extensionmade=[];\n'+
|
|
|
|
|
'_status.extensionmade.push("'+name+'");\n}}\n}';
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var extension={'extension.js':'game.import("extension",'+str+')'};
|
|
|
|
|
game.importExtension(extension,null,name);
|
|
|
|
|
},{marginLeft:'6px'});
|
|
|
|
|
}
|
2016-08-20 04:17:33 +00:00
|
|
|
|
},
|
|
|
|
|
content:{
|
|
|
|
|
submode:'normal',
|
2016-08-20 09:47:05 +00:00
|
|
|
|
noAddSetting:true,
|
|
|
|
|
identityShown:true,
|
2016-08-28 00:30:25 +00:00
|
|
|
|
orderedPile:true,
|
|
|
|
|
cardPile:function(list){
|
|
|
|
|
list.randomSort();
|
|
|
|
|
var scene=_status.brawl.scene;
|
|
|
|
|
var inpile=[];
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
if(lib.card[list[i][2]]){
|
|
|
|
|
if(lib.config.bannedcards.contains(list[i][2])) continue;
|
|
|
|
|
if(game.bannedcards&&game.bannedcards.contains(list[i][2])) continue;
|
|
|
|
|
inpile.add(list[i][2]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var parseInfo=function(info){
|
|
|
|
|
var info2=[];
|
|
|
|
|
if(info[1]=='random'){
|
|
|
|
|
info2.push(['club','spade','heart','diamond'].randomGet());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info2.push(info[1]);
|
|
|
|
|
}
|
|
|
|
|
if(info[2]=='random'){
|
|
|
|
|
info2.push(Math.ceil(Math.random()*13));
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info2.push(info[2]);
|
|
|
|
|
}
|
|
|
|
|
if(info[0]=='random'){
|
|
|
|
|
info2.push(inpile.randomGet());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info2.push(info[0]);
|
|
|
|
|
}
|
|
|
|
|
return info2;
|
|
|
|
|
}
|
|
|
|
|
if(scene.replacepile){
|
|
|
|
|
list.length=0;
|
|
|
|
|
}
|
|
|
|
|
for(var i=scene.cardPileTop.length-1;i>=0;i--){
|
|
|
|
|
list.unshift(parseInfo(scene.cardPileTop[i]));
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.cardPileBottom.length;i++){
|
|
|
|
|
list.push(parseInfo(scene.cardPileBottom[i]));
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.discardPile.length;i++){
|
|
|
|
|
ui.create.card(ui.discardPile).init(parseInfo(scene.discardPile[i]));
|
|
|
|
|
}
|
|
|
|
|
return list;
|
|
|
|
|
},
|
|
|
|
|
gameStart:function(){
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
game.players[i].node.marks.show();
|
|
|
|
|
game.players[i].node.name.show();
|
|
|
|
|
game.players[i].node.name2.show();
|
|
|
|
|
var info=game.players[i].brawlinfo;
|
|
|
|
|
if(info.maxHp){
|
|
|
|
|
game.players[i].maxHp=info.maxHp;
|
|
|
|
|
if(game.players[i].hp>game.players[i].maxHp){
|
|
|
|
|
game.players[i].hp=game.players[i].maxHp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(info.hp){
|
|
|
|
|
game.players[i].hp=info.hp;
|
|
|
|
|
if(game.players[i].hp>game.players[i].maxHp){
|
|
|
|
|
game.players[i].maxHp=game.players[i].hp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.players[i].update();
|
|
|
|
|
}
|
|
|
|
|
var scene=_status.brawl.scene;
|
|
|
|
|
var over=function(str){
|
|
|
|
|
switch(str){
|
|
|
|
|
case 'win':game.over(true);break;
|
|
|
|
|
case 'lose':game.over(false);break;
|
|
|
|
|
case 'tie':game.over('平局');break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(scene.turns){
|
|
|
|
|
var turns=scene.turns[0];
|
|
|
|
|
lib.onphase.push(function(){
|
|
|
|
|
turns--;
|
|
|
|
|
if(turns<0){
|
|
|
|
|
over(scene.turns[1]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if(scene.washes){
|
|
|
|
|
var washes=scene.washes[0];
|
|
|
|
|
lib.onwash.push(function(){
|
|
|
|
|
washes--;
|
|
|
|
|
if(washes<=0){
|
|
|
|
|
over(scene.washes[1]);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-08-20 04:17:33 +00:00
|
|
|
|
chooseCharacterBefore:function(){
|
|
|
|
|
var scene=_status.brawl.scene;
|
|
|
|
|
var playercontrol=[];
|
2016-08-20 09:47:05 +00:00
|
|
|
|
var maxpos=0;
|
2016-08-20 04:17:33 +00:00
|
|
|
|
for(var i=0;i<scene.players.length;i++){
|
|
|
|
|
if(scene.players[i].playercontrol){
|
|
|
|
|
playercontrol.push(scene.players[i]);
|
|
|
|
|
}
|
2016-08-20 09:47:05 +00:00
|
|
|
|
maxpos=Math.max(maxpos,scene.players[i].position);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(maxpos<scene.players.length){
|
|
|
|
|
maxpos=scene.players.length;
|
|
|
|
|
}
|
|
|
|
|
var posmap=[];
|
2016-08-28 00:30:25 +00:00
|
|
|
|
for(var i=1;i<=maxpos;i++){
|
|
|
|
|
posmap.push(i);
|
2016-08-20 09:47:05 +00:00
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.players.length;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(scene.players[i].position){
|
|
|
|
|
posmap.remove(scene.players[i].position);
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
2016-08-20 09:47:05 +00:00
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.players.length;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(!scene.players[i].position){
|
|
|
|
|
scene.players[i].position=posmap.randomRemove();
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(playercontrol.length){
|
|
|
|
|
game.me.brawlinfo=playercontrol.randomGet();
|
|
|
|
|
}
|
|
|
|
|
else{
|
2016-08-20 09:47:05 +00:00
|
|
|
|
game.me.brawlinfo=scene.players.randomGet();
|
|
|
|
|
}
|
|
|
|
|
var getpos=function(info){
|
|
|
|
|
var dp=info.position-game.me.brawlinfo.position;
|
|
|
|
|
if(dp<0){
|
|
|
|
|
dp+=maxpos;
|
|
|
|
|
}
|
|
|
|
|
return dp;
|
|
|
|
|
};
|
|
|
|
|
scene.players.sort(function(a,b){
|
|
|
|
|
return getpos(a)-getpos(b);
|
|
|
|
|
});
|
|
|
|
|
var target=game.me;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var createCard=function(info){
|
|
|
|
|
var info2=[];
|
|
|
|
|
if(info[1]=='random'){
|
|
|
|
|
info2.push(['club','spade','heart','diamond'].randomGet());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info2.push(info[1]);
|
|
|
|
|
}
|
|
|
|
|
if(info[2]=='random'){
|
|
|
|
|
info2.push(Math.ceil(Math.random()*13));
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info2.push(info[2]);
|
|
|
|
|
}
|
|
|
|
|
if(info[0]=='random'){
|
|
|
|
|
info2.push(lib.inpile.randomGet());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info2.push(info[0]);
|
|
|
|
|
}
|
|
|
|
|
return ui.create.card().init(info2);
|
|
|
|
|
}
|
|
|
|
|
_status.firstAct=game.me;
|
2016-08-20 09:47:05 +00:00
|
|
|
|
for(var i=0;i<scene.players.length;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var info=scene.players[i];
|
|
|
|
|
target.brawlinfo=info;
|
|
|
|
|
target.identity=info.identity;
|
|
|
|
|
target.setIdentity(info.identity);
|
|
|
|
|
target.node.marks.hide();
|
|
|
|
|
if(info.name2!='none'&&info.name2!='random'){
|
|
|
|
|
if(info.name=='random'){
|
|
|
|
|
target.init(info.name2,info.name2);
|
|
|
|
|
target.node.name.hide();
|
|
|
|
|
target.node.avatar.hide();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
target.init(info.name,info.name2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(info.name!='random'){
|
|
|
|
|
if(info.name2=='random'){
|
|
|
|
|
target.init(info.name,info.name);
|
|
|
|
|
target.node.name2.hide();
|
|
|
|
|
target.node.avatar2.hide();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
target.init(info.name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(info.linked) target.classList.add('linked');
|
|
|
|
|
if(info.turnedover) target.classList.add('turnedover');
|
|
|
|
|
if(info.position<_status.firstAct.brawlinfo.position) _status.firstAct=target;
|
|
|
|
|
var hs=[];
|
|
|
|
|
for(var j=0;j<info.handcards.length;j++){
|
|
|
|
|
hs.push(createCard(info.handcards[j]));
|
|
|
|
|
}
|
|
|
|
|
if(hs.length){
|
|
|
|
|
target.directgain(hs);
|
|
|
|
|
}
|
|
|
|
|
for(var j=0;j<info.equips.length;j++){
|
|
|
|
|
target.$equip(createCard(info.equips[j]));
|
|
|
|
|
}
|
|
|
|
|
for(var j=0;j<info.judges.length;j++){
|
|
|
|
|
target.node.judges.appendChild(createCard(info.judges[j]));
|
|
|
|
|
}
|
2016-08-20 09:47:05 +00:00
|
|
|
|
target=target.next;
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2016-08-28 00:30:25 +00:00
|
|
|
|
chooseCharacterAi:function(player,list,list2){
|
|
|
|
|
var info=player.brawlinfo;
|
|
|
|
|
if(info.name2!='none'){
|
|
|
|
|
if(info.name=='random'&&info.name2=='random'){
|
|
|
|
|
list=list.slice(0);
|
|
|
|
|
player.init(list.randomRemove(),list.randomRemove());
|
|
|
|
|
}
|
|
|
|
|
else if(info.name=='random'){
|
|
|
|
|
player.init(list.randomGet(),info.name2);
|
|
|
|
|
}
|
|
|
|
|
else if(info.name2=='random'){
|
|
|
|
|
player.init(info.name,list.randomGet());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(info.name=='random'){
|
|
|
|
|
player.init(list.randomGet());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
chooseCharacter:function(list){
|
|
|
|
|
var info=game.me.brawlinfo;
|
|
|
|
|
var event=_status.event;
|
|
|
|
|
if(info.name2=='none'){
|
|
|
|
|
if(info.name!='random'){
|
|
|
|
|
event.chosen=[info.name];
|
|
|
|
|
}
|
2016-08-20 09:47:05 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(info.name2=='random'&&info.name=='random'){
|
|
|
|
|
_status.brawl.doubleCharacter=true;
|
|
|
|
|
}
|
|
|
|
|
else if(info.name=='random'){
|
|
|
|
|
game.me.init(info.name2,info.name2);
|
|
|
|
|
game.me.node.avatar.hide();
|
|
|
|
|
game.me.node.name.hide();
|
|
|
|
|
_status.brawl.chooseCharacterStr='选择主将';
|
|
|
|
|
event.modchosen=[info.name,info.name2];
|
|
|
|
|
}
|
|
|
|
|
else if(info.name2=='random'){
|
|
|
|
|
game.me.init(info.name,info.name);
|
|
|
|
|
game.me.node.avatar2.hide();
|
|
|
|
|
game.me.node.name2.hide();
|
|
|
|
|
_status.brawl.chooseCharacterStr='选择副将';
|
|
|
|
|
event.modchosen=[info.name,info.name2];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
event.chosen=[info.name,info.name2];
|
|
|
|
|
}
|
2016-08-20 09:47:05 +00:00
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(game.me.identity=='zhu') return false;
|
|
|
|
|
return 'nozhu';
|
|
|
|
|
},
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2016-08-18 10:51:06 +00:00
|
|
|
|
showcase:function(init){
|
|
|
|
|
if(init){
|
2016-08-19 10:33:20 +00:00
|
|
|
|
lib.translate.zhu=lib.translate.zhu||'主';
|
|
|
|
|
lib.translate.zhong=lib.translate.zhong||'忠';
|
|
|
|
|
lib.translate.nei=lib.translate.nei||'内';
|
|
|
|
|
lib.translate.fan=lib.translate.fan||'反';
|
|
|
|
|
|
|
|
|
|
|
2016-08-18 10:51:06 +00:00
|
|
|
|
this.style.transition='all 0s';
|
|
|
|
|
this.style.height=(this.offsetHeight-10)+'px';
|
|
|
|
|
this.style.overflow='scroll';
|
|
|
|
|
lib.setScroll(this);
|
|
|
|
|
var style={marginLeft:'3px',marginRight:'3px'};
|
|
|
|
|
var style2={position:'relative',display:'block',left:0,top:0,marginBottom:'6px',padding:0,width:'100%'};
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var style3={marginLeft:'4px',marginRight:'4px',position:'relative'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var scenename=ui.create.node('input',ui.create.div(style2,'','场景名称:',this),{width:'120px'});
|
|
|
|
|
scenename.type='text';
|
|
|
|
|
scenename.style.marginTop='20px';
|
2016-09-01 10:36:59 +00:00
|
|
|
|
var sceneintro=ui.create.node('input',ui.create.div(style2,'','场景描述:',this),{width:'120px'});
|
2016-08-19 10:33:20 +00:00
|
|
|
|
sceneintro.type='text';
|
|
|
|
|
sceneintro.style.marginBottom='10px';
|
|
|
|
|
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var line1=ui.create.div(style2,this);
|
|
|
|
|
var addCharacter=ui.create.node('button','添加角色',line1,function(){
|
2016-08-19 10:33:20 +00:00
|
|
|
|
// line1.style.display='none';
|
|
|
|
|
resetStatus();
|
|
|
|
|
editPile.disabled=true;
|
2016-08-19 15:34:01 +00:00
|
|
|
|
// editCode.disabled=true;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
saveButton.disabled=true;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
// exportButton.disabled=true;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
line7.style.display='none';
|
|
|
|
|
line2.style.display='block';
|
|
|
|
|
line2_t.style.display='block';
|
|
|
|
|
line3.style.display='block';
|
|
|
|
|
line4.style.display='block';
|
|
|
|
|
line5.style.display='block';
|
|
|
|
|
line6_h.style.display='block';
|
|
|
|
|
line6_e.style.display='block';
|
|
|
|
|
line6_j.style.display='block';
|
|
|
|
|
capt1.style.display='block';
|
|
|
|
|
capt2.style.display='block';
|
|
|
|
|
if(line6_h.childElementCount) capt_h.style.display='block';
|
|
|
|
|
if(line6_e.childElementCount) capt_e.style.display='block';
|
|
|
|
|
if(line6_j.childElementCount) capt_j.style.display='block';
|
|
|
|
|
},style);
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var editPile=ui.create.node('button','场景选项',line1,function(){
|
2016-08-19 10:33:20 +00:00
|
|
|
|
resetCharacter();
|
|
|
|
|
addCharacter.disabled=true;
|
2016-08-19 15:34:01 +00:00
|
|
|
|
// editCode.disabled=true;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
saveButton.disabled=true;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
// exportButton.disabled=true;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
line7.style.display='none';
|
|
|
|
|
line8.style.display='block';
|
|
|
|
|
capt8.style.display='block';
|
|
|
|
|
line9.style.display='block';
|
|
|
|
|
line10.style.display='block';
|
|
|
|
|
line11.style.display='block';
|
|
|
|
|
capt9.style.display='block';
|
|
|
|
|
line3.style.display='block';
|
|
|
|
|
|
|
|
|
|
line6_t.style.display='block';
|
|
|
|
|
line6_b.style.display='block';
|
|
|
|
|
line6_d.style.display='block';
|
|
|
|
|
if(line6_t.childElementCount) capt_t.style.display='block';
|
|
|
|
|
if(line6_b.childElementCount) capt_b.style.display='block';
|
|
|
|
|
if(line6_d.childElementCount) capt_d.style.display='block';
|
|
|
|
|
},style);
|
2016-08-19 15:34:01 +00:00
|
|
|
|
// var editCode=ui.create.node('button','编辑代码',line1,function(){
|
|
|
|
|
// console.log(1);
|
|
|
|
|
// },style);
|
|
|
|
|
var saveButton=ui.create.node('button','保存场景',line1,function(){
|
2016-08-20 04:17:33 +00:00
|
|
|
|
if(!scenename.value){
|
|
|
|
|
alert('请填写场景名称');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var scene={
|
|
|
|
|
name:scenename.value,
|
|
|
|
|
intro:sceneintro.value,
|
|
|
|
|
players:[],
|
|
|
|
|
cardPileTop:[],
|
|
|
|
|
cardPileBottom:[],
|
|
|
|
|
discardPile:[],
|
|
|
|
|
};
|
|
|
|
|
for(var i=0;i<line7.childElementCount;i++){
|
|
|
|
|
scene.players.push(line7.childNodes[i].info);
|
|
|
|
|
}
|
|
|
|
|
if(scene.players.length<2){
|
|
|
|
|
alert('请添加至少两名角色');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(lib.storage.scene[scenename.value]){
|
|
|
|
|
if(_status.currentScene!=scenename.value){
|
2016-08-20 04:17:33 +00:00
|
|
|
|
if(!confirm('场景名与现有场景重复,是否覆盖?')){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
game.removeScene(scenename.value);
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<line6_t.childElementCount;i++){
|
|
|
|
|
scene.cardPileTop.push(line6_t.childNodes[i].info);
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<line6_b.childElementCount;i++){
|
|
|
|
|
scene.cardPileBottom.push(line6_b.childNodes[i].info);
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<line6_d.childElementCount;i++){
|
|
|
|
|
scene.discardPile.push(line6_d.childNodes[i].info);
|
|
|
|
|
}
|
|
|
|
|
if(replacepile.checked){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
scene.replacepile=true;
|
2016-08-20 04:17:33 +00:00
|
|
|
|
}
|
2016-09-01 10:36:59 +00:00
|
|
|
|
if(gameDraw.checked){
|
|
|
|
|
scene.gameDraw=true;
|
|
|
|
|
}
|
2016-08-20 04:17:33 +00:00
|
|
|
|
if(turnsresult.value!='none'){
|
|
|
|
|
scene.turns=[parseInt(turns.value),turnsresult.value]
|
|
|
|
|
}
|
|
|
|
|
if(washesresult.value!='none'){
|
|
|
|
|
scene.washes=[parseInt(washes.value),washesresult.value]
|
|
|
|
|
}
|
|
|
|
|
lib.storage.scene[scene.name]=scene;
|
|
|
|
|
game.save('scene',lib.storage.scene);
|
2016-08-28 00:30:25 +00:00
|
|
|
|
game.addScene(scene.name,true);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
},style);
|
|
|
|
|
|
2016-08-18 10:51:06 +00:00
|
|
|
|
|
|
|
|
|
var capt1=ui.create.div(style2,'','角色信息',this);
|
|
|
|
|
var line2=ui.create.div(style2,this);
|
|
|
|
|
line2.style.display='none';
|
|
|
|
|
var identity=ui.create.selectlist([['zhu','主公'],['zhong','忠臣'],['nei','内奸'],['fan','反贼']],'zhu',line2);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
identity.value='fan';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
identity.style.marginLeft='3px';
|
|
|
|
|
identity.style.marginRight='3px';
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var position=ui.create.selectlist([['0','随机位置'],['1','一号位'],['2','二号位'],['3','三号位'],['4','四号位'],['5','五号位'],['6','六号位'],['7','七号位'],['8','八号位']],'1',line2);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
position.style.marginLeft='3px';
|
|
|
|
|
position.style.marginRight='3px';
|
|
|
|
|
var line2_t=ui.create.div(style2,this);
|
|
|
|
|
line2_t.style.display='none';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
// line2_t.style.marginBottom='10px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
ui.create.node('span','体力:',line2_t);
|
|
|
|
|
var hp=ui.create.node('input',line2_t,{width:'40px'});
|
|
|
|
|
hp.type='text';
|
2016-08-20 04:17:33 +00:00
|
|
|
|
ui.create.node('span','体力上限:',line2_t,{marginLeft:'10px'});
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var maxHp=ui.create.node('input',line2_t,{width:'40px'});
|
|
|
|
|
maxHp.type='text';
|
2016-08-18 13:48:50 +00:00
|
|
|
|
ui.create.node('span','横置 ',line2_t,{marginLeft:'20px'});
|
|
|
|
|
var linked=ui.create.node('input',line2_t);
|
|
|
|
|
linked.type='checkbox';
|
2016-08-20 04:17:33 +00:00
|
|
|
|
ui.create.node('span','翻面 ',line2_t,{marginLeft:'10px'});
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var turnedover=ui.create.node('input',line2_t);
|
|
|
|
|
turnedover.type='checkbox';
|
2016-08-20 04:17:33 +00:00
|
|
|
|
ui.create.node('span','玩家 ',line2_t,{marginLeft:'10px'});
|
|
|
|
|
var playercontrol=ui.create.node('input',line2_t);
|
|
|
|
|
playercontrol.type='checkbox';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
|
|
|
|
|
var list=[];
|
|
|
|
|
for(var i in lib.character){
|
|
|
|
|
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;
|
|
|
|
|
});
|
2016-08-18 13:48:50 +00:00
|
|
|
|
list.unshift(['random','自选主将']);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var name1=ui.create.selectlist(list,list[0],line2);
|
|
|
|
|
name1.style.marginLeft='3px';
|
|
|
|
|
name1.style.marginRight='3px';
|
|
|
|
|
name1.style.maxWidth='80px';
|
2016-08-18 13:48:50 +00:00
|
|
|
|
list[0][1]='自选副将';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
list.unshift(['none','无副将']);
|
|
|
|
|
var name2=ui.create.selectlist(list,list[0],line2);
|
|
|
|
|
name2.style.marginLeft='3px';
|
|
|
|
|
name2.style.marginRight='3px';
|
|
|
|
|
name2.style.maxWidth='80px';
|
|
|
|
|
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var capt9=ui.create.div(style2,'','编辑牌堆',this);
|
|
|
|
|
capt9.style.display='none';
|
|
|
|
|
|
|
|
|
|
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var capt2=ui.create.div(style2,'','添加卡牌',this);
|
|
|
|
|
var line3=ui.create.div(style2,this);
|
|
|
|
|
line3.style.display='none';
|
|
|
|
|
capt1.style.display='none';
|
|
|
|
|
capt2.style.display='none';
|
|
|
|
|
|
|
|
|
|
var line5=ui.create.div(style2,this);
|
|
|
|
|
line5.style.display='none';
|
|
|
|
|
var pileaddlist=[];
|
|
|
|
|
for(var i=0;i<lib.config.cards.length;i++){
|
|
|
|
|
if(!lib.cardPack[lib.config.cards[i]]) continue;
|
|
|
|
|
for(var j=0;j<lib.cardPack[lib.config.cards[i]].length;j++){
|
|
|
|
|
var cname=lib.cardPack[lib.config.cards[i]][j];
|
|
|
|
|
pileaddlist.push([cname,get.translation(cname)]);
|
|
|
|
|
if(cname=='sha'){
|
|
|
|
|
pileaddlist.push(['huosha','火杀']);
|
|
|
|
|
pileaddlist.push(['leisha','雷杀']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in lib.cardPack){
|
|
|
|
|
if(lib.config.all.cards.contains(i)) continue;
|
|
|
|
|
for(var j=0;j<lib.cardPack[i].length;j++){
|
|
|
|
|
var cname=lib.cardPack[i][j];
|
|
|
|
|
pileaddlist.push([cname,get.translation(cname)]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-18 13:48:50 +00:00
|
|
|
|
pileaddlist.unshift(['random',['随机卡牌']]);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var cardpileaddname=ui.create.selectlist(pileaddlist,null,line3);
|
|
|
|
|
cardpileaddname.style.marginLeft='3px';
|
|
|
|
|
cardpileaddname.style.marginRight='3px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cardpileaddname.style.width='85px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var cardpileaddsuit=ui.create.selectlist([
|
|
|
|
|
['random','随机花色'],
|
|
|
|
|
['heart','红桃'],
|
|
|
|
|
['diamond','方片'],
|
|
|
|
|
['club','梅花'],
|
|
|
|
|
['spade','黑桃'],
|
|
|
|
|
],null,line3);
|
|
|
|
|
cardpileaddsuit.style.marginLeft='3px';
|
|
|
|
|
cardpileaddsuit.style.marginRight='3px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cardpileaddsuit.style.width='85px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var cardpileaddnumber=ui.create.selectlist([
|
|
|
|
|
['random','随机点数'],1,2,3,4,5,6,7,8,9,10,11,12,13
|
|
|
|
|
],null,line3);
|
|
|
|
|
cardpileaddnumber.style.marginLeft='3px';
|
|
|
|
|
cardpileaddnumber.style.marginRight='3px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cardpileaddnumber.style.width='85px';
|
2016-08-18 13:48:50 +00:00
|
|
|
|
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var fakecard=function(info,position,capt){
|
|
|
|
|
var name=info[0],suit=info[1],number=info[2];
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var card=ui.create.card(null,'noclick',true);
|
|
|
|
|
card.style.zoom=0.6;
|
2016-08-18 13:48:50 +00:00
|
|
|
|
number=parseInt(cardpileaddnumber.value);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var name2=name;
|
|
|
|
|
var suit2=suit;
|
|
|
|
|
var number2=number;
|
|
|
|
|
if(name2=='random') name2='sha';
|
|
|
|
|
if(suit2=='random') suit2='?';
|
|
|
|
|
if(!number2){
|
|
|
|
|
number='random';
|
|
|
|
|
number2='?';
|
|
|
|
|
}
|
|
|
|
|
card.init([suit2,number2,name2]);
|
2016-08-28 00:30:25 +00:00
|
|
|
|
card.info=info;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
if(name=='random'){
|
|
|
|
|
card.node.name.innerHTML=get.verticalStr('随机卡牌');
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(position&&capt){
|
|
|
|
|
card.listen(function(){
|
|
|
|
|
this.remove();
|
|
|
|
|
if(!position.childElementCount) capt.style.display='none';
|
|
|
|
|
});
|
|
|
|
|
position.appendChild(card);
|
|
|
|
|
}
|
2016-08-18 13:48:50 +00:00
|
|
|
|
return card;
|
|
|
|
|
};
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var cc_h=ui.create.node('button','加入手牌区',line5,function(){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
fakecard([cardpileaddname.value,cardpileaddsuit.value,cardpileaddnumber.value],line6_h,capt_h);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
capt_h.style.display='block';
|
|
|
|
|
});
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var cc_e=ui.create.node('button','加入装备区',line5,function(){
|
2016-08-18 10:51:06 +00:00
|
|
|
|
if(get.type(cardpileaddname.value)!='equip') return;
|
|
|
|
|
var subtype=get.subtype(cardpileaddname.value);
|
|
|
|
|
for(var i=0;i<line6_e.childElementCount;i++){
|
|
|
|
|
if(get.subtype(line6_e.childNodes[i].name)==subtype){
|
|
|
|
|
line6_e.childNodes[i].remove();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
fakecard([cardpileaddname.value,cardpileaddsuit.value,cardpileaddnumber.value],line6_e,capt_e);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
capt_e.style.display='block';
|
|
|
|
|
});
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var cc_j=ui.create.node('button','加入判定区',line5,function(){
|
2016-08-18 10:51:06 +00:00
|
|
|
|
if(get.type(cardpileaddname.value)!='delay') return;
|
|
|
|
|
for(var i=0;i<line6_j.childElementCount;i++){
|
|
|
|
|
if(line6_j.childNodes[i].name==cardpileaddname.value){
|
|
|
|
|
line6_j.childNodes[i].remove();break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
fakecard([cardpileaddname.value,cardpileaddsuit.value,cardpileaddnumber.value],line6_j,capt_j);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
capt_j.style.display='block';
|
|
|
|
|
});
|
|
|
|
|
cc_h.style.marginLeft='3px';
|
|
|
|
|
cc_h.style.marginRight='3px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cc_h.style.width='85px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
cc_e.style.marginLeft='3px';
|
|
|
|
|
cc_e.style.marginRight='3px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cc_e.style.width='85px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
cc_j.style.marginLeft='3px';
|
|
|
|
|
cc_j.style.marginRight='3px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cc_j.style.width='85px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
|
|
|
|
|
var capt_h=ui.create.div(style2,'','手牌区',this);
|
|
|
|
|
var line6_h=ui.create.div(style2,this);
|
|
|
|
|
var capt_e=ui.create.div(style2,'','装备区',this);
|
|
|
|
|
var line6_e=ui.create.div(style2,this);
|
|
|
|
|
var capt_j=ui.create.div(style2,'','判定区',this);
|
|
|
|
|
var line6_j=ui.create.div(style2,this);
|
|
|
|
|
line6_j.style.marginBottom='10px';
|
|
|
|
|
capt_h.style.display='none';
|
|
|
|
|
capt_e.style.display='none';
|
|
|
|
|
capt_j.style.display='none';
|
|
|
|
|
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var line10=ui.create.div(style2,this);
|
|
|
|
|
line10.style.display='none';
|
|
|
|
|
var ac_h=ui.create.node('button','加入牌堆顶',line10,function(){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
fakecard([cardpileaddname.value,cardpileaddsuit.value,cardpileaddnumber.value],line6_t,capt_t);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
capt_t.style.display='block';
|
|
|
|
|
});
|
|
|
|
|
var ac_e=ui.create.node('button','加入牌堆底',line10,function(){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
fakecard([cardpileaddname.value,cardpileaddsuit.value,cardpileaddnumber.value],line6_b,capt_b);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
capt_b.style.display='block';
|
|
|
|
|
});
|
|
|
|
|
var ac_j=ui.create.node('button','加入弃牌堆',line10,function(){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
fakecard([cardpileaddname.value,cardpileaddsuit.value,cardpileaddnumber.value],line6_d,capt_d);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
capt_d.style.display='block';
|
|
|
|
|
});
|
|
|
|
|
ac_h.style.marginLeft='3px';
|
|
|
|
|
ac_h.style.marginRight='3px';
|
|
|
|
|
ac_h.style.width='85px';
|
|
|
|
|
ac_e.style.marginLeft='3px';
|
|
|
|
|
ac_e.style.marginRight='3px';
|
|
|
|
|
ac_e.style.width='85px';
|
|
|
|
|
ac_j.style.marginLeft='3px';
|
|
|
|
|
ac_j.style.marginRight='3px';
|
|
|
|
|
ac_j.style.width='85px';
|
|
|
|
|
|
2016-09-01 10:36:59 +00:00
|
|
|
|
var line11=ui.create.div(style2,this,'','<span>替换牌堆</span>');
|
2016-08-19 10:33:20 +00:00
|
|
|
|
line11.style.display='none';
|
|
|
|
|
var replacepile=ui.create.node('input',line11);
|
|
|
|
|
replacepile.type='checkbox';
|
|
|
|
|
|
2016-09-01 10:36:59 +00:00
|
|
|
|
ui.create.node('span',line11,'开局摸牌',{marginLeft:'10px'});
|
|
|
|
|
var gameDraw=ui.create.node('input',line11);
|
|
|
|
|
gameDraw.type='checkbox';
|
|
|
|
|
gameDraw.checked=true;
|
|
|
|
|
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var capt_t=ui.create.div(style2,'','牌堆顶',this);
|
|
|
|
|
var line6_t=ui.create.div(style2,this);
|
|
|
|
|
var capt_b=ui.create.div(style2,'','牌堆底',this);
|
|
|
|
|
var line6_b=ui.create.div(style2,this);
|
|
|
|
|
var capt_d=ui.create.div(style2,'','弃牌堆',this);
|
|
|
|
|
var line6_d=ui.create.div(style2,this);
|
|
|
|
|
line6_d.style.marginBottom='10px';
|
|
|
|
|
capt_t.style.display='none';
|
|
|
|
|
capt_b.style.display='none';
|
|
|
|
|
capt_d.style.display='none';
|
|
|
|
|
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var line4=ui.create.div(style2,this);
|
|
|
|
|
line4.style.display='none';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
line4.style.marginTop='20px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var resetCharacter=function(){
|
2016-08-19 10:33:20 +00:00
|
|
|
|
// line1.style.display='block';
|
|
|
|
|
editPile.disabled=false;
|
2016-08-19 15:34:01 +00:00
|
|
|
|
// editCode.disabled=false;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
saveButton.disabled=false;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
// exportButton.disabled=false;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
line7.style.display='block';
|
|
|
|
|
line2.style.display='none';
|
|
|
|
|
line2_t.style.display='none';
|
|
|
|
|
line3.style.display='none';
|
|
|
|
|
line4.style.display='none';
|
|
|
|
|
line5.style.display='none';
|
|
|
|
|
line6_h.style.display='none';
|
|
|
|
|
line6_e.style.display='none';
|
|
|
|
|
line6_j.style.display='none';
|
|
|
|
|
capt1.style.display='none';
|
|
|
|
|
capt2.style.display='none';
|
|
|
|
|
capt_h.style.display='none';
|
|
|
|
|
capt_e.style.display='none';
|
|
|
|
|
capt_j.style.display='none';
|
|
|
|
|
|
|
|
|
|
name1.value='random';
|
|
|
|
|
name2.value='none';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
identity.value='fan';
|
|
|
|
|
position.value='0';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
hp.value='';
|
|
|
|
|
maxHp.value='';
|
|
|
|
|
line6_h.innerHTML='';
|
|
|
|
|
line6_e.innerHTML='';
|
|
|
|
|
line6_j.innerHTML='';
|
|
|
|
|
cardpileaddname.value='random';
|
|
|
|
|
cardpileaddsuit.value='random';
|
|
|
|
|
cardpileaddnumber.value='random';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
linked.checked=false;
|
|
|
|
|
turnedover.checked=false;
|
2016-08-20 04:17:33 +00:00
|
|
|
|
playercontrol.checked=false;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
};
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var createCharacter=function(info){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
var player=ui.create.player(null,true);
|
2016-09-01 10:36:59 +00:00
|
|
|
|
player._customintro=function(uiintro){
|
|
|
|
|
if(info.handcards.length){
|
|
|
|
|
uiintro.addText('手牌',true);
|
|
|
|
|
var hs=ui.create.div('.buttons');
|
|
|
|
|
for(var i=0;i<info.handcards.length;i++){
|
|
|
|
|
hs.appendChild(fakecard(info.handcards[i]));
|
|
|
|
|
}
|
|
|
|
|
uiintro.add(hs);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-19 10:33:20 +00:00
|
|
|
|
player.info=info;
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var name=info.name,name3=info.name2;
|
|
|
|
|
if(name=='random'){
|
|
|
|
|
name='re_caocao';
|
|
|
|
|
}
|
|
|
|
|
if(name3!='none'){
|
|
|
|
|
if(name3=='random'){
|
|
|
|
|
name3='liubei';
|
|
|
|
|
}
|
|
|
|
|
player.init(name,name3);
|
|
|
|
|
if(info.name2=='random'){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
player.node.name2.innerHTML=get.verticalStr('自选副将');
|
2016-08-18 10:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
player.init(name);
|
|
|
|
|
}
|
|
|
|
|
if(info.name=='random'){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
player.node.name.innerHTML=get.verticalStr('自选主将');
|
2016-08-18 10:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
if(info.maxHp){
|
|
|
|
|
player.maxHp=info.maxHp;
|
|
|
|
|
}
|
|
|
|
|
if(info.hp){
|
|
|
|
|
player.hp=Math.min(info.hp,player.maxHp);
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<info.handcards.length;i++){
|
2016-08-18 13:48:50 +00:00
|
|
|
|
player.node.handcards1.appendChild(ui.create.card());
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<info.equips.length;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
player.$equip(fakecard(info.equips[i]));
|
2016-08-18 13:48:50 +00:00
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<info.judges.length;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
player.node.judges.appendChild(fakecard(info.judges[i]));
|
2016-08-18 10:51:06 +00:00
|
|
|
|
}
|
2016-08-19 10:33:20 +00:00
|
|
|
|
player.setIdentity(info.identity);
|
2016-08-20 09:47:05 +00:00
|
|
|
|
var pos=info.position;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
if(pos==0){
|
|
|
|
|
pos='随机位置';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
pos=get.cnNumber(pos,true)+'号位'
|
|
|
|
|
}
|
|
|
|
|
if(info.linked&&info.turnedover){
|
|
|
|
|
pos+='<br>横置 - 翻面'
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(info.linked) pos+=' - 横置';
|
|
|
|
|
if(info.turnedover) pos+=' - 翻面';
|
|
|
|
|
}
|
|
|
|
|
player.setNickname(pos);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
player.update();
|
2016-08-19 10:33:20 +00:00
|
|
|
|
player.style.transform='scale(0.7)';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
player.style.position='relative';
|
|
|
|
|
player.style.left=0;
|
|
|
|
|
player.style.top=0;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
player.style.margin='-18px';
|
2016-08-18 10:51:06 +00:00
|
|
|
|
player.node.marks.remove();
|
2016-08-28 00:30:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
line7.appendChild(player);
|
|
|
|
|
player.listen(function(){
|
|
|
|
|
if(confirm('是否删除此角色?')){
|
|
|
|
|
this.remove();
|
|
|
|
|
if(line7.childElementCount<8){
|
|
|
|
|
addCharacter.disabled=false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if(line7.childElementCount>=8){
|
|
|
|
|
addCharacter.disabled=true;
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-19 10:33:20 +00:00
|
|
|
|
return player;
|
|
|
|
|
};
|
|
|
|
|
ui.create.div('.menubutton.large','确定',line4,style3,function(){
|
|
|
|
|
var info={
|
|
|
|
|
name:name1.value,
|
|
|
|
|
name2:name2.value,
|
|
|
|
|
identity:identity.value,
|
2016-08-20 09:47:05 +00:00
|
|
|
|
position:parseInt(position.value),
|
2016-08-19 10:33:20 +00:00
|
|
|
|
hp:parseInt(hp.value),
|
|
|
|
|
maxHp:parseInt(maxHp.value),
|
|
|
|
|
linked:linked.checked,
|
|
|
|
|
turnedover:turnedover.checked,
|
2016-08-20 04:17:33 +00:00
|
|
|
|
playercontrol:playercontrol.checked,
|
2016-08-19 10:33:20 +00:00
|
|
|
|
handcards:[],
|
|
|
|
|
equips:[],
|
|
|
|
|
judges:[]
|
|
|
|
|
};
|
|
|
|
|
for(var i=0;i<line7.childElementCount;i++){
|
|
|
|
|
if(info.identity=='zhu'&&line7.childNodes[i].info.identity=='zhu'){
|
|
|
|
|
alert('不能有两个主公');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-08-20 09:47:05 +00:00
|
|
|
|
if(info.position!=0&&info.position==line7.childNodes[i].info.position){
|
2016-08-19 10:33:20 +00:00
|
|
|
|
alert('座位与现在角色相同');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<line6_h.childElementCount;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
info.handcards.push(line6_h.childNodes[i].info);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<line6_e.childElementCount;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
info.equips.push(line6_e.childNodes[i].info);
|
2016-08-19 10:33:20 +00:00
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<line6_j.childElementCount;i++){
|
2016-08-28 00:30:25 +00:00
|
|
|
|
info.judges.push(line6_j.childNodes[i].info);
|
2016-08-20 09:47:05 +00:00
|
|
|
|
}
|
2016-08-28 00:30:25 +00:00
|
|
|
|
createCharacter(info);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
resetCharacter();
|
|
|
|
|
});
|
2016-08-19 10:33:20 +00:00
|
|
|
|
ui.create.div('.menubutton.large','取消',line4,style3,resetCharacter);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
var line7=ui.create.div(style2,this);
|
|
|
|
|
line7.style.marginTop='12px';
|
2016-08-19 10:33:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var capt8=ui.create.div(style2,'','胜负条件',this);
|
|
|
|
|
capt8.style.display='none';
|
|
|
|
|
var line8=ui.create.div(style2,this);
|
|
|
|
|
line8.style.display='none';
|
|
|
|
|
line8.style.marginTop='10px';
|
|
|
|
|
line8.style.marginBottom='10px';
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var turnslist=[['1','一'],['2','两'],['3','三'],['4','四'],['5','五'],['6','六'],['7','七'],['8','八'],['9','九'],['10','十']];
|
2016-08-19 10:33:20 +00:00
|
|
|
|
var results=[['none','无'],['win','胜利'],['lose','失败'],['tie','平局']];
|
|
|
|
|
var turns=ui.create.selectlist(turnslist,'1',line8);
|
|
|
|
|
ui.create.node('span','个回合后',line8,style);
|
|
|
|
|
var turnsresult=ui.create.selectlist(results,'none',line8);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var washes=ui.create.selectlist(turnslist,'1',line8);
|
|
|
|
|
washes.style.marginLeft='20px';
|
|
|
|
|
ui.create.node('span','次洗牌后',line8,style);
|
|
|
|
|
var washesresult=ui.create.selectlist(results,'none',line8);
|
|
|
|
|
|
|
|
|
|
var line9=ui.create.div(style2,this);
|
|
|
|
|
line9.style.display='none';
|
|
|
|
|
line9.style.marginTop='20px';
|
2016-08-28 00:30:25 +00:00
|
|
|
|
var resetStatus=function(all){
|
2016-08-20 09:47:05 +00:00
|
|
|
|
if(line7.childElementCount>=8){
|
|
|
|
|
addCharacter.disabled=true;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
addCharacter.disabled=false;
|
|
|
|
|
}
|
2016-08-19 15:34:01 +00:00
|
|
|
|
// editCode.disabled=false;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
saveButton.disabled=false;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
// exportButton.disabled=false;
|
2016-08-19 10:33:20 +00:00
|
|
|
|
cardpileaddname.value='random';
|
|
|
|
|
cardpileaddsuit.value='random';
|
|
|
|
|
cardpileaddnumber.value='random';
|
|
|
|
|
|
|
|
|
|
line8.style.display='none';
|
|
|
|
|
capt8.style.display='none';
|
|
|
|
|
capt9.style.display='none';
|
|
|
|
|
line9.style.display='none';
|
|
|
|
|
line10.style.display='none';
|
|
|
|
|
line11.style.display='none';
|
|
|
|
|
line3.style.display='none';
|
|
|
|
|
line7.style.display='block';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
line6_t.style.display='none';
|
|
|
|
|
line6_b.style.display='none';
|
|
|
|
|
line6_d.style.display='none';
|
|
|
|
|
capt_t.style.display='none';
|
|
|
|
|
capt_b.style.display='none';
|
|
|
|
|
capt_d.style.display='none';
|
2016-08-28 00:30:25 +00:00
|
|
|
|
|
|
|
|
|
if(all===true){
|
|
|
|
|
replacepile.checked=false;
|
2016-09-01 10:36:59 +00:00
|
|
|
|
gameDraw.checked=true;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
turns.value='1';
|
|
|
|
|
turnsresult.value='none';
|
|
|
|
|
washes.value='1';
|
|
|
|
|
washesresult.value='none';
|
|
|
|
|
line6_t.innerHTML='';
|
|
|
|
|
line6_b.innerHTML='';
|
|
|
|
|
line6_d.innerHTML='';
|
|
|
|
|
}
|
2016-08-19 10:33:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.create.div('.menubutton.large','确定',line9,style3,resetStatus);
|
2016-08-28 00:30:25 +00:00
|
|
|
|
|
|
|
|
|
game.addSceneClear=function(){
|
|
|
|
|
resetCharacter();
|
|
|
|
|
resetStatus(true);
|
|
|
|
|
scenename.value='';
|
|
|
|
|
sceneintro.value='';
|
|
|
|
|
line7.innerHTML='';
|
|
|
|
|
delete _status.currentScene;
|
|
|
|
|
};
|
|
|
|
|
game.loadScene=function(scene){
|
|
|
|
|
resetCharacter();
|
|
|
|
|
resetStatus(true);
|
|
|
|
|
scenename.value=scene.name;
|
|
|
|
|
sceneintro.value=scene.intro;
|
|
|
|
|
_status.currentScene=scene.name;
|
|
|
|
|
line7.innerHTML='';
|
|
|
|
|
if(scene.replacepile) replacepile.checked=true;
|
2016-09-01 10:36:59 +00:00
|
|
|
|
if(scene.gameDraw) gameDraw.checked=true;
|
|
|
|
|
else gameDraw.checked=false;
|
2016-08-28 00:30:25 +00:00
|
|
|
|
if(scene.turns){
|
|
|
|
|
turns.value=scene.turns[0].toString();
|
|
|
|
|
turnsresult.value=scene.turns[1];
|
|
|
|
|
}
|
|
|
|
|
if(scene.washes){
|
|
|
|
|
washes.value=scene.washes[0].toString();
|
|
|
|
|
washesresult.value=scene.washes[1];
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.cardPileTop.length;i++){
|
|
|
|
|
fakecard(scene.cardPileTop[i],line6_t,capt_t);
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.cardPileBottom.length;i++){
|
|
|
|
|
fakecard(scene.cardPileBottom[i],line6_b,capt_b);
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<scene.discardPile.length;i++){
|
|
|
|
|
fakecard(scene.discardPile[i],line6_d,capt_d);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<scene.players.length;i++){
|
|
|
|
|
createCharacter(scene.players[i]);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
if(_status.sceneToLoad){
|
|
|
|
|
var scene=_status.sceneToLoad;
|
|
|
|
|
delete _status.sceneToLoad;
|
|
|
|
|
game.loadScene(scene);
|
2016-08-18 10:51:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-01 06:07:17 +00:00
|
|
|
|
},
|
|
|
|
|
stage:{
|
|
|
|
|
name:'创建关卡',
|
|
|
|
|
content:{
|
|
|
|
|
submode:'normal'
|
|
|
|
|
},
|
|
|
|
|
nostart:true,
|
|
|
|
|
fullshow:true,
|
2016-10-05 06:03:57 +00:00
|
|
|
|
template:{
|
|
|
|
|
showcase:function(init){
|
|
|
|
|
if(init){
|
|
|
|
|
var name=lib.brawl[this.link].name;
|
|
|
|
|
var stage=lib.storage.stage[name];
|
2016-10-06 04:38:28 +00:00
|
|
|
|
var style2={position:'relative',display:'block',left:0,top:0,marginBottom:'10px',padding:0,width:'100%'};
|
|
|
|
|
var style3={marginLeft:'4px',marginRight:'4px',position:'relative'}
|
|
|
|
|
var line1=ui.create.div(style2,this);
|
|
|
|
|
var line2=ui.create.div(style2,this);
|
|
|
|
|
line2.style.lineHeight='50px';
|
2016-10-07 07:23:50 +00:00
|
|
|
|
if(_status.extensionmade.contains(name)){
|
|
|
|
|
ui.create.node('button','管理扩展',line1,function(){
|
|
|
|
|
ui.click.configMenu();
|
|
|
|
|
ui.click.extensionTab(name);
|
|
|
|
|
},{marginLeft:'6px'});
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.create.node('button','删除关卡',line1,function(){
|
|
|
|
|
if(confirm('确定删除'+name+'?')){
|
|
|
|
|
game.removeStage(name);
|
|
|
|
|
}
|
|
|
|
|
},{marginLeft:'6px'});
|
|
|
|
|
}
|
2016-10-06 04:38:28 +00:00
|
|
|
|
ui.create.node('button','导出扩展',line1,function(){
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var level=stage.level;
|
|
|
|
|
stage.level=0;
|
2016-10-05 06:03:57 +00:00
|
|
|
|
var str='{name:"'+name+'",content:function(){\nif(lib.config.mode=="brawl"){\n'+
|
|
|
|
|
'if(!lib.storage.stage) lib.storage.stage={};\n'+
|
2016-10-07 07:23:50 +00:00
|
|
|
|
'if(!lib.storage.stage["'+name+'"]){\nlib.storage.stage["'+name+'"]='+get.stringify(stage)+';\n_status.extensionstage=true;}\n'+
|
|
|
|
|
'if(!_status.extensionmade) _status.extensionmade=[];\n'+
|
|
|
|
|
'_status.extensionmade.push("'+name+'");\n}}\n}';
|
|
|
|
|
stage.level=level;
|
2016-10-05 06:03:57 +00:00
|
|
|
|
var extension={'extension.js':'game.import("extension",'+str+')'};
|
|
|
|
|
game.importExtension(extension,null,name);
|
|
|
|
|
},{marginLeft:'6px'});
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var noactive=true;
|
|
|
|
|
var clickNode=function(){
|
|
|
|
|
if(this.classList.contains('unselectable')) return;
|
|
|
|
|
if(!this.classList.contains('active')){
|
|
|
|
|
var active=this.parentNode.querySelector('.menubutton.large.active');
|
|
|
|
|
if(active){
|
|
|
|
|
active.classList.remove('active');
|
|
|
|
|
}
|
|
|
|
|
this.classList.add('active');
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-06 04:38:28 +00:00
|
|
|
|
for(var i=0;i<stage.scenes.length;i++){
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var node=ui.create.div('.menubutton.large',line2,stage.scenes[i].name,style3,clickNode);
|
|
|
|
|
node.index=i;
|
|
|
|
|
if(stage.mode=='sequal'){
|
|
|
|
|
if(i==stage.level){
|
|
|
|
|
node.classList.add('active');
|
|
|
|
|
noactive=false;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
node.classList.add('unselectable');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(stage.mode=='normal'){
|
|
|
|
|
if(i>stage.level){
|
|
|
|
|
node.classList.add('unselectable');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(lib.storage.lastStage==i&&!node.classList.contains('unselectable')){
|
|
|
|
|
node.classList.add('active');
|
|
|
|
|
noactive=false;
|
|
|
|
|
}
|
|
|
|
|
else if(lib.storage.lastStage==undefined&&noactive&&!node.classList.contains('unselectable')){
|
|
|
|
|
node.classList.add('active');
|
|
|
|
|
noactive=false;
|
|
|
|
|
}
|
2016-10-06 04:38:28 +00:00
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
2016-10-01 06:07:17 +00:00
|
|
|
|
showcase:function(init){
|
|
|
|
|
if(_status.sceneChanged){
|
|
|
|
|
init=true;
|
|
|
|
|
this.innerHTML='';
|
|
|
|
|
delete _status.sceneChanged;
|
|
|
|
|
}
|
|
|
|
|
if(init){
|
|
|
|
|
this.style.transition='all 0s';
|
|
|
|
|
this.style.height=(this.offsetHeight-10)+'px';
|
|
|
|
|
this.style.overflow='scroll';
|
|
|
|
|
lib.setScroll(this);
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var style2={position:'relative',display:'block',left:0,top:0,marginBottom:'6px',padding:0,width:'100%'};
|
|
|
|
|
var style3={marginLeft:'4px',marginRight:'4px',position:'relative'}
|
2016-10-01 06:07:17 +00:00
|
|
|
|
|
|
|
|
|
var scenename=ui.create.node('input',ui.create.div(style2,'','关卡名称:',this),{width:'120px'});
|
|
|
|
|
scenename.type='text';
|
|
|
|
|
scenename.style.marginTop='20px';
|
|
|
|
|
var sceneintro=ui.create.node('input',ui.create.div(style2,'','关卡描述:',this),{width:'120px'});
|
|
|
|
|
sceneintro.type='text';
|
|
|
|
|
sceneintro.style.marginBottom='10px';
|
|
|
|
|
|
|
|
|
|
var line1=ui.create.div(style2,this);
|
2016-10-05 06:03:57 +00:00
|
|
|
|
var line2=ui.create.div(style2,this);
|
2016-10-07 07:23:50 +00:00
|
|
|
|
line1.style.marginBottom='10px';
|
|
|
|
|
line2.style.lineHeight='50px';
|
2016-10-01 06:07:17 +00:00
|
|
|
|
var scenes=[];
|
|
|
|
|
for(var i in lib.storage.scene){
|
2016-10-05 06:03:57 +00:00
|
|
|
|
scenes.push([i,i]);
|
2016-10-01 06:07:17 +00:00
|
|
|
|
}
|
2016-10-07 07:23:50 +00:00
|
|
|
|
if(!scenes.length){
|
|
|
|
|
alert('请创建至少1个场景');
|
2016-10-01 06:07:17 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
var scenelist=ui.create.selectlist(scenes,null,line1);
|
|
|
|
|
var e1=function(){
|
|
|
|
|
if(this.nextSibling){
|
|
|
|
|
this.parentNode.insertBefore(this,this.nextSibling.nextSibling);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var e2=function(){
|
|
|
|
|
var that=this;
|
|
|
|
|
this.movetimeout=setTimeout(function(){
|
|
|
|
|
e1.call(that);
|
|
|
|
|
},500);
|
|
|
|
|
}
|
|
|
|
|
var e3=function(){
|
|
|
|
|
clearTimeout(this.movetimeout);
|
|
|
|
|
delete this.movetimeout;
|
|
|
|
|
}
|
|
|
|
|
var e4=function(value){
|
2016-10-07 07:23:50 +00:00
|
|
|
|
var node=ui.create.div('.menubutton.large',value,line2,style3,function(){
|
2016-10-05 06:03:57 +00:00
|
|
|
|
if(confirm('是否移除'+this.innerHTML+'?')){
|
|
|
|
|
this.remove();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if(lib.config.touchscreen){
|
|
|
|
|
node.ontouchstart=e2;
|
|
|
|
|
node.ontouchend=e3;
|
|
|
|
|
node.ontouchmove=e3;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
node.oncontextmenu=e1;
|
|
|
|
|
node.onmousedown=e2;
|
|
|
|
|
node.onmouseup=e3;
|
|
|
|
|
node.onmouseleave=e3;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-10-01 06:07:17 +00:00
|
|
|
|
var addButton=ui.create.node('button','添加场景',line1,function(){
|
2016-10-05 06:03:57 +00:00
|
|
|
|
e4(scenelist.value);
|
2016-10-01 06:07:17 +00:00
|
|
|
|
},{marginLeft:'6px',marginRight:'12px'});
|
2016-10-05 06:03:57 +00:00
|
|
|
|
var sceneconfig=ui.create.selectlist([
|
2016-10-01 06:07:17 +00:00
|
|
|
|
['normal','默认模式'],
|
|
|
|
|
['sequal','连续闯关'],
|
|
|
|
|
['free','自由选关']
|
|
|
|
|
],null,line1);
|
|
|
|
|
var saveButton=ui.create.node('button','保存关卡',line1,function(){
|
|
|
|
|
if(!scenename.value){
|
|
|
|
|
alert('请填写关卡名称');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2016-10-05 06:03:57 +00:00
|
|
|
|
if(line2.childElementCount<2){
|
|
|
|
|
alert('请添加至少2个场景');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var stage={
|
|
|
|
|
name:scenename.value,
|
|
|
|
|
intro:sceneintro.value,
|
|
|
|
|
scenes:[],
|
2016-10-06 04:38:28 +00:00
|
|
|
|
mode:sceneconfig.value,
|
|
|
|
|
level:0
|
2016-10-05 06:03:57 +00:00
|
|
|
|
};
|
|
|
|
|
for(var i=0;i<line2.childElementCount;i++){
|
2016-10-06 04:38:28 +00:00
|
|
|
|
stage.scenes.push(lib.storage.scene[line2.childNodes[i].innerHTML]);
|
2016-10-05 06:03:57 +00:00
|
|
|
|
}
|
|
|
|
|
if(lib.storage.stage[scenename.value]){
|
|
|
|
|
if(!confirm('关卡名与现有关卡重复,是否覆盖?')){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
game.removeStage(scenename.value);
|
|
|
|
|
}
|
|
|
|
|
lib.storage.stage[stage.name]=stage;
|
|
|
|
|
game.save('stage',lib.storage.stage);
|
|
|
|
|
game.addStage(stage.name,true);
|
2016-10-01 06:07:17 +00:00
|
|
|
|
},{marginLeft:'6px'});
|
2016-10-06 04:38:28 +00:00
|
|
|
|
game.addStageClear=function(){
|
|
|
|
|
scenelist.value=scenes[0][0];
|
|
|
|
|
sceneconfig.value='normal';
|
|
|
|
|
scenename.value='';
|
|
|
|
|
sceneintro.value='';
|
|
|
|
|
line2.innerHTML='';
|
|
|
|
|
};
|
2016-10-01 06:07:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-08-18 10:51:06 +00:00
|
|
|
|
}
|
2016-08-19 10:33:20 +00:00
|
|
|
|
},
|
2016-08-15 14:19:58 +00:00
|
|
|
|
};
|