◆少前百科是非盈利性、非官方的少女前线维基百科。 ◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科。 ◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科 ◆To foreigners,You can use twitter to contact us. |
“Widget:AVGplayer/js”的版本间的差异
(fix avgnavigation display) |
小 |
||
(未显示2个用户的24个中间版本) | |||
第1行: | 第1行: | ||
<includeonly><script type="text/javascript">(window.RLQ=window.RLQ||[]).push(function(){ | <includeonly><script type="text/javascript">(window.RLQ=window.RLQ||[]).push(function(){ | ||
− | var dollarray, bgarray, bgmarray; | + | var dollarray, bgarray, bgmarray, searray; |
− | var | + | var xmlhttp_doll = new XMLHttpRequest(); |
− | + | xmlhttp_doll.onreadystatechange = function() { | |
− | if (this.readyState == 4 && this.status == 200) { | + | if (this.readyState == 4 && this.status == 200) { |
− | dollarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));} | + | dollarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}")); |
+ | getdollarrays(); | ||
+ | } | ||
}; | }; | ||
− | + | xmlhttp_doll.open("GET", "/index.php?title=JSON:AVGDOLL&action=raw", true); | |
− | + | xmlhttp_doll.send(); | |
− | var | + | var xmlhttp_bg = new XMLHttpRequest(); |
− | + | xmlhttp_bg.onreadystatechange = function() { | |
if (this.readyState == 4 && this.status == 200) { | if (this.readyState == 4 && this.status == 200) { | ||
bgarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));} | bgarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));} | ||
}; | }; | ||
− | + | xmlhttp_bg.open("GET", "/index.php?title=JSON:AVGBGCG&action=raw", true); | |
− | + | xmlhttp_bg.send(); | |
− | var | + | var xmlhttp_bgm = new XMLHttpRequest(); |
− | + | xmlhttp_bgm.onreadystatechange = function() { | |
if (this.readyState == 4 && this.status == 200) { | if (this.readyState == 4 && this.status == 200) { | ||
bgmarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));} | bgmarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));} | ||
}; | }; | ||
− | + | xmlhttp_bgm.open("GET", "/index.php?title=JSON:AVGBGM&action=raw", true); | |
− | + | xmlhttp_bgm.send(); | |
+ | |||
+ | var xmlhttp_se = new XMLHttpRequest(); | ||
+ | xmlhttp_se.onreadystatechange = function() { | ||
+ | if (this.readyState == 4 && this.status == 200) { | ||
+ | searray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));} | ||
+ | }; | ||
+ | xmlhttp_se.open("GET", "/index.php?title=JSON:AVGSE&action=raw", true); | ||
+ | xmlhttp_se.send(); | ||
− | var | + | function getdollarrays() { |
− | + | mw.loader.using('ext.gadget.md5hasher', function() { | |
+ | const prefabcodes = [0, 2, 3, 4, 5, 6, 7, 8, 9].concat([...Array(26)].map((_, i) => String.fromCharCode(i + 97))); | ||
+ | for (const c of prefabcodes) { | ||
+ | var newXhr = new XMLHttpRequest(); | ||
+ | newXhr.responseType = 'json'; | ||
+ | newXhr.onload = function() { | ||
+ | dollarray = Object.assign(dollarray, this.response); | ||
+ | } | ||
+ | const prefab = 'AVG_Pic_' + c + '.txt'; | ||
+ | newXhr.open('GET', '/images/' + window.gfUtils.createWikiPathPart(prefab) + '/' + prefab); | ||
+ | newXhr.send(); | ||
+ | } | ||
+ | }); | ||
} | } | ||
第60行: | 第82行: | ||
"%%code=changjing_huafen%%":"", | "%%code=changjing_huafen%%":"", | ||
+ | |||
+ | "%%code=DoomsdayClock01%%wait=1%%":"/images/Video/AVG/DoomsdayClock01.mp4", | ||
+ | "%%code=DoomsdayClock02%%wait=1%%":"/images/Video/AVG/DoomsdayClock02.mp4", | ||
+ | "%%code=DoomsdayClock03%%wait=1%%":"/images/Video/AVG/DoomsdayClock03.mp4", | ||
+ | "%%code=DoomsdayClock04%%wait=1%%":"/images/Video/AVG/DoomsdayClock04.mp4", | ||
+ | "%%code=DoomsdayClock05%%wait=1%%":"/images/Video/AVG/DoomsdayClock05.mp4", | ||
+ | "%%code=DoomsdayClock06%%wait=1%%":"/images/Video/AVG/DoomsdayClock06.mp4", | ||
+ | "%%code=DoomsdayClock07%%wait=1%%":"/images/Video/AVG/DoomsdayClock07.mp4" | ||
} | } | ||
第86行: | 第116行: | ||
var loadingfin = {doll:0, bg:0, bgm:0, eff:0}; | var loadingfin = {doll:0, bg:0, bgm:0, eff:0}; | ||
var loadingnow = {doll:0, bg:0, bgm:0, eff:0}; | var loadingnow = {doll:0, bg:0, bgm:0, eff:0}; | ||
+ | |||
+ | var bgmEnd = false; | ||
+ | |||
+ | window.playAvgGlobal = function(text, title) { | ||
+ | if (typeof text != 'string') { | ||
+ | console.warn('AVGplayer interface called with parameter of invalid type: must be string.'); | ||
+ | return; | ||
+ | } | ||
+ | bgmEnd = false; | ||
+ | avgtxt = text; | ||
+ | endsign = 0; | ||
+ | avgnextline = ""; | ||
+ | linepos = 0; | ||
+ | $("#avgbgm").attr("src", ""); $(".avgsound").remove(); | ||
+ | $("#avgbackground").html(""); | ||
+ | $(".avgdollpic").remove(); | ||
+ | $(".avgefect").remove(); | ||
+ | readline(); | ||
+ | firstloading(); | ||
+ | $('#avgtitle').html(title||''); | ||
+ | } | ||
function avgcreat(){ | function avgcreat(){ | ||
$(".avgchoice").click(function(){ | $(".avgchoice").click(function(){ | ||
+ | if (window.pauseMainBgm) window.pauseMainBgm(); | ||
+ | bgmEnd = false; | ||
var xmlhttp = new XMLHttpRequest(); | var xmlhttp = new XMLHttpRequest(); | ||
xmlhttp.onreadystatechange = function() { | xmlhttp.onreadystatechange = function() { | ||
第105行: | 第158行: | ||
$("#avgtitle").html($(this).children("span.avgname").html().replace(/<span class="subsign">/g, "").replace(/<\/span>/g, "")); | $("#avgtitle").html($(this).children("span.avgname").html().replace(/<span class="subsign">/g, "").replace(/<\/span>/g, "")); | ||
console.log($(this).children("span.avgname").html().replace(/<span class="subsign">/g, "").replace(/<\/span>/g, "") + " : " + $(this).attr("link")); | console.log($(this).children("span.avgname").html().replace(/<span class="subsign">/g, "").replace(/<\/span>/g, "") + " : " + $(this).attr("link")); | ||
− | $("#avgbgm").attr("src", ""); | + | $("#avgbgm").attr("src", ""); $(".avgsound").remove(); |
$("#avgbackground").html(""); | $("#avgbackground").html(""); | ||
$(".avgdollpic").remove(); | $(".avgdollpic").remove(); | ||
第145行: | 第198行: | ||
<div id="avgtonext" class="avgbutton avgpushbutton">下一章节<\/div> | <div id="avgtonext" class="avgbutton avgpushbutton">下一章节<\/div> | ||
<div id="avgchose" state="off" class="avgbutton">选择剧情<\/div> | <div id="avgchose" state="off" class="avgbutton">选择剧情<\/div> | ||
− | <div id="avgload">加载进度: PIC[0/0] CG[0/0] BGM[0/0] | + | <div id="avgload">加载进度: PIC[0/0] CG[0/0] BGM[0/0] SE[0/0] E[0/0]<\/div> |
<\/div> | <\/div> | ||
第177行: | 第230行: | ||
$("div#content").css("cssText","margin-left:11em; border:;"); | $("div#content").css("cssText","margin-left:11em; border:;"); | ||
$("#avgdiv").css({"margin-left":"0px", "margin-top":"0px"}); | $("#avgdiv").css({"margin-left":"0px", "margin-top":"0px"}); | ||
+ | $(".avgnavigationtitle").css({"margin-left":"0px"}); | ||
$(".avgnavigation").css({"margin-left":"0px"}); | $(".avgnavigation").css({"margin-left":"0px"}); | ||
$(window).scrollTop(340); | $(window).scrollTop(340); | ||
第187行: | 第241行: | ||
$("div#content").css("cssText","margin-left:0em !important; border:none;"); | $("div#content").css("cssText","margin-left:0em !important; border:none;"); | ||
$("#avgdiv").css({"margin-left":(window.innerWidth - 1202)/2 + "px", "margin-top":"100px"}); | $("#avgdiv").css({"margin-left":(window.innerWidth - 1202)/2 + "px", "margin-top":"100px"}); | ||
+ | $(".avgnavigationtitle").css({"margin-left":(window.innerWidth - 1202)/2 + "px"}); | ||
$(".avgnavigation").css({"margin-left":(window.innerWidth - 1202)/2 + "px"}); | $(".avgnavigation").css({"margin-left":(window.innerWidth - 1202)/2 + "px"}); | ||
$(window).scrollTop(0); | $(window).scrollTop(0); | ||
第197行: | 第252行: | ||
$(this).css({"background-color":"transparent","color":"#eaeaea"}); | $(this).css({"background-color":"transparent","color":"#eaeaea"}); | ||
$("#avgbgm")[0].muted = true; | $("#avgbgm")[0].muted = true; | ||
+ | for(let i in $(".avgsound")) $(".avgsound")[i].muted = true; | ||
} else if($(this).attr("state") == "off"){ | } else if($(this).attr("state") == "off"){ | ||
$(this).attr("state", "on"); | $(this).attr("state", "on"); | ||
$(this).css({"background-color":"#eaeaea","color":"black"}); | $(this).css({"background-color":"#eaeaea","color":"black"}); | ||
$("#avgbgm")[0].muted = false; | $("#avgbgm")[0].muted = false; | ||
+ | for(let i in $(".avgsound")) $(".avgsound")[i].muted = false; | ||
} | } | ||
}); | }); | ||
第207行: | 第264行: | ||
if(sound_num > 0) sound_num = sound_num - 1; | if(sound_num > 0) sound_num = sound_num - 1; | ||
let back_text = String(sound_num) + "0%"; | let back_text = String(sound_num) + "0%"; | ||
− | $("#avgbgm")[0].volume = sound_num / 10; | + | $("#avgbgm")[0].volume = sound_num / 20; |
+ | for(let i in $(".avgsound")) $(".avgsound")[i].volume = sound_num / 10; | ||
$("#avgsoundwidth").css("cssText","background-image: linear-gradient(90deg, #eaeaea " + back_text + ", transparent " + back_text + ");"); | $("#avgsoundwidth").css("cssText","background-image: linear-gradient(90deg, #eaeaea " + back_text + ", transparent " + back_text + ");"); | ||
$("#avgsoundwidth").attr("state",sound_num); | $("#avgsoundwidth").attr("state",sound_num); | ||
第215行: | 第273行: | ||
if(sound_num < 10) sound_num = sound_num + 1; | if(sound_num < 10) sound_num = sound_num + 1; | ||
let back_text = String(sound_num) + "0%"; | let back_text = String(sound_num) + "0%"; | ||
− | $("#avgbgm")[0].volume = sound_num / 10; | + | $("#avgbgm")[0].volume = sound_num / 20; |
+ | for(let i in $(".avgsound")) $(".avgsound")[i].volume = sound_num / 10; | ||
$("#avgsoundwidth").css("cssText","background-image: linear-gradient(90deg, #eaeaea " + back_text + ", transparent " + back_text + ");"); | $("#avgsoundwidth").css("cssText","background-image: linear-gradient(90deg, #eaeaea " + back_text + ", transparent " + back_text + ");"); | ||
$("#avgsoundwidth").attr("state",sound_num); | $("#avgsoundwidth").attr("state",sound_num); | ||
第290行: | 第349行: | ||
$(this).css({"background-color":"#111111","color":"#eaeaea"}); | $(this).css({"background-color":"#111111","color":"#eaeaea"}); | ||
$(".avgnavigationtitle").css("display","none"); | $(".avgnavigationtitle").css("display","none"); | ||
+ | $(".avgnavigationtitle").attr("state","coll-off"); | ||
$(".avgnavigation").css("display","none"); | $(".avgnavigation").css("display","none"); | ||
} else if($(this).attr("state") == "off"){ | } else if($(this).attr("state") == "off"){ | ||
第313行: | 第373行: | ||
else readline(); | else readline(); | ||
}); | }); | ||
+ | |||
+ | function endBgm() { | ||
+ | bgmEnd = true; | ||
+ | $('#avgbgm')[0].pause(); | ||
+ | setTimeout(function() { | ||
+ | if (endsign == 1 && window.canPlayMainBgm && window.resumeMainBgm) window.resumeMainBgm(); | ||
+ | }, 2000); | ||
+ | $('#avgbox')[0].removeEventListener('click', endBgm); | ||
+ | } | ||
function readline(){ | function readline(){ | ||
if(blacksign == 1 || branchblock == 1 || flash_block == 1) return; | if(blacksign == 1 || branchblock == 1 || flash_block == 1) return; | ||
− | if(endsign == 1) { | + | if(endsign == 1 && !avgnextline) { |
$("#avgline").html(`<div class="endsigndiv">${$("#avgtitle").html()} END</div>`); | $("#avgline").html(`<div class="endsigndiv">${$("#avgtitle").html()} END</div>`); | ||
+ | if (!bgmEnd) { | ||
+ | $('#avgbox')[0].addEventListener('click', endBgm); | ||
+ | } | ||
return; | return; | ||
} | } | ||
第333行: | 第405行: | ||
if(avgbranches.length != 0){ | if(avgbranches.length != 0){ | ||
− | let html_string = `<div id="avgbranchdiv">`; | + | let isCg = avgbranches.every(opt => opt.startsWith('cg')); |
− | for(i in avgbranches) html_string += `<div class="avgbranch" index="${i}">${ | + | let html_string = `<div id="avgbranchdiv"${isCg ? ' class="cg-options"' : ''}>`; |
+ | for(i in avgbranches) { | ||
+ | let optionText = avgbranches[i]; | ||
+ | let xpos = '', ypos = ''; | ||
+ | if (isCg) { | ||
+ | optionText = optionText.slice(2); | ||
+ | let poses = optionText.split(','); | ||
+ | xpos = `calc(50% + ${poses[0]*0.625}px)`; | ||
+ | ypos = `calc(50% - ${poses[1]*0.625}px)`; | ||
+ | } | ||
+ | html_string += `<div class="avgbranch" index="${i}"${isCg ? ' style="left:'+xpos+';top:'+ypos+'"' : ''}>${isCg ? '' : optionText}<\/div>`; | ||
+ | } | ||
html_string += `<\/div>`; | html_string += `<\/div>`; | ||
第364行: | 第447行: | ||
$("#avgbackground").fadeOut(1000 / autospeed); $("#avgword").fadeOut(1000 / autospeed); | $("#avgbackground").fadeOut(1000 / autospeed); $("#avgword").fadeOut(1000 / autospeed); | ||
setTimeout(function(){ | setTimeout(function(){ | ||
− | $(".avgefect").remove(); | + | $(".avgefect").remove(); $(".avgsound").remove(); |
− | $(".avgdollpic").remove(); $("#avgbackground").html(""); $("#avgbgm").attr("src", ""); | + | $(".avgdollpic").remove(); $("#avgbackground").html(""); //$("#avgbgm").attr("src", ""); |
$("#avgspeaker").html(""); $("#avgline").html(""); | $("#avgspeaker").html(""); $("#avgline").html(""); | ||
setTimeout(function(){ | setTimeout(function(){ | ||
第377行: | 第460行: | ||
} else if(blacksign == 2){ | } else if(blacksign == 2){ | ||
blacksign = 0; | blacksign = 0; | ||
+ | if(!$("#avgbgm").attr("src") && $("#avgbgm")[0].paused){ | ||
+ | $("#avgbgm").attr("src", $("#avgbgm").attr("src-save")); // this black is for ending mp4 | ||
+ | $("#avgbgm")[0].play(); | ||
+ | } | ||
} | } | ||
第382行: | 第469行: | ||
if(thisline.indexOf("<BGM>") != -1){ | if(thisline.indexOf("<BGM>") != -1){ | ||
$("#avgbgm").attr("src", bgmarray[thisline.slice(thisline.indexOf("<BGM>") + ("<BGM>").length, thisline.indexOf("</BGM>"))]); | $("#avgbgm").attr("src", bgmarray[thisline.slice(thisline.indexOf("<BGM>") + ("<BGM>").length, thisline.indexOf("</BGM>"))]); | ||
+ | $("#avgbgm").attr("src-save", bgmarray[thisline.slice(thisline.indexOf("<BGM>") + ("<BGM>").length, thisline.indexOf("</BGM>"))]); | ||
$("#avgbgm")[0].play(); | $("#avgbgm")[0].play(); | ||
+ | } | ||
+ | |||
+ | // sound effect | ||
+ | if(thisline.indexOf("<SE1>") != -1){ | ||
+ | while(thisline.indexOf("<SE1>") != -1){ | ||
+ | sound = thisline.slice(thisline.indexOf("<SE1>") + ("<SE1>").length, thisline.indexOf("</SE1>")); | ||
+ | thisline = thisline.replace("<SE1>" + sound + "</SE1>", ""); | ||
+ | |||
+ | let audio = new Audio(); | ||
+ | audio.addEventListener("ended", function(){ $(this).remove();}); | ||
+ | $(audio).attr({"src":searray[sound], "preload":"preload", "controls":"controls"}); | ||
+ | $(audio).addClass(".avgsound"); | ||
+ | audio.play(); | ||
+ | |||
+ | if($("#avgsound").attr("state") == "off") audio.muted = true; | ||
+ | audio.volume = Number($("#avgsoundwidth").attr("state")) / 10; | ||
+ | } | ||
} | } | ||
第397行: | 第502行: | ||
if(thisline.indexOf("<BIN>") != -1){ | if(thisline.indexOf("<BIN>") != -1){ | ||
var bgsrc = bgarray[thisline.slice(thisline.indexOf("<BIN>") + ("<BIN>").length, thisline.indexOf("</BIN>"))]; | var bgsrc = bgarray[thisline.slice(thisline.indexOf("<BIN>") + ("<BIN>").length, thisline.indexOf("</BIN>"))]; | ||
− | $("#avgbackground").html(`<img src="` + bgsrc + `"/>`); | + | $("#avgbackground").html(`<img src="` + bgsrc + `" draggable="false"/>`); |
if(thisline.indexOf("<Night>") != -1) $("#avgbackground").append(`<div style="width:1200px; height:675px; position:absolute; backdrop-filter:saturate(0.6) brightness(0.4) hue-rotate(15deg)"><\/div>`); | if(thisline.indexOf("<Night>") != -1) $("#avgbackground").append(`<div style="width:1200px; height:675px; position:absolute; backdrop-filter:saturate(0.6) brightness(0.4) hue-rotate(15deg)"><\/div>`); | ||
} | } | ||
第411行: | 第516行: | ||
setTimeout(function(){ | setTimeout(function(){ | ||
flash_block = 0; | flash_block = 0; | ||
− | $("#avgbackground").html(`<img src="${bgarray[background_array[background_array.length - 1]]}" style="display:none;"/>`); | + | $("#avgbackground").html(`<img src="${bgarray[background_array[background_array.length - 1]]}" style="display:none;" draggable="false"/>`); |
$("#avgbackground").children("img").fadeIn(control_parament.rate * 5); | $("#avgbackground").children("img").fadeIn(control_parament.rate * 5); | ||
}, background_array.length * (control_parament.delay + control_parament.rate * 2 + control_parament.duration) * 5); | }, background_array.length * (control_parament.delay + control_parament.rate * 2 + control_parament.duration) * 5); | ||
第418行: | 第523行: | ||
let time_start = ((i + 1) * control_parament.delay + i * control_parament.rate * 2 + i * control_parament.duration) * 5; | let time_start = ((i + 1) * control_parament.delay + i * control_parament.rate * 2 + i * control_parament.duration) * 5; | ||
setTimeout(function(){ | setTimeout(function(){ | ||
− | $("#avgbackground").html(`<img src="${bgarray[background_array[i]]}" style="display:none;"/>`); | + | $("#avgbackground").html(`<img src="${bgarray[background_array[i]]}" style="display:none;" draggable="false"/>`); |
$("#avgbackground").children("img").fadeIn(control_parament.rate * 5); | $("#avgbackground").children("img").fadeIn(control_parament.rate * 5); | ||
}, time_start); | }, time_start); | ||
第505行: | 第610行: | ||
} else the_center += `left:152px;">`; | } else the_center += `left:152px;">`; | ||
− | the_center += `<img src="` + dollarray[newavgdoll.center] + `" style="`; | + | the_center += `<img draggable="false" src="` + dollarray[newavgdoll.center] + `" style="`; |
if((avgpicstr.indexOf("<通讯框>") != -1) && (avgpicstr.indexOf("<通讯框>") > avgpicstr.indexOf(";"))){ | if((avgpicstr.indexOf("<通讯框>") != -1) && (avgpicstr.indexOf("<通讯框>") > avgpicstr.indexOf(";"))){ | ||
the_center += `background-color:#12131d; -webkit-mask-image:url(/images/d/d0/Mask.png); -webkit-mask-position-x: 28px; -webkit-mask-size: 850px;"/>` + telemask + `<\/div>`; | the_center += `background-color:#12131d; -webkit-mask-image:url(/images/d/d0/Mask.png); -webkit-mask-position-x: 28px; -webkit-mask-size: 850px;"/>` + telemask + `<\/div>`; | ||
第582行: | 第687行: | ||
} else the_left += `left:-20px;">`; | } else the_left += `left:-20px;">`; | ||
− | the_left += `<img src="` + dollarray[newavgdoll.left] + `" style="`; | + | the_left += `<img draggable="false" src="` + dollarray[newavgdoll.left] + `" style="`; |
if((avgpicstr.indexOf("<通讯框>") != -1) && (avgpicstr.indexOf("<通讯框>") < avgpicstr.indexOf(";"))){ | if((avgpicstr.indexOf("<通讯框>") != -1) && (avgpicstr.indexOf("<通讯框>") < avgpicstr.indexOf(";"))){ | ||
the_left += `background-color:#12131d; -webkit-mask-image:url(/images/d/d0/Mask.png); -webkit-mask-position-x: 28px; -webkit-mask-size: 850px;"/>` + telemask + `<\/div>`; | the_left += `background-color:#12131d; -webkit-mask-image:url(/images/d/d0/Mask.png); -webkit-mask-position-x: 28px; -webkit-mask-size: 850px;"/>` + telemask + `<\/div>`; | ||
第600行: | 第705行: | ||
} else the_right += `left:324px;">`; | } else the_right += `left:324px;">`; | ||
− | the_right += `<img src="` + dollarray[newavgdoll.right] + `" style="`; | + | the_right += `<img draggable="false" src="` + dollarray[newavgdoll.right] + `" style="`; |
if((avgpicstr.indexOf("<通讯框>") != -1) && (avgpicstr.indexOf("<通讯框>") > avgpicstr.indexOf(";"))){ | if((avgpicstr.indexOf("<通讯框>") != -1) && (avgpicstr.indexOf("<通讯框>") > avgpicstr.indexOf(";"))){ | ||
the_right += `background-color:#12131d; -webkit-mask-image:url(/images/d/d0/Mask.png); -webkit-mask-position-x: 28px; -webkit-mask-size: 850px;"/>` + telemask + `<\/div>`; | the_right += `background-color:#12131d; -webkit-mask-image:url(/images/d/d0/Mask.png); -webkit-mask-position-x: 28px; -webkit-mask-size: 850px;"/>` + telemask + `<\/div>`; | ||
第625行: | 第730行: | ||
//word line - color & size handler | //word line - color & size handler | ||
if(thisline.indexOf(":") != -1){ | if(thisline.indexOf(":") != -1){ | ||
− | let keyword = (thisline.indexOf("+") != -1) ? "+" : ((thisline.indexOf("<c>") != -1) ? "<c>" : "\n"); | + | let keyword = (thisline.indexOf("+") != -1) ? "+" : ((thisline.indexOf("<c>") != -1) ? "<c>" : (thisline.indexOf('<cg>') != -1 ? '<cg>' : "\n")); |
let line = thisline.slice(thisline.indexOf(":") + 1, thisline.length); | let line = thisline.slice(thisline.indexOf(":") + 1, thisline.length); | ||
// color & size | // color & size | ||
第650行: | 第755行: | ||
avgbranches = line_temp.split("<c>"); | avgbranches = line_temp.split("<c>"); | ||
console.log(avgbranches); | console.log(avgbranches); | ||
+ | } else if (line.indexOf('<cg>') != -1) { | ||
+ | let line_temp = line.slice(line.indexOf('<cg>') + 4, line.length).replace('\r', ''); | ||
+ | avgbranches = line_temp.split('<cg>').map(opt => 'cg' + opt); | ||
+ | console.log(avgbranches); | ||
} | } | ||
} else { | } else { | ||
第698行: | 第807行: | ||
log_string += `<\/td><td style="width:80%; vertical-align:baseline;">` + ((thisline.indexOf("<分支") != -1) ? ("分支" + thisline[thisline.indexOf("<分支") + 4] + "<br>") : ""); | log_string += `<\/td><td style="width:80%; vertical-align:baseline;">` + ((thisline.indexOf("<分支") != -1) ? ("分支" + thisline[thisline.indexOf("<分支") + 4] + "<br>") : ""); | ||
log_string += thisline.slice(thisline.indexOf(":") + 1, thisline.length).replace(/\+/g, "<br>").replace(/<c>/g, " 分支") + `<\/td><\/tr><\/table><\/div>`; | log_string += thisline.slice(thisline.indexOf(":") + 1, thisline.length).replace(/\+/g, "<br>").replace(/<c>/g, " 分支") + `<\/td><\/tr><\/table><\/div>`; | ||
+ | log_string += thisline.slice(thisline.indexOf(":") + 1, thisline.length).replace(/\+/g, "<br>").replace(/<cg>/g, " 分支") + `<\/td><\/tr><\/table><\/div>`; | ||
if(avgtxt.indexOf("\n", logpos) == -1) break; | if(avgtxt.indexOf("\n", logpos) == -1) break; | ||
第719行: | 第829行: | ||
/*------ first load, preload, display loading information ------*/ | /*------ first load, preload, display loading information ------*/ | ||
function firstloading(){ | function firstloading(){ | ||
− | loadingfin = {doll:0, bg:0, bgm:0, eff:0}; | + | loadingfin = {doll:0, bg:0, bgm:0, se:0, eff:0}; |
− | loadingnow = {doll:0, bg:0, bgm:0, eff:0}; | + | loadingnow = {doll:0, bg:0, bgm:0, se:0, eff:0}; |
var logpos = 0; | var logpos = 0; | ||
− | var loading = {doll:[], bg:[], bgm:[], eff:[]}; | + | var loading = {doll:[], bg:[], bgm:[], se:[], eff:[]}; |
/*--------------------------- key word query, console that not in the array ---------------------------*/ | /*--------------------------- key word query, console that not in the array ---------------------------*/ | ||
第741行: | 第851行: | ||
while(1){ | while(1){ | ||
var thisline = (avgtxt.indexOf("\n", logpos) == -1) ? avgtxt.slice(logpos, avgtxt.length) : avgtxt.slice(logpos, avgtxt.indexOf("\n", logpos)); | var thisline = (avgtxt.indexOf("\n", logpos) == -1) ? avgtxt.slice(logpos, avgtxt.length) : avgtxt.slice(logpos, avgtxt.indexOf("\n", logpos)); | ||
+ | thisline = thisline.replace(/\<Position\>[0-9]{1,3},[0-9]{1,3}\<\/Position\>/g, ''); | ||
if(thisline.indexOf("<Speaker>") != -1 && thisline.indexOf("()<Speaker>") == -1){ | if(thisline.indexOf("<Speaker>") != -1 && thisline.indexOf("()<Speaker>") == -1){ | ||
第770行: | 第881行: | ||
if(a == loading.bgm[i].ID){ sign = 0; break; } | if(a == loading.bgm[i].ID){ sign = 0; break; } | ||
} if(sign) loading.bgm.push({"ID":a, "URL":bgmarray[a]}); | } if(sign) loading.bgm.push({"ID":a, "URL":bgmarray[a]}); | ||
+ | } | ||
+ | if(thisline.indexOf("<SE1>") != -1){ | ||
+ | while(thisline.indexOf("<SE1>") != -1){ | ||
+ | let sign = 1; | ||
+ | let a = thisline.slice(thisline.indexOf("<SE1>") + ("<SE1>").length, thisline.indexOf("</SE1>")); | ||
+ | thisline = thisline.replace("<SE1>" + a + "</SE1>", ""); | ||
+ | for(let i = 0; i < loading.se.length; i++){ | ||
+ | if(a == loading.se[i].ID){ sign = 0; break; } | ||
+ | } if(sign) loading.se.push({"ID":a, "URL":searray[a]}); | ||
+ | } | ||
} | } | ||
if(thisline.indexOf("<BIN>") != -1){ | if(thisline.indexOf("<BIN>") != -1){ | ||
第803行: | 第924行: | ||
/*----------------- console loading urls ---------------*/ | /*----------------- console loading urls ---------------*/ | ||
− | console.log("Character Image | + | console.log("Character Image", loading.doll); |
− | console.log("Background CG | + | console.log("Background CG", loading.bg); |
− | console.log("Background Music | + | console.log("Background Music", loading.bgm); |
− | console.log("Common Effect | + | console.log("Sound Effect", loading.se); |
+ | console.log("Common Effect", loading.eff); | ||
console.log("********* Console end *********"); | console.log("********* Console end *********"); | ||
loadingfin.doll = loading.doll.length; | loadingfin.doll = loading.doll.length; | ||
loadingfin.bg = loading.bg.length; | loadingfin.bg = loading.bg.length; | ||
loadingfin.bgm = loading.bgm.length; | loadingfin.bgm = loading.bgm.length; | ||
+ | loadingfin.se = loading.se.length; | ||
loadingfin.eff = loading.eff.length; | loadingfin.eff = loading.eff.length; | ||
loading_sub(); | loading_sub(); | ||
第837行: | 第960行: | ||
}); | }); | ||
$(audio).attr({"src":bgmarray[loading.bgm[i].ID], "file":loadingfile, "preload":"preload", "controls":"controls"}); | $(audio).attr({"src":bgmarray[loading.bgm[i].ID], "file":loadingfile, "preload":"preload", "controls":"controls"}); | ||
+ | } | ||
+ | for(i in loading.se){ | ||
+ | let audio = new Audio(); | ||
+ | audio.addEventListener("canplaythrough", function(){ | ||
+ | if($(this).attr("file") == loadingfile) loadingnow.se ++; | ||
+ | loading_sub(); $(this).remove(); | ||
+ | }); | ||
+ | $(audio).attr({"src":searray[loading.se[i].ID], "file":loadingfile, "preload":"preload", "controls":"controls"}); | ||
} | } | ||
for(i in loading.eff){ | for(i in loading.eff){ | ||
第860行: | 第991行: | ||
function loading_sub(){ | function loading_sub(){ | ||
− | $("#avgload").html(`加载进度: PIC[${loadingnow.doll}/${loadingfin.doll}] CG[${loadingnow.bg}/${loadingfin.bg}] BGM[${loadingnow.bgm}/${loadingfin.bgm}] | + | $("#avgload").html(`加载进度: PIC[${loadingnow.doll}/${loadingfin.doll}] CG[${loadingnow.bg}/${loadingfin.bg}] BGM[${loadingnow.bgm}/${loadingfin.bgm}] SE[${loadingnow.se}/${loadingfin.se}] E[${loadingnow.eff}/${loadingfin.eff}]`); |
} | } | ||
/*---------------------------特效code 创建---------------------------*/ | /*---------------------------特效code 创建---------------------------*/ | ||
function effect_creat(effect_name){ | function effect_creat(effect_name){ | ||
− | if(effect_name == "%%code= | + | if(effect_name.slice(0, ("%%code=AVG_ink").length) == "%%code=AVG_ink") { |
let new_element = document.createElement('video'); | let new_element = document.createElement('video'); | ||
$(new_element).attr({"class":"avgefect", "autoplay":"autoplay", "preload":"auto", "src":effarray[effect_name]}); | $(new_element).attr({"class":"avgefect", "autoplay":"autoplay", "preload":"auto", "src":effarray[effect_name]}); | ||
$(new_element).css({"position":"absolute", "width":"1200px", "height":"675px", "top":"0px", "left":"0px", "overflow":"hidden", "z-index":"1"}); | $(new_element).css({"position":"absolute", "width":"1200px", "height":"675px", "top":"0px", "left":"0px", "overflow":"hidden", "z-index":"1"}); | ||
− | $(new_element).bind('ended', function(){ $(this).remove(); }); | + | $(new_element).bind('ended', function(){ $(this).remove();}); |
$("#avgbox").append(new_element); | $("#avgbox").append(new_element); | ||
+ | $("#avgbgm")[0].pause(); | ||
} else if(effect_name.slice(0, ("%%code=NPC_TV").length) == "%%code=NPC_TV"){ | } else if(effect_name.slice(0, ("%%code=NPC_TV").length) == "%%code=NPC_TV"){ | ||
let new_element = document.createElement('img'); | let new_element = document.createElement('img'); |