danoniplus 42.2.1 → 42.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/js/danoni_main.js +18 -9
  2. package/package.json +1 -1
package/js/danoni_main.js CHANGED
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Source by tickle
6
6
  * Created : 2018/10/08
7
- * Revised : 2025/06/15
8
- *
7
+ * Revised : 2025/06/18
8
+ *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 42.2.1`;
12
- const g_revisedDate = `2025/06/17`;
11
+ const g_version = `Ver 42.2.2`;
12
+ const g_revisedDate = `2025/06/18`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -5468,11 +5468,13 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5468
5468
  const FADE_INTERVAL_MS = 100;
5469
5469
  const FADE_DELAY_MS = 500;
5470
5470
 
5471
+ const currentIdx = g_headerObj.musicIdxList[g_settings.musicIdxNum];
5471
5472
  const musicUrl = getMusicUrl(g_headerObj.viewLists[0]);
5472
5473
  const url = getFullMusicUrl(musicUrl);
5473
5474
  const encodeFlg = listMatching(musicUrl, [`.js`, `.txt`], { suffix: `$` });
5474
- const musicStart = g_headerObj.musicStarts?.[g_headerObj.musicIdxList[g_settings.musicIdxNum]] ?? 0;
5475
- const musicEnd = g_headerObj.musicEnds?.[g_headerObj.musicIdxList[g_settings.musicIdxNum]] ?? 0;
5475
+ const musicStart = g_headerObj.musicStarts?.[currentIdx] ?? 0;
5476
+ const musicEnd = g_headerObj.musicEnds?.[currentIdx] ?? 0;
5477
+ const isTitle = () => g_currentPage === `title`;
5476
5478
 
5477
5479
  /**
5478
5480
  * BGMのフェードアウトとシーク
@@ -5480,7 +5482,7 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5480
5482
  const fadeOutAndSeek = () => {
5481
5483
  let volume = g_audio.volume;
5482
5484
  const fadeInterval = setInterval(() => {
5483
- if (volume > FADE_STEP && g_currentPage === `title`) {
5485
+ if (volume > FADE_STEP && isTitle()) {
5484
5486
  volume -= FADE_STEP;
5485
5487
  g_audio.volume = Math.max(volume, 0);
5486
5488
  } else {
@@ -5490,7 +5492,7 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5490
5492
  g_audio.currentTime = musicStart;
5491
5493
 
5492
5494
  // フェードイン開始
5493
- if (g_currentPage === `title`) {
5495
+ if (isTitle()) {
5494
5496
  setTimeout(() => {
5495
5497
  fadeIn();
5496
5498
  if (encodeFlg) {
@@ -5517,13 +5519,20 @@ const playBGM = async (_num, _currentLoopNum = g_settings.musicLoopNum) => {
5517
5519
  let volume = 0;
5518
5520
  g_audio.play();
5519
5521
  const fadeInterval = setInterval(() => {
5520
- if (volume < g_stateObj.bgmVolume / 100 && g_currentPage === `title`) {
5522
+ if (volume < g_stateObj.bgmVolume / 100 && isTitle()) {
5521
5523
  volume += FADE_STEP;
5522
5524
  g_audio.volume = Math.min(volume, 1);
5523
5525
  } else {
5524
5526
  clearInterval(fadeInterval);
5525
5527
  g_stateObj.bgmFadeIn = null;
5526
5528
  }
5529
+
5530
+ // フェードイン中に楽曲が変更された場合は停止
5531
+ if (currentIdx !== g_headerObj.musicIdxList[g_settings.musicIdxNum]) {
5532
+ pauseBGM();
5533
+ clearInterval(fadeInterval);
5534
+ g_stateObj.bgmFadeIn = null;
5535
+ }
5527
5536
  }, FADE_INTERVAL_MS);
5528
5537
  g_stateObj.bgmFadeIn = fadeInterval;
5529
5538
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "42.2.1",
3
+ "version": "42.2.2",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {