◆少前百科是非盈利性、非官方的少女前线维基百科。 ◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科。 ◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科 ◆To foreigners,You can use twitter to contact us. |
“Widget:EnemyInfo/js”的版本间的差异
(测试) |
(更新) |
||
第184行: | 第184行: | ||
var namepos = Mission_txt.indexOf(Mission[i].name); | var namepos = Mission_txt.indexOf(Mission[i].name); | ||
var namestr = Mission_txt.slice(namepos + Mission[i].name.length + 1, Mission_txt.indexOf("\n", namepos)); | var namestr = Mission_txt.slice(namepos + Mission[i].name.length + 1, Mission_txt.indexOf("\n", namepos)); | ||
− | Mission[i].name = namestr; | + | Mission[i].name = namestr.replace("//n", " "); |
} | } | ||
第257行: | 第257行: | ||
var eteamspot = []; | var eteamspot = []; | ||
+ | var enemyteaminfo = []; | ||
/*-- 下载 sdownload 重置 sredraw 隐藏 smaphide 图例 sexample | /*-- 下载 sdownload 重置 sredraw 隐藏 smaphide 图例 sexample | ||
敌人 smapenemy 建筑 smapbuild 类型 smaptype 颜色 smapcolor 标号 smapspotn 逻辑 smapenemyai | 敌人 smapenemy 建筑 smapbuild 类型 smaptype 颜色 smapcolor 标号 smapspotn 逻辑 smapenemyai | ||
建筑表格 sbuildtable 传送表格 sporttable 点位标记 sspotsign 同组堆叠 senemypile --*/ | 建筑表格 sbuildtable 传送表格 sporttable 点位标记 sspotsign 同组堆叠 senemypile --*/ | ||
− | var setmessage = {sdownload:0, sredraw:0, smaphide:0, sexample:0, smapenemy:1, smapbuild:1, smaptype:1, smapcolor:1, smapspotn:1, smapenemyai:1, sbuildtable:1, sporttable:1, sspotsign:0, senemypile:0}; | + | var setmessage = {sdownload:0, sredraw:0, smaphide:0, sexample:0, smapenemy:1, smapbuild:1, smaptype:1, smapcolor:1, smapspotn:1, smapenemyai:1, sbuildtable:1, sporttable:1, sspotsign:0, senemypile:0, steamconsult:0, sexistspot:0}; |
function missioncreat(){ | function missioncreat(){ | ||
第299行: | 第300行: | ||
<option value="3036">[主线] 偏振光</option> | <option value="3036">[主线] 偏振光</option> | ||
<option value="3041">[主线] 双联乱数</option> | <option value="3041">[主线] 双联乱数</option> | ||
+ | <option value="3044">[主线] 镜像论</option> | ||
<option value="4008">[联动] 猎兔行动</option> | <option value="4008">[联动] 猎兔行动</option> | ||
第1,331行: | 第1,333行: | ||
for(var i = 0; i < Enemy_team.length; i++) output += "<option value=\"" + Enemy_team[i].id + "\">" + Enemy_team[i].id + "</option>"; | for(var i = 0; i < Enemy_team.length; i++) output += "<option value=\"" + Enemy_team[i].id + "\">" + Enemy_team[i].id + "</option>"; | ||
output += `</select></div> <input type="text" id="enemytext" name="enemytext" style="border:none; padding:10px; background-color:#e0e0e0;"/>`; | output += `</select></div> <input type="text" id="enemytext" name="enemytext" style="border:none; padding:10px; background-color:#e0e0e0;"/>`; | ||
+ | |||
+ | output += `<div class="eteambtn" id="steamconsult" style="display:inline-block; user-select:none; border:1px #eaeaea solid; padding:5.5px 10px; cursor:pointer; vertical-align:middle; margin-left:50px;">组成查询</div> | ||
+ | <div class="eteambtn" id="sexistspot" style="display:inline-block; user-select:none; border:1px #eaeaea solid; padding:5.5px 10px; cursor:pointer; vertical-align:middle;">存在地点</div>`; | ||
+ | |||
+ | $("#enemychose").html(output); | ||
/*-- 绘制画布 --*/ | /*-- 绘制画布 --*/ | ||
第1,336行: | 第1,343行: | ||
$("#enemyposition").html(drawingoutput); | $("#enemyposition").html(drawingoutput); | ||
− | $("# | + | $(".eteambtn").mouseover(function(){ |
+ | $(this).css({"border":"1px #f4c430 solid","padding":"5px 10px"}); | ||
+ | }); | ||
+ | $(".eteambtn").mouseout(function(){ | ||
+ | $(this).css({"border":"1px #eaeaea solid","padding":"5px 10px"}); | ||
+ | }); | ||
+ | |||
+ | $("#teammadediv").hide(); | ||
+ | $("#teamexistdiv").hide(); | ||
+ | $("#steamconsult").click(function(){ | ||
+ | if(setmessage["steamconsult"] == 0){ | ||
+ | setmessage["steamconsult"] = 1; | ||
+ | $(this).css({"background-color":"#f4c430","color":"black"}); | ||
+ | $("#teammadediv").show(); | ||
+ | }else{ | ||
+ | setmessage["steamconsult"] = 0; | ||
+ | $(this).css({"background-color":"#111111","color":"#eaeaea"}); | ||
+ | $("#teammadediv").hide(); | ||
+ | } | ||
+ | }); | ||
+ | |||
+ | $("#sexistspot").click(function(){ | ||
+ | if(enemyteaminfo.length == 0)enemymadecal(); | ||
+ | if(setmessage["sexistspot"] == 0){ | ||
+ | setmessage["sexistspot"] = 1; | ||
+ | $(this).css({"background-color":"#f4c430","color":"black"}); | ||
+ | $("#teamexistdiv").show(); | ||
+ | }else{ | ||
+ | setmessage["sexistspot"] = 0; | ||
+ | $(this).css({"background-color":"#111111","color":"#eaeaea"}); | ||
+ | $("#teamexistdiv").hide(); | ||
+ | } | ||
+ | }); | ||
+ | |||
$("#enemyselect").change(function(){ | $("#enemyselect").change(function(){ | ||
enemydisplay(Number(this.value)); | enemydisplay(Number(this.value)); | ||
+ | if(setmessage.sexistspot == 1) existdisplay(Number(this.value)); | ||
}); | }); | ||
$("#enemytext").change(function(){ | $("#enemytext").change(function(){ | ||
第1,344行: | 第1,385行: | ||
if(Enemy_team[i].id == Number(this.value)){ | if(Enemy_team[i].id == Number(this.value)){ | ||
enemydisplay(Number(this.value)); | enemydisplay(Number(this.value)); | ||
+ | if(setmessage.sexistspot == 1) existdisplay(Number(this.value)); | ||
return; | return; | ||
} | } | ||
第1,349行: | 第1,391行: | ||
alert("该敌人不存在"); | alert("该敌人不存在"); | ||
}); | }); | ||
+ | |||
+ | let teamoutput = `<div class="enemyname" id="enemyname1">NONE</div><input type="number" name="enemynumber1" id="enemynumber1" class="enemynumber" value="0" min="0"/> | ||
+ | <div class="enemyname" id="enemyname2">NONE</div><input type="number" name="enemynumber2" id="enemynumber2" class="enemynumber" value="0" min="0"/> | ||
+ | <div class="enemyname" id="enemyname3">NONE</div><input type="number" name="enemynumber3" id="enemynumber3" class="enemynumber" value="0" min="0"/> | ||
+ | <div id="teamconfirm" style="border:1px solid #e0e0e0; padding:6px; margin-left:10px; cursor:pointer; display:inline-block;">确认</div><br/><br/>`; | ||
+ | |||
+ | for(i in Enemy_charater_type){ | ||
+ | let sign = 1; | ||
+ | for(let j = 0; j < i; j++) if(Enemy_charater_type[j].name == Enemy_charater_type[i].name){ sign = 0; break;} | ||
+ | if(sign && Enemy_charater_type[i].name && (Enemy_charater_type[i].name != ",")) teamoutput += `<div class="enemytypename" state="off">` + Enemy_charater_type[i].name + `</div>`; | ||
+ | } | ||
+ | $("#teammadediv").html(teamoutput); | ||
+ | $("div.enemyname").css({"width":"160px", "display":"inline-block", "padding":"5px", "background-color":"#e0e0e0", "color":"black", "margin-left":"6px", "cursor":"pointer", "border":"double"}); | ||
+ | $("input.enemynumber").css({"width":"50px", "padding":"9.5px", "background-color":"#e0e0e0", "border":"none", "margin-left":"2px"}); | ||
+ | $("div.enemytypename").css({"background-color":"#e0e0e0", "color":"black", "display":"inline-block", "margin":"4px 4px", "padding":"4px", "cursor":"pointer", "border-style":"double"}); | ||
+ | $("div#teamconfirm").mouseover(function(){$(this).css({"border-color":"#f4c430", "color":"#f4c430"})}); | ||
+ | $("div#teamconfirm").mouseout(function(){$(this).css({"border-color":"#e0e0e0", "color":"#eaeaea"})}); | ||
+ | |||
+ | $("div.enemyname").click(function(){ | ||
+ | if($(this).html() == "NONE") return; | ||
+ | var namedivs = document.querySelectorAll("div.enemytypename"); | ||
+ | for(i in namedivs) if($(namedivs[i]).html() == $(this).html()){ $(namedivs[i]).css({"background-color":"#e0e0e0"}); break;} | ||
+ | $(this).html("NONE"); | ||
+ | $(this).css("background-color", "#e0e0e0"); | ||
+ | $(this).next().val(0); | ||
+ | }); | ||
+ | $("div.enemytypename").click(function(){ | ||
+ | if($(this).attr("state") == "off"){ | ||
+ | if($("#enemyname1").html() == "NONE"){ | ||
+ | $("#enemyname1").html($(this).html()); | ||
+ | $("#enemyname1").css("background-color", "#f4c430"); | ||
+ | } | ||
+ | else if($("#enemyname2").html() == "NONE"){ | ||
+ | $("#enemyname2").html($(this).html()); | ||
+ | $("#enemyname2").css("background-color", "#f4c430"); | ||
+ | } | ||
+ | else if($("#enemyname3").html() == "NONE"){ | ||
+ | $("#enemyname3").html($(this).html()); | ||
+ | $("#enemyname3").css("background-color", "#f4c430"); | ||
+ | } | ||
+ | else return; | ||
+ | $(this).attr("state", "on"); | ||
+ | $(this).css({"background-color":"#f4c430"}); | ||
+ | } else { | ||
+ | if($("#enemyname1").html() == $(this).html()) $("#enemyname1").click(); | ||
+ | else if($("#enemyname2").html() == $(this).html()) $("#enemyname2").click(); | ||
+ | else if($("#enemyname3").html() == $(this).html()) $("#enemyname3").click(); | ||
+ | $(this).attr("state", "off"); | ||
+ | } | ||
+ | }); | ||
+ | $("div#teamconfirm").click(function(){ | ||
+ | if(setmessage.sexistspot == 1) existdisplay(); | ||
+ | }); | ||
+ | |||
+ | } | ||
+ | |||
+ | function enemymadecal(){ | ||
+ | /*-- 敌方存在的关卡以及点位,计算 --*/ | ||
+ | for(i in Enemy_team){ | ||
+ | enemyteaminfo.push({id:Enemy_team[i].id, enemy:[]}); | ||
+ | let thisteam = enemyteaminfo.length - 1; | ||
+ | |||
+ | for(j in Enemy_in_team){ | ||
+ | if(Enemy_in_team[j]["enemy_team_id"] != Enemy_team[i].id) continue; | ||
+ | let enemyname; | ||
+ | |||
+ | for(k in Enemy_charater_type) if(Enemy_charater_type[k]["id"] == Enemy_in_team[j]["enemy_character_type_id"]){ enemyname = Enemy_charater_type[k]["name"]; break;} | ||
+ | |||
+ | let sign = 1; | ||
+ | for(k in enemyteaminfo[thisteam].enemy){ | ||
+ | if(enemyteaminfo[thisteam].enemy[k].name == enemyname){ enemyteaminfo[thisteam].enemy[k].number += Number(Enemy_in_team[j]["number"]); sign = 0;} | ||
+ | } | ||
+ | if(enemyteaminfo[thisteam].enemy.length == 0) enemyteaminfo[thisteam].enemy.push({name:enemyname, number:Number(Enemy_in_team[j]["number"])}); | ||
+ | else if(sign) enemyteaminfo[thisteam].enemy.push({name:enemyname, number:Number(Enemy_in_team[j]["number"])}); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function existdisplay(define_team){ | ||
+ | var output = `<table id="existancetable" class="enemydata" style="text-align:center; border:1px #f4c430cc solid; background-color:#111111; margin:4px 0px 14px 0px;" cellspacing="1"> | ||
+ | <thead style="display:block; background-color:#f4c430; color:black;"><tr> | ||
+ | <th style="width:100px;">编号<\/th> | ||
+ | <th style="width:540px;">组成<\/th> | ||
+ | <th style="width:140px;">战役<\/th> | ||
+ | <th style="width:140px;">关卡<\/th> | ||
+ | <th style="width:100px;">效能<\/th> | ||
+ | <th style="width:100px;">点位<\/th> | ||
+ | <th style="width:80px;">其它<\/th> | ||
+ | <\/tr><\/thead><tbody id="Buildingbody" style="height:300px; overflow-y:scroll; display:block;">`; | ||
+ | |||
+ | if(define_team) output += existcalculation(define_team) + `</tbody></table>`; | ||
+ | else{ | ||
+ | for(list in enemyteaminfo){ | ||
+ | let sign = 0; | ||
+ | if($("#enemyname1").html() != "NONE"){ | ||
+ | for(i in enemyteaminfo[list].enemy){ | ||
+ | if(enemyteaminfo[list].enemy[i].name == $("#enemyname1").html() && enemyteaminfo[list].enemy[i].number >= Number($("#enemynumber1").val())) {sign = 1; break;} | ||
+ | } | ||
+ | if(sign == 0) continue; | ||
+ | else sign = 1; | ||
+ | } | ||
+ | if($("#enemyname2").html() != "NONE"){ | ||
+ | for(i in enemyteaminfo[list].enemy){ | ||
+ | if(enemyteaminfo[list].enemy[i].name == $("#enemyname2").html() && enemyteaminfo[list].enemy[i].number >= Number($("#enemynumber2").val())) {sign = 1; break;} | ||
+ | } | ||
+ | if(sign == 0) continue; | ||
+ | else sign = 1; | ||
+ | } | ||
+ | if($("#enemyname3").html() != "NONE"){ | ||
+ | for(i in enemyteaminfo[list].enemy){ | ||
+ | if(enemyteaminfo[list].enemy[i].name == $("#enemyname3").html() && enemyteaminfo[list].enemy[i].number >= Number($("#enemynumber3").val())) {sign = 1; break;} | ||
+ | } | ||
+ | if(sign == 0) continue; | ||
+ | } | ||
+ | |||
+ | output += existcalculation(enemyteaminfo[list].id) ; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | $("#teamexistdiv").html(output + `</tbody></table>`); | ||
+ | |||
+ | $(".existanceline").mouseover(function(){ | ||
+ | $(this).children("td").css("background-color", "#f4c43033"); | ||
+ | }); | ||
+ | $(".existanceline").mouseout(function(){ | ||
+ | $(this).children("td").css("background-color", ""); | ||
+ | }); | ||
+ | $(".existanceline").click(function(){ | ||
+ | if(setmessage.sspotsign == 0) return; | ||
+ | $("#spotsign1").val(Number($($(this).children("td")[0]).html())); | ||
+ | drawmap(); | ||
+ | }); | ||
+ | } | ||
+ | |||
+ | function existcalculation(enemy_team_id){ | ||
+ | var thisput = ``; | ||
+ | for(i in Spot){ | ||
+ | if(Spot[i]["enemy_team_id"] != enemy_team_id && !(Spot[i]["ally_team_id"])) continue; | ||
+ | else if(Spot[i]["enemy_team_id"] != enemy_team_id && Spot[i]["ally_team_id"]){ | ||
+ | var ally_tar; | ||
+ | for(j in Ally_team) if(Ally_team[j].id == Number(Spot[i]["ally_team_id"])){ ally_tar = j; break;} | ||
+ | if(!(Ally_team[ally_tar]) || Ally_team[ally_tar]["enemy_team_id"] != enemy_team_id) continue; | ||
+ | } | ||
+ | |||
+ | var enemymadestr = ""; | ||
+ | for(j in enemyteaminfo) if(enemyteaminfo[j].id == enemy_team_id) for(k in enemyteaminfo[j].enemy) enemymadestr += enemyteaminfo[j].enemy[k].name + "×" + enemyteaminfo[j].enemy[k].number + " "; | ||
+ | |||
+ | var mapname = "", campaignname = ""; | ||
+ | for(j in Mission) if(Mission[j].id == Spot[i].mission_id){ | ||
+ | mapname = Mission[j].name; | ||
+ | campaignname = Mission[j].campaign; | ||
+ | } | ||
+ | |||
+ | let thisline = `<tr class="existanceline" style="border-bottom:2px #f4c43033 solid; display:block; cursor:pointer;"><td width="100px">`; | ||
+ | thisline += enemy_team_id + `<\/td><td width="540px">`; | ||
+ | thisline += enemymadestr.slice(0, enemymadestr.length - 1) + `<\/td><td width="140px">`; | ||
+ | thisline += campaignname + `<\/td><td width="140px">`; | ||
+ | thisline += mapname + `<\/td><td width="100px">`; | ||
+ | thisline += efectcal(enemy_team_id) + `<\/td><td width="100px">`; | ||
+ | thisline += Spot[i].id + `<\/td><td width="60px">`; | ||
+ | thisline += "其他" + "<\/td><\/tr>"; | ||
+ | |||
+ | thisput += thisline; | ||
+ | } | ||
+ | return thisput; | ||
} | } | ||
第2,020行: | 第2,227行: | ||
<div id="missionshow" style="max-width:1222px;"></div> | <div id="missionshow" style="max-width:1222px;"></div> | ||
<div id="enemychose"></div> | <div id="enemychose"></div> | ||
+ | <div id="teammadediv" style="max-width:1220px; border:1px #e0e0e0 solid; padding:5px; margin:5px 0px;"></div> | ||
+ | <div id="teamexistdiv" style="max-width:1222px;"></div> | ||
<div id="enemyshow" style="max-width:1222px;"></div> | <div id="enemyshow" style="max-width:1222px;"></div> | ||
<div id="enemyposition" style="overflow-x:scroll; width:1222px;"></div> | <div id="enemyposition" style="overflow-x:scroll; width:1222px;"></div> |