From be3a7d5c11cc024be4938ae4189ad7e29aa9509b 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, 28 Sep 2020 20:30:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0or=E7=8A=B6=E6=80=81=E4=B8=8B?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E6=9C=89=E5=8F=AF=E4=BB=A5=E6=89=93=E8=BF=99?= =?UTF-8?q?=E4=B8=AA=E6=9D=80=E7=9A=84type=E7=9A=84=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- multi.html | 10 +++++++++ script-json_data.js | 13 ++++++------ script.js | 51 +++++++++++++++++++++++++++++++++++++++------ solo.html | 10 +++++++++ style.css | 12 +++++++++++ triple.html | 10 +++++++++ 6 files changed, 94 insertions(+), 12 deletions(-) diff --git a/multi.html b/multi.html index b8180c5a..c81df4ca 100644 --- a/multi.html +++ b/multi.html @@ -487,6 +487,16 @@ var formation = new Formation(teamsCount,5); +
diff --git a/script-json_data.js b/script-json_data.js index ff7970b0..3ae3399e 100644 --- a/script-json_data.js +++ b/script-json_data.js @@ -28,15 +28,16 @@ const typekiller_for_type = [ {type:3,awoken:38,latent:27,typeKiller:[4,6]}, //3回复 {type:9,awoken:null,latent:null,typeKiller:[]}, //特殊保护 ]; -typekiller_for_type.forEach(t=> - t.typeKiller.push(0,12,14,15) //补充4种特殊杀 -); //类型允许的潜觉杀 const type_allowable_latent = []; typekiller_for_type.forEach(t=> - type_allowable_latent[t.type] = t.typeKiller.map(tn=> - typekiller_for_type.find(_t=>_t.type == tn).latent - ) + { + t.allowableLatent = t.typeKiller.concat([0,12,14,15]) //补充4种特殊杀 + .map(tn=> + typekiller_for_type.find(_t=>_t.type == tn).latent + ); + type_allowable_latent[t.type] = t.allowableLatent; + } ); //等效觉醒列表 const equivalent_awoken = [ diff --git a/script.js b/script.js index 4d55dd60..0528a096 100644 --- a/script.js +++ b/script.js @@ -835,16 +835,55 @@ function initialize() { const s_typesLi = Array.from(s_typesUl.querySelectorAll("li")); const s_typesCheckBox = s_typesLi.map(li=>li.querySelector(".type-check")); s_typesCheckBox.forEach(checkBox=> - checkBox.onchange = function(){ - const newClassName = `type-killer-${this.value}`; - if (this.checked && s_typeAndOr.checked) - s_typesUl.classList.add(newClassName); - else - s_typesUl.classList.remove(newClassName); + { + checkBox.onchange = function(){ + const newClassName = `type-killer-${this.value}`; + if (this.checked && s_typeAndOr.checked) //and的时候才生效 + s_typesUl.classList.add(newClassName); + else + s_typesUl.classList.remove(newClassName); + } } ); + + const s_types_latentUl = s_typesDiv.querySelector(".latent-list"); + const s_types_latentli = Array.from(s_types_latentUl.querySelectorAll("li")); + s_types_latentli.forEach(latent=> + { + latent.onclick = function(){ + const latenttype = parseInt(this.getAttribute("data-latent-icon")); + const killerTypes = typekiller_for_type.filter(o=>o.allowableLatent.includes(latenttype)).map(o=>o.type); + s_typesCheckBox.forEach(checkbox=>{ + const type = parseInt(checkbox.value); + checkbox.checked = killerTypes.includes(type); + }); + }; + }); +/* const s_typesCheckBoxIcon = s_typesLi.map(li=>li.querySelector(".type-icon")); + s_typesCheckBoxIcon.forEach(icon=> + { + icon.onclick = function(e){ + console.log(e,s_typeAndOr.checked); + if (!s_typeAndOr.checked) //or的时候才生效 + { + const type = parseInt(this.getAttribute("data-type-icon")); + const killerTypes = typekiller_for_type.filter(o=>o.typeKiller.includes(type)).map(o=>o.type); + console.log(killerTypes); + s_typesCheckBox.forEach(checkbox=>{ + const type = parseInt(checkbox.value); + checkbox.checked = killerTypes.includes(type); + }); + } + } + } + ); +*/ s_typeAndOr.onchange = function(){ s_typesCheckBox.forEach(checkBox=>checkBox.onchange()); + if (this.checked) + s_types_latentUl.classList.add(className_displayNone); + else + s_types_latentUl.classList.remove(className_displayNone); }; s_typeAndOr.onchange(); diff --git a/solo.html b/solo.html index 296a6ea4..2cadd746 100644 --- a/solo.html +++ b/solo.html @@ -437,6 +437,16 @@ var formation = new Formation(teamsCount,6); +
diff --git a/style.css b/style.css index 5f3849cc..f318345e 100644 --- a/style.css +++ b/style.css @@ -989,6 +989,18 @@ ul{ { display: block; } +.types-div .latent-list .latent-icon +{ + cursor: pointer; + box-shadow: none; +} +.types-div .latent-list .latent-icon:before +{ + margin-left: -23px; + margin-right: -25px; + margin-top: -3px; + margin-bottom: -5px; +} /*.search-box .awoken-div::before{ content: "觉醒"; }*/ diff --git a/triple.html b/triple.html index 25879ed6..f7d3c29a 100644 --- a/triple.html +++ b/triple.html @@ -1132,6 +1132,16 @@ var formation = new Formation(teamsCount,6); +