似乎完成了数量的显示
This commit is contained in:
parent
4d1b80e787
commit
478e2b9fe4
|
@ -401,6 +401,17 @@ label[for="merge-skill"]::after{
|
|||
.search-box .special-div::before{
|
||||
content: "▼特殊搜索";
|
||||
}
|
||||
.search-box .fast-switch::before {
|
||||
content: "快速开关:";
|
||||
}
|
||||
label[for="no-henshin"]::after
|
||||
{
|
||||
content: "非变身";
|
||||
}
|
||||
label[for="box-have"]::after
|
||||
{
|
||||
content: "强调箱子拥有";
|
||||
}
|
||||
.special-div .special-add::before {
|
||||
content: "➕";
|
||||
}
|
||||
|
|
|
@ -613,8 +613,10 @@ function calculateAbility_max(id, solo, teamsCount) {
|
|||
}
|
||||
}
|
||||
//搜索卡片用
|
||||
function searchCards(cards, attr1, attr2, fixMainColor, types, typeAndOr, rares, awokens, sawokens, equalAk, incSawoken) {
|
||||
function searchCards(cards, attr1, attr2, fixMainColor, types, typeAndOr, rares, awokens, sawokens, equalAk, incSawoken, canAssist, noHenshin) {
|
||||
let cardsRange = cards.concat(); //这里需要复制一份原来的数组,不然若无筛选,后面的排序会改变初始Cards
|
||||
if (canAssist) cardsRange = cardsRange.filter(card=>card.canAssist);
|
||||
if (noHenshin) cardsRange = cardsRange.filter(card=>!card.henshinFrom || card.limitBreakIncr);
|
||||
//属性
|
||||
if (attr1 != null && attr1 === attr2 || //主副属性一致并不为空
|
||||
(attr1 === 6 && attr2 === -1)) //主副属性都为“无”
|
||||
|
@ -729,35 +731,33 @@ function searchByString(str)
|
|||
return [];
|
||||
}
|
||||
}
|
||||
function copyString(input)
|
||||
{
|
||||
function copyString(input) {
|
||||
input.focus(); //设input为焦点
|
||||
input.select(); //选择全部
|
||||
if (document.execCommand('copy')) {
|
||||
document.execCommand('copy');
|
||||
}
|
||||
|
||||
navigator.clipboard.writeText(input.value).then(function() {
|
||||
/* clipboard successfully set */
|
||||
//复制成功
|
||||
}, function() {
|
||||
/* clipboard write failed */
|
||||
document.execCommand('copy'); //尝试废弃的老方法
|
||||
});
|
||||
//input.blur(); //取消焦点
|
||||
}
|
||||
//产生一个怪物头像
|
||||
function createCardA() {
|
||||
const cdom = document.createElement("a");
|
||||
cdom.className = "monster";
|
||||
cdom.target = "_blank";
|
||||
const property = cdom.appendChild(document.createElement("div"));
|
||||
property.className = "property";
|
||||
const subproperty = cdom.appendChild(document.createElement("div"));
|
||||
subproperty.className = "subproperty";
|
||||
const cid = cdom.appendChild(document.createElement("div"));
|
||||
cid.className = "id";
|
||||
const cawoken = cdom.appendChild(document.createElement("div"));
|
||||
cawoken.className = "awoken-count-num";
|
||||
return cdom;
|
||||
function createCardA(option) {
|
||||
const t = document.body.querySelector('#template-card-a');
|
||||
const clone = document.importNode(t.content, true);
|
||||
const monster = clone.querySelector(".monster");
|
||||
if (option?.noTreeCount) monster.querySelector(".count-in-box .evo-tree").remove();
|
||||
if (option?.noBoxCount) monster.querySelector(".count-in-box").remove();
|
||||
return monster;
|
||||
}
|
||||
//返回文字说明内怪物Card的纯HTML
|
||||
function cardN(id) {
|
||||
const monOuterDom = document.createElement("span");
|
||||
monOuterDom.className = "detail-mon";
|
||||
const monDom = createCardA(id);
|
||||
const monDom = createCardA({noBoxCount: true});
|
||||
monOuterDom.appendChild(monDom);
|
||||
monOuterDom.monDom = monDom;
|
||||
changeid({ id: id }, monDom);
|
||||
|
|
144
script.js
144
script.js
|
@ -661,7 +661,6 @@ class EvoTree
|
|||
//mid = Cards[mid].evoRootId;
|
||||
function returnRootId(mid)
|
||||
{
|
||||
console.log(mid)
|
||||
mid = Cards[mid].evoRootId;
|
||||
const m = Cards[mid];
|
||||
if (m.henshinFrom && m.henshinFrom < m.id)
|
||||
|
@ -756,7 +755,7 @@ class EvoTree
|
|||
evoTypeDiv.className = "evo-type-div";
|
||||
const evoType = evoTypeDiv.appendChild(document.createElement("span"));
|
||||
evoType.className = "evo-type";
|
||||
const monHead = evotPanel_L.appendChild(createCardHead(this.id));
|
||||
const monHead = evotPanel_L.appendChild(createCardHead(this.id, {noTreeCount: true}));
|
||||
monHead.className = "monster-head";
|
||||
|
||||
const monName = evotPanel_R.appendChild(document.createElement("div"));
|
||||
|
@ -767,7 +766,7 @@ class EvoTree
|
|||
evotMaterials.className = "evo-materials";
|
||||
this.card.evoMaterials.forEach(mid=>{
|
||||
//const li = evotMaterials.appendChild(document.createElement("li"));
|
||||
evotMaterials.appendChild(createCardHead(mid));
|
||||
evotMaterials.appendChild(createCardHead(mid, {noTreeCount: true}));
|
||||
});
|
||||
|
||||
const evoSubEvo = tBox.appendChild(document.createElement("ul"));
|
||||
|
@ -1033,10 +1032,10 @@ function loadData(force = false)
|
|||
{
|
||||
const monstersList = editBox.querySelector("#monsters-name-list");
|
||||
let fragment = document.createDocumentFragment();
|
||||
Cards.forEach(function(m) { //添加下拉框候选
|
||||
Cards.forEach(function(card, idx, arr) { //添加下拉框候选
|
||||
const opt = fragment.appendChild(document.createElement("option"));
|
||||
opt.value = m.id;
|
||||
opt.label = m.id + " - " + returnMonsterNameArr(m, currentLanguage.searchlist, currentDataSource.code).join(" | ");
|
||||
opt.value = card.id;
|
||||
opt.label = card.id + " - " + returnMonsterNameArr(card, currentLanguage.searchlist, currentDataSource.code).join(" | ");
|
||||
|
||||
/*const linkRes = new RegExp("link:(\\d+)", "ig").exec(m.specialAttribute);
|
||||
if (linkRes) { //每个有链接的符卡,把它们被链接的符卡的进化根修改到链接前的
|
||||
|
@ -1048,7 +1047,12 @@ function loadData(force = false)
|
|||
m.henshinTo = toId;
|
||||
_m.henshinFrom = m.id;
|
||||
}*/
|
||||
/*if (card.evoRootId === card.id)
|
||||
{
|
||||
card.evoTree = arr.filter(c=>c.evoRootId === card.evoRootId);
|
||||
}*/
|
||||
});
|
||||
|
||||
monstersList.appendChild(fragment);
|
||||
}
|
||||
|
||||
|
@ -1148,7 +1152,7 @@ function loadData(force = false)
|
|||
if (db) dbReadAll(db, "palyer_datas").then(datas=>{
|
||||
PlayerDatas = datas.map(data=>new PlayerData(data));
|
||||
currentPlayerData = PlayerDatas.find(data=>data.name == localStorage.getItem(cfgPrefix + "default-player-name"));
|
||||
document.body.querySelector("#player-data-frame").show();
|
||||
//document.body.querySelector("#player-data-frame").show(); //debug用显示
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -2517,7 +2521,7 @@ function initialize(event) {
|
|||
return false; //取消链接的默认操作
|
||||
}
|
||||
const cli = document.createElement("li");
|
||||
const cdom = cli.head = createCardA(id);
|
||||
const cdom = cli.head = createCardA(options);
|
||||
cli.appendChild(cdom);
|
||||
changeid({ id: id }, cdom);
|
||||
const card = Cards[id];
|
||||
|
@ -2734,10 +2738,12 @@ function initialize(event) {
|
|||
|
||||
const s_awokensEquivalent = searchBox.querySelector("#consider-equivalent-awoken"); //搜索等效觉醒
|
||||
const s_canAssist = searchBox.querySelector("#can-assist"); //只搜索辅助
|
||||
s_canAssist.onchange = function() {
|
||||
toggleDomClassName(this, "only-display-can-assist", true, searchMonList);
|
||||
};
|
||||
const s_noHenshin = searchBox.querySelector("#no-henshin"); //只搜索非变身
|
||||
|
||||
const s_boxHave = searchBox.querySelector("#box-have"); //只搜索辅助
|
||||
s_boxHave.onchange = function() {
|
||||
toggleDomClassName(this, "emphasize-box-have", true, document.body);
|
||||
};
|
||||
|
||||
const s_sawokensDiv = searchBox.querySelector(".sawoken-div");
|
||||
const s_sawokensUl = s_sawokensDiv.querySelector(".sawoken-ul");
|
||||
|
@ -2999,7 +3005,9 @@ function initialize(event) {
|
|||
awokensFilter,
|
||||
sawokensFilter,
|
||||
s_awokensEquivalent.checked,
|
||||
s_includeSuperAwoken.checked
|
||||
s_includeSuperAwoken.checked,
|
||||
s_canAssist.checked,
|
||||
s_noHenshin.checked,
|
||||
);
|
||||
|
||||
//进行特殊附加搜索
|
||||
|
@ -3120,7 +3128,7 @@ function initialize(event) {
|
|||
if (e.key == "Enter" && this.value.length > 0 && !/^\d+$/.test(this.value))
|
||||
{
|
||||
s_includeSuperAwoken.onchange();
|
||||
s_canAssist.onchange();
|
||||
s_boxHave.onchange();
|
||||
showSearch(searchByString(this.value));
|
||||
}
|
||||
}
|
||||
|
@ -3137,7 +3145,7 @@ function initialize(event) {
|
|||
//字符串搜索
|
||||
btnSearchByString.onclick = function() {
|
||||
s_includeSuperAwoken.onchange();
|
||||
s_canAssist.onchange();
|
||||
s_boxHave.onchange();
|
||||
showSearch(searchByString(monstersID.value));
|
||||
};
|
||||
//觉醒
|
||||
|
@ -3590,12 +3598,53 @@ function initialize(event) {
|
|||
if (isGuideMod) //图鉴模式直接打开搜索框
|
||||
{
|
||||
s_includeSuperAwoken.onchange();
|
||||
s_canAssist.onchange();
|
||||
s_boxHave.onchange();
|
||||
showSearch([]);
|
||||
//if (monstersID.value.length == 0) editBoxChangeMonId(0);
|
||||
}
|
||||
}
|
||||
|
||||
//搜出一个卡片包含变身的的完整进化树
|
||||
function buildEvoTreeIdsArray(card, includeHenshin = true) {
|
||||
const evoLinkCardsIdArray = card.evoRootId !== 0 ? Cards.filter(m=>m.evoRootId == card.evoRootId).map(m=>m.id) : []; //筛选出相同进化链的
|
||||
function loopAddHenshin(arr,card)
|
||||
{
|
||||
const tcard1 = Cards[card.henshinFrom] || null;
|
||||
const tcard2 = Cards[card.henshinTo] || null;
|
||||
const evoCards = Cards.filter(m=>m.evoRootId == card.evoRootId && !arr.includes(m.id)).map(m=>m.id);
|
||||
if (tcard1 && !arr.includes(tcard1.id))
|
||||
{
|
||||
arr.push(tcard1.id);
|
||||
loopAddHenshin(arr,tcard1);
|
||||
}
|
||||
if (tcard2 && !arr.includes(tcard2.id))
|
||||
{
|
||||
arr.push(tcard2.id);
|
||||
loopAddHenshin(arr,tcard2);
|
||||
}
|
||||
if (evoCards.length > 0)
|
||||
{
|
||||
evoCards.forEach(mid=>{
|
||||
arr.push(mid);
|
||||
const m = Cards[mid];
|
||||
if (m.henshinFrom || m.henshinTo)
|
||||
{ //添加变身的
|
||||
loopAddHenshin(arr,m);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
evoLinkCardsIdArray.forEach((mid,idx,arr)=>{
|
||||
const m = Cards[mid];
|
||||
if (includeHenshin && (m.henshinFrom || m.henshinTo))
|
||||
{ //添加变身的
|
||||
loopAddHenshin(arr,m);
|
||||
}
|
||||
});
|
||||
evoLinkCardsIdArray.sort((a,b)=>a-b);
|
||||
return evoLinkCardsIdArray;
|
||||
}
|
||||
|
||||
//改变一个怪物头像
|
||||
function changeid(mon, monDom, latentDom) {
|
||||
let fragment = document.createDocumentFragment(); //创建节点用的临时空间
|
||||
|
@ -3759,6 +3808,29 @@ function changeid(mon, monDom, latentDom) {
|
|||
switchLeaderDom.classList.add(className_displayNone);
|
||||
}
|
||||
}
|
||||
const countInBox = monDom.querySelector(".count-in-box");
|
||||
if (countInBox && currentPlayerData) { //如果存在当前绑定用户数据
|
||||
function cardsCount(pre,cur) {
|
||||
return pre + cur.count;
|
||||
}
|
||||
let sameIdCount = currentPlayerData.parsedCards.filter(mon=>mon.id === monId).reduce(cardsCount, 0);
|
||||
|
||||
monDom.setAttribute("data-box-have", sameIdCount === 0 ? 0 : 1);
|
||||
|
||||
const countSameId = countInBox.querySelector(".same-id");
|
||||
if (countSameId) {
|
||||
countSameId.setAttribute("data-same-id", sameIdCount);
|
||||
}
|
||||
const countEvoTree = countInBox.querySelector(".evo-tree");
|
||||
if (countEvoTree) {
|
||||
let evoLinkCardsIdArray = buildEvoTreeIdsArray(card);
|
||||
let evoTreeCount = currentPlayerData.parsedCards.filter(mon=>evoLinkCardsIdArray.includes(mon.id)).reduce(cardsCount, 0);
|
||||
if (sameIdCount === 0 && evoTreeCount > 0) {
|
||||
monDom.setAttribute("data-box-have", 2);
|
||||
}
|
||||
countEvoTree.setAttribute("data-evo-tree", evoTreeCount - sameIdCount);
|
||||
}
|
||||
}
|
||||
|
||||
parentNode.appendChild(fragment);
|
||||
}
|
||||
|
@ -3914,45 +3986,7 @@ function editBoxChangeMonId(id) {
|
|||
mAltName.classList.add(className_displayNone);
|
||||
}
|
||||
|
||||
|
||||
const evoLinkCardsIdArray = card.evoRootId !== 0 ? Cards.filter(m=>m.evoRootId == card.evoRootId).map(m=>m.id) : []; //筛选出相同进化链的
|
||||
|
||||
function loopAddHenshin(arr,card)
|
||||
{
|
||||
const tcard1 = Cards[card.henshinFrom] || null;
|
||||
const tcard2 = Cards[card.henshinTo] || null;
|
||||
const evoCards = Cards.filter(m=>m.evoRootId == card.evoRootId && !arr.includes(m.id)).map(m=>m.id);
|
||||
if (tcard1 && !arr.includes(tcard1.id))
|
||||
{
|
||||
arr.push(tcard1.id);
|
||||
loopAddHenshin(arr,tcard1);
|
||||
}
|
||||
if (tcard2 && !arr.includes(tcard2.id))
|
||||
{
|
||||
arr.push(tcard2.id);
|
||||
loopAddHenshin(arr,tcard2);
|
||||
}
|
||||
if (evoCards.length > 0)
|
||||
{
|
||||
evoCards.forEach(mid=>
|
||||
{
|
||||
arr.push(mid);
|
||||
const m = Cards[mid];
|
||||
if (m.henshinFrom || m.henshinTo)
|
||||
{ //添加变身的
|
||||
loopAddHenshin(arr,m);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
evoLinkCardsIdArray.forEach((mid,idx,arr)=>{
|
||||
const m = Cards[mid];
|
||||
if (m.henshinFrom || m.henshinTo)
|
||||
{ //添加变身的
|
||||
loopAddHenshin(arr,m);
|
||||
}
|
||||
});
|
||||
evoLinkCardsIdArray.sort((a,b)=>a-b);
|
||||
const evoLinkCardsIdArray = buildEvoTreeIdsArray(card);
|
||||
|
||||
const createCardHead = editBox.createCardHead;
|
||||
const evoCardUl = settingBox.querySelector(".row-mon-id .evo-card-list");
|
||||
|
@ -3962,7 +3996,7 @@ function editBoxChangeMonId(id) {
|
|||
if (evoLinkCardsIdArray.length > 1) {
|
||||
let fragment = document.createDocumentFragment(); //创建节点用的临时空间
|
||||
evoLinkCardsIdArray.forEach(function(mid) {
|
||||
const cli = createCardHead(mid);
|
||||
const cli = createCardHead(mid, {noTreeCount: true});
|
||||
if (mid == id) {
|
||||
cli.classList.add("unable-monster");
|
||||
}
|
||||
|
|
18
solo.html
18
solo.html
|
@ -787,6 +787,10 @@ var formation = new Formation(teamsCount,6);
|
|||
<li><select class="special-filter"></select></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="fast-switch">
|
||||
<input type="checkbox" class="config-checkbox-ipt" name="can-assist" id="can-assist"><label class="config-checkbox-lbl can-assist-label" for="can-assist"><div class="config-checkbox-lbl-cicle"></div></label>
|
||||
<input type="checkbox" class="config-checkbox-ipt" name="no-henshin" id="no-henshin"><label class="config-checkbox-lbl" for="no-henshin"><div class="config-checkbox-lbl-cicle"></div></label>
|
||||
</div>
|
||||
<div class="control-div"><!--控制栏-->
|
||||
<button class="search-start"><!--开始搜索--></button>
|
||||
<button class="search-close"><!--关闭搜索--></button>
|
||||
|
@ -800,7 +804,7 @@ var formation = new Formation(teamsCount,6);
|
|||
<div class="sort-div"><!--排序栏-->
|
||||
<select class="sort-list"></select>
|
||||
<input type="checkbox" class="config-checkbox-ipt" name="sort-reverse" id="sort-reverse"><label class="config-checkbox-lbl sort-reverse-label" for="sort-reverse"><div class="config-checkbox-lbl-cicle"></div></label>
|
||||
<input type="checkbox" class="config-checkbox-ipt" name="can-assist" id="can-assist"><label class="config-checkbox-lbl can-assist-label" for="can-assist"><div class="config-checkbox-lbl-cicle"></div></label>
|
||||
<input type="checkbox" class="config-checkbox-ipt" name="box-have" id="box-have"><label class="config-checkbox-lbl" for="box-have"><div class="config-checkbox-lbl-cicle"></div></label>
|
||||
<div class="search-list-length"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1016,6 +1020,16 @@ var formation = new Formation(teamsCount,6);
|
|||
<button class="button-done"><!--确认修改--></button>
|
||||
<button class="button-cancel"><!--取消修改--></button>
|
||||
</div>
|
||||
|
||||
<template id="template-card-a">
|
||||
<a class="monster" target="_blank" data-cardid="" data-cards-pic-idx="" data-cards-pic-x="" data-cards-pic-y="" title="">
|
||||
<div class="property" data-property=""></div>
|
||||
<div class="subproperty" data-property=""></div>
|
||||
<div class="id"></div>
|
||||
<div class="awoken-count-num"></div>
|
||||
<div class="count-in-box"><span class="same-id"></span><span class="evo-tree"></span></div>
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
<svg id="interchange-line" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.2" height="100%" width="100%" style="display:none;">
|
||||
<g class="transBox">
|
||||
|
@ -1098,7 +1112,7 @@ var formation = new Formation(teamsCount,6);
|
|||
<div class="dialog-control"><button class="dialog-clear brown-button"></button><button class="dialog-confirm brown-button"></button></div>
|
||||
</div>
|
||||
|
||||
<div id="player-data-frame" class="mask">
|
||||
<div id="player-data-frame" class="mask display-none">
|
||||
<div class="player-box-title"><!--玩家数据子--></div>
|
||||
<div class="control-button-box">
|
||||
<button class="mask-close brown-button"></button>
|
||||
|
|
41
style.css
41
style.css
|
@ -332,6 +332,7 @@ ul{
|
|||
position: relative;
|
||||
cursor: pointer;
|
||||
border-radius: 5px;
|
||||
text-decoration:none;
|
||||
}
|
||||
.monster.null,.monster.delay,
|
||||
.null .property,.delay .property,
|
||||
|
@ -567,6 +568,37 @@ ul{
|
|||
{
|
||||
animation: icon-active 0.2s;
|
||||
}
|
||||
/*怪物-箱子统计*/
|
||||
.monster .count-in-box
|
||||
{
|
||||
position: absolute;
|
||||
left: 15px;
|
||||
top: -10px;
|
||||
color: white;
|
||||
text-shadow: black 0px 0px 2px,black -1px -1px 1px,black 1px 1px 1px,black 0px 3px 0;
|
||||
font-size: 19px;
|
||||
}
|
||||
.monster .count-in-box .same-id[data-same-id]::before
|
||||
{
|
||||
content: "×"attr(data-same-id);
|
||||
}
|
||||
.monster .count-in-box .evo-tree[data-evo-tree]:not([data-evo-tree="0"])::before
|
||||
{
|
||||
content: "("attr(data-evo-tree)")";
|
||||
}
|
||||
|
||||
.emphasize-box-have .monster[data-box-have="0"]
|
||||
{
|
||||
opacity: 0.45;
|
||||
}
|
||||
.emphasize-box-have .search-mon-list .monster[data-box-have="0"]
|
||||
{
|
||||
filter: grayscale(1);
|
||||
}
|
||||
.emphasize-box-have .monster[data-box-have="2"]
|
||||
{
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.not-show-awoken-count .formation-box .team-total-info, /*单个队伍血量统计*/
|
||||
.not-show-awoken-count .formation-box .team-ability, /*单个队伍三维*/
|
||||
|
@ -1892,14 +1924,7 @@ icon.inflicts::after
|
|||
max-height: 790px;
|
||||
overflow: auto;
|
||||
}
|
||||
.search-mon-list.only-display-can-assist>li
|
||||
{
|
||||
opacity: 0.25;
|
||||
}
|
||||
.search-mon-list.only-display-can-assist>li.allowable-assist
|
||||
{
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.setting-box .row-mon-id .real-time-change-card-label
|
||||
{
|
||||
margin-right: 0;
|
||||
|
|
Loading…
Reference in New Issue