-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0330/reset-window] 画面初期表示と画面消去を統一 #938
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1676,6 +1676,8 @@ function loadSettingJs() { | |
} | ||
|
||
function loadMusic() { | ||
|
||
clearWindow(); | ||
document.onkeydown = evt => blockCode(transCode(evt.code)); | ||
|
||
const musicUrl = g_headerObj.musicUrls[g_headerObj.musicNos[g_stateObj.scoreId]] || g_headerObj.musicUrls[0]; | ||
|
@@ -2021,6 +2023,8 @@ function drawTitleResultMotion(_spriteName) { | |
* タイトル画面初期化 | ||
*/ | ||
function titleInit() { | ||
|
||
clearWindow(); | ||
drawDefaultBackImage(``); | ||
|
||
// タイトル用フレーム初期化 | ||
|
@@ -2182,7 +2186,6 @@ function titleInit() { | |
// Click Here | ||
createCss2Button(`btnStart`, `Click Here!!`, _ => { | ||
clearTimeout(g_timeoutEvtTitleId); | ||
clearWindow(); | ||
optionInit(); | ||
}, { | ||
w: g_sWidth, siz: C_LBL_TITLESIZE, | ||
|
@@ -2329,7 +2332,6 @@ function titleInit() { | |
|
||
if (setCode === `Enter`) { | ||
clearTimeout(g_timeoutEvtTitleId); | ||
clearWindow(); | ||
optionInit(); | ||
} | ||
return blockCode(setCode); | ||
|
@@ -3475,6 +3477,7 @@ function keysConvert(_dosObj) { | |
*/ | ||
function optionInit() { | ||
|
||
clearWindow(); | ||
drawDefaultBackImage(``); | ||
const divRoot = document.querySelector(`#divRoot`); | ||
g_baseDisp = `Settings`; | ||
|
@@ -3497,35 +3500,21 @@ function optionInit() { | |
multiAppend(divRoot, | ||
|
||
// タイトル画面へ戻る | ||
createCss2Button(`btnBack`, `Back`, _ => { | ||
clearWindow(); | ||
titleInit(); | ||
}, { | ||
createCss2Button(`btnBack`, `Back`, _ => titleInit(), { | ||
animationName: (g_initialFlg ? `` : `smallToNormalY`), | ||
}, g_cssObj.button_Back), | ||
|
||
// キーコンフィグ画面へ移動 | ||
createCss2Button(`btnKeyConfig`, `KeyConfig`, _ => { | ||
// キーコンフィグ画面へ遷移 | ||
g_kcType = `Main`; | ||
clearWindow(); | ||
keyConfigInit(); | ||
}, { | ||
createCss2Button(`btnKeyConfig`, `KeyConfig`, _ => keyConfigInit(`Main`), { | ||
x: g_sWidth / 3, | ||
animationName: (g_initialFlg ? `` : `smallToNormalY`), | ||
}, g_cssObj.button_Setting), | ||
|
||
// プレイ開始 | ||
makePlayButton(_ => { | ||
clearWindow(); | ||
loadMusic(); | ||
}), | ||
makePlayButton(_ => loadMusic()), | ||
|
||
// Display設定へ移動 | ||
createCss2Button(`btnDisplay`, `>`, _ => { | ||
clearWindow(); | ||
settingsDisplayInit(); | ||
}, { | ||
createCss2Button(`btnDisplay`, `>`, _ => settingsDisplayInit(), { | ||
x: g_sWidth / 2 + 175 - C_LEN_SETMINI_WIDTH / 2, y: 25, | ||
w: C_LEN_SETMINI_WIDTH, h: 40, | ||
title: g_msgObj.toDisplay, | ||
|
@@ -3554,7 +3543,6 @@ function optionInit() { | |
} | ||
|
||
if (setCode === `Enter`) { | ||
clearWindow(); | ||
loadMusic(); | ||
} | ||
return blockCode(setCode); | ||
|
@@ -4730,6 +4718,7 @@ function makeMiniCssButton(_id, _directionFlg, _heightPos, _func, { dx = 0, dy = | |
|
||
function settingsDisplayInit() { | ||
|
||
clearWindow(); | ||
drawDefaultBackImage(``); | ||
const divRoot = document.querySelector(`#divRoot`); | ||
g_baseDisp = `Display`; | ||
|
@@ -4762,31 +4751,18 @@ function settingsDisplayInit() { | |
multiAppend(divRoot, | ||
|
||
// タイトル画面へ戻る | ||
createCss2Button(`btnBack`, `Back`, _ => { | ||
clearWindow(); | ||
titleInit(); | ||
}, {}, g_cssObj.button_Back), | ||
createCss2Button(`btnBack`, `Back`, _ => titleInit(), {}, g_cssObj.button_Back), | ||
|
||
// キーコンフィグ画面へ移動 | ||
createCss2Button(`btnKeyConfig`, `KeyConfig`, _ => { | ||
g_kcType = `Main`; | ||
clearWindow(); | ||
keyConfigInit(); | ||
}, { | ||
createCss2Button(`btnKeyConfig`, `KeyConfig`, _ => keyConfigInit(`Main`), { | ||
x: g_sWidth / 3, | ||
}, g_cssObj.button_Setting), | ||
|
||
// プレイ開始 | ||
makePlayButton(_ => { | ||
clearWindow(); | ||
loadMusic(); | ||
}), | ||
makePlayButton(_ => loadMusic()), | ||
|
||
// メイン設定へ戻る | ||
createCss2Button(`btnSettings`, `<`, _ => { | ||
clearWindow(); | ||
optionInit(); | ||
}, { | ||
createCss2Button(`btnSettings`, `<`, _ => optionInit(), { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar blocks of code found in 2 locations. Consider refactoring. |
||
x: g_sWidth / 2 - 175 - C_LEN_SETMINI_WIDTH / 2, y: 25, | ||
w: C_LEN_SETMINI_WIDTH, h: 40, | ||
title: g_msgObj.toSettings, | ||
|
@@ -4803,7 +4779,6 @@ function settingsDisplayInit() { | |
} | ||
|
||
if (setCode === `Enter`) { | ||
clearWindow(); | ||
loadMusic(); | ||
} | ||
return blockCode(setCode); | ||
|
@@ -4961,10 +4936,12 @@ function interlockingButton(_headerObj, _name, _current, _next, _buttonFlg = fal | |
/** | ||
* キーコンフィグ画面初期化 | ||
*/ | ||
function keyConfigInit() { | ||
function keyConfigInit(_kcType = g_kcType) { | ||
|
||
clearWindow(); | ||
drawDefaultBackImage(``); | ||
const divRoot = document.querySelector(`#divRoot`); | ||
g_kcType = _kcType; | ||
|
||
// 譜面初期情報ロード許可フラグ | ||
g_canLoadDifInfoFlg = false; | ||
|
@@ -5188,7 +5165,6 @@ function keyConfigInit() { | |
g_currentj = 0; | ||
g_currentk = 0; | ||
g_prevKey = 0; | ||
clearWindow(); | ||
|
||
if (g_baseDisp === `Settings`) { | ||
optionInit(); | ||
|
@@ -5211,7 +5187,6 @@ function keyConfigInit() { | |
g_keyObj.currentPtn = (g_keyObj[`keyCtrl${g_keyObj.currentKey}_${tempPtn}`] !== undefined ? | ||
tempPtn : (g_keyObj[`keyCtrl${g_keyObj.currentKey}_-1`] !== undefined ? -1 : 0)); | ||
|
||
clearWindow(); | ||
keyConfigInit(); | ||
const keyCtrlPtn = `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`; | ||
const divideCnt = g_keyObj[`div${keyCtrlPtn}`] - 1; | ||
|
@@ -5227,7 +5202,6 @@ function keyConfigInit() { | |
g_keyObj.currentPtn = (g_keyObj[`keyCtrl${g_keyObj.currentKey}_${tempPtn}`] !== undefined ? | ||
tempPtn : searchPattern(searchPattern(0, 1) - 1, -1, g_headerObj.transKeyUse, `transKey`)); | ||
|
||
clearWindow(); | ||
keyConfigInit(); | ||
const keyCtrlPtn = `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`; | ||
const divideCnt = g_keyObj[`div${keyCtrlPtn}`] - 1; | ||
|
@@ -5680,7 +5654,6 @@ function loadingScoreInit() { | |
const tempId = setInterval(() => { | ||
const executeMain = _ => { | ||
clearInterval(tempId); | ||
clearWindow(); | ||
MainInit(); | ||
} | ||
if (g_audio.duration !== undefined) { | ||
|
@@ -7067,6 +7040,7 @@ function setKeyCtrl(_localStorage, _keyNum, _keyCtrlPtn) { | |
* メイン画面初期化 | ||
*/ | ||
function MainInit() { | ||
clearWindow(); | ||
drawDefaultBackImage(`Main`); | ||
const divRoot = document.querySelector(`#divRoot`); | ||
document.oncontextmenu = _ => false; | ||
|
@@ -7540,7 +7514,6 @@ function MainInit() { | |
} else if (setCode === g_kCdN[g_headerObj.keyTitleBack]) { | ||
g_audio.pause(); | ||
clearTimeout(g_timeoutEvtId); | ||
clearWindow(); | ||
if (keyIsDown(`ShiftLeft`)) { | ||
g_gameOverFlg = true; | ||
g_finishFlg = false; | ||
|
@@ -8282,17 +8255,13 @@ function MainInit() { | |
document.onkeyup = evt => { } | ||
|
||
clearTimeout(g_timeoutEvtId); | ||
setTimeout(_ => { | ||
clearWindow(); | ||
resultInit(); | ||
}, 100); | ||
setTimeout(_ => resultInit(), 100); | ||
|
||
} else if (g_workObj.lifeVal === 0 && g_workObj.lifeBorder === 0) { | ||
|
||
// ライフ制&ライフ0の場合は途中終了 | ||
g_audio.pause(); | ||
clearTimeout(g_timeoutEvtId); | ||
clearWindow(); | ||
g_gameOverFlg = true; | ||
g_finishFlg = false; | ||
resultInit(); | ||
|
@@ -8876,6 +8845,7 @@ function finishViewing() { | |
*/ | ||
function resultInit() { | ||
|
||
clearWindow(); | ||
drawDefaultBackImage(``); | ||
|
||
// 結果画面用フレーム初期化 | ||
|
@@ -9253,7 +9223,6 @@ function resultInit() { | |
} | ||
clearTimeout(g_timeoutEvtId); | ||
clearTimeout(g_timeoutEvtResultId); | ||
clearWindow(); | ||
titleInit(); | ||
}, { | ||
w: g_sWidth / 4, h: C_BTN_HEIGHT * 5 / 4, | ||
|
@@ -9292,7 +9261,6 @@ function resultInit() { | |
} | ||
clearTimeout(g_timeoutEvtId); | ||
clearTimeout(g_timeoutEvtResultId); | ||
clearWindow(); | ||
loadMusic(); | ||
}, { | ||
x: g_sWidth / 4 * 3, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.