From 9919ef8e2ece1dd268f665cd6334caf0b707dabf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=AB=E8=B0=B7=E5=89=91=E4=BB=99?= Date: Mon, 27 Jan 2020 03:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E4=B8=AA=E9=A1=B5=E9=9D=A2=E4=B9=8B?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- languages/zh-CN.css | 3 ++ script.js | 74 +++++++++++++++++++++++++++++++++------------ 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/languages/zh-CN.css b/languages/zh-CN.css index 43ec6c5e..be6bd2bf 100644 --- a/languages/zh-CN.css +++ b/languages/zh-CN.css @@ -189,6 +189,9 @@ .control-box .btn-multi-link::before{ content: "🧑‍🤝‍🧑转到2人车队"; } +.control-box .btn-triple-link::before{ + content: "👪转到3人协力"; +} .control-box .btn-clear-data::before{ content: "🗑️清除数据"; } diff --git a/script.js b/script.js index 2b84852b..60445a88 100644 --- a/script.js +++ b/script.js @@ -221,35 +221,69 @@ function swapABteam() //在单人和多人之间转移数据 function turnPage(toPage) { + let pagename = null; switch(toPage) { case 1: + if (formation.teams[0][0].length<6) + { + //把第二支队伍的队长添加到最后方 + formation.teams[0][0].push(formation.teams[1][0][0]); + formation.teams[0][1].push(formation.teams[1][1][0]); + } + //删掉第2支开始的队伍 + formation.teams.splice(1); + pagename = "solo.html"; break; case 2: + if (formation.teams.length<2) + { + //创建第二支队伍,各4个空的 + /*formation.teams[1] = [ + Array.from(new Array(4)).map(()=>{return new MemberTeam();}), + Array.from(new Array(4)).map(()=>{return new MemberAssist();}) + ];*/ + formation.teams[1] = [[],[]]; + //把右边的队长加到第二支队伍最后面 + formation.teams[1][0].splice(0,0,formation.teams[0][0].splice(5,1)[0]); + formation.teams[1][1].splice(0,0,formation.teams[0][1].splice(5,1)[0]); + }else //三人则直接删除 + { + //删掉第3支开始的队伍 + formation.teams.splice(2); + //删掉前面两支队伍的战友 + formation.teams[0][0].splice(5); + formation.teams[0][1].splice(5); + formation.teams[1][0].splice(5); + formation.teams[1][1].splice(5); + } + formation.badge = 0; + pagename = "multi.html"; break; case 3: + if (formation.teams.length<2) + { + //创建第二支队伍,各4个空的 + /*formation.teams[1] = [ + Array.from(new Array(6)).map(()=>{return new MemberTeam();}), + Array.from(new Array(6)).map(()=>{return new MemberAssist();}) + ]; + formation.teams[2] = [ + Array.from(new Array(6)).map(()=>{return new MemberTeam();}), + Array.from(new Array(6)).map(()=>{return new MemberAssist();}) + ];*/ + }else //2人 + { + formation.teams[0][0].push(formation.teams[1][0][0]); + formation.teams[0][1].push(formation.teams[1][1][0]); + formation.teams[1][0].push(formation.teams[0][0][0]); + formation.teams[1][1].push(formation.teams[0][1][0]); + } + formation.badge = 0; + pagename = "triple.html"; break; } - if (solo) - { - //创建第二支队伍,各4个空的 - formation.teams[1] = [ - Array.from(new Array(4)).map(()=>{return new MemberTeam();}), - Array.from(new Array(4)).map(()=>{return new MemberAssist();}) - ]; - //把右边的队长加到第二支队伍最后面 - formation.teams[1][0].push(formation.teams[0][0].splice(5,1)[0]); - formation.teams[1][1].push(formation.teams[0][1].splice(5,1)[0]); - formation.badge = 0; - }else - { - //把第二支队五的队长添加到最后方 - formation.teams[0][0].push(formation.teams[1][0][4]); - formation.teams[0][1].push(formation.teams[1][1][4]); - //删掉第二支队伍 - formation.teams.splice(1,1); - } - location.href = creatNewUrl({url:solo?"multi.html":"solo.html",notPushState:true}); + location.href = creatNewUrl({url:pagename, notPushState:true}); } window.onload = function() {