Compare commits

..
2 Commits
2 changed files with 663 additions and 664 deletions
+110 -111
View File
@@ -6,9 +6,9 @@ var now_action_tag = '_2017_anti_entropy_now_action'
var now_galgame = 1 var now_galgame = 1
var sceneList = [] var sceneList = []
var characterData = [] var characterData = []
var now_scene = -1 //存放当前场景,存档 var now_scene = -1 // Stores the current scene for saves
var now_action = -1 var now_action = -1
var historyChoiceList = [] //用于记录当前场景的历史选择 var historyChoiceList = [] // Records choices made in the current scene
var uiImageList = new Array() var uiImageList = new Array()
var showInSceneList = new Array() var showInSceneList = new Array()
var date_url = '' var date_url = ''
@@ -45,13 +45,13 @@ uiImageList.push(
function tryAudio(pauseOrPlay, indexOrInner, countNumber) { function tryAudio(pauseOrPlay, indexOrInner, countNumber) {
var audio var audio
if (indexOrInner == 0) audio = $('#indexbgm')[0] if (indexOrInner == 0) audio = $('#indexbgm')[0]
else audio = $('#bgm')[0] //选择控件 else audio = $('#bgm')[0] // Selection control
if (pauseOrPlay == 0) { if (pauseOrPlay == 0) {
audio.pause() audio.pause()
if (!isNaN(audio.duration)) audio.currentTime = 0 if (!isNaN(audio.duration)) audio.currentTime = 0
if (indexOrInner == 0) indexAudioPlayingflag = false if (indexOrInner == 0) indexAudioPlayingflag = false
else innerAudioPlayingflag = false else innerAudioPlayingflag = false
return //暂停,立即执行 return // Pause and return immediately
} }
if (countNumber != 0) { if (countNumber != 0) {
if (indexOrInner == 0 && indexAudioPlayingflag == false) return if (indexOrInner == 0 && indexAudioPlayingflag == false) return
@@ -91,22 +91,22 @@ $(function () {
window.onresize = function () { window.onresize = function () {
check_size() check_size()
if (wrk_check_size()) window.scrollTo(0, 1) //隐藏浏览器工具栏 if (wrk_check_size()) window.scrollTo(0, 1) // Hide the browser toolbar
} }
window.addEventListener( window.addEventListener(
'orientationchange', 'orientationchange',
function () { function () {
window.scrollTo(0, 1) //隐藏浏览器工具栏 window.scrollTo(0, 1) // Hide the browser toolbar
}, },
false false
) )
//------------------------------------------------------ //------------------------------------------------------
//主框体单击响应事件------------------------------------ // Main frame click response------------------------------------
var listenScene //监听场景动向 var listenScene // Scene activity listener
var listenAction //监听行动列动向 var listenAction // Action list activity listener
var listenLoading //监听读档动向 var listenLoading // Save-load activity listener
var str_index_in_Autotype //打字机动画用 var str_index_in_Autotype // Used by the typewriter animation
function setListens(s, a, k) { function setListens(s, a, k) {
listenScene = s listenScene = s
@@ -116,30 +116,30 @@ function setListens(s, a, k) {
$('.galgame-content').click(function () { $('.galgame-content').click(function () {
if (listenScene != null && listenAction != null) { if (listenScene != null && listenAction != null) {
if (listenLoading != 1) nextAction(listenScene, listenAction) //进行下一步 if (listenLoading != 1) nextAction(listenScene, listenAction) // Proceed to the next step
else Action(listenScene, listenAction, listenLoading) //调回状态 else Action(listenScene, listenAction, listenLoading) // Restore the state
} else if (listenScene == null && listenAction == null && listenLoading != null) { } else if (listenScene == null && listenAction == null && listenLoading != null) {
if (listenLoading >= 0) { if (listenLoading >= 0) {
if (autoSpeed == 'typing') dialogAutoplay('stop') //自动播放的打字,优先关闭自动播放 if (autoSpeed == 'typing') dialogAutoplay('stop') // Stop autoplay before stopping typing
else str_index_in_autotype = listenLoading //打字机状态调整 else str_index_in_autotype = listenLoading // Adjust the typewriter state
} else if (listenLoading == -1) dialogAutoplay('stop') //处理自动播放变化 } else if (listenLoading == -1) dialogAutoplay('stop') // Handle autoplay changes
else if (listenLoading == -2) $('.dialog-overflow').stop(true, true) //立即结束滚屏动画 else if (listenLoading == -2) $('.dialog-overflow').stop(true, true) // End scrolling immediately
} }
}) })
var textSpeed = 75 var textSpeed = 75
//全局变量相关:打字机效果 // Global typewriter effect state
$.fn.autotype_text = function (gotoScene, gotoAction) { $.fn.autotype_text = function (gotoScene, gotoAction) {
var str var str
var timer_key var timer_key
var $pThis = $(this) var $pThis = $(this)
$('.dialog-overflow').scrollTop(0) //开始打字前校正滚动条位置 $('.dialog-overflow').scrollTop(0) // Reset scrolling before typing starts
if (autoSpeed != 'skip') { if (autoSpeed != 'skip') {
str = $pThis.html() str = $pThis.html()
if (str.indexOf('<') >= 0) { if (str.indexOf('<') >= 0) {
return return
} //注入了html文档的情形 } // The content contains injected HTML
if (isdialogAutoplay()) dialogAutoplayAutoStop('autotype') if (isdialogAutoplay()) dialogAutoplayAutoStop('autotype')
@@ -150,20 +150,20 @@ $.fn.autotype_text = function (gotoScene, gotoAction) {
timer_key = setInterval(function () { timer_key = setInterval(function () {
str_index_in_autotype++ str_index_in_autotype++
$pThis.html(str.substring(0, str_index_in_autotype)) //当前显示的文本长度 $pThis.html(str.substring(0, str_index_in_autotype)) // Display the current text length
if ($('.dialog-overflow')[0].scrollHeight > $('.dialog-overflow').height()) { if ($('.dialog-overflow')[0].scrollHeight > $('.dialog-overflow').height()) {
//超出内容一次性显示完毕 // Show all content when it exceeds the visible area
$pThis.html(str) $pThis.html(str)
str_index_in_autotype = str.length str_index_in_autotype = str.length
} }
if (isdialogAutoplay()) { if (isdialogAutoplay()) {
//打字动画中自动播放开启 // Autoplay was enabled during the typing animation
$pThis.html(str) $pThis.html(str)
str_index_in_autotype = str.length str_index_in_autotype = str.length
} }
if (str_index_in_autotype >= str.length) { if (str_index_in_autotype >= str.length) {
clearInterval(timer_key) //结束setInterval的定时循环 clearInterval(timer_key) // End the setInterval loop
if (isdialogAutoplay()) { if (isdialogAutoplay()) {
if (autoSpeed == 'auto') { if (autoSpeed == 'auto') {
dialogAutoplay('countinue') dialogAutoplay('countinue')
@@ -178,10 +178,10 @@ $.fn.autotype_text = function (gotoScene, gotoAction) {
} }
} }
//全局变量相关:自动播放 // Global autoplay state
var dialogAutoplayFlag = -1 //控制自动播放 var dialogAutoplayFlag = -1 // Controls autoplay
var timer_Autoplay //每次单击调用的是同一个timer var timer_Autoplay // The same timer is used for every click
var autoSpeed = 'stop' //skip和autoplay的速度变量 var autoSpeed = 'stop' // Speed mode for skip and autoplay
$('.dialog-btn-autoplay').click(function (e) { $('.dialog-btn-autoplay').click(function (e) {
e.stopPropagation() e.stopPropagation()
@@ -199,7 +199,7 @@ $('.dialog-btn-autoplay').click(function (e) {
$('.dialog-btn-skip').click(function (e) { $('.dialog-btn-skip').click(function (e) {
e.stopPropagation() e.stopPropagation()
if (listenScene == null && listenAction == null && listenLoading != null) { if (listenScene == null && listenAction == null && listenLoading != null) {
if (listenLoading >= 0) str_index_in_autotype = listenLoading //打字机状态调整 if (listenLoading >= 0) str_index_in_autotype = listenLoading // Adjust the typewriter state
} }
dialogAutoplay('skip') dialogAutoplay('skip')
}) })
@@ -207,17 +207,17 @@ $('.dialog-btn-skip').click(function (e) {
function dialogAutoplay(keySpeed) { function dialogAutoplay(keySpeed) {
var tempTimeout var tempTimeout
if (keySpeed == null || keySpeed == 'auto' || keySpeed == 'countinue') { if (keySpeed == null || keySpeed == 'auto' || keySpeed == 'countinue') {
//按下auto // Auto was pressed
if (autoSpeed == 'skip' && isdialogAutoplay()) { if (autoSpeed == 'skip' && isdialogAutoplay()) {
//在skip时按下auto // Auto was pressed while skipping
dialogAutoplayAutoStop() dialogAutoplayAutoStop()
} }
autoSpeed = 'auto' autoSpeed = 'auto'
$('.dialog-btn-autoplay').addClass('dialog-btn-autoplay-on') $('.dialog-btn-autoplay').addClass('dialog-btn-autoplay-on')
} else if (keySpeed == 'skip') { } else if (keySpeed == 'skip') {
//按下skip // Skip was pressed
if (autoSpeed == 'auto' && isdialogAutoplay()) { if (autoSpeed == 'auto' && isdialogAutoplay()) {
//在auto时按下skip // Skip was pressed while autoplaying
dialogAutoplayAutoStop() dialogAutoplayAutoStop()
} }
autoSpeed = 'skip' autoSpeed = 'skip'
@@ -228,7 +228,7 @@ function dialogAutoplay(keySpeed) {
} }
changedialogAutoplayFlag() changedialogAutoplayFlag()
if (isdialogAutoplay()) { if (isdialogAutoplay()) {
setListens(null, null, -1) //主操作响应事件改变 setListens(null, null, -1) // Change the main input response
if (keySpeed == 'countinue') { if (keySpeed == 'countinue') {
tempTimeout = baseTime() tempTimeout = baseTime()
} else { } else {
@@ -310,7 +310,7 @@ function dialogAutoplayAutoStop(keyFlag) {
} }
//------------------------------------------------------ //------------------------------------------------------
//CG展示 // CG display
var cgPageIndex = 0 var cgPageIndex = 0
var cgPageLength = 0 var cgPageLength = 0
var cgListTemp = null var cgListTemp = null
@@ -357,10 +357,9 @@ function cgPage(page, flag) {
j++ j++
} }
preLoadUiImages('cg', cgImageList) preLoadUiImages('cg', cgImageList)
//检测预加载图片是否加载完毕 // Check whether preloaded images have finished loading
if (preLoadImagesCheck() > 0) { if (preLoadImagesCheck() > 0) {
//如果已经预载过 // Already preloaded; load the images
//加载
j = 0 j = 0
for (i in cgListSort) { for (i in cgListSort) {
if (j >= page * 4 && j < (page + 1) * 4) { if (j >= page * 4 && j < (page + 1) * 4) {
@@ -387,9 +386,9 @@ function cgPage(page, flag) {
var i var i
var j var j
if (preLoadImagesCheck() > 0 || countIndexTimer > 1000) { if (preLoadImagesCheck() > 0 || countIndexTimer > 1000) {
//图片预载完毕,或者超时 // Images are preloaded or the timeout was reached
clearTimeout(preLoadImagesTimer) clearTimeout(preLoadImagesTimer)
//加载 // Load the images
j = 0 j = 0
for (i in cgListSort) { for (i in cgListSort) {
if (j >= page * 4 && j < (page + 1) * 4) { if (j >= page * 4 && j < (page + 1) * 4) {
@@ -455,7 +454,7 @@ function generate_all_characterData(name) {
}) })
if (!xmlDoc) return if (!xmlDoc) return
if (characterData.length) { if (characterData.length) {
//此时xml已经载入过 // The XML has already been loaded
var imageList = xmlDoc.getElementsByTagName('image') var imageList = xmlDoc.getElementsByTagName('image')
preLoadImagesBegin(imageList) preLoadImagesBegin(imageList)
return return
@@ -464,7 +463,7 @@ function generate_all_characterData(name) {
generate_all_characterData(name) generate_all_characterData(name)
}) })
if (!xmlDoc) return if (!xmlDoc) return
//此时characterData还是空的,从下面开始读入 // characterData is still empty; populate it below
var characterList = xmlDoc.getElementsByTagName('character') var characterList = xmlDoc.getElementsByTagName('character')
for (j = 0; j < characterList.length; j++) { for (j = 0; j < characterList.length; j++) {
var newCharacter = {} var newCharacter = {}
@@ -509,7 +508,7 @@ function generate_all_characterData(name) {
) )
} }
} }
//此时xml已经载入过 // The XML has already been loaded
xmlDoc = loadExistXmlFile(name) xmlDoc = loadExistXmlFile(name)
var imageList = xmlDoc.getElementsByTagName('image') var imageList = xmlDoc.getElementsByTagName('image')
preLoadImagesBegin(imageList) preLoadImagesBegin(imageList)
@@ -533,7 +532,7 @@ function galgame(name) {
galgame(name) galgame(name)
}) })
if (!xmlDoc) return if (!xmlDoc) return
//--让scene的id在sceneList中有意义 //-- Make scene IDs meaningful in sceneList
var sceneList0 = [] var sceneList0 = []
sceneList0 = xmlDoc.getElementsByTagName('scene') sceneList0 = xmlDoc.getElementsByTagName('scene')
sceneList = new Array() sceneList = new Array()
@@ -547,7 +546,7 @@ function galgame(name) {
} }
for (j = 0; uselessTexts[j] != null; j++) { for (j = 0; uselessTexts[j] != null; j++) {
thisSceneTemp.removeChild(uselessTexts[j]) thisSceneTemp.removeChild(uselessTexts[j])
} //在此处清除所有#text } // Remove all #text nodes here
j = thisSceneTemp.getAttribute('id') j = thisSceneTemp.getAttribute('id')
sceneList[Number(j)] = thisSceneTemp sceneList[Number(j)] = thisSceneTemp
sceneList0[i] = null sceneList0[i] = null
@@ -588,9 +587,9 @@ function checkTextScroll() {
textLenth: (baseTime() / 5) * ((scrollTop1 - scrollTop0) / lineHeight) textLenth: (baseTime() / 5) * ((scrollTop1 - scrollTop0) / lineHeight)
} }
} else if (scrollTop0 + showHeight < scrollHeight0 - lineHeight / 5) { } else if (scrollTop0 + showHeight < scrollHeight0 - lineHeight / 5) {
return { scrollTop: scrollTop1, textLenth: baseTime() / 20 } //误差累积的情形 return { scrollTop: scrollTop1, textLenth: baseTime() / 20 } // Handle accumulated error
} else { } else {
return null //到底了 return null // Already at the bottom
} }
} }
@@ -600,10 +599,10 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) {
//console.log("action: " + gotoScene + ', ' + gotoAction + ', ' +skipKey + ', ' + loadKey2 + '; autoSpeed:' + autoSpeed) ; //console.log("action: " + gotoScene + ', ' + gotoAction + ', ' +skipKey + ', ' + loadKey2 + '; autoSpeed:' + autoSpeed) ;
var thisScene var thisScene
var thisEvent var thisEvent
//首先判断文本滚动的情况,优先显示完毕当前文本 // Handle text scrolling first so the current text is shown completely
checkTextScrollLastMove = 0 checkTextScrollLastMove = 0
if (!skipKey && autoSpeed != 'skip' && gotoScene == now_scene) { if (!skipKey && autoSpeed != 'skip' && gotoScene == now_scene) {
//如果不是读档的情形 // Not loading a saved game
var checkTextScroll_answer = checkTextScroll() var checkTextScroll_answer = checkTextScroll()
if (checkTextScroll_answer != null) { if (checkTextScroll_answer != null) {
checkTextScrollLastMove = checkTextScroll_answer.textLenth * 5 * 2.5 checkTextScrollLastMove = checkTextScroll_answer.textLenth * 5 * 2.5
@@ -616,7 +615,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) {
}, },
step: function () { step: function () {
if (autoSpeed == 'stop') { if (autoSpeed == 'stop') {
setListens(null, null, -2) //单击事件变成快速完成动画 setListens(null, null, -2) // Make a click complete the animation immediately
} else if (autoSpeed == 'skip') { } else if (autoSpeed == 'skip') {
$('.dialog-overflow').stop(true, true) $('.dialog-overflow').stop(true, true)
} }
@@ -640,7 +639,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) {
return return
} }
} }
if (autoSpeed == 'stop') setListens(gotoScene, gotoAction) //普通状态 if (autoSpeed == 'stop') setListens(gotoScene, gotoAction) // Normal state
//-- //--
remark_btn_hide() remark_btn_hide()
$('.choice_list').hide() $('.choice_list').hide()
@@ -649,7 +648,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) {
thisScene = sceneList[gotoScene] thisScene = sceneList[gotoScene]
if (gotoAction < 2) { if (gotoAction < 2) {
historyChoiceList = new Array() //清空选择标记 historyChoiceList = new Array() // Clear choice markers
} }
thisEvent = thisScene.childNodes[gotoAction] thisEvent = thisScene.childNodes[gotoAction]
@@ -669,7 +668,7 @@ function Action(gotoScene, gotoAction, skipKey, loadKey2) {
.css( .css(
'background', 'background',
"url('" + base_url + '/resources/background/' + thisScene.getAttribute('background') + "') no-repeat" "url('" + base_url + '/resources/background/' + thisScene.getAttribute('background') + "') no-repeat"
) //附加属性 white去除 否则会一瞬间跳白 ) // Remove the white attribute to prevent a brief white flash
.css('background-size', size + ' ' + size) .css('background-size', size + ' ' + size)
.css('background-position', 'center') .css('background-position', 'center')
} }
@@ -698,9 +697,9 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
switch (act.nodeName) { switch (act.nodeName) {
case 'cg': case 'cg':
if (skipKey) { if (skipKey) {
if (loadKey2) return //读档时跳过CG if (loadKey2) return // Skip CG while loading a save
} }
dialogAutoplay('stop') //强制终止自动播放 dialogAutoplay('stop') // Force autoplay to stop
lastEventNode = gotoAction lastEventNode = gotoAction
$('#all').hide() $('#all').hide()
var fadeInTimeCG = 300 var fadeInTimeCG = 300
@@ -741,7 +740,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
lastEventNode = gotoAction lastEventNode = gotoAction
$('#all').hide() $('#all').hide()
if (skipKey || autoSpeed == 'skip') { if (skipKey || autoSpeed == 'skip') {
//快速播放或读档时跳过 // Skip during fast playback or while loading a save
return return
} }
var time = 0.5 var time = 0.5
@@ -775,7 +774,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
case 'shake': case 'shake':
lastEventNode = gotoAction lastEventNode = gotoAction
if (skipKey || autoSpeed == 'skip') { if (skipKey || autoSpeed == 'skip') {
//快速播放或读档时跳过 // Skip during fast playback or while loading a save
return return
} }
var time = Number(act.getAttribute('time')) var time = Number(act.getAttribute('time'))
@@ -792,7 +791,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
case 'text': case 'text':
lastEventNode = gotoAction lastEventNode = gotoAction
ClearDialog() //清除临时加载的格式 ClearDialog() // Clear temporarily loaded formatting
$('.dialog-chara').hide() $('.dialog-chara').hide()
post_achievement_in_event(act) post_achievement_in_event(act)
var tempAttribute = act.getAttribute('article') var tempAttribute = act.getAttribute('article')
@@ -832,7 +831,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
case 'speak': case 'speak':
lastEventNode = gotoAction lastEventNode = gotoAction
ClearDialog() //清除临时加载的格式 ClearDialog() // Clear temporarily loaded formatting
post_achievement_in_event(act) post_achievement_in_event(act)
$('.dialog').removeClass('dialog_article') $('.dialog').removeClass('dialog_article')
$('.dialog-overflow').removeClass('dialog-overflow_article').removeClass('dialog-overflow_article_center') $('.dialog-overflow').removeClass('dialog-overflow_article').removeClass('dialog-overflow_article_center')
@@ -858,9 +857,9 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
case 'choices': case 'choices':
lastEventNode = gotoAction lastEventNode = gotoAction
if (skipKey) { if (skipKey) {
if (loadKey2) return //读档过程中,跳过 if (loadKey2) return // Skip while loading a save
} }
dialogAutoplay('stop') //强制终止自动播放 dialogAutoplay('stop') // Force autoplay to stop
var choiceList = act.childNodes var choiceList = act.childNodes
var choices = [] var choices = []
for (var i = 0; i < choiceList.length; i++) { for (var i = 0; i < choiceList.length; i++) {
@@ -871,7 +870,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
text: getText(choiceList[i]), text: getText(choiceList[i]),
continueScene: gotoScene, continueScene: gotoScene,
continueAction: gotoAction continueAction: gotoAction
}) //选择肢无影响 }) // This choice has no effect
} else { } else {
choices.push({ choices.push({
text: getText(choiceList[i]), text: getText(choiceList[i]),
@@ -958,7 +957,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
case 'end': case 'end':
lastEventNode = gotoAction lastEventNode = gotoAction
dialogAutoplay('stop') //强制终止自动播放 dialogAutoplay('stop') // Force autoplay to stop
post_achievement_in_event(act) post_achievement_in_event(act)
if (act.getAttribute('last')) { if (act.getAttribute('last')) {
endGame(-1) endGame(-1)
@@ -973,7 +972,7 @@ function processAction(act, gotoScene, gotoAction, skipKey, loadKey2) {
case 'sound': case 'sound':
lastEventNode = gotoAction lastEventNode = gotoAction
if (skipKey || autoSpeed == 'skip') { if (skipKey || autoSpeed == 'skip') {
//读档或快进跳过历史音效 // Skip historical sound effects while loading or fast-forwarding
return return
} }
var sound = $('#sound')[0] var sound = $('#sound')[0]
@@ -1059,11 +1058,11 @@ function gotoA(sceneKey, change, skipKey) {
changeColour = null changeColour = null
} }
} }
if (changeColour) dialogAutoplay('stop') //强制终止自动播放 if (changeColour) dialogAutoplay('stop') // Force autoplay to stop
$('.white').removeClass().addClass('white').hide() //容错 $('.white').removeClass().addClass('white').hide() // Error recovery
$('.background').css('transition-duration', '0ms').css('transform', 'scale(1,1)').css('transform-origin', 'center') $('.background').css('transition-duration', '0ms').css('transform', 'scale(1,1)').css('transform-origin', 'center')
if (changeColour) { if (changeColour) {
setListens() //单击暂时无响应 setListens() // Temporarily ignore clicks
$('.white') $('.white')
.css('background', changeColour) .css('background', changeColour)
.fadeIn(changeTime, function () { .fadeIn(changeTime, function () {
@@ -1079,9 +1078,9 @@ function gotoA(sceneKey, change, skipKey) {
var actionTimer var actionTimer
function nextAction(nowScene, nowAction, nowKey) { function nextAction(nowScene, nowAction, nowKey) {
systemAutoSave() //自动保存 systemAutoSave() // Auto-save
if (!isdialogAutoplay()) { if (!isdialogAutoplay()) {
setListens() //单击暂时无响应 setListens() // Temporarily ignore clicks
} }
if (actionTimer) { if (actionTimer) {
clearTimeout(actionTimer) clearTimeout(actionTimer)
@@ -1098,9 +1097,9 @@ function RefreshDialog(dialog_text, gotoScene, gotoAction, typeLoad, textColour)
return "url('" + base_url + '/resources/background/' + $('div.article-pic')[n].getAttribute('picsrc') + "')" return "url('" + base_url + '/resources/background/' + $('div.article-pic')[n].getAttribute('picsrc') + "')"
}) })
if (checkTextScroll() == null) { if (checkTextScroll() == null) {
$('.dialog-overflow_article').addClass('dialog-overflow_article_center') //居中 $('.dialog-overflow_article').addClass('dialog-overflow_article_center') // Center the text
} else { } else {
$('.dialog-overflow_article').removeClass('dialog-overflow_article_center') //取消居中 $('.dialog-overflow_article').removeClass('dialog-overflow_article_center') // Disable centering
} }
if (textColour != null) $('.dialog-text').css('color', textColour) if (textColour != null) $('.dialog-text').css('color', textColour)
else $('.dialog-text').css('color', '#ffffff') else $('.dialog-text').css('color', '#ffffff')
@@ -1130,7 +1129,7 @@ function ShowDialog(mode, content) {
c3: i c3: i
}, },
function (e) { function (e) {
historyChoiceList[e.data.c2] = e.data.c3 // 记录非转场选择 historyChoiceList[e.data.c2] = e.data.c3 // Record a choice without a scene transition
nextAction(e.data.c1, e.data.c2) nextAction(e.data.c1, e.data.c2)
$('.choice_list').hide() $('.choice_list').hide()
$('.choice_list').html('') $('.choice_list').html('')
@@ -1205,7 +1204,7 @@ function ToggleWindow(mode) {
} }
///////////////////////////////// /////////////////////////////////
//自动存档---------------------------------------------------------- // Automatic saves----------------------------------------------------------
function systemAutoSave() { function systemAutoSave() {
setCookie(now_galgame_tag, now_galgame) setCookie(now_galgame_tag, now_galgame)
setCookie(now_scene_tag, now_scene) setCookie(now_scene_tag, now_scene)
@@ -1265,7 +1264,7 @@ function startGame(galgameKey, loadKey) {
return return
} }
startLoad() startLoad()
//catalogListTemp 和 catalogListLength都是全局变量,注意 // catalogListTemp and catalogListLength are global variables
var xmlDoc = loadExistXmlFile('catalog_list', function () { var xmlDoc = loadExistXmlFile('catalog_list', function () {
catalogListTemp = xml_files_all_in_this['catalog_list'].getElementsByTagName('log') catalogListTemp = xml_files_all_in_this['catalog_list'].getElementsByTagName('log')
catalogListLength = catalogListTemp.length catalogListLength = catalogListTemp.length
@@ -1275,26 +1274,26 @@ function startGame(galgameKey, loadKey) {
if (!xmlDoc) return if (!xmlDoc) return
for (var i = 0; i < catalogListLength; i++) { for (var i = 0; i < catalogListLength; i++) {
if (getText(catalogListTemp[i]) == galgameKey) { if (getText(catalogListTemp[i]) == galgameKey) {
playKey = galgameKey //传入的是文件名 playKey = galgameKey // The input is a filename
break break
} }
if (catalogListTemp[i].getAttribute('id') == galgameKey) { if (catalogListTemp[i].getAttribute('id') == galgameKey) {
playKey = getText(catalogListTemp[i]) //传入的是ID playKey = getText(catalogListTemp[i]) // The input is an ID
break break
} }
} }
if (playKey != galgameKey && Number(galgameKey) < 1) { if (playKey != galgameKey && Number(galgameKey) < 1) {
i-- i--
playKey = getText(catalogListTemp[i]) //无效参数,读取最新章节 playKey = getText(catalogListTemp[i]) // Invalid parameter; load the latest chapter
} else if (i >= catalogListLength) { } else if (i >= catalogListLength) {
//传入的可能是章节列表中的数组序号,所以之前的循环中没有检测到任何结果 // The input may be an index in the chapter list, so the previous loop found no match
if (catalogListTemp[Number(galgameKey) - 1] != null) { if (catalogListTemp[Number(galgameKey) - 1] != null) {
playKey = getText(catalogListTemp[Number(galgameKey) - 1]) playKey = getText(catalogListTemp[Number(galgameKey) - 1])
i = Number(galgameKey) - 1 i = Number(galgameKey) - 1
} else { } else {
LoadFinish() LoadFinish()
thanksWords() thanksWords()
return //章节到头 return // No more chapters
} }
} }
@@ -1318,21 +1317,21 @@ function startGame(galgameKey, loadKey) {
// } else if (GetQueryString("from") == "cd") { // } else if (GetQueryString("from") == "cd") {
// pv("gameStart_" + now_galgame + "_CD"); // pv("gameStart_" + now_galgame + "_CD");
// } // }
//检测预加载图片是否加载完毕 // Check whether preloaded images have finished loading
var countIndexTimer = 0 var countIndexTimer = 0
var preLoadImagesTimer = setInterval(function () { var preLoadImagesTimer = setInterval(function () {
if (!loadExistXmlFile(playKey, function () {})) { if (!loadExistXmlFile(playKey, function () {})) {
//xml声明加载不受超时限制 // XML declaration loading is not subject to the timeout
countIndexTimer++ countIndexTimer++
return return
} }
if (!characterData.length) { if (!characterData.length) {
//xml声明加载不受超时限制 // XML declaration loading is not subject to the timeout
countIndexTimer++ countIndexTimer++
return return
} }
if (preLoadImagesCheck() > 0 || countIndexTimer > 100) { if (preLoadImagesCheck() > 0 || countIndexTimer > 100) {
//图片加载完毕,或者超时 // Images have loaded or the timeout was reached
clearTimeout(preLoadImagesTimer) clearTimeout(preLoadImagesTimer)
$('.cg').css('display', 'none') $('.cg').css('display', 'none')
$('.transition').fadeIn(300, function () { $('.transition').fadeIn(300, function () {
@@ -1374,7 +1373,7 @@ function preLoadUiImages(resStr, resList, flag_continue) {
.bind('error', function () { .bind('error', function () {
var count = $(this).data('retryCount') var count = $(this).data('retryCount')
if (count < 5) { if (count < 5) {
//尝试次数 // Retry count
$(this).data('retryCount', count + 1) $(this).data('retryCount', count + 1)
this.src = this.src this.src = this.src
} }
@@ -1384,12 +1383,12 @@ function preLoadUiImages(resStr, resList, flag_continue) {
} }
function preLoadImagesBegin(imageList) { function preLoadImagesBegin(imageList) {
showInSceneList = new Array() //清空立绘缓存名单 showInSceneList = new Array() // Clear the character image cache list
bgInSceneList = new Array() bgInSceneList = new Array()
cgInSceneList = new Array() cgInSceneList = new Array()
var charaDefErrorList = new Array() var charaDefErrorList = new Array()
for (i in sceneList) { for (i in sceneList) {
var thisScene = sceneList[i] //场景列表在流程上已被读取 var thisScene = sceneList[i] // The scene list has already been loaded
var thisBgFileName = thisScene.getAttribute('background') var thisBgFileName = thisScene.getAttribute('background')
if (thisBgFileName.length) { if (thisBgFileName.length) {
if ($.inArray(thisBgFileName, bgInSceneList) < 0 && $.inArray('.', thisBgFileName) > 0) { if ($.inArray(thisBgFileName, bgInSceneList) < 0 && $.inArray('.', thisBgFileName) > 0) {
@@ -1403,7 +1402,7 @@ function preLoadImagesBegin(imageList) {
if (chara) { if (chara) {
if (characterData[chara]) { if (characterData[chara]) {
if ($.inArray(characterData[chara]['src'], showInSceneList) < 0) { if ($.inArray(characterData[chara]['src'], showInSceneList) < 0) {
showInSceneList.push(characterData[chara]['src']) //只存储确实使用过且被声明的立绘 showInSceneList.push(characterData[chara]['src']) // Store only declared character images that are used
} }
} else if (!charaDefErrorList[chara]) { } else if (!charaDefErrorList[chara]) {
console.log('Defination Error: ' + chara) console.log('Defination Error: ' + chara)
@@ -1457,7 +1456,7 @@ function preLoadImagesBegin(imageList) {
.bind('error', function () { .bind('error', function () {
var count = $(this).data('retryCount') var count = $(this).data('retryCount')
if (count < 5) { if (count < 5) {
//尝试次数 // Retry count
$(this).data('retryCount', count + 1) $(this).data('retryCount', count + 1)
this.src = this.src this.src = this.src
} }
@@ -1473,7 +1472,7 @@ function preLoadImagesBegin(imageList) {
.bind('error', function () { .bind('error', function () {
var count = $(this).data('retryCount') var count = $(this).data('retryCount')
if (count < 5) { if (count < 5) {
//尝试次数 // Retry count
$(this).data('retryCount', count + 1) $(this).data('retryCount', count + 1)
this.src = this.src this.src = this.src
} }
@@ -1563,7 +1562,7 @@ function ShowUi(dialog, chara) {
} }
function ToggleCloseButton(close_obj) { function ToggleCloseButton(close_obj) {
//功能是否已经变化? // Has the state changed?
var close_btn_data = $('.close_btn').attr('data') var close_btn_data = $('.close_btn').attr('data')
if (close_btn_data) { if (close_btn_data) {
$('.close_btn').toggle() $('.close_btn').toggle()
@@ -1575,7 +1574,7 @@ function ToggleCloseButton(close_obj) {
} }
} }
//读档存档 // Save and load
function add_record() { function add_record() {
dialogAutoplay('stop') dialogAutoplay('stop')
$('#confirm_1').html( $('#confirm_1').html(
@@ -1668,11 +1667,11 @@ function browserRedirect() {
function check_size() { function check_size() {
var winWidth var winWidth
var winHeight var winHeight
//获取窗口宽度 // Get the window width
if (window.innerWidth) { if (window.innerWidth) {
winWidth = window.innerWidth winWidth = window.innerWidth
} else if (document.body && document.body.clientWidth) { } else if (document.body && document.body.clientWidth) {
winWidth = document.body.clientWidth //获取窗口高度 winWidth = document.body.clientWidth // Get the window height
} }
winWidth = parseInt(winWidth) winWidth = parseInt(winWidth)
if (window.innerHeight) { if (window.innerHeight) {
@@ -1681,7 +1680,7 @@ function check_size() {
winHeight = document.body.clientHeight winHeight = document.body.clientHeight
} }
winHeight = parseInt(winHeight) winHeight = parseInt(winHeight)
//通过深入Document内部对body进行检测,获取窗口大小 // Inspect the document to determine the window size
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
winHeight = document.documentElement.clientHeight winHeight = document.documentElement.clientHeight
winWidth = document.documentElement.clientWidth winWidth = document.documentElement.clientWidth
@@ -1708,7 +1707,7 @@ function check_size() {
.css('left', ($('.black').width() - $('.frame').width()) / 2 + 'px') .css('left', ($('.black').width() - $('.frame').width()) / 2 + 'px')
.css('top', ($('.black').height() - $('.frame').height()) / 2 + 'px') .css('top', ($('.black').height() - $('.frame').height()) / 2 + 'px')
window.scrollTo(0, 1) //隐藏浏览器工具栏 window.scrollTo(0, 1) // Hide the browser toolbar
} }
// CUSTOM: requests XML from user-configurable xmlPath, if it fails, it'll fall back to main VN repo // CUSTOM: requests XML from user-configurable xmlPath, if it fails, it'll fall back to main VN repo
@@ -1743,7 +1742,7 @@ function loadExistXmlFile(xmlName, callBack, fileType) {
if (xml_files_all_in_this.hasOwnProperty(xmlName)) { if (xml_files_all_in_this.hasOwnProperty(xmlName)) {
return xml_files_all_in_this[xmlName] return xml_files_all_in_this[xmlName]
} else if (loading_xml_files.hasOwnProperty(xmlName)) { } else if (loading_xml_files.hasOwnProperty(xmlName)) {
return null //排除意外并发 return null // Prevent unexpected concurrent loads
} else { } else {
loading_xml_files[xmlName] = true loading_xml_files[xmlName] = true
//console.log(xmlName + ' start load'); //console.log(xmlName + ' start load');
@@ -1762,14 +1761,14 @@ function loadExistXmlFile(xmlName, callBack, fileType) {
function getText(e) { function getText(e) {
var t = '' var t = ''
if (!e) return null if (!e) return null
e = e.childNodes || e //如果传入的是元素,则继续遍历其子元素;否则假定它是一个数组 e = e.childNodes || e // Traverse child nodes for elements; otherwise assume an array
for (var i = 0; i < e.length; i++) { for (var i = 0; i < e.length; i++) {
//如果不是元素,追回其文本值; // Append the text value when this is not an element;
//否则,递归遍历所有元素的子节点; // Otherwise, recursively traverse all child nodes;
if (e[i].nodeType) { if (e[i].nodeType) {
t += e[i].nodeType != 1 ? e[i].nodeValue : getText(e[i].childNodes) t += e[i].nodeType != 1 ? e[i].nodeValue : getText(e[i].childNodes)
} else { } else {
t += e[i] //字符串的情形 t += e[i] // String input
} }
} }
return t return t
@@ -1791,7 +1790,7 @@ function base64Decode(input) {
} }
//------------------------------------------------------- //-------------------------------------------------------
//Catalog 目录界面 // Catalog interface
var catalogPageIndex = 0 var catalogPageIndex = 0
var catalogListLength = 0 var catalogListLength = 0
var catalogListTemp = null var catalogListTemp = null
@@ -2088,7 +2087,7 @@ $('.pagenum#pagenum-7').click(function () {
$('.pagenum#pagenum-7').addClass('pagenum-gray') $('.pagenum#pagenum-7').addClass('pagenum-gray')
} }
} }
}) //向前 }) // Previous page
$('.pagenum#pagenum-8').click(function () { $('.pagenum#pagenum-8').click(function () {
if ((catalogPageIndex + 1) * 2 < catalogListLength) { if ((catalogPageIndex + 1) * 2 < catalogListLength) {
@@ -2101,7 +2100,7 @@ $('.pagenum#pagenum-8').click(function () {
$('.pagenum#pagenum-8').addClass('pagenum-gray') $('.pagenum#pagenum-8').addClass('pagenum-gray')
} }
} }
}) //向后 }) // Next page
function showCatalogFrame(page) { function showCatalogFrame(page) {
//new //new
@@ -2117,7 +2116,7 @@ function setCookie(name, value) {
localStorage.setItem(name, value) localStorage.setItem(name, value)
} }
///删除cookie /// Delete cookie
function delCookie(name) { function delCookie(name) {
// var exp = new Date(); // var exp = new Date();
// exp.setTime(exp.getTime() - 1); // exp.setTime(exp.getTime() - 1);
@@ -2126,7 +2125,7 @@ function delCookie(name) {
localStorage.removeItem(name) localStorage.removeItem(name)
} }
//读取cookie // Read cookie
function getCookie(name) { function getCookie(name) {
// var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); // var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"));
// if (arr != null) return unescape(arr[2]); // if (arr != null) return unescape(arr[2]);
@@ -2141,7 +2140,7 @@ function GetQueryString(_name) {
return null return null
} }
//历史纪录相关------------------------------------------------------ // History ------------------------------------------------------
$('.dialog-btn-history').click(function (e) { $('.dialog-btn-history').click(function (e) {
e.stopPropagation() e.stopPropagation()
showHistory() showHistory()
@@ -2256,7 +2255,7 @@ function hideHistory() {
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
//文本注释系统相关------------------------------------------------ // Text annotation system ------------------------------------------------
$('.remark').hide() $('.remark').hide()
remark_btn_hide() remark_btn_hide()
@@ -2333,10 +2332,10 @@ function wrk_get_size() {
if (window.innerWidth) winWidth = window.innerWidth if (window.innerWidth) winWidth = window.innerWidth
else if (document.body && document.body.clientWidth) winWidth = document.body.clientWidth else if (document.body && document.body.clientWidth) winWidth = document.body.clientWidth
//获取窗口高度 // Get the window height
if (window.innerHeight) winHeight = window.innerHeight if (window.innerHeight) winHeight = window.innerHeight
else if (document.body && document.body.clientHeight) winHeight = document.body.clientHeight else if (document.body && document.body.clientHeight) winHeight = document.body.clientHeight
//通过深入Document内部对body进行检测,获取窗口大小 // Inspect the document to determine the window size
if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
winHeight = document.documentElement.clientHeight winHeight = document.documentElement.clientHeight
winWidth = document.documentElement.clientWidth winWidth = document.documentElement.clientWidth
@@ -2490,11 +2489,11 @@ function portraitPage(typeReturn) {
} }
} }
preLoadUiImages('achievement', achievementImageList) preLoadUiImages('achievement', achievementImageList)
//检测预加载图片是否加载完毕 // Check whether preloaded images have finished loading
var countIndexTimer = 0 var countIndexTimer = 0
var preLoadImagesTimer = setInterval(function () { var preLoadImagesTimer = setInterval(function () {
if (preLoadImagesCheck() > 0 || countIndexTimer > 1000) { if (preLoadImagesCheck() > 0 || countIndexTimer > 1000) {
//图片预载完毕,或者超时 // Images are preloaded or the timeout was reached
clearTimeout(preLoadImagesTimer) clearTimeout(preLoadImagesTimer)
$('#family-portrait').addClass('family-portrait') $('#family-portrait').addClass('family-portrait')
$('#achievement-exhibition').addClass('achievement-exhibition') $('#achievement-exhibition').addClass('achievement-exhibition')
+517 -517
View File
File diff suppressed because it is too large Load Diff