danoniplus 41.0.3 → 41.1.0

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 +66 -25
  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/04/27
7
+ * Revised : 2025/05/05
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 41.0.3`;
12
- const g_revisedDate = `2025/04/27`;
11
+ const g_version = `Ver 41.1.0`;
12
+ const g_revisedDate = `2025/05/05`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -2601,7 +2601,8 @@ const initialControl = async () => {
2601
2601
  g_customJsObj.preTitle.forEach(func => func());
2602
2602
  const queryMusicId = getQueryParamVal(`musicId`);
2603
2603
  g_settings.musicIdxNum = queryMusicId !== null ? Number(queryMusicId) :
2604
- g_headerObj.musicNos[g_stateObj.scoreId] || g_headerObj.musicNos[0];
2604
+ g_headerObj.musicGroups?.[g_headerObj.musicNos[g_stateObj.scoreId]] ??
2605
+ g_headerObj.musicNos[g_stateObj.scoreId] ?? g_headerObj.musicNos[0];
2605
2606
  titleInit(true);
2606
2607
 
2607
2608
  // 未使用のg_keyObjプロパティを削除
@@ -3583,6 +3584,19 @@ const headerConvert = _dosObj => {
3583
3584
  obj.musicNos = fillArray(obj.keyLabels.length);
3584
3585
  }
3585
3586
 
3587
+ // 楽曲別のグループ化設定(選曲モードのみ)
3588
+ if (hasVal(_dosObj.musicGroup)) {
3589
+ obj.musicGroups = _dosObj.musicGroup.split(`,`)
3590
+ .map((val, j) => setVal(val, j, C_TYP_NUMBER))
3591
+ .map((val, j) => val < 0 ? j + val : val);
3592
+ for (let k = obj.musicGroups.length; k <= Math.max(...obj.musicNos); k++) {
3593
+ obj.musicGroups[k] = k;
3594
+ }
3595
+ obj.musicIdxList = makeDedupliArray(obj.musicGroups);
3596
+ } else {
3597
+ obj.musicIdxList = [...Array(Math.max(...obj.musicNos) + 1).keys()];
3598
+ }
3599
+
3586
3600
  // 譜面変更セレクターの利用有無
3587
3601
  obj.difSelectorUse = getDifSelectorUse(_dosObj.difSelectorUse, obj.viewLists);
3588
3602
 
@@ -4874,7 +4888,7 @@ const titleInit = (_initFlg = false) => {
4874
4888
  if (getQueryParamVal(`scoreId`) !== null) {
4875
4889
  g_headerObj.viewLists = [];
4876
4890
  g_headerObj.musicNos.forEach((val, j) => {
4877
- if (val === g_settings.musicIdxNum) {
4891
+ if ((g_headerObj.musicGroups?.[val] ?? val) === g_settings.musicIdxNum) {
4878
4892
  g_headerObj.viewLists.push(j);
4879
4893
  tmpCreatorList.push(g_headerObj.creatorNames[j]);
4880
4894
  }
@@ -4893,8 +4907,6 @@ const titleInit = (_initFlg = false) => {
4893
4907
 
4894
4908
  // 選曲画面の初期化
4895
4909
  const wheelCycle = 2;
4896
- const musicMaxIdx = Math.max(...g_headerObj.musicNos);
4897
- const musicIdxTmpList = [...Array(musicMaxIdx + 1).keys()];
4898
4910
 
4899
4911
  /**
4900
4912
  * メイン以外の選曲ボタンの作成
@@ -4931,7 +4943,7 @@ const titleInit = (_initFlg = false) => {
4931
4943
  createCss2Button(`btnMusicSelectNext`, `↓`, () => changeMSelect(1),
4932
4944
  g_lblPosObj.btnMusicSelectNext, g_cssObj.button_Setting),
4933
4945
  createCss2Button(`btnMusicSelectRandom`, `Random`, () =>
4934
- changeMSelect(Math.floor(Math.random() * musicIdxTmpList.length)),
4946
+ changeMSelect(g_headerObj.musicIdxList[Math.floor(Math.random() * g_headerObj.musicIdxList.length)]),
4935
4947
  g_lblPosObj.btnMusicSelectRandom, g_cssObj.button_Default),
4936
4948
  createDivCss2Label(`lblMusicCnt`, ``, g_lblPosObj.lblMusicCnt),
4937
4949
  createDivCss2Label(`lblComment`, ``, g_lblPosObj.lblComment_music),
@@ -4940,8 +4952,23 @@ const titleInit = (_initFlg = false) => {
4940
4952
 
4941
4953
  let wheelCnt = 0;
4942
4954
  wheelHandler = g_handler.addListener(divRoot, `wheel`, e => {
4955
+
4956
+ // コメント欄(lblComment)のスクロール可能性をチェック
4957
+ const isScrollable = lblComment.scrollHeight > lblComment.clientHeight;
4958
+
4959
+ // マウスがコメント欄上にあり、スクロールが可能ならイベントをスキップ
4960
+ if (lblComment.contains(e.target) && isScrollable) {
4961
+ // スクロール位置の判定
4962
+ const atTop = lblComment.scrollTop === 0 && e.deltaY < 0;
4963
+ const atBottom = (lblComment.scrollTop + lblComment.clientHeight >= lblComment.scrollHeight) && e.deltaY > 0;
4964
+
4965
+ // スクロール可能&上端または下端ではないなら処理をスキップ
4966
+ if (!atTop && !atBottom) {
4967
+ return;
4968
+ }
4969
+ }
4970
+ e.preventDefault();
4943
4971
  if (g_stateObj.keyInitial && wheelCnt === 0) {
4944
- e.preventDefault();
4945
4972
  changeMSelect(e.deltaY > 0 ? 1 : -1);
4946
4973
  }
4947
4974
  wheelCnt = (wheelCnt + 1) % wheelCycle;
@@ -5258,12 +5285,10 @@ const getCreatorInfo = (_creatorList) => {
5258
5285
  */
5259
5286
  const changeMSelect = (_num, _initFlg = false) => {
5260
5287
  const limitedMLength = 35;
5261
- const musicMaxIdx = Math.max(...g_headerObj.musicNos);
5262
- const musicIdxTmpList = [...Array(musicMaxIdx + 1).keys()];
5263
5288
 
5264
5289
  // 選択方向に合わせて楽曲リスト情報を再取得
5265
5290
  for (let j = -g_settings.mSelectableTerms; j <= g_settings.mSelectableTerms; j++) {
5266
- const idx = (j + _num + g_settings.musicIdxNum + musicIdxTmpList.length * 10) % musicIdxTmpList.length;
5291
+ const idx = g_headerObj.musicIdxList[(j + _num + g_settings.musicIdxNum + g_headerObj.musicIdxList.length * 10) % g_headerObj.musicIdxList.length];
5267
5292
  if (j === 0) {
5268
5293
  } else {
5269
5294
  document.getElementById(`btnMusicSelect${j}`).style.fontSize =
@@ -5274,33 +5299,35 @@ const changeMSelect = (_num, _initFlg = false) => {
5274
5299
  }
5275
5300
  }
5276
5301
  // 現在選択中の楽曲IDを再設定
5277
- g_settings.musicIdxNum = (g_settings.musicIdxNum + _num + musicIdxTmpList.length) % musicIdxTmpList.length;
5302
+ g_settings.musicIdxNum = (g_settings.musicIdxNum + _num + g_headerObj.musicIdxList.length) % g_headerObj.musicIdxList.length;
5278
5303
 
5279
5304
  // 選択した楽曲に対応する譜面番号、製作者情報、曲長を取得
5280
5305
  g_headerObj.viewLists = [];
5281
- const tmpKeyList = [], tmpCreatorList = [], tmpPlayingFrameList = [];
5306
+ const tmpKeyList = [], tmpCreatorList = [], tmpPlayingFrameList = [], tmpBpmList = [];
5307
+ const targetIdx = g_headerObj.musicIdxList[(g_settings.musicIdxNum + g_headerObj.musicIdxList.length * 20) % g_headerObj.musicIdxList.length];
5282
5308
  g_headerObj.musicNos.forEach((val, j) => {
5283
- if (val === (g_settings.musicIdxNum + musicIdxTmpList.length * 20) %
5284
- musicIdxTmpList.length) {
5309
+ if ((g_headerObj.musicGroups?.[val] ?? val) === targetIdx) {
5285
5310
  g_headerObj.viewLists.push(j);
5286
5311
  tmpKeyList.push(g_headerObj.keyLabels[j]);
5287
5312
  tmpCreatorList.push(g_headerObj.creatorNames[j]);
5288
5313
  tmpPlayingFrameList.push(g_detailObj.playingFrameWithBlank[j]);
5314
+ tmpBpmList.push(g_headerObj.bpms[g_headerObj.musicNos[j]]);
5289
5315
  }
5290
5316
  });
5291
- const playingFrames = makeDedupliArray(tmpPlayingFrameList.sort((a, b) => a - b).map(val => transFrameToTimer(val))).join(`, `);
5317
+ const playingFrames = makeDedupliArray(tmpPlayingFrameList.map(val => transFrameToTimer(val))).join(`, `);
5318
+ const bpm = makeDedupliArray(tmpBpmList).join(`, `);
5292
5319
  const [creatorName, creatorUrl, creatorIdx] = getCreatorInfo(tmpCreatorList);
5293
5320
  const creatorLink = creatorIdx >= 0 ?
5294
5321
  `<a href="${creatorUrl}" target="_blank">${creatorName}</a>` : creatorName;
5295
5322
 
5296
5323
  // 選択した楽曲の情報表示
5297
- const idx = g_settings.musicIdxNum;
5324
+ const idx = g_headerObj.musicIdxList[g_settings.musicIdxNum];
5298
5325
  document.getElementById(`lblMusicSelect`).innerHTML =
5299
5326
  `<span style="font-size:${getFontSize(g_headerObj.musicTitlesForView[idx].join(`<br>`), g_btnWidth(1 / 2), getBasicFont(), 18)}px;` +
5300
5327
  `font-weight:bold">${g_headerObj.musicTitlesForView[idx].join(`<br>`)}</span>`;
5301
5328
  document.getElementById(`lblMusicSelectDetail`).innerHTML =
5302
5329
  `Maker: ${creatorLink} / Artist: <a href="${g_headerObj.artistUrls[idx]}" target="_blank">` +
5303
- `${g_headerObj.artistNames[idx]}</a><br>Duration: ${playingFrames} / BPM: ${g_headerObj.bpms[idx]}`;
5330
+ `${g_headerObj.artistNames[idx]}</a><br>Duration: ${playingFrames} / BPM: ${bpm}`;
5304
5331
 
5305
5332
  // 選択した楽曲で使われているキー種の一覧を作成
5306
5333
  deleteChildspriteAll(`keyTitleSprite`);
@@ -5312,7 +5339,7 @@ const changeMSelect = (_num, _initFlg = false) => {
5312
5339
 
5313
5340
 
5314
5341
  // 選択した楽曲の選択位置を表示
5315
- lblMusicCnt.innerHTML = `${g_settings.musicIdxNum + 1} / ${musicMaxIdx + 1}`;
5342
+ lblMusicCnt.innerHTML = `${g_settings.musicIdxNum + 1} / ${g_headerObj.musicIdxList.length}`;
5316
5343
 
5317
5344
  // 楽曲別のローカルストレージを再取得
5318
5345
  loadLocalStorage(g_settings.musicIdxNum);
@@ -5830,11 +5857,7 @@ const optionInit = () => {
5830
5857
  g_stateObj.filterKeys = ``;
5831
5858
 
5832
5859
  // 楽曲データの表示
5833
- let text = `♪` + (g_headerObj.musicSelectUse ? `${g_headerObj.musicTitles[g_settings.musicIdxNum]} / ` : ``) +
5834
- `BPM: ${g_headerObj.bpms[g_settings.musicIdxNum]}`;
5835
- if (!g_headerObj.musicSelectUse && g_headerObj.bpms[g_settings.musicIdxNum] === `----`) {
5836
- text = ``;
5837
- }
5860
+ const text = getMusicInfoView();
5838
5861
  divRoot.appendChild(createDivCss2Label(`lblMusicInfo`, text,
5839
5862
  Object.assign({ siz: getFontSize(text, g_btnWidth(3 / 4), getBasicFont(), 12) }, g_lblPosObj.lblMusicInfo)));
5840
5863
 
@@ -5858,6 +5881,20 @@ const optionInit = () => {
5858
5881
  g_skinJsObj.option.forEach(func => func());
5859
5882
  };
5860
5883
 
5884
+ /**
5885
+ * 設定画面に表示する楽曲・BPM情報の取得
5886
+ * @returns {string}
5887
+ */
5888
+ const getMusicInfoView = () => {
5889
+ const idx = g_headerObj.musicNos[g_stateObj.scoreId];
5890
+ let text = `♪` + (g_headerObj.musicSelectUse ? `${g_headerObj.musicTitles[idx]} / ` : ``) +
5891
+ `BPM: ${g_headerObj.bpms[idx]}`;
5892
+ if (!g_headerObj.musicSelectUse && g_headerObj.bpms[idx] === `----`) {
5893
+ text = ``;
5894
+ }
5895
+ return text;
5896
+ };
5897
+
5861
5898
  /**
5862
5899
  * 設定画面用スプライトリストの作成
5863
5900
  * @param {object} _settingList (設定名、縦位置、縦位置差分、幅差分、高さ差分)を設定別にリスト化
@@ -6686,6 +6723,10 @@ const setDifficulty = (_initFlg) => {
6686
6723
  makeHighScore(g_stateObj.scoreId);
6687
6724
  }
6688
6725
 
6726
+ // 楽曲データの表示
6727
+ lblMusicInfo.textContent = getMusicInfoView();
6728
+ lblMusicInfo.style.fontSize = wUnit(getFontSize(lblMusicInfo.textContent, g_btnWidth(3 / 4), getBasicFont(), 12));
6729
+
6689
6730
  // ユーザカスタムイベント(初期)
6690
6731
  g_customJsObj.difficulty.forEach(func => func(_initFlg, g_canLoadDifInfoFlg));
6691
6732
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "41.0.3",
3
+ "version": "41.1.0",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {