◆少前百科是非盈利性、非官方的少女前线维基百科。
◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科
◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科
◆To foreigners,You can use twitter to contact us.
Icon Nyto Silver.png

“Widget:AVGplayer/js”的版本间的差异

来自少前百科GFwiki
跳转至: 导航搜索
(更新)
 
(未显示3个用户的37个中间版本)
第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, searray;
  
var dollarray = {
+
var xmlhttp_doll = new XMLHttpRequest();
    "M16(3)":"http://www.gfwiki.org/images/d/db/M16A1_T.png",
+
xmlhttp_doll.onreadystatechange = function() {
    "SOPII(3)":"http://www.gfwiki.org/images/3/3d/Pic_M4_SOPMOD_II.png",
+
  if (this.readyState == 4 && this.status == 200) {
    "M4A1(2)":"http://www.gfwiki.org/images/4/41/M4A1_SAD.png",
+
     dollarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));
     "AR15(2)":"http://www.gfwiki.org/images/3/39/AR15_T.png",
+
     getdollarrays();
    "M4A1(0)":"http://www.gfwiki.org/images/4/4e/Pic_M4A1.png",
+
  }
    "RO635(0)":"http://www.gfwiki.org/images/a/ae/%E5%B0%91%E5%A5%B3%E5%89%8D%E7%BA%BF-RO635.png",
+
};
     "RO635(4)":"http://www.gfwiki.org/images/c/c8/Pic_RO635_4.png",
+
xmlhttp_doll.open("GET", "/index.php?title=JSON:AVGDOLL&action=raw", true);
   
+
xmlhttp_doll.send();
    "M1903(10)":"http://www.gfwiki.org/images/5/5e/AVG_pic_M1903_10.png",
 
    "M1903(11)":"http://www.gfwiki.org/images/b/be/AVG_pic_M1903_11.png",
 
    "M1903(12)":"http://www.gfwiki.org/images/7/7e/AVG_pic_M1903_12.png",
 
    "M1903(13)":"http://www.gfwiki.org/images/a/a8/AVG_pic_M1903_13.png",
 
    "G36Mod(0)":"http://www.gfwiki.org/images/d/d8/Pic_G36Mod.png",
 
  
    "M4 SOPMOD IIMod(0)":"http://www.gfwiki.org/images/7/70/M4_SOPMOD_IIMod.png",
+
var xmlhttp_bg = new XMLHttpRequest();
    "M4 SOPMOD IIMod(3)":"http://www.gfwiki.org/images/8/8c/Pic_M4_SOPMOD_IIMod_2.png",
+
xmlhttp_bg.onreadystatechange = function() {
    "AR15Mod(0)":"http://www.gfwiki.org/images/c/cd/Pic_AR15Mod.png",
+
if (this.readyState == 4 && this.status == 200) {
    "AR15Mod(4)":"http://www.gfwiki.org/images/c/cd/AR15Mod_%E5%BE%AE%E7%AC%91.png",
+
     bgarray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));}
    "RO635Mod(0)":"http://www.gfwiki.org/images/9/90/Pic_RO635Mod.png",
+
};
    "RO635Mod(2)":"http://www.gfwiki.org/images/2/26/Pic_RO635Mod_2.png",
+
xmlhttp_bg.open("GET", "/index.php?title=JSON:AVGBGCG&action=raw", true);
    "RO635Mod(3)":"http://www.gfwiki.org/images/8/8c/Pic_RO635Mod_3.png",
+
xmlhttp_bg.send();
    "RO635Mod(4)":"http://www.gfwiki.org/images/7/74/Pic_RO635Mod_4.png",
 
    "RO635Mod(5)":"http://www.gfwiki.org/images/a/a5/Pic_RO635Mod_5.png",
 
 
 
     "NPC-Kalin(0)":"http://www.gfwiki.org/images/2/21/Kalina.png",
 
    "NPC-Kalin(1)":"http://www.gfwiki.org/images/a/a5/Kalina_1.png",
 
    "NPC-Kalin(2)":"http://www.gfwiki.org/images/1/15/Kalina_2.png",
 
    "NPC-Kalin(3)":"http://www.gfwiki.org/images/9/95/Kalina_3.png",
 
    "NPC-Kalin(4)":"http://www.gfwiki.org/images/6/67/Kalina_4.png",
 
    "NPC-Kalin(5)":"http://www.gfwiki.org/images/0/0b/Kalina_5.png",
 
    "NPC-Kalin(6)":"http://www.gfwiki.org/images/0/0c/Kalina_6.png",
 
    "NPC-Kalin(7)":"http://www.gfwiki.org/images/1/11/Kalina_7.png",
 
    "NPC-Kalin(8)":"http://www.gfwiki.org/images/2/29/Kalina_8.png",
 
 
 
    "NPC-Ange(2)":"http://www.gfwiki.org/images/8/82/Pic_NPC-Ange_2.png",
 
 
 
    "NPC-Jason(0)":"http://www.gfwiki.org/images/e/e5/NPC-Jason.png",
 
    "NPC-Helian(0)":"http://www.gfwiki.org/images/4/4b/NPC-Helian.png",
 
    "NPC-Kyruger(0)":"http://www.gfwiki.org/images/c/cb/NPC-Kyruger.png",
 
    "NPC-Griffin(0)":"http://www.gfwiki.org/images/9/9b/NPC-Griffin%280%29.png",
 
    "NPC-Griffin(1)":"http://www.gfwiki.org/images/c/c4/NPC-Griffin%281%29.png",
 
 
 
    "NPC-Refugee(0)":"http://www.gfwiki.org/images/9/97/Pic_NPC-Refugee_0.png",
 
    "NPC-Lilyan(0)":"http://www.gfwiki.org/images/1/13/Pic_NPC-Lilyan_0.png",
 
    "NPC-Elijah(0)":"http://www.gfwiki.org/images/a/a8/NPC-Elijah%280%29.png",
 
 
 
    "NPC-Machlian(0)":"http://www.gfwiki.org/images/c/c7/NPC-Machlian%280%29.png",
 
    "NPC-Machlian(1)":"http://www.gfwiki.org/images/0/03/NPC-Machlian%281%29.png",
 
    "NPC-Machlian(2)":"http://www.gfwiki.org/images/0/0a/NPC-Machlian%282%29.png",
 
    "NPC-Machlian(3)":"http://www.gfwiki.org/images/b/b7/NPC-Machlian%283%29.png",
 
    "NPC-Machlian(4)":"http://www.gfwiki.org/images/f/f2/NPC-Machlian%284%29.png",
 
    "NPC-Machlian(6)":"http://www.gfwiki.org/images/b/bc/NPC-Machlian%286%29.png",
 
    "NPC-Machlian(7)":"http://www.gfwiki.org/images/9/97/NPC-Machlian%287%29.png",
 
    "NPC-Machlian(8)":"http://www.gfwiki.org/images/2/2d/NPC-Machlian%288%29.png",
 
   
 
    /*  16 */ "M1928A1(0)":"http://www.gfwiki.org/images/f/f4/Pic_M1928A1.png",
 
    /* 106 */ "FAL(0)":"http://www.gfwiki.org/images/d/d2/Pic_FNFALhx.png",
 
    /* 112 */ "NEGEV(0)":"http://www.gfwiki.org/images/0/04/Pic_NEGEV.png",
 
    /* 257 */ "M200(0)":"http://www.gfwiki.org/images/3/3e/Pic_M200.png",
 
    /* 272 */ "DesertEagle(0)":"http://www.gfwiki.org/images/4/4b/Pic_DesertEagle.png",
 
    /* 296 */ "SL8(0)":"http://www.gfwiki.org/images/9/92/Pic_SL8.png",
 
    /* 296 */ "SL8(3)":"http://www.gfwiki.org/images/d/da/Pic_SL8_3.png",
 
    /* 316 */ "GeneralLiu(0)":"http://www.gfwiki.org/images/a/a0/Pic_GeneralLiu.png",
 
    /* 316 */ "GeneralLiu(1)":"http://www.gfwiki.org/images/d/d7/Pic_GeneralLiu_D.png",
 
    /* 331 */ "Kolibri(0)":"http://www.gfwiki.org/images/a/a7/Pic_Kolibri.png",
 
    /* 332 */ "Derringer(0)":"http://www.gfwiki.org/images/a/a8/Pic_Derringer.png",
 
    /* 333 */ "VP1915(0)":"http://www.gfwiki.org/images/d/dc/Pic_VP1915.png",
 
    /* 334 */ "Savage99(0)":"http://www.gfwiki.org/images/e/ee/Pic_Savage99.png",
 
    /* 335 */ "Fedorov(0)":"http://www.gfwiki.org/images/e/e0/Pic_Fedorov.png",
 
 
 
    "P22(0)":"http://www.gfwiki.org/images/7/77/Pic_P22.png",
 
    "Lewis(0)":"http://www.gfwiki.org/images/5/5d/Pic_Lewis.png",
 
    "AUGPARA(0)":"http://www.gfwiki.org/images/1/11/Pic_AUGPARA.png",
 
    "VHS(0)":"http://www.gfwiki.org/images/5/57/Pic_VHS.png",
 
 
 
    "Nyto(1)":"http://www.gfwiki.org/images/e/e3/Pic_Nyto_black_LL.png",
 
    "NytoWhite(0)":"http://www.gfwiki.org/images/1/17/Pic_Nyto_white_LL.png",
 
    "NPC-Mercurows(0)":"http://www.gfwiki.org/images/f/f4/NPC-Mercurows.png",
 
    "NPC-Nimogen(0)":"http://www.gfwiki.org/images/b/be/NPC-Nimogen.png",
 
 
 
    "Narciss(4)":"http://www.gfwiki.org/images/0/07/Narciss%284%29.png",
 
    "NytoIsomer(3)":"http://www.gfwiki.org/images/1/11/Nyto_Isomer_Shadow.png",
 
    "NytoIsomer(8)":"http://www.gfwiki.org/images/d/d0/Nyto_Isomer_8.png",
 
  
    "NPC-Doppelsoldner(0)":"http://www.gfwiki.org/images/e/e8/Pic_Doppelsoldner_LL.png",
+
var xmlhttp_bgm = new XMLHttpRequest();
     "NPC-Uhlan(0)":"http://www.gfwiki.org/images/4/4d/Pic_Uhlan_LL.png",
+
xmlhttp_bgm.onreadystatechange = function() {
    "NPC-Rodelero(0)":"http://www.gfwiki.org/images/8/88/Pic_Rodelero_LL.png",
+
if (this.readyState == 4 && this.status == 200) {
    "NPC-Strelet(0)":"http://www.gfwiki.org/images/3/39/Pic_Strelet_LL.png",
+
     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 bgarray = {
+
var xmlhttp_se = new XMLHttpRequest();
    "1":"http://www.gfwiki.org/images/0/00/%E6%A0%91%E6%9E%97.png",
+
xmlhttp_se.onreadystatechange = function() {
    "8":"http://www.gfwiki.org/images/9/9a/%E4%BD%9C%E6%88%98%E5%AE%A4avg.png",
+
if (this.readyState == 4 && this.status == 200) {
    "9":"http://www.gfwiki.org/images/4/44/BG-none.png",
+
     searray = JSON.parse(this.responseText.replace(/\/\*\s{1,4}\d{1,4}\s{1,4}\*\//g,"").replace(",\n}", "\n}"));}
     "15":"http://www.gfwiki.org/images/a/ab/%E5%AE%A4%E5%86%85%E6%88%98%E6%96%97.png",
 
    "55":"http://www.gfwiki.org/images/6/65/Metro.png",
 
    "73":"http://www.gfwiki.org/images/1/17/17xh-ShootingRange.png",
 
    "82":"http://www.gfwiki.org/images/6/63/BG-Dorm.png",
 
    "85":"http://www.gfwiki.org/images/b/b8/BG_Inner.png",
 
    "99":"http://www.gfwiki.org/images/2/22/BG-WildBattle.png",
 
    "160":"http://www.gfwiki.org/images/a/ac/BG-Sanatorium.png",
 
    "161":"http://www.gfwiki.org/images/d/dc/BG_Base.png",
 
    "166":"http://www.gfwiki.org/images/7/79/BG-Cybercity.png",
 
    "170":"http://www.gfwiki.org/images/c/c6/19WinterCG1.png",
 
    "182":"http://www.gfwiki.org/images/d/dc/BG-Guildhall.png",
 
    "197":"http://www.gfwiki.org/images/8/88/2019summer_3.png",
 
    "202":"http://www.gfwiki.org/images/5/52/2019summer_7.png",
 
    "227":"http://www.gfwiki.org/images/3/37/19winter_aurora.png",
 
    "262":"http://www.gfwiki.org/images/c/c8/GunCGlake.png",
 
    "269":"http://www.gfwiki.org/images/4/46/2020summerFlowerfield.png",
 
    "270":"http://www.gfwiki.org/images/6/67/2020summerOrphanage.png",
 
    "315":"http://www.gfwiki.org/images/6/6a/2021white_Berlin.png",
 
    "318":"http://www.gfwiki.org/images/d/df/2021white_Bernvillage.png",
 
    "334":"http://www.gfwiki.org/images/e/e3/2021white_Virgin.png",
 
    "335":"http://www.gfwiki.org/images/f/f0/2021white_Morridow.png",
 
    "356":"http://www.gfwiki.org/images/6/65/2021white_Safehouse.png",
 
    "357":"http://www.gfwiki.org/images/b/bd/2021white_GriffinSPAWAR.png",
 
 
};
 
};
 +
xmlhttp_se.open("GET", "/index.php?title=JSON:AVGSE&action=raw", true);
 +
xmlhttp_se.send();
  
var bgmarray = {
+
function getdollarrays() {
    "BGM_Battle":"http://www.gfwiki.org/images/b/b4/BGM_Battle.mp3",
+
mw.loader.using('ext.gadget.md5hasher', function() {
    "BGM_Danger":"http://www.gfwiki.org/images/9/98/BGM_Danger.mp3",
+
const prefabcodes = [0, 2, 3, 4, 5, 6, 7, 8, 9].concat([...Array(26)].map((_, i) => String.fromCharCode(i + 97)));
    "BGM_Empty":"http://www.gfwiki.org/images/7/72/BGM_Empty.mp3",
+
for (const c of prefabcodes) {
    "BGM_Room":"http://www.gfwiki.org/images/4/46/BGM_Room.mp3",
+
  var newXhr = new XMLHttpRequest();
    "BGM_Sneak":"http://www.gfwiki.org/images/4/44/BGM_Sneak.mp3",
+
  newXhr.responseType = 'json';
    "BGM_Truth":"http://www.gfwiki.org/images/b/b3/BGM_Truth.mp3",
+
  newXhr.onload = function() {
    "BGM_Hello":"http://www.gfwiki.org/images/2/2a/GF_Daily_01_loop.mp3",
+
     dollarray = Object.assign(dollarray, this.response);
    "BGM_Sunshine":"http://www.gfwiki.org/images/3/3f/Home_formation_factory.mp3",
+
  }
    "BGM_NightOPS":"http://www.gfwiki.org/images/4/4d/GUN_CineTense_loop.mp3",
+
  const prefab = 'AVG_Pic_' + c + '.txt';
 
+
  newXhr.open('GET', '/images/' + window.gfUtils.createWikiPathPart(prefab) + '/' + prefab);
    "GF_EV9_Story":"http://www.gfwiki.org/images/2/29/GF_EV9_Story.mp3",
+
  newXhr.send();
     "GF_Memorial":"http://www.gfwiki.org/images/1/17/GF_Memorial.mp3",
+
}
    "m_avg_casual":"http://www.gfwiki.org/images/c/cf/M_avg_casual.mp3",
+
});
    "GF_21winter_avg_pathfinder":"http://www.gfwiki.org/images/0/05/GF_21winter_avg_pathfinder.mp3",
+
}
    "GF_21winter_avg_mahaline":"http://www.gfwiki.org/images/c/ce/GF_21winter_avg_mahaline.mp3",
 
  
     "BGM_stage1":"http://www.gfwiki.org/images/1/1d/GF_MAP1_BGM.mp3",
+
var effarray = {
     "BGM_stage10":"http://www.gfwiki.org/images/d/db/GF_MAP10_BGM.mp3",
+
     "%%code=AVG_ink1%%":"/images/Video/AVG/AVG_ink1.mp4",
     "BGM_stage11":"http://www.gfwiki.org/images/d/dc/GF_MAP11_BGM.mp3",
+
    "%%code=AVG_ink2%%":"/images/Video/AVG/AVG_ink2.mp4",
 +
     "%%code=AVG_ink3%%":"/images/Video/AVG/AVG_ink3.mp4",
 +
    "%%code=AVG_ink4%%":"/images/Video/AVG/AVG_ink4.mp4",
 +
     "%%code=AVG_ink5%%":"/images/Video/AVG/AVG_ink5.mp4",
 +
    "%%code=AVG_ink6%%":"/images/Video/AVG/AVG_ink6.mp4",
  
     "10051":"http://www.gfwiki.org/images/8/87/GF_EV4_Map1.mp3",
+
     "%%code=NPC_TV_0%%":"/images/2/2c/NPC-news%280%29.png",
     "10065":"http://www.gfwiki.org/images/a/a1/Bluestar_1_0%28win%29.mp3",
+
    "%%code=NPC_TV_1%%":"/images/2/2e/NPC-news%281%29.png",
     "10082":"http://www.gfwiki.org/images/d/da/GF_EV4_Map3.mp3",
+
    "%%code=NPC_TV_2%%":"/images/8/81/NPC-news%282%29.png",
     "10106":"http://www.gfwiki.org/images/3/39/GF_EV5_BattleL1.mp3",
+
     "%%code=NPC_TV_3%%":"/images/b/bc/NPC-news%283%29.png",
     "10194":"http://www.gfwiki.org/images/4/49/GF_EV6_G%26K_pt1.mp3",
+
    "%%code=NPC_TV_4%%":"/images/3/37/NPC-news%284%29.png",
     "10209":"http://www.gfwiki.org/images/6/6f/GF_EV6_G%26K_pt3.mp3",
+
     "%%code=NPC_TV_5%%":"/images/7/76/NPC-news%285%29.png",
     "10213":"http://www.gfwiki.org/images/3/31/GF_EV6_90w_pt1.mp3",
+
    "%%code=NPC_TV_6%%":"/images/6/69/NPC-news%286%29.png",
};
+
     "%%code=NPC_TV_7%%":"/images/1/1f/NPC-news%287%29.png",
 +
    "%%code=NPC_TV_8%%":"/images/f/f4/NPC-news%288%29.png",
 +
     "%%code=NPC_TV_9%%":"/images/f/f2/NPC-news%289%29.png",
 +
    "%%code=NPC_TV_10%%":"/images/4/40/NPC-news%2810%29.png",
 +
     "%%code=NPC_TV_11%%":"/images/0/05/NPC-news%2811%29.png",
 +
    "%%code=NPC_TV_12%%":"/images/a/af/NPC-news%2812%29.png",
 +
    "%%code=NPC_TV_13%%":"/images/1/13/NPC-news%2813%29.png",
 +
    "%%code=NPC_TV_14%%":"/images/7/70/NPC-news%2814%29.png",
 +
     "%%code=NPC_TV_15%%":"/images/8/8c/NPC-news%2815%29.png",
 +
    "%%code=NPC_TV_16%%":"/images/d/df/NPC-news%2816%29.png",
 +
    "%%code=NPC_TV_17%%":"/images/d/dc/NPC-news%2817%29.png",
 +
    "%%code=NPC_TV_18%%":"/images/c/c6/NPC-news%2818%29.png",
 +
    "%%code=NPC_TV_19%%":"/images/c/cf/NPC-news%2819%29.png",
  
var searray = {
+
    "%%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"
 
}
 
}
  
 
var linepos = 0;
 
var linepos = 0;
var endsign = 0; //该剧情是否结束的标志
+
var endsign = 0; /* 该剧情是否结束的标志 */
var avgtxt = ""; //avg文本
+
var avgtxt = ""; /* avg文本 */
var avgdoll = {left:0,center:0,right:0}; // 当前立绘
+
var avgdoll = {left:0, center:0, right:0}; /*  当前立绘 */
var avgnextline = ""; //当一个场景有多个+台词时
+
var avgnextline = ""; /* 当一个场景有多个+台词时 */
 +
var avgbranches = [];
 +
var branchblock = 0;
 +
var branchchosen = 0;
 +
 
 +
var flash_block = 0;
  
var autosign = 0; //是否开启自动模式
+
var autosign = 0; /* 是否开启自动模式 */
var autospeed = 4; //自动速度
+
var autospeed = 4; /* 自动速度 */
  
var logallsign = 0; //log是否展示全部的标志
+
var logallsign = 0; /* log是否展示全部的标志 */
  
var printwordstr; //打印的台词
+
var printwordstr; /* 打印的台词 */
var printwordnum; //打印台词的位置
+
var printwordnum; /* 打印台词的位置 */
  
var blacksign = 0; //黑幕的标志
+
var blacksign = 0; /* 黑幕的标志 */
  
 
var loadingfile = "";
 
var loadingfile = "";
var loadingfin = {doll:0, bg:0, bgm:0};
+
var loadingfin = {doll:0, bg:0, bgm:0, eff:0};
var loadingnow = {doll:0, bg:0, bgm: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() {
第190行: 第155行:
 
         xmlhttp.send();
 
         xmlhttp.send();
  
        $("#avgtitle").html($(this).children("span.avgname").html());
 
 
         loadingfile = $(this).attr("link");
 
         loadingfile = $(this).attr("link");
         $("#avgbgm").attr("src", "");
+
        $("#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"));
 +
         $("#avgbgm").attr("src", ""); $(".avgsound").remove();
 
         $("#avgbackground").html("");
 
         $("#avgbackground").html("");
 
         $(".avgdollpic").remove();
 
         $(".avgdollpic").remove();
第203行: 第169行:
 
function divcreat(){
 
function divcreat(){
 
     var html_string = `
 
     var html_string = `
 +
        <div id="avgtitle">请选择剧情<\/div>
 +
 
         <div id="avgsettings">
 
         <div id="avgsettings">
             <div id="avgblack" state="off" class="avgbutton">黑幕</div>  
+
             <div id="avgblack" state="off" class="avgbutton">黑幕<\/div>  
 
             <div id="avgbtnbox">     
 
             <div id="avgbtnbox">     
                 <div id="avgsound" state="off" class="avgsmallbtn">▢)</div>
+
                 <div id="avgsound" state="off" class="avgsmallbtn">▢)<\/div>
                 <div id="avgsoundminus" class="avgsmallbtn avgpushbutton">-</div>
+
                 <div id="avgsoundminus" class="avgsmallbtn avgpushbutton">-<\/div>
                 <div id="avgsoundwidth" state="8"></div>
+
                 <div id="avgsoundwidth" state="4"><\/div>
                 <div id="avgsoundplus" class="avgsmallbtn avgpushbutton">+</div>
+
                 <div id="avgsoundplus" class="avgsmallbtn avgpushbutton">+<\/div>
             </div>
+
             <\/div>
             <span style="padding:5px;"></span>
+
             <span style="padding:5px;"><\/span>
  
             <div id="avghand" class="avgbutton">手动</div>
+
             <div id="avghand" class="avgbutton">手动<\/div>
             <div id="avgauto" class="avgbutton">自动</div>
+
             <div id="avgauto" class="avgbutton">自动<\/div>
 
             <div id="avgbtnbox">
 
             <div id="avgbtnbox">
                 <div id="avgautominus" class="avgsmallbtn avgpushbutton">-</div>
+
                 <div id="avgautominus" class="avgsmallbtn avgpushbutton">-<\/div>
                 <div id="avgautonum">4</div>
+
                 <div id="avgautonum">4<\/div>
                 <div id="avgautoplus" class="avgsmallbtn avgpushbutton">+</div>
+
                 <div id="avgautoplus" class="avgsmallbtn avgpushbutton">+<\/div>
             </div>
+
             <\/div>
             <span style="padding:5px;"></span>
+
             <span style="padding:5px;"><\/span>
  
             <div id="avglog" state="off" class="avgbutton">LOG</div>
+
             <div id="avglog" state="off" class="avgbutton">LOG<\/div>
             <div id="avglognow" class="avgbutton avgbutton">当前</div>
+
             <div id="avglognow" class="avgbutton avgbutton">当前<\/div>
             <div id="avglogall" class="avgbutton avgbutton">全部</div>
+
             <div id="avglogall" class="avgbutton avgbutton">全部<\/div>
             <span style="padding:5px;"></span>
+
             <span style="padding:5px;"><\/span>
  
             <div id="avgtobegin" class="avgbutton avgpushbutton">返回开始</div>
+
             <div id="avgtobegin" class="avgbutton avgpushbutton">返回开始<\/div>
             <div id="avgchose" state="off" class="avgbutton">选择剧情</div>
+
             <div id="avgtonext" class="avgbutton avgpushbutton">下一章节<\/div>
             <div id="avgtitle"></div>
+
             <div id="avgchose" state="off" class="avgbutton">选择剧情<\/div>
             <div id="avgload">加载进度: PIC[0/0] CG[0/0] BGM[0/0]</div>
+
             <div id="avgload">加载进度: PIC[0/0] CG[0/0] BGM[0/0] SE[0/0] E[0/0]<\/div>
         </div>
+
         <\/div>
  
 
         <div id="avgbox">
 
         <div id="avgbox">
             <div id="avgbackground"></div>
+
             <div id="avgbackground"><\/div>
 
             <div id="avgword">
 
             <div id="avgword">
                 <div id="avgspeaker"></div>
+
                 <div id="avgspeaker"><\/div>
                 <div id="avgline"></div>
+
                 <div id="avgline"><\/div>
             </div>
+
             <\/div>
         </div>
+
         <\/div>
 
          
 
          
         <div id="avglogbox" style="width:1200px; height:675px; border:1px #8888 solid; overflow-y:scroll; display:none; background-color:#111;"></div>
+
         <div id="avglogbox" style="width:1200px; height:675px; border:1px #8888 solid; overflow-y:scroll; display:none; background-color:#111;"><\/div>
         <audio id="avgbgm" controls preload loop style="display:none;"></audio>`;
+
         <audio id="avgbgm" controls preload loop style="display:none;"><\/audio>`;
  
 
     $("#avgdiv").html(html_string);
 
     $("#avgdiv").html(html_string);
  
 
     $(".avgpushbutton").mousedown(function(){
 
     $(".avgpushbutton").mousedown(function(){
         $(this).css({"background-color":"#f4c430aa","color":"black"});
+
         $(this).css({"background-color":"#eaeaea88","color":"black"});
 
     });
 
     });
 
     $(".avgpushbutton").mouseup(function(){
 
     $(".avgpushbutton").mouseup(function(){
第262行: 第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"});
             $("#avgnavigation").css({"margin-left":"0px"});
+
           $(".avgnavigationtitle").css({"margin-left":"0px"});
 +
             $(".avgnavigation").css({"margin-left":"0px"});
 +
            $(window).scrollTop(340);
 
         } else if($(this).attr("state") == "off"){
 
         } else if($(this).attr("state") == "off"){
 
             $(this).attr("state", "on");
 
             $(this).attr("state", "on");
             $(this).css({"background-color":"#f4c430","color":"black"});
+
             $(this).css({"background-color":"#eaeaea","color":"black"});
 
             $("#mw-page-base").hide();$("#mw-head-base").hide();$("#mw-navigation").hide();
 
             $("#mw-page-base").hide();$("#mw-head-base").hide();$("#mw-navigation").hide();
 
             $("#footer").hide();$(".comment-replybox").hide();$("#siteNotice").hide();$("#firstHeading").hide();$("#contentSub").hide();
 
             $("#footer").hide();$(".comment-replybox").hide();$("#siteNotice").hide();$("#firstHeading").hide();$("#contentSub").hide();
第271行: 第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"});
             $("#avgnavigation").css({"margin-left":(window.innerWidth - 1202)/2 + "px"});
+
             $(".avgnavigationtitle").css({"margin-left":(window.innerWidth - 1202)/2 + "px"});
 +
            $(".avgnavigation").css({"margin-left":(window.innerWidth - 1202)/2 + "px"});
 +
            $(window).scrollTop(0);
 
         }
 
         }
 
     });
 
     });
第279行: 第251行:
 
             $(this).attr("state", "off");
 
             $(this).attr("state", "off");
 
             $(this).css({"background-color":"transparent","color":"#eaeaea"});
 
             $(this).css({"background-color":"transparent","color":"#eaeaea"});
             $("#avgbgm")[0].muted = false;
+
             $("#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":"#f4c430","color":"black"});
+
             $(this).css({"background-color":"#eaeaea","color":"black"});
             $("#avgbgm")[0].muted = true;
+
             $("#avgbgm")[0].muted = false;
 +
            for(let i in $(".avgsound")) $(".avgsound")[i].muted = false;
 
         }
 
         }
 
     });
 
     });
第290行: 第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;
         $("#avgsoundwidth").css("cssText","background-image: linear-gradient(90deg, #f4c430 " + back_text + ", transparent " + back_text + ");");
+
        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").attr("state",sound_num);
 
         $("#avgsoundwidth").attr("state",sound_num);
 
     });
 
     });
第298行: 第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;
         $("#avgsoundwidth").css("cssText","background-image: linear-gradient(90deg, #f4c430 " + back_text + ", transparent " + back_text + ");");
+
        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").attr("state",sound_num);
 
         $("#avgsoundwidth").attr("state",sound_num);
 
     });
 
     });
第306行: 第282行:
 
         autosign = 1;
 
         autosign = 1;
 
         setTimeout(function(){ autoreadline(); }, 4000 / autospeed);  
 
         setTimeout(function(){ autoreadline(); }, 4000 / autospeed);  
         $(this).css({"background-color":"#f4c430","color":"black"});
+
         $(this).css({"background-color":"#eaeaea","color":"black"});
 
         $("#avghand").css({"background-color":"#111111","color":"#eaeaea"});
 
         $("#avghand").css({"background-color":"#111111","color":"#eaeaea"});
 
     });
 
     });
 
     $("#avghand").click(function(){
 
     $("#avghand").click(function(){
 
         autosign = 0;
 
         autosign = 0;
         $(this).css({"background-color":"#f4c430","color":"black"});
+
         $(this).css({"background-color":"#eaeaea","color":"black"});
 
         $("#avgauto").css({"background-color":"#111111","color":"#eaeaea"});
 
         $("#avgauto").css({"background-color":"#111111","color":"#eaeaea"});
 
     });
 
     });
第334行: 第310行:
 
         } else if($(this).attr("state") == "off"){
 
         } else if($(this).attr("state") == "off"){
 
             $(this).attr("state", "on");
 
             $(this).attr("state", "on");
             $(this).css({"background-color":"#f4c430","color":"black"});
+
             $(this).css({"background-color":"#eaeaea","color":"black"});
 
             $("#avgbox").fadeOut(300);
 
             $("#avgbox").fadeOut(300);
 
             setTimeout(function(){ $("#avglogbox").fadeIn(300); }, 300);
 
             setTimeout(function(){ $("#avglogbox").fadeIn(300); }, 300);
第341行: 第317行:
 
     });
 
     });
 
     $("#avglognow").click(function(){
 
     $("#avglognow").click(function(){
         $(this).css({"background-color":"#f4c430","color":"black"});
+
         $(this).css({"background-color":"#eaeaea","color":"black"});
 
         $("#avglogall").css({"background-color":"#111111","color":"#eaeaea"});
 
         $("#avglogall").css({"background-color":"#111111","color":"#eaeaea"});
 
         logallsign = 0;
 
         logallsign = 0;
第347行: 第323行:
 
     });
 
     });
 
     $("#avglogall").click(function(){
 
     $("#avglogall").click(function(){
         $(this).css({"background-color":"#f4c430","color":"black"});
+
         $(this).css({"background-color":"#eaeaea","color":"black"});
 
         $("#avglognow").css({"background-color":"#111111","color":"#eaeaea"});
 
         $("#avglognow").css({"background-color":"#111111","color":"#eaeaea"});
 
         logallsign = 1;
 
         logallsign = 1;
第359行: 第335行:
 
         $(".avgefect").remove();
 
         $(".avgefect").remove();
 
         readline();
 
         readline();
 +
    });
 +
 +
    $("#avgtonext").click(function(){
 +
        let chosen_element = document.querySelectorAll(".avgchoice");
 +
        for(let i = 0; i < chosen_element.length; i ++){
 +
            if($(chosen_element[i]).attr("link") == loadingfile && (i + 1 < chosen_element.length)) { $(chosen_element[i + 1]).click(); return;}
 +
        }
 
     });
 
     });
  
第365行: 第348行:
 
             $(this).attr("state", "off");
 
             $(this).attr("state", "off");
 
             $(this).css({"background-color":"#111111","color":"#eaeaea"});
 
             $(this).css({"background-color":"#111111","color":"#eaeaea"});
             $("#avgnavigation").css("display","none");
+
             $(".avgnavigationtitle").css("display","none");
 +
            $(".avgnavigationtitle").attr("state","coll-off");
 +
            $(".avgnavigation").css("display","none");
 
         } else if($(this).attr("state") == "off"){
 
         } else if($(this).attr("state") == "off"){
 
             $(this).attr("state", "on");
 
             $(this).attr("state", "on");
             $(this).css({"background-color":"#f4c430","color":"black"});
+
             $(this).css({"background-color":"#eaeaea","color":"black"});
             $("#avgnavigation").css("display","block");
+
             $(".avgnavigationtitle").css("display","block");
 
             avglogcreat();
 
             avglogcreat();
 
         }
 
         }
 
     });
 
     });
  
     $("#avgsound").click()
+
     $("#avgsound").click();
 +
    $("#avgsoundminus").click();
 
     $("#avghand").click();
 
     $("#avghand").click();
 
     $("#avglognow").click();
 
     $("#avglognow").click();
第387行: 第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(endsign == 1 || blacksign == 1) return;
+
     if(blacksign == 1 || branchblock == 1 || flash_block == 1) return;
 +
   
 +
    if(endsign == 1 && !avgnextline) {
 +
        $("#avgline").html(`<div class="endsigndiv">${$("#avgtitle").html()} END</div>`);
 +
        if (!bgmEnd) {
 +
          $('#avgbox')[0].addEventListener('click', endBgm);
 +
        }
 +
        return;
 +
    }
  
 
     if(avgnextline){
 
     if(avgnextline){
第401行: 第404行:
 
     }
 
     }
  
     var thisline = avgtxt.slice(linepos, avgtxt.indexOf("\n", linepos));
+
    if(avgbranches.length != 0){
 +
        let isCg = avgbranches.every(opt => opt.startsWith('cg'));
 +
        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>`;
 +
 
 +
        $("#avgbox").append(html_string);
 +
        avgbranches = [];
 +
        branchblock = 1;
 +
       
 +
        $(".avgbranch").click(function(){
 +
            branchblock = 0;
 +
            branchchosen = Number($(this).attr("index")) + 1;
 +
            $("#avgbranchdiv").remove();
 +
        });
 +
        return;
 +
    }
 +
 
 +
     var thisline = (avgtxt.indexOf("\n", linepos) == -1) ? avgtxt.slice(linepos, avgtxt.length) : avgtxt.slice(linepos, avgtxt.indexOf("\n", linepos));
 +
 
 +
    // branches
 +
    while(thisline.indexOf("<分支>") != -1 && Number(thisline[thisline.indexOf("<分支>") + 4]) != branchchosen){
 +
        if(avgtxt.indexOf("\n", linepos) == -1) { endsign = 1; return;}
 +
        linepos = avgtxt.indexOf("\n", linepos) + 1;
 +
        thisline = (avgtxt.indexOf("\n", linepos) == -1) ? avgtxt.slice(linepos, avgtxt.length) : avgtxt.slice(linepos, avgtxt.indexOf("\n", linepos));
 +
    }
 +
    if(thisline.indexOf("<分支>") == -1 && branchchosen != 0) branchchosen = 0;
  
     //black
+
     // black
     if(thisline.indexOf("<黑屏2>") != -1 && blacksign == 0){
+
     if((thisline.indexOf("<黑屏2>") != -1 || thisline.indexOf("<黑点2>") != -1) && blacksign == 0){
 
         $(".avgdollpic").fadeOut(1000 / autospeed); $(".avgefect").fadeOut(1000 / autospeed);
 
         $(".avgdollpic").fadeOut(1000 / autospeed); $(".avgefect").fadeOut(1000 / autospeed);
 
         $("#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(){
第421行: 第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();
 +
        }
 
     }
 
     }
  
     //bgm
+
     // bgm
 
     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();
 
     }
 
     }
  
     //background
+
    // 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;
 +
        }
 +
    }
 +
 
 +
    //special '<' efect
 +
    if(thisline.indexOf("<关闭蒙版>") != -1) $(".avgefect").remove();
 +
    if(thisline.indexOf("<回忆>") != -1) $("#avgbox").append(`<div class="avgefect" style="width:1200px; height:675px; position:absolute; z-index:10; backdrop-filter:sepia(0.8) brightness(0.8)"><\/div>`);
 +
 
 +
    /*-- common_effect mp4 or other code --*/
 +
    if(thisline.indexOf("<common_effect>") != -1){
 +
        effect_creat(thisline.slice(thisline.indexOf("<common_effect>") + ("<common_effect>").length, thisline.indexOf("</common_effect>")));
 +
    }
 +
 
 +
     // background
 
     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>`);
 +
    }
 +
    if(thisline.indexOf("<闪屏>") != -1){
 +
        let flash_str = thisline.slice(thisline.indexOf("<闪屏>") + ("<闪屏>").length, thisline.indexOf("</闪屏>"));
 +
        let background_array = flash_str.slice(flash_str.indexOf("<CG>") + ("<CG>").length, flash_str.indexOf("</CG>")).split(",");
 +
        let control_parament = {
 +
            "duration":Number(flash_str.slice(flash_str.indexOf("<duration>") + ("<duration>").length, flash_str.indexOf("</duration>"))),
 +
            "rate":Number(flash_str.slice(flash_str.indexOf("<rate>") + ("<rate>").length, flash_str.indexOf("</rate>"))),
 +
            "delay":Number(flash_str.slice(flash_str.indexOf("<delay>") + ("<delay>").length, flash_str.indexOf("</delay>"))),
 +
        };
 +
        flash_block = 1;
 +
        setTimeout(function(){
 +
            flash_block = 0;
 +
            $("#avgbackground").html(`<img src="${bgarray[background_array[background_array.length - 1]]}" style="display:none;" draggable="false"/>`);
 +
            $("#avgbackground").children("img").fadeIn(control_parament.rate * 5);
 +
        }, background_array.length * (control_parament.delay + control_parament.rate * 2 + control_parament.duration) * 5);
 +
 
 +
        for(let i = 0; i < background_array.length; i ++){
 +
            let time_start = ((i + 1) * control_parament.delay + i * control_parament.rate * 2 + i * control_parament.duration) * 5;
 +
            setTimeout(function(){
 +
                $("#avgbackground").html(`<img src="${bgarray[background_array[i]]}" style="display:none;" draggable="false"/>`);
 +
                $("#avgbackground").children("img").fadeIn(control_parament.rate * 5);
 +
            }, time_start);
 +
            setTimeout(function(){
 +
                $("#avgbackground").children("img").fadeOut(control_parament.rate * 5);
 +
            }, time_start + (control_parament.rate + control_parament.duration) * 5);
 +
        }
 
     }
 
     }
  
 
     //doll pic
 
     //doll pic
 
     if(thisline.indexOf("<Speaker>") != -1){
 
     if(thisline.indexOf("<Speaker>") != -1){
         var avgpicstr = thisline.slice(0, thisline.indexOf("||"));
+
         let avgpicstr = thisline.slice(0, thisline.indexOf("||"));
         var newavgdoll = {left:0,center:0,right:0};
+
         let newavgdoll = {left:0,center:0,right:0};
         var the_speaker = "center";
+
         let the_speaker = "center";
  
 
         // center
 
         // center
第450行: 第546行:
 
         else if(avgpicstr.indexOf("<Speaker>") < avgpicstr.indexOf(";")){
 
         else if(avgpicstr.indexOf("<Speaker>") < avgpicstr.indexOf(";")){
 
             the_speaker = "left";
 
             the_speaker = "left";
 +
            let avgpicstr_righ = avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.length);
 
             avgpicleft = avgpicstr.slice(0, avgpicstr.indexOf("<Speaker>"));
 
             avgpicleft = avgpicstr.slice(0, avgpicstr.indexOf("<Speaker>"));
             avgpicrigh = avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.length);
+
             avgpicrigh = avgpicstr_righ.slice(0, ((avgpicstr_righ.indexOf("<") != -1) ? avgpicstr_righ.indexOf("<") : avgpicstr_righ.legth));
             newavgdoll = {left: avgpicleft,center:0,right: avgpicrigh};
+
             newavgdoll = {left: avgpicleft, center: 0, right: avgpicrigh};
 
         }
 
         }
 
         // speaker = right
 
         // speaker = right
第460行: 第557行:
 
             avgpicleft = avgpicstr_left.slice(0, ((avgpicstr_left.indexOf("<") < avgpicstr_left.indexOf(";")) ? avgpicstr_left.indexOf("<") : avgpicstr_left.indexOf(";")));
 
             avgpicleft = avgpicstr_left.slice(0, ((avgpicstr_left.indexOf("<") < avgpicstr_left.indexOf(";")) ? avgpicstr_left.indexOf("<") : avgpicstr_left.indexOf(";")));
 
             avgpicrigh = avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.indexOf("<Speaker>"));
 
             avgpicrigh = avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.indexOf("<Speaker>"));
             newavgdoll = {left: avgpicleft,center:0,right: avgpicrigh};
+
             newavgdoll = {left: avgpicleft, center: 0, right: avgpicrigh};
 
         }
 
         }
  
 
         // the same - none - changed
 
         // the same - none - changed
         if(newavgdoll == avgdoll) {}
+
         if(newavgdoll == avgdoll) {
         else if(newavgdoll == {left:0,center:0,right:0}) {
+
         } else if(newavgdoll == {left:0,center:0,right:0}) {
 
             $(".avgdollpic").fadeOut(150);
 
             $(".avgdollpic").fadeOut(150);
 
             setTimeout(function(){ $(".avgdollpic").remove();}, 150);
 
             setTimeout(function(){ $(".avgdollpic").remove();}, 150);
第471行: 第568行:
 
             // telephone frame mask - not speaker dark mask
 
             // telephone frame mask - not speaker dark mask
 
             // if telephone frame mask exist , not speaker dark mask won't exist
 
             // if telephone frame mask exist , not speaker dark mask won't exist
             let telemask = `<div class="telemaskdiv"></div>`;
+
             let telemask = `<div class="telemaskdiv"><\/div>`;
 
             let darkmask_a = `<div class="darkmask" style="-webkit-mask-image:url(`;
 
             let darkmask_a = `<div class="darkmask" style="-webkit-mask-image:url(`;
             let darkmask_b = `); -webkit-mask-size:cover; display:none;"></div>`;
+
             let darkmask_b = `); -webkit-mask-size:cover; display:none;"><\/div>`;
 
              
 
              
 
             if(newavgdoll.center != 0){
 
             if(newavgdoll.center != 0){
第484行: 第581行:
 
                     if(target_name == this_name){
 
                     if(target_name == this_name){
 
                         cen_sign = 0;
 
                         cen_sign = 0;
 +
                        $(avgdoll_div[i]).stop();
 
                         $(avgdoll_div[i]).css({"z-index":"6"});
 
                         $(avgdoll_div[i]).css({"z-index":"6"});
 
                         $(avgdoll_div[i]).animate({"left":"152px"}, 300);
 
                         $(avgdoll_div[i]).animate({"left":"152px"}, 300);
第504行: 第602行:
 
                 if(cen_sign){
 
                 if(cen_sign){
 
                     setTimeout(function(){  
 
                     setTimeout(function(){  
                         let the_center = `<div class="avgdollpic" name-data="` + newavgdoll.center + `" style="left:152px; z-index:6; display:none;">`
+
                         let the_center = `<div class="avgdollpic" name-data="${newavgdoll.center}" style="z-index:6; display:none;`;
                         the_center += `<img src="` + dollarray[newavgdoll.center] + `" style="`;
+
 
 +
                        if((avgpicstr.indexOf("<Position>") != -1) && (avgpicstr.indexOf("<Position>") > avgpicstr.indexOf(";"))){
 +
                            let position_str = avgpicstr.slice(avgpicstr.indexOf("<Position>") + ("<Position>").length, avgpicstr.indexOf("</Position>"));
 +
                            let position_array = position_str.split(",");
 +
                            the_center += `left:${152 - Number(position_array[0])/2}px; top:${110 - Number(position_array[1])/2}px; height:${565 + Number(position_array[1])/2}px;">`;
 +
                        } else the_center += `left:152px;">`;
 +
 
 +
                         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(http://www.gfwiki.org/images/d/d0/Mask.png);"/>` + 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>`;
                         } else the_center += `"/></div>`;
+
                         } else the_center += `"/><\/div>`;
 +
                       
 
                         $("#avgbox").append(the_center);
 
                         $("#avgbox").append(the_center);
 
                         $(".avgdollpic").fadeIn(150);
 
                         $(".avgdollpic").fadeIn(150);
第525行: 第631行:
 
                     if(left_name == this_name){
 
                     if(left_name == this_name){
 
                         left_sign = 0;
 
                         left_sign = 0;
 +
                        $(avgdoll_div[i]).stop();
 
                         $(avgdoll_div[i]).animate({"left":"-20px"}, 300);
 
                         $(avgdoll_div[i]).animate({"left":"-20px"}, 300);
 
                         $(avgdoll_div[i]).css({"z-index":((the_speaker == "left") ? "4" : "2")});
 
                         $(avgdoll_div[i]).css({"z-index":((the_speaker == "left") ? "4" : "2")});
第545行: 第652行:
 
                     } else if(right_name == this_name){
 
                     } else if(right_name == this_name){
 
                         right_sign = 0;
 
                         right_sign = 0;
 +
                        $(avgdoll_div[i]).stop();
 
                         $(avgdoll_div[i]).animate({"left":"324px"}, 300);
 
                         $(avgdoll_div[i]).animate({"left":"324px"}, 300);
 
                         $(avgdoll_div[i]).css({"z-index":((the_speaker == "right") ? "4" : "2")});
 
                         $(avgdoll_div[i]).css({"z-index":((the_speaker == "right") ? "4" : "2")});
第571行: 第679行:
 
                 if(left_sign){
 
                 if(left_sign){
 
                     setTimeout(function(){  
 
                     setTimeout(function(){  
                         let the_left = `<div class="avgdollpic" name-data="` + newavgdoll.left + `" style="left:-20px; z-index:` + ((the_speaker == "left") ? "4" : "2") + `;">`
+
                         let the_left = `<div class="avgdollpic" name-data="${newavgdoll.left}" style="z-index:` + ((the_speaker == "left") ? "4" : "2") + ";";
                         the_left += `<img src="` + dollarray[newavgdoll.left] + `" style="`;
+
                       
 +
                        if((avgpicstr.indexOf("<Position>") != -1) && (avgpicstr.indexOf("<Position>") < avgpicstr.indexOf(";"))){
 +
                            let position_str = avgpicstr.slice(avgpicstr.indexOf("<Position>") + ("<Position>").length, avgpicstr.indexOf("</Position>"));
 +
                            let position_array = position_str.split(",");
 +
                            the_left += `left:${-20 - Number(position_array[0])/2}px; top:${110 - Number(position_array[1])/2}px; height:${565 + Number(position_array[1])/2}px;">`;
 +
                        } else the_left += `left:-20px;">`;
 +
 
 +
                         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(http://www.gfwiki.org/images/d/d0/Mask.png);"/>` + 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>`;
                         } else the_left += `"/></div>`;
+
                         } else the_left += `"/><\/div>`;
 
                         $("#avgbox").append(the_left);
 
                         $("#avgbox").append(the_left);
 
                         $(".avgdollpic").fadeIn(150);
 
                         $(".avgdollpic").fadeIn(150);
第582行: 第697行:
 
                 if(right_sign){
 
                 if(right_sign){
 
                     setTimeout(function(){  
 
                     setTimeout(function(){  
                         let the_right = `<div class="avgdollpic" name-data="` + newavgdoll.right + `" style="left:324px; z-index:` + ((the_speaker == "right") ? "4" : "2") + `;">`
+
                         let the_right = `<div class="avgdollpic" name-data="${newavgdoll.right}" style="z-index:` + ((the_speaker == "right") ? "4" : "2") + ";";
                         the_right += `<img src="` + dollarray[newavgdoll.right] + `" style="`;
+
 
 +
                        if((avgpicstr.indexOf("<Position>") != -1) && (avgpicstr.indexOf("<Position>") > avgpicstr.indexOf(";"))){
 +
                            let position_str = avgpicstr.slice(avgpicstr.indexOf("<Position>") + ("<Position>").length, avgpicstr.indexOf("</Position>"));
 +
                            let position_array = position_str.split(",");
 +
                            the_right += `left:${324 - Number(position_array[0])/2}px; top:${110 - Number(position_array[1])/2}px; height:${565 + Number(position_array[1])/2}px;">`;
 +
                        } else the_right += `left:324px;">`;
 +
 
 +
                         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(http://www.gfwiki.org/images/d/d0/Mask.png);"/>` + 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>`;
                         } else the_right += `"/></div>`;
+
                         } else the_right += `"/><\/div>`;
 
                         $("#avgbox").append(the_right);
 
                         $("#avgbox").append(the_right);
 
                         $(".avgdollpic").fadeIn(150);
 
                         $(".avgdollpic").fadeIn(150);
第608行: 第730行:
 
     //word line - color & size handler
 
     //word line - color & size handler
 
     if(thisline.indexOf(":") != -1){
 
     if(thisline.indexOf(":") != -1){
         let keyword = (thisline.indexOf("+") != -1) ? "+" : "\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
         line = line.replace(/<\/color>/g, "</span").replace(/<\/Size>/g, "</span");
+
         line = line.replace(/<\/color>/g, "<\/span>").replace(/<\/Size>/g, "<\/span>");
        line = line.replace(/<color=/g, "<span style=\"color:").replace(/<Size=/g, "<span style=\"font-size:1");
 
 
         for(let j = 0; j < line.length; j++){
 
         for(let j = 0; j < line.length; j++){
             if(line.slice(j - ("font-size:1").length, j) == "font-size:1") line = line.slice(0, j+2) + "%" + line.slice(j+2, line.length);
+
             if(line.slice(j - ("<Size=").length, j) == "<Size="){
 +
                let size_num = (Number(line.slice(j, j+2)) / 2.4).toFixed(0);
 +
                line = line.slice(0, j - ("<Size=").length) + "<span style=\"font-size:" + size_num + "px;\"" + line.slice(j+2, line.length);
 +
            } else if(line.slice(j - ("<color=").length, j) == "<color="){
 +
                line = line.slice(0, j - ("<color=").length) + "<span style=\"color:" + line.slice(j, j + ("#000000").length) + ";\"" + line.slice(j + ("#000000").length, line.length);
 +
            }
 
         }
 
         }
         line = line.replace(/>/g, "\">").replace(/<\/span/g, "<\/span>");
+
         printwordstr = (keyword == "\n" && line.indexOf("/n") == -1) ? line : line.slice(0, line.indexOf(keyword));
 
 
        printwordstr = line.slice(0, line.indexOf(keyword));
 
  
 +
        $("#avgword").stop();
 
         $("#avgword").animate({opacity:"0.0"}, 400, "swing");
 
         $("#avgword").animate({opacity:"0.0"}, 400, "swing");
 
         setTimeout(function(){ $("#avgline").html(""); $("#avgword").animate({opacity:"1.0"}, 400, "swing");}, 400);
 
         setTimeout(function(){ $("#avgline").html(""); $("#avgword").animate({opacity:"1.0"}, 400, "swing");}, 400);
第626行: 第751行:
  
 
         if((line.indexOf("+") != -1)) avgnextline = line.slice(line.indexOf("+") + 1, line.length);
 
         if((line.indexOf("+") != -1)) avgnextline = line.slice(line.indexOf("+") + 1, line.length);
 +
        else if(line.indexOf("<c>") != -1) {
 +
            let line_temp = line.slice(line.indexOf("<c>") + 3, line.length).replace("\r", "");
 +
            avgbranches = line_temp.split("<c>");
 +
            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 {
 +
        $("#avgword").stop();
 
         $("#avgword").animate({opacity:"0.0"}, 400, "swing");
 
         $("#avgword").animate({opacity:"0.0"}, 400, "swing");
 
         setTimeout(function(){ $("#avgline").html(""); $("#avgword").animate({opacity:"1.0"}, 400, "swing");}, 400);
 
         setTimeout(function(){ $("#avgline").html(""); $("#avgword").animate({opacity:"1.0"}, 400, "swing");}, 400);
 
     }
 
     }
 
    //special efect
 
    if(thisline.indexOf("<关闭蒙版>") != -1) $(".avgefect").remove();
 
    if(thisline.indexOf("<回忆>") != -1) $("#avgbox").append(`<div class="avgefect" style="width:1200px; height:675px; position:absolute; z-index:10; backdrop-filter:sepia(0.8) brightness(0.8)"></div>`);
 
  
 
     //position sign
 
     //position sign
第642行: 第773行:
  
 
function autoreadline(){
 
function autoreadline(){
     if(autosign == 0) return;
+
     if(autosign == 0 || branchblock == 1) return;
 
     if($("#avglog").attr("state") != "on") readline();
 
     if($("#avglog").attr("state") != "on") readline();
 
     setTimeout(function(){
 
     setTimeout(function(){
第652行: 第783行:
 
     if(printwordstr[printwordnum - 1] == "<") printwordnum = printwordstr.indexOf(">", printwordnum - 1) + 2;
 
     if(printwordstr[printwordnum - 1] == "<") printwordnum = printwordstr.indexOf(">", printwordnum - 1) + 2;
 
     let thisprint = printwordstr.slice(0, printwordnum);
 
     let thisprint = printwordstr.slice(0, printwordnum);
     if(thisprint.indexOf("<span") != -1 && ((thisprint.indexOf("</span") == -1) || (thisprint.lastIndexOf("</span") < thisprint.lastIndexOf("<span")))) $("#avgline").html(thisprint + "</span>");  
+
     if(thisprint.indexOf("<span") != -1 && ((thisprint.indexOf("</span") == -1) || (thisprint.lastIndexOf("</span") < thisprint.lastIndexOf("<span")))) $("#avgline").html(thisprint + "<\/span>");  
 
     else $("#avgline").html(thisprint);
 
     else $("#avgline").html(thisprint);
  
第660行: 第791行:
 
}
 
}
  
/*---------------------------AVG记录的展示与控制---------------------------*/
+
/*------- AVG log's display and control -------*/
 
function avglogcreat(){
 
function avglogcreat(){
     var logpos = 0;
+
     let logpos = 0;
     var logline = 1;
+
     let logline = 1;
     var output = ``;
+
     let log_string = ``;
  
 
     while(1){
 
     while(1){
         var thisline = (avgtxt.indexOf("\n", logpos) == -1) ? avgtxt.slice(logpos, avgtxt.length) : avgtxt.slice(logpos, avgtxt.indexOf("\n", logpos));
+
         let thisline = (avgtxt.indexOf("\n", logpos) == -1) ? avgtxt.slice(logpos, avgtxt.length) : avgtxt.slice(logpos, avgtxt.indexOf("\n", logpos));
  
         output += `<div style="border-top:1px #8886 dashed; padding:7px 4px;"><table style="width:100%;"><tr><td avgpos="` + logpos + `"`;
+
         log_string += `<div style="border-top:1px #8886 dashed; padding:7px 4px;"><table style="width:100%;"><tr><td avgpos="` + logpos + `"`;
         if(thisline.indexOf("<黑屏2>") != -1) output += ` class="avglogtd" style="border:1px dashed #f4c430; cursor:zoom-in;`;
+
         if(thisline.indexOf("<黑屏2>") != -1 || thisline.indexOf("<黑点2>") != -1) log_string += ` class="avglogtd" style="border:1px dashed #f4c430; cursor:zoom-in;`;
         else output += ` style="border:none;`;
+
         else log_string += ` style="border:none;`;
         output += `width:5%; text-align:center; vertical-align:baseline;">` + logline + `</td>`;
+
         log_string += `width:5%; text-align:center; vertical-align:baseline;">` + logline + `<\/td>`;
         output += `<td style="width:15%; text-align:center; vertical-align:baseline;">` + ((thisline.indexOf("<Speaker>") != -1) ? thisline.slice(thisline.indexOf("<Speaker>") + ("<Speaker>").length , thisline.indexOf("</Speaker>")) : "");
+
         log_string += `<td style="width:15%; text-align:center; vertical-align:baseline;">` + ((thisline.indexOf("<Speaker>") != -1) ? thisline.slice(thisline.indexOf("<Speaker>") + ("<Speaker>").length , thisline.indexOf("</Speaker>")) : "");
         output += `</td><td style="width:80%; vertical-align:baseline;">` + thisline.slice(thisline.indexOf(":") + 1, thisline.length).replace(/\+/g, "<br>") + `</td></tr></table></div>`;
+
         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(/<cg>/g, " 分支") + `<\/td><\/tr><\/table><\/div>`;
 
              
 
              
 
         if(avgtxt.indexOf("\n", logpos) == -1) break;
 
         if(avgtxt.indexOf("\n", logpos) == -1) break;
第682行: 第815行:
 
     }
 
     }
  
     $("#avglogbox").html(output);
+
     $("#avglogbox").html(log_string);
  
 
     $(".avglogtd").click(function(){
 
     $(".avglogtd").click(function(){
第694行: 第827行:
 
}
 
}
  
/*---------------------------初次加载,预加载,显示加载信息---------------------------*/
+
/*------ first load, preload, display loading information ------*/
 
function firstloading(){
 
function firstloading(){
     loadingfin = {doll:0, bg:0, bgm:0};
+
     loadingfin = {doll:0, bg:0, bgm:0, se:0, eff:0};
     loadingnow = {doll:0, bg:0, bgm:0};
+
     loadingnow = {doll:0, bg:0, bgm:0, se:0, eff:0};
  
 
     var logpos = 0;
 
     var logpos = 0;
     var loading = {doll:[], bg:[], bgm:[]};
+
     var loading = {doll:[], bg:[], bgm:[], se:[], eff:[]};
 +
 
 +
    /*--------------------------- key word query, console that not in the array ---------------------------*/
 +
    var sekeyword = ["Speaker", "BIN", "BGM", "SE1", "SE2", "color", "Size", "通讯框", "黑屏1", "黑屏2", "黑点1", "黑点2", "common_effect", "关闭蒙版", "CGDelay", "回忆", "Position", "Night"];
 +
    var the_words = avgtxt.replace(/<color=#[A-Za-z0-9]{6}>/g, "<color>").replace(/<Size=\d{2}>/g, "<Size>");
 +
    while(the_words.indexOf("<") != -1 && the_words.length != 0){
 +
        let this_word = the_words.slice(the_words.indexOf("<"), the_words.indexOf(">") + 1);
 +
        the_words = the_words.slice(the_words.indexOf(">") + 1, the_words.length);
 +
        if(this_word[1] == "/") continue;
 +
 
 +
        let sign = 1;
 +
        for(i in sekeyword) if(("<" + sekeyword[i] + ">") == this_word) { sign = 0; break;}
 +
        if(sign) console.log("need effect -- " + this_word);
 +
        if(sign) sekeyword.push(this_word.slice(1, this_word.length - 1));
 +
    }
  
 
     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){
第712行: 第860行:
 
             } else if(thisline.indexOf(";") == -1 && thisline.indexOf("()") != -1){
 
             } else if(thisline.indexOf(";") == -1 && thisline.indexOf("()") != -1){
 
             } else if(avgpicstr.indexOf("<Speaker>") < avgpicstr.indexOf(";")){
 
             } else if(avgpicstr.indexOf("<Speaker>") < avgpicstr.indexOf(";")){
 +
                let avgpic_righ = avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.length);
 
                 newavgdoll.push(avgpicstr.slice(0, avgpicstr.indexOf("<Speaker>")));
 
                 newavgdoll.push(avgpicstr.slice(0, avgpicstr.indexOf("<Speaker>")));
                 newavgdoll.push(avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.length));
+
                 newavgdoll.push((avgpic_righ.indexOf("<") == -1) ? avgpic_righ : avgpic_righ.slice(0, avgpic_righ.indexOf("<")));
 
             } else if(avgpicstr.indexOf("<Speaker>") > avgpicstr.indexOf(";")){
 
             } else if(avgpicstr.indexOf("<Speaker>") > avgpicstr.indexOf(";")){
                 avgpicleft = avgpicstr.slice(0, ((avgpicstr.indexOf("<") < avgpicstr.indexOf(";")) ? avgpicstr.indexOf(";") : avgpicstr.indexOf("<")));
+
                 newavgdoll.push(avgpicstr.slice(0, ((avgpicstr.indexOf("<") > avgpicstr.indexOf(";")) ? avgpicstr.indexOf(";") : avgpicstr.indexOf("<"))));
 
                 newavgdoll.push(avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.indexOf("<Speaker>")));
 
                 newavgdoll.push(avgpicstr.slice(avgpicstr.indexOf(";") + 1, avgpicstr.indexOf("<Speaker>")));
 
             }
 
             }
第722行: 第871行:
 
                 let sign = 1;
 
                 let sign = 1;
 
                 for(let j = 0; j < loading.doll.length; j++){
 
                 for(let j = 0; j < loading.doll.length; j++){
                     if(newavgdoll[i] == loading.doll[j]){ sign = 0; break; }
+
                     if(newavgdoll[i] == loading.doll[j].ID){ sign = 0; break; }
                 } if(sign) loading.doll.push(newavgdoll[i]);
+
                 } if(sign) loading.doll.push({"ID":newavgdoll[i], "URL":dollarray[newavgdoll[i]]});
 
             }
 
             }
 
         }
 
         }
第730行: 第879行:
 
             let a = thisline.slice(thisline.indexOf("<BGM>") + ("<BGM>").length, thisline.indexOf("</BGM>"));
 
             let a = thisline.slice(thisline.indexOf("<BGM>") + ("<BGM>").length, thisline.indexOf("</BGM>"));
 
             for(let i = 0; i < loading.bgm.length; i++){
 
             for(let i = 0; i < loading.bgm.length; i++){
                 if(a == loading.bgm[i]){ sign = 0; break; }
+
                 if(a == loading.bgm[i].ID){ sign = 0; break; }
             } if(sign) loading.bgm.push(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){
第737行: 第896行:
 
             let a = thisline.slice(thisline.indexOf("<BIN>") + ("<BIN>").length, thisline.indexOf("</BIN>"));
 
             let a = thisline.slice(thisline.indexOf("<BIN>") + ("<BIN>").length, thisline.indexOf("</BIN>"));
 
             for(let i = 0; i < loading.bg.length; i++){
 
             for(let i = 0; i < loading.bg.length; i++){
                 if(a == loading.bg[i]){ sign = 0; break; }
+
                 if(a == loading.bg[i].ID){ sign = 0; break; }
             } if(sign) loading.bg.push(a);
+
             } if(sign) loading.bg.push({"ID":a, "URL":bgarray[a]});
 +
        }
 +
        if(thisline.indexOf("<闪屏>") != -1){
 +
            let a = thisline.slice(thisline.indexOf("<闪屏>") + ("<闪屏>").length, thisline.indexOf("</闪屏>"));
 +
            if(a.indexOf("<CG>") != -1){
 +
                let b = a.slice(a.indexOf("<CG>") + ("<CG>").length, a.indexOf("</CG>")).split(",");
 +
                for(let j = 0; j < b.length; j ++){
 +
                    let sign = 1;
 +
                    for(let i = 0; i < loading.bg.length; i++){
 +
                        if(b[j] == loading.bg[i].ID){ sign = 0; break; }
 +
                    } if(sign) loading.bg.push({"ID":b[j], "URL":bgarray[b[j]]});
 +
                }
 +
            }
 +
        }
 +
        if(thisline.indexOf("<common_effect>") != -1){
 +
            let sign = 1;
 +
            let a = thisline.slice(thisline.indexOf("<common_effect>") + ("<common_effect>").length, thisline.indexOf("</common_effect>"));
 +
            for(let i = 0; i < loading.eff.length; i++){
 +
                if(a == loading.eff[i].ID){ sign = 0; break; }
 +
            } if(sign) loading.eff.push({"ID":a, "URL":effarray[a]});
 
         }
 
         }
  
第745行: 第923行:
 
     }
 
     }
  
     console.log(loading);
+
    /*----------------- console loading urls ---------------*/
 +
    console.log("Character Image", loading.doll);
 +
    console.log("Background CG", loading.bg);
 +
     console.log("Background Music", loading.bgm);
 +
    console.log("Sound Effect", loading.se);
 +
    console.log("Common Effect", loading.eff);
 +
    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;
     $("#avgload").html("加载进度: PIC[" + loadingnow.doll + "/" + loadingfin.doll + "] CG[" + loadingnow.bg + "/" + loadingfin.bg + "] BGM[" + loadingnow.bgm + "/" + loadingfin.bgm + "]");
+
     loadingfin.se = loading.se.length;
 +
    loadingfin.eff = loading.eff.length;
 +
    loading_sub();
  
 
     for(i in loading.doll){
 
     for(i in loading.doll){
         var img = new Image();
+
         let img = new Image();
 
         $(img).load(function(){  
 
         $(img).load(function(){  
 
             if($(this).attr("file") == loadingfile) loadingnow.doll ++;  
 
             if($(this).attr("file") == loadingfile) loadingnow.doll ++;  
             $("#avgload").html("加载进度: PIC[" + loadingnow.doll + "/" + loadingfin.doll + "] CG[" + loadingnow.bg + "/" + loadingfin.bg + "] BGM[" + loadingnow.bgm + "/" + loadingfin.bgm + "]");
+
             loading_sub(); $(this).remove();
            $(this).remove();
 
 
         });  
 
         });  
         $(img).attr({"src":dollarray[loading.doll[i]], "file":loadingfile});
+
         $(img).attr({"src":dollarray[loading.doll[i].ID], "file":loadingfile});
 
     }
 
     }
 
     for(i in loading.bg){
 
     for(i in loading.bg){
         var img = new Image();
+
         let img = new Image();
 
         $(img).load(function(){  
 
         $(img).load(function(){  
 
             if($(this).attr("file") == loadingfile) loadingnow.bg ++;  
 
             if($(this).attr("file") == loadingfile) loadingnow.bg ++;  
             $("#avgload").html("加载进度: PIC[" + loadingnow.doll + "/" + loadingfin.doll + "] CG[" + loadingnow.bg + "/" + loadingfin.bg + "] BGM[" + loadingnow.bgm + "/" + loadingfin.bgm + "]");
+
             loading_sub(); $(this).remove();
            $(this).remove();
 
 
         });  
 
         });  
         $(img).attr({"src":bgarray[loading.bg[i]], "file":loadingfile});
+
         $(img).attr({"src":bgarray[loading.bg[i].ID], "file":loadingfile});
 
     }
 
     }
 
     for(i in loading.bgm){
 
     for(i in loading.bgm){
         var audio = new Audio();
+
         let audio = new Audio();
 
         audio.addEventListener("canplaythrough", function(){  
 
         audio.addEventListener("canplaythrough", function(){  
 
             if($(this).attr("file") == loadingfile) loadingnow.bgm ++;  
 
             if($(this).attr("file") == loadingfile) loadingnow.bgm ++;  
             $("#avgload").html("加载进度: PIC[" + loadingnow.doll + "/" + loadingfin.doll + "] CG[" + loadingnow.bg + "/" + loadingfin.bg + "] BGM[" + loadingnow.bgm + "/" + loadingfin.bgm + "]");
+
             loading_sub(); $(this).remove();
            $(this).remove();
+
        });
         });  
+
        $(audio).attr({"src":bgmarray[loading.bgm[i].ID], "file":loadingfile, "preload":"preload", "controls":"controls"});
         $(audio).attr({"src":bgmarray[loading.bgm[i]], "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){
 +
        let target_url = effarray[loading.eff[i].ID];
 +
        if(!target_url) {loadingnow.eff ++; continue;}
 +
        let target_type = target_url.slice(target_url.length - 3, target_url.length);
 +
        let new_element = (target_type == "png") ? document.createElement('img') : document.createElement('video');
 +
        if(target_type == "mp4") {
 +
            new_element.addEventListener("canplaythrough", function(){
 +
                if($(this).attr("file") == loadingfile) loadingnow.eff ++;
 +
                loading_sub(); $(this).remove();
 +
            });
 +
            $(new_element).attr({"src":effarray[loading.eff[i].ID], "file":loadingfile, "preload":"preload"});
 +
        } else if(target_type == "png") {
 +
            $(new_element).load(function(){
 +
                if($(this).attr("file") == loadingfile) loadingnow.eff ++;
 +
                loading_sub(); $(this).remove();
 +
            });
 +
            $(new_element).attr({"src":effarray[loading.eff[i].ID], "file":loadingfile});
 +
        }
 +
    }
 +
}
 +
 
 +
function loading_sub(){
 +
    $("#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 创建---------------------------*/
 +
function effect_creat(effect_name){
 +
    if(effect_name.slice(0, ("%%code=AVG_ink").length) == "%%code=AVG_ink") {
 +
        let new_element = document.createElement('video');
 +
        $(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).bind('ended', function(){ $(this).remove();});
 +
        $("#avgbox").append(new_element);
 +
         $("#avgbgm")[0].pause();
 +
    } else if(effect_name.slice(0, ("%%code=NPC_TV").length) == "%%code=NPC_TV"){
 +
        let new_element = document.createElement('img');
 +
         $(new_element).attr({"class":"avgefect", "src":effarray[effect_name]});
 +
        $(new_element).css({"position":"absolute", "width":"1200px", "top":"-262.5px", "z-index":"1"});
 +
        $("#avgbox").append(new_element);
 +
    } else if(effect_name == "%%code=changjing_huafen%%"){
 +
        return;
 
     }
 
     }
 
}
 
}
 
})
 
})
 
</script></includeonly>
 
</script></includeonly>

2023年6月13日 (二) 22:38的最新版本