danoniplus 31.5.0 → 31.7.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.
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 : 2023/04/16
7
+ * Revised : 2023/05/03
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 31.5.0`;
12
- const g_revisedDate = `2023/04/16`;
11
+ const g_version = `Ver 31.7.0`;
12
+ const g_revisedDate = `2023/05/03`;
13
13
  const g_alphaVersion = ``;
14
14
 
15
15
  // カスタム用バージョン (danoni_custom.js 等で指定可)
@@ -2465,7 +2465,7 @@ const calcLevel = _scoreObj => {
2465
2465
  const push3Cnt = push3List.length;
2466
2466
  const calcArrowCnt = allCnt - push3Cnt - 3;
2467
2467
  const toDecimal2 = num => Math.round(num * 100) / 100;
2468
- const calcDifLevel = num => calcArrowCnt <= 0 ? 0 : toDecimal2(num / Math.sqrt(calcArrowCnt) * 4);
2468
+ const calcDifLevel = num => Math.max(toDecimal2(num / Math.sqrt(calcArrowCnt) * 4), 0);
2469
2469
 
2470
2470
  const baseDifLevel = calcDifLevel(levelcount);
2471
2471
  const difLevel = toDecimal2(baseDifLevel * (allCnt - 3) / calcArrowCnt);
@@ -2744,11 +2744,12 @@ const headerConvert = _dosObj => {
2744
2744
  obj.creatorNames = [obj.tuning];
2745
2745
  }
2746
2746
  const keyLists = makeDedupliArray(obj.keyLabels);
2747
+ obj.viewLists = [...Array(obj.keyLabels.length).keys()];
2747
2748
  obj.keyLists = keyLists.sort((a, b) => parseInt(a) - parseInt(b));
2748
2749
  obj.undefinedKeyLists = obj.keyLists.filter(key => g_keyObj[`${g_keyObj.defaultProp}${key}_0`] === undefined);
2749
2750
 
2750
2751
  // 譜面変更セレクターの利用有無
2751
- obj.difSelectorUse = (setBoolVal(_dosObj.difSelectorUse, obj.keyLabels.length > 5));
2752
+ obj.difSelectorUse = getDifSelectorUse(_dosObj.difSelectorUse, obj.viewLists);
2752
2753
 
2753
2754
  // 初期速度の設定
2754
2755
  g_stateObj.speed = obj.initSpeeds[g_stateObj.scoreId];
@@ -3153,6 +3154,14 @@ const headerConvert = _dosObj => {
3153
3154
  return obj;
3154
3155
  };
3155
3156
 
3157
+ /**
3158
+ * 譜面リスト作成有無の状態を取得
3159
+ * @param {boolean} _headerFlg
3160
+ * @param {array} _viewLists
3161
+ * @returns
3162
+ */
3163
+ const getDifSelectorUse = (_headerFlg, _viewLists = g_headerObj.viewLists) => setBoolVal(_headerFlg, _viewLists.length > 5);
3164
+
3156
3165
  /**
3157
3166
  * カラーセットの格納
3158
3167
  * @param {object} obj
@@ -4303,155 +4312,626 @@ const inputSlider = (_slider, _link) => {
4303
4312
  };
4304
4313
 
4305
4314
  /**
4306
- * 設定・オプション画面のラベル・ボタン処理の描画
4307
- * @param {Object} _sprite 基準とするスプライト(ここで指定する座標は、そのスプライトからの相対位置)
4315
+ * 譜面変更セレクターの削除
4308
4316
  */
4309
- const createOptionWindow = _sprite => {
4317
+ const resetDifWindow = _ => {
4318
+ if (document.querySelector(`#difList`) !== null) {
4319
+ deleteChildspriteAll(`difList`);
4320
+ [`difList`, `difCover`, `btnDifU`, `btnDifD`].forEach(obj => optionsprite.removeChild(document.getElementById(obj)));
4321
+ g_currentPage = `option`;
4322
+ setShortcutEvent(g_currentPage, _ => true, { displayFlg: false, dfEvtFlg: true });
4323
+ }
4324
+ };
4310
4325
 
4311
- // 各ボタン用のスプライトを作成
4312
- const optionsprite = createOptionSprite(_sprite);
4326
+ /**
4327
+ * 次の譜面番号を取得
4328
+ * @param {number} _scoreId
4329
+ * @param {number} _scrollNum
4330
+ * @returns
4331
+ */
4332
+ const getNextDifficulty = (_scoreId, _scrollNum) => {
4333
+ const currentPosIdx = g_headerObj.viewLists.findIndex(val => val === _scoreId);
4334
+ const nextPosIdx = (currentPosIdx === -1 ? 0 : nextPos(currentPosIdx, _scrollNum, g_headerObj.viewLists.length));
4335
+ return g_headerObj.viewLists[nextPosIdx];
4336
+ };
4313
4337
 
4314
- // 設定毎に個別のスプライトを作成し、その中にラベル・ボタン類を配置
4315
- const spriteList = setSpriteList(g_settingPos.option);
4338
+ /**
4339
+ * 譜面選択処理
4340
+ * @param {number} _scrollNum
4341
+ */
4342
+ const nextDifficulty = (_scrollNum = 1) => {
4343
+ g_keyObj.prevKey = g_headerObj.keyLabels[g_stateObj.scoreId];
4344
+ g_stateObj.scoreId = getNextDifficulty(g_stateObj.scoreId, _scrollNum);
4345
+ setDifficulty(true);
4346
+ resetDifWindow();
4347
+ };
4316
4348
 
4317
- // ---------------------------------------------------
4318
- // 難易度 (Difficulty)
4319
- // 縦位置: 0
4320
- spriteList.difficulty.appendChild(createLblSetting(`Difficulty`, -5));
4349
+ /**
4350
+ * 譜面リストの作成
4351
+ * @param {object} _difList
4352
+ * @param {string} _targetKey
4353
+ */
4354
+ const makeDifList = (_difList, _targetKey = ``) => {
4355
+ let k = 0;
4356
+ let pos = 0;
4357
+ g_headerObj.viewLists.forEach(j => {
4358
+ const keyLabel = g_headerObj.keyLabels[j];
4359
+ if (_targetKey === `` || keyLabel === _targetKey) {
4360
+ let text = `${getKeyName(keyLabel)} / ${g_headerObj.difLabels[j]}`;
4361
+ if (g_headerObj.makerView) {
4362
+ text += ` (${g_headerObj.creatorNames[j]})`;
4363
+ }
4364
+ _difList.appendChild(makeDifLblCssButton(`dif${k}`, text, k, _ => {
4365
+ nextDifficulty(j - g_stateObj.scoreId);
4366
+ }, { btnStyle: (j === g_stateObj.scoreId ? `Setting` : `Default`) }));
4367
+ if (j === g_stateObj.scoreId) {
4368
+ pos = k + 6;
4369
+ }
4370
+ k++;
4371
+ }
4372
+ });
4373
+ _difList.scrollTop = Math.max(pos * g_limitObj.setLblHeight - parseInt(_difList.style.height), 0);
4374
+ };
4321
4375
 
4322
- /**
4323
- * 譜面変更セレクターの削除
4324
- */
4325
- const resetDifWindow = _ => {
4326
- if (document.querySelector(`#difList`) !== null) {
4327
- deleteChildspriteAll(`difList`);
4328
- [`difList`, `difCover`, `btnDifU`, `btnDifD`].forEach(obj => optionsprite.removeChild(document.getElementById(obj)));
4329
- g_currentPage = `option`;
4330
- setShortcutEvent(g_currentPage, _ => true, { displayFlg: false, dfEvtFlg: true });
4376
+ /**
4377
+ * 譜面セレクター位置の変更ボタン
4378
+ * @param {number} _scrollNum
4379
+ * @returns
4380
+ */
4381
+ const makeDifBtn = (_scrollNum = 1) => {
4382
+ const dir = _scrollNum === 1 ? `D` : `U`;
4383
+ return createCss2Button(`btnDif${dir}`, g_settingBtnObj.chara[dir], _ => {
4384
+ do {
4385
+ g_stateObj.scoreId = getNextDifficulty(g_stateObj.scoreId, _scrollNum);
4386
+ } while (g_stateObj.filterKeys !== `` && g_stateObj.filterKeys !== g_headerObj.keyLabels[g_stateObj.scoreId]);
4387
+ setDifficulty(true);
4388
+ deleteChildspriteAll(`difList`);
4389
+ makeDifList(difList, g_stateObj.filterKeys);
4390
+ g_keyObj.prevKey = g_keyObj.currentKey;
4391
+ }, {
4392
+ x: 430 + _scrollNum * 10, y: 40, w: 20, h: 20, siz: g_limitObj.jdgCntsSiz,
4393
+ }, g_cssObj.button_Mini);
4394
+ };
4395
+
4396
+ /**
4397
+ * 譜面変更セレクターの作成・再作成
4398
+ * @param {string} _key
4399
+ */
4400
+ const createDifWindow = (_key = ``) => {
4401
+ g_currentPage = `difSelector`;
4402
+ setShortcutEvent(g_currentPage);
4403
+ const difList = createEmptySprite(optionsprite, `difList`, g_windowObj.difList, g_cssObj.settings_DifSelector);
4404
+ const difCover = createEmptySprite(optionsprite, `difCover`, g_windowObj.difCover, g_cssObj.settings_DifSelector);
4405
+
4406
+ // リスト再作成
4407
+ makeDifList(difList, _key);
4408
+
4409
+ // ランダム選択
4410
+ difCover.appendChild(
4411
+ makeDifLblCssButton(`difRandom`, `RANDOM`, 0, _ => {
4412
+ nextDifficulty(Math.floor(Math.random() * g_headerObj.keyLabels.length));
4413
+ }, { w: g_limitObj.difCoverWidth })
4414
+ );
4415
+
4416
+ // 全リスト
4417
+ difCover.appendChild(
4418
+ makeDifLblCssButton(`keyFilter`, `ALL`, 1.5, _ => {
4419
+ resetDifWindow();
4420
+ g_stateObj.filterKeys = ``;
4421
+ createDifWindow();
4422
+ }, { w: g_limitObj.difCoverWidth, btnStyle: (g_stateObj.filterKeys === `` ? `Setting` : `Default`) })
4423
+ );
4424
+
4425
+ // キー別フィルタボタン作成
4426
+ let pos = 0;
4427
+ g_headerObj.viewKeyLists.forEach((targetKey, m) => {
4428
+ difCover.appendChild(
4429
+ makeDifLblCssButton(`keyFilter${m}`, `${getKeyName(targetKey)} ${getStgDetailName('key')}`, m + 2.5, _ => {
4430
+ resetDifWindow();
4431
+ g_stateObj.filterKeys = targetKey;
4432
+ createDifWindow(targetKey);
4433
+ }, { w: g_limitObj.difCoverWidth, btnStyle: (g_stateObj.filterKeys === targetKey ? `Setting` : `Default`) })
4434
+ );
4435
+ if (g_stateObj.filterKeys === targetKey) {
4436
+ pos = m + 9;
4331
4437
  }
4438
+ });
4439
+ difCover.scrollTop = Math.max(pos * g_limitObj.setLblHeight - parseInt(difCover.style.height), 0);
4440
+
4441
+ multiAppend(optionsprite, makeDifBtn(-1), makeDifBtn());
4442
+ };
4443
+
4444
+ const changeDifficulty = (_num = 1) => {
4445
+ if (g_headerObj.difSelectorUse) {
4446
+ g_stateObj.filterKeys = ``;
4447
+ if (document.querySelector(`#difList`) === null) {
4448
+ g_keyObj.prevKey = g_keyObj.currentKey;
4449
+ createDifWindow();
4450
+ } else {
4451
+ resetDifWindow();
4452
+ }
4453
+ } else {
4454
+ nextDifficulty(_num);
4455
+ }
4456
+ };
4457
+
4458
+ /**
4459
+ * 譜面基礎データの取得
4460
+ * @param {number} _scoreId
4461
+ */
4462
+ const getScoreBaseData = _scoreId => {
4463
+ const arrowCnts = sumData(g_detailObj.arrowCnt[_scoreId]);
4464
+ const frzCnts = sumData(g_detailObj.frzCnt[_scoreId]);
4465
+ return {
4466
+ arrowCnts: arrowCnts,
4467
+ frzCnts: frzCnts,
4468
+ apm: Math.round((arrowCnts + frzCnts) / (g_detailObj.playingFrame[_scoreId] / g_fps / 60)),
4469
+ playingTime: transFrameToTimer(g_detailObj.playingFrame[_scoreId]),
4332
4470
  };
4471
+ };
4333
4472
 
4334
- /**
4335
- * 譜面選択処理
4336
- * @param {number} _scrollNum
4337
- */
4338
- const nextDifficulty = (_scrollNum = 1) => {
4339
- g_keyObj.prevKey = g_headerObj.keyLabels[g_stateObj.scoreId];
4340
- g_stateObj.scoreId = nextPos(g_stateObj.scoreId, _scrollNum, g_headerObj.keyLabels.length);
4341
- setDifficulty(true);
4342
- resetDifWindow();
4473
+ /**
4474
+ * 速度変化グラフの描画
4475
+ * @param {number} _scoreId
4476
+ */
4477
+ const drawSpeedGraph = _scoreId => {
4478
+ const startFrame = g_detailObj.startFrame[_scoreId];
4479
+ const playingFrame = g_detailObj.playingFrameWithBlank[_scoreId];
4480
+ const speedObj = {
4481
+ speed: { frame: [0], speed: [1], cnt: 0, strokeColor: g_graphColorObj.speed },
4482
+ boost: { frame: [0], speed: [1], cnt: 0, strokeColor: g_graphColorObj.boost }
4343
4483
  };
4344
4484
 
4345
- /**
4346
- * 譜面リストの作成
4347
- * @param {object} _difList
4348
- * @param {string} _targetKey
4349
- */
4350
- const makeDifList = (_difList, _targetKey = ``) => {
4351
- let k = 0;
4352
- let pos = 0;
4353
- g_headerObj.keyLabels.forEach((keyLabel, j) => {
4354
- if (_targetKey === `` || keyLabel === _targetKey) {
4355
- let text = `${getKeyName(keyLabel)} / ${g_headerObj.difLabels[j]}`;
4356
- if (g_headerObj.makerView) {
4357
- text += ` (${g_headerObj.creatorNames[j]})`;
4358
- }
4359
- _difList.appendChild(makeDifLblCssButton(`dif${k}`, text, k, _ => {
4360
- nextDifficulty(j - g_stateObj.scoreId);
4361
- }, { btnStyle: (j === g_stateObj.scoreId ? `Setting` : `Default`) }));
4362
- if (j === g_stateObj.scoreId) {
4363
- pos = k + 6;
4485
+ Object.keys(speedObj).forEach(speedType => {
4486
+ let frame = speedObj[speedType].frame;
4487
+ let speed = speedObj[speedType].speed;
4488
+ const speedData = g_detailObj[`${speedType}Data`][_scoreId];
4489
+
4490
+ if (speedData !== undefined) {
4491
+ for (let i = 0; i < speedData.length; i += 2) {
4492
+ if (speedData[i] >= startFrame) {
4493
+ frame.push(speedData[i] - startFrame);
4494
+ speed.push(speedData[i + 1]);
4364
4495
  }
4365
- k++;
4496
+ speedObj[speedType].cnt++;
4366
4497
  }
4498
+ frame.push(playingFrame);
4499
+ speed.push(speed[speed.length - 1]);
4500
+ }
4501
+ });
4502
+
4503
+ const canvas = document.querySelector(`#graphSpeed`);
4504
+ const context = canvas.getContext(`2d`);
4505
+ drawBaseLine(context);
4506
+
4507
+ Object.keys(speedObj).forEach((speedType, j) => {
4508
+ context.beginPath();
4509
+ let preY;
4510
+
4511
+ for (let i = 0; i < speedObj[speedType].frame.length; i++) {
4512
+ const x = speedObj[speedType].frame[i] * (g_limitObj.graphWidth - 30) / playingFrame + 30;
4513
+ const y = (speedObj[speedType].speed[i] - 1) * -90 + 105;
4514
+
4515
+ context.lineTo(x, preY);
4516
+ context.lineTo(x, y);
4517
+ preY = y;
4518
+ }
4519
+
4520
+ context.lineWidth = 1;
4521
+ context.strokeStyle = speedObj[speedType].strokeColor;
4522
+ context.stroke();
4523
+
4524
+ const lineX = (speedType === `speed`) ? 125 : 210;
4525
+ context.beginPath();
4526
+ context.moveTo(lineX, 215);
4527
+ context.lineTo(lineX + 30, 215);
4528
+ context.stroke();
4529
+ context.font = `${g_limitObj.difSelectorSiz}px ${getBasicFont()}`;
4530
+ context.fillText(speedType, lineX + 35, 218);
4531
+
4532
+ updateScoreDetailLabel(`Speed`, `${speedType}S`, speedObj[speedType].cnt, j, g_lblNameObj[`s_${speedType}`]);
4533
+ });
4534
+ };
4535
+
4536
+ /**
4537
+ * 譜面密度グラフの描画
4538
+ * @param {number} _scoreId
4539
+ */
4540
+ const drawDensityGraph = _scoreId => {
4541
+
4542
+ const canvas = document.querySelector(`#graphDensity`);
4543
+ const context = canvas.getContext(`2d`);
4544
+ drawBaseLine(context);
4545
+ for (let j = 0; j < g_limitObj.densityDivision; j++) {
4546
+ context.beginPath();
4547
+ [``, `2Push`, `3Push`].forEach(val => {
4548
+ context.fillStyle = (g_detailObj.maxDensity[_scoreId].includes(j) ? g_graphColorObj[`max${val}`] : g_graphColorObj[`default${val}`]);
4549
+ context.fillRect(16 * j * 16 / g_limitObj.densityDivision + 30, 195 - 9 * g_detailObj[`density${val}Data`][_scoreId][j] / 10,
4550
+ 15.5 * 16 / g_limitObj.densityDivision, 9 * g_detailObj[`density${val}Diff`][_scoreId][j] / 10
4551
+ );
4367
4552
  });
4368
- const overlength = pos * g_limitObj.setLblHeight - parseInt(difList.style.height);
4369
- difList.scrollTop = (overlength > 0 ? overlength : 0);
4370
- };
4553
+ context.stroke();
4554
+ }
4555
+
4556
+ const lineNames = [`Single`, `Chord`, `Triad+`];
4557
+ Object.keys(g_graphColorObj).filter(val => val.indexOf(`max`) !== -1).forEach((val, j) => {
4558
+ const lineX = 70 + j * 70;
4559
+
4560
+ context.beginPath();
4561
+ context.lineWidth = 3;
4562
+ context.fillStyle = g_rankObj.rankColorAllPerfect;
4563
+ context.strokeStyle = g_graphColorObj[val];
4564
+ context.moveTo(lineX, 215);
4565
+ context.lineTo(lineX + 20, 215);
4566
+ context.stroke();
4567
+ context.font = `${g_limitObj.difSelectorSiz}px ${getBasicFont()}`;
4568
+ context.fillText(lineNames[j], lineX + 20, 218);
4569
+ });
4371
4570
 
4372
- /**
4373
- * 譜面セレクター位置の変更ボタン
4374
- * @param {number} _scrollNum
4375
- * @returns
4376
- */
4377
- const makeDifBtn = (_scrollNum = 1) => {
4378
- const dir = _scrollNum === 1 ? `D` : `U`;
4379
- return createCss2Button(`btnDif${dir}`, g_settingBtnObj.chara[dir], _ => {
4380
- do {
4381
- g_stateObj.scoreId = nextPos(g_stateObj.scoreId, _scrollNum, g_headerObj.keyLabels.length);
4382
- } while (g_stateObj.filterKeys !== `` && g_stateObj.filterKeys !== g_headerObj.keyLabels[g_stateObj.scoreId]);
4383
- setDifficulty(true);
4384
- deleteChildspriteAll(`difList`);
4385
- makeDifList(difList, g_stateObj.filterKeys);
4386
- if (g_keyObj.prevKey !== g_keyObj.currentKey) {
4387
- g_keyObj.prevKey = g_keyObj.currentKey;
4388
- }
4389
- }, {
4390
- x: 430 + _scrollNum * 10, y: 40, w: 20, h: 20, siz: g_limitObj.jdgCntsSiz,
4391
- }, g_cssObj.button_Mini);
4392
- };
4571
+ const obj = getScoreBaseData(_scoreId);
4572
+ updateScoreDetailLabel(`Density`, `APM`, obj.apm, 0, g_lblNameObj.s_apm);
4573
+ updateScoreDetailLabel(`Density`, `Time`, obj.playingTime, 1, g_lblNameObj.s_time);
4574
+ updateScoreDetailLabel(`Density`, `Arrow`, obj.arrowCnts, 3, g_lblNameObj.s_arrow);
4575
+ updateScoreDetailLabel(`Density`, `Frz`, obj.frzCnts, 4, g_lblNameObj.s_frz);
4576
+ };
4577
+
4578
+ /**
4579
+ * 譜面明細内の補足情報の登録・更新
4580
+ * @param {string} _name 表示する譜面明細のラベル
4581
+ * @param {string} _label
4582
+ * @param {string} _value
4583
+ * @param {number} _pos 表示位置
4584
+ * @param {string} _labelname
4585
+ */
4586
+ const updateScoreDetailLabel = (_name, _label, _value, _pos = 0, _labelname = _label) => {
4587
+ const baseLabel = (_bLabel, _bLabelname, _bAlign) =>
4588
+ document.querySelector(`#detail${_name}`).appendChild(
4589
+ createDivCss2Label(`${_bLabel}`, `${_bLabelname}`, {
4590
+ x: 10, y: 105 + _pos * 20, w: 100, h: 20, siz: g_limitObj.difSelectorSiz, align: _bAlign,
4591
+ })
4592
+ );
4593
+ if (document.querySelector(`#data${_label}`) === null) {
4594
+ baseLabel(`lbl${_label}`, `${_labelname}`, C_ALIGN_LEFT);
4595
+ baseLabel(`data${_label}`, `${_value}`, C_ALIGN_RIGHT);
4596
+ } else {
4597
+ document.querySelector(`#data${_label}`).textContent = `${_value}`;
4598
+ }
4599
+ };
4600
+
4601
+ /**
4602
+ * グラフの縦軸を描画
4603
+ * @param {object} _context
4604
+ * @param {number} _resolution
4605
+ */
4606
+ const drawBaseLine = (_context, _resolution = 10) => {
4607
+ _context.clearRect(0, 0, g_limitObj.graphWidth, g_limitObj.graphHeight);
4608
+
4609
+ for (let j = 0; j <= 2 * _resolution; j += 5) {
4610
+ drawLine(_context, j / _resolution, `main`, 2);
4611
+ for (let k = 1; k < 5; k++) {
4612
+ drawLine(_context, (j + k) / _resolution, `sub`, 2);
4613
+ }
4614
+ }
4615
+ };
4393
4616
 
4617
+ /**
4618
+ * グラフ上に目盛を表示
4619
+ * @param {object} _context
4620
+ * @param {number} _y
4621
+ * @param {string} _lineType
4622
+ * @param {number} _fixed
4623
+ */
4624
+ const drawLine = (_context, _y, _lineType, _fixed = 0) => {
4625
+ const lineY = (_y - 1) * -90 + 105;
4626
+ _context.beginPath();
4627
+ _context.moveTo(30, lineY);
4628
+ _context.lineTo(g_limitObj.graphWidth, lineY);
4629
+ _context.lineWidth = 1;
4630
+
4631
+ if (_lineType === `main`) {
4632
+ const textBaseObj = document.querySelector(`#lnkDifficulty`);
4633
+ const textColor = window.getComputedStyle(textBaseObj, ``).color;
4634
+ _context.strokeStyle = textColor;
4635
+ _context.font = `12px ${getBasicFont()}`;
4636
+ _context.fillStyle = textColor;
4637
+ _context.fillText(_y.toFixed(_fixed), 0, lineY + 4);
4638
+ } else {
4639
+ _context.strokeStyle = `#646464`;
4640
+ }
4641
+ _context.stroke();
4642
+ };
4643
+
4644
+ /**
4645
+ * 譜面の難易度情報用ラベル作成
4646
+ * @param {number} _scoreId
4647
+ */
4648
+ const makeDifInfoLabels = _scoreId => {
4649
+
4650
+ // ツール難易度
4651
+ const detailToolDif = document.querySelector(`#detailToolDif`);
4394
4652
  /**
4395
- * 譜面変更セレクターの作成・再作成
4396
- * @param {string} _key
4653
+ * 譜面の難易度情報ラベルの作成
4654
+ * @param {string} _lbl
4655
+ * @param {string} _data
4656
+ * @param {object} _obj
4397
4657
  */
4398
- const createDifWindow = (_key = ``) => {
4399
- g_currentPage = `difSelector`;
4400
- setShortcutEvent(g_currentPage);
4401
- const difList = createEmptySprite(optionsprite, `difList`, g_windowObj.difList, g_cssObj.settings_DifSelector);
4402
- const difCover = createEmptySprite(optionsprite, `difCover`, g_windowObj.difCover, g_cssObj.settings_DifSelector);
4658
+ const makeDifInfoLabel = (_lbl, _data, { x = 130, y = 25, w = 125, h = 35, siz = g_limitObj.difSelectorSiz, ...rest } = {}) =>
4659
+ createDivCss2Label(_lbl, _data, { x, y, w, h, siz, align: C_ALIGN_LEFT, ...rest });
4660
+
4661
+ let printData = ``;
4662
+ for (let j = 0; j < g_detailObj.arrowCnt.length; j++) {
4663
+ const obj = getScoreBaseData(j);
4664
+ printData +=
4665
+ // 譜面番号
4666
+ `[${j + 1}]\t` +
4667
+ // ツール値
4668
+ `${g_detailObj.toolDif[j].tool}\t` +
4669
+ // 同時
4670
+ `${g_detailObj.toolDif[j].douji}\t` +
4671
+ // 縦連
4672
+ `${g_detailObj.toolDif[j].tate}\t` +
4673
+ // 総矢印数
4674
+ `${(obj.arrowCnts + obj.frzCnts)}\t` +
4675
+ // 矢印
4676
+ `${obj.arrowCnts}\t` +
4677
+ // フリーズアロー
4678
+ `${obj.frzCnts}\t` +
4679
+ // APM
4680
+ `${obj.apm}\t` +
4681
+ // 時間(分秒)
4682
+ `${obj.playingTime}\r\n`;
4683
+ }
4684
+ multiAppend(detailToolDif,
4685
+ makeDifInfoLabel(`lblTooldif`, g_lblNameObj.s_level, g_lblPosObj.lblTooldif),
4686
+ makeDifInfoLabel(`dataTooldif`, ``, g_lblPosObj.dataTooldif),
4687
+ makeDifInfoLabel(`lblDouji`, g_lblNameObj.s_douji, g_lblPosObj.lblDouji),
4688
+ makeDifInfoLabel(`lblTate`, g_lblNameObj.s_tate, g_lblPosObj.lblTate),
4689
+ makeDifInfoLabel(`dataDouji`, ``, g_lblPosObj.dataDouji),
4690
+ makeDifInfoLabel(`dataTate`, ``, g_lblPosObj.dataTate),
4691
+ makeDifInfoLabel(`lblArrowInfo`, g_lblNameObj.s_cnts, g_lblPosObj.lblArrowInfo),
4692
+ makeDifInfoLabel(`dataArrowInfo`, ``, g_lblPosObj.dataArrowInfo),
4693
+ makeDifInfoLabel(`lblArrowInfo2`, ``, g_lblPosObj.lblArrowInfo2),
4694
+ makeDifInfoLabel(`dataArrowInfo2`, ``, g_lblPosObj.dataArrowInfo2),
4695
+ makeDifLblCssButton(`lnkDifInfo`, g_lblNameObj.s_print, 8, _ => {
4696
+ copyTextToClipboard(
4697
+ `****** ${g_lblNameObj.s_printTitle} [${g_version}] ******\r\n\r\n`
4698
+ + `\t${g_lblNameObj.s_printHeader}\r\n\r\n${printData}`, g_msgInfoObj.I_0003
4699
+ );
4700
+ }, g_lblPosObj.lnkDifInfo),
4701
+ );
4702
+ createScText(lnkDifInfo, `DifInfo`, { targetLabel: `lnkDifInfo`, x: -10 });
4703
+ };
4704
+
4705
+ /**
4706
+ * 譜面の難易度情報更新
4707
+ * @param {number} _scoreId
4708
+ */
4709
+ const makeDifInfo = _scoreId => {
4403
4710
 
4404
- // リスト再作成
4405
- makeDifList(difList, _key);
4711
+ const arrowCnts = sumData(g_detailObj.arrowCnt[_scoreId]);
4712
+ const frzCnts = sumData(g_detailObj.frzCnt[_scoreId]);
4713
+ const push3CntStr = (g_detailObj.toolDif[_scoreId].push3.length === 0 ? `None` : `(${g_detailObj.toolDif[_scoreId].push3})`);
4406
4714
 
4407
- // ランダム選択
4408
- difCover.appendChild(
4409
- makeDifLblCssButton(`difRandom`, `RANDOM`, 0, _ => {
4410
- nextDifficulty(Math.floor(Math.random() * g_headerObj.keyLabels.length));
4411
- }, { w: g_limitObj.difCoverWidth })
4412
- );
4715
+ if (document.querySelector(`#lblTooldif`) === null) {
4716
+ makeDifInfoLabels(_scoreId);
4717
+ }
4718
+ dataTooldif.textContent = g_detailObj.toolDif[_scoreId].tool;
4719
+ dataDouji.textContent = g_detailObj.toolDif[_scoreId].douji;
4720
+ dataTate.textContent = g_detailObj.toolDif[_scoreId].tate;
4721
+ lblArrowInfo2.innerHTML = g_lblNameObj.s_linecnts.split(`{0}`).join(g_detailObj.toolDif[_scoreId].push3cnt);
4722
+ dataArrowInfo.innerHTML = `${arrowCnts + frzCnts} <span style="font-size:${g_limitObj.difSelectorSiz}px;">(${arrowCnts} + ${frzCnts})</span>`;
4723
+ dataArrowInfo2.innerHTML = `<br>(${g_detailObj.arrowCnt[_scoreId]})<br><br>
4724
+ (${g_detailObj.frzCnt[_scoreId]})<br><br>
4725
+ ${push3CntStr}`.split(`,`).join(`/`);
4726
+ };
4413
4727
 
4414
- // 全リスト
4415
- difCover.appendChild(
4416
- makeDifLblCssButton(`keyFilter`, `ALL`, 1.5, _ => {
4417
- resetDifWindow();
4418
- g_stateObj.filterKeys = ``;
4419
- createDifWindow();
4420
- }, { w: g_limitObj.difCoverWidth, btnStyle: (g_stateObj.filterKeys === `` ? `Setting` : `Default`) })
4421
- );
4728
+ /**
4729
+ * 譜面初期化処理
4730
+ * - 譜面の基本設定(キー数、初期速度、リバース、ゲージ設定)をここで行う
4731
+ * - g_canLoadDifInfoFlg は譜面初期化フラグで、初期化したくない場合は対象画面にて false にしておく
4732
+ * (Display設定画面、キーコンフィグ画面では通常OFF)
4733
+ * この関数を実行後、このフラグはONに戻るようになっている
4734
+ * - [キーコン]->[初期化]->[名称設定]の順に配置する。
4735
+ * 初期化処理にてキー数関連の設定を行っているため、この順序で無いとデータが正しく格納されない
4736
+ */
4737
+ const setDifficulty = (_initFlg) => {
4422
4738
 
4423
- // キー別フィルタボタン作成
4424
- let pos = 0;
4425
- g_headerObj.keyLists.forEach((targetKey, m) => {
4426
- difCover.appendChild(
4427
- makeDifLblCssButton(`keyFilter${m}`, `${getKeyName(targetKey)} key`, m + 2.5, _ => {
4428
- resetDifWindow();
4429
- g_stateObj.filterKeys = targetKey;
4430
- createDifWindow(targetKey);
4431
- }, { w: g_limitObj.difCoverWidth, btnStyle: (g_stateObj.filterKeys === targetKey ? `Setting` : `Default`) })
4432
- );
4433
- if (g_stateObj.filterKeys === targetKey) {
4434
- pos = m + 9;
4739
+ const getCurrentNo = (_list, _target) => roundZero(_list.findIndex(item => item === _target));
4740
+
4741
+ // ---------------------------------------------------
4742
+ // 1. キーコンフィグ設定 (KeyConfig)
4743
+ g_keyObj.currentKey = g_headerObj.keyLabels[g_stateObj.scoreId];
4744
+ const isNotSameKey = (g_keyObj.prevKey !== g_keyObj.currentKey);
4745
+
4746
+ if (g_headerObj.dummyScoreNos !== undefined) {
4747
+ g_stateObj.dummyId = setIntVal(g_headerObj.dummyScoreNos[g_stateObj.scoreId], ``);
4748
+ }
4749
+ // 特殊キーフラグ
4750
+ g_stateObj.extraKeyFlg = g_headerObj.keyExtraList.includes(g_keyObj.currentKey);
4751
+
4752
+ // ---------------------------------------------------
4753
+ // 2. 初期化設定
4754
+
4755
+ // 保存した設定の再読込条件(設定画面切り替え時はスキップ)
4756
+ // ローカルストレージで保存した設定を呼び出し
4757
+ if ((g_canLoadDifInfoFlg && (isNotSameKey && g_stateObj.dataSaveFlg)) || _initFlg) {
4758
+
4759
+ if (isNotSameKey && g_keyObj.prevKey !== `Dummy`) {
4760
+ // キーパターン初期化
4761
+ g_keyObj.currentPtn = 0;
4762
+ g_keycons.keySwitchNum = 0;
4763
+ }
4764
+ const hasKeyStorage = localStorage.getItem(`danonicw-${g_keyObj.currentKey}k`);
4765
+ let storageObj, addKey = ``;
4766
+
4767
+ if (!g_stateObj.extraKeyFlg) {
4768
+
4769
+ // キー別のローカルストレージの初期設定 ※特殊キーは除く
4770
+ g_localKeyStorage = hasKeyStorage ? JSON.parse(hasKeyStorage) : {
4771
+ reverse: C_FLG_OFF,
4772
+ keyCtrl: [[]],
4773
+ keyCtrlPtn: 0,
4774
+ setColor: [],
4775
+ };
4776
+ storageObj = g_localKeyStorage;
4777
+
4778
+ } else {
4779
+ storageObj = g_localStorage;
4780
+ addKey = g_keyObj.currentKey;
4781
+ }
4782
+ if (isNotSameKey) {
4783
+ getKeyReverse(storageObj, addKey);
4784
+
4785
+ // キーコンフィグ初期値設定
4786
+ if (storageObj[`keyCtrlPtn${addKey}`] === undefined) {
4787
+ storageObj[`keyCtrlPtn${addKey}`] = 0;
4435
4788
  }
4436
- });
4437
- const overlength = pos * g_limitObj.setLblHeight - parseInt(difCover.style.height);
4438
- difCover.scrollTop = (overlength > 0 ? overlength : 0);
4789
+ getKeyCtrl(storageObj, addKey);
4439
4790
 
4440
- multiAppend(optionsprite, makeDifBtn(-1), makeDifBtn());
4441
- };
4791
+ // カラーセット初期値設定
4792
+ if (storageObj[`setColor${addKey}`] === undefined) {
4793
+ storageObj[`setColor${addKey}`] = [];
4794
+ }
4795
+ if (storageObj[`setColor${addKey}`].length > 0) {
4796
+ g_keycons.colorTypes = addValtoArray(g_keycons.colorTypes, g_keycons.colorSelf);
4797
+ resetColorType({ _fromObj: storageObj, _from: addKey, _to: g_keycons.colorSelf });
4798
+ resetColorType({ _fromObj: storageObj, _from: addKey, _toObj: g_dfColorObj, _to: g_keycons.colorSelf });
4442
4799
 
4443
- const changeDifficulty = (_num = 1) => {
4444
- if (g_headerObj.difSelectorUse) {
4445
- g_stateObj.filterKeys = ``;
4446
- if (document.querySelector(`#difList`) === null) {
4447
- createDifWindow();
4448
4800
  } else {
4449
- resetDifWindow();
4801
+ if (g_localStorage.colorType === g_keycons.colorSelf) {
4802
+ g_colorType = `Default`;
4803
+ }
4804
+ g_keycons.colorTypes = g_keycons.colorTypes.filter(val => val !== g_keycons.colorSelf);
4450
4805
  }
4451
- } else {
4452
- nextDifficulty(_num);
4806
+
4807
+ const keyCtrlPtn = `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`;
4808
+
4809
+ // カラーグループ、シャッフルグループの設定
4810
+ g_keycons.groups.forEach(type => {
4811
+ resetGroupList(type, keyCtrlPtn);
4812
+ if (g_keyObj.currentPtn === -1) {
4813
+ const storageKeyName = storageObj[`${type}${addKey}`] || storageObj[`${type}${g_keyObj.currentKey}_-1_-1`];
4814
+ if (storageKeyName !== undefined) {
4815
+ g_keyObj[`${type}${g_keyObj.currentKey}_-1`] = structuredClone(storageKeyName);
4816
+ }
4817
+ g_keyObj[`${type}${g_keyObj.currentKey}_-1_-1`] = structuredClone(g_keyObj[`${type}${g_keyObj.currentKey}_-1`]);
4818
+ } else {
4819
+ g_keyObj[`${type}${keyCtrlPtn}`] = structuredClone(g_keyObj[`${type}${keyCtrlPtn}_0`]);
4820
+ }
4821
+ });
4822
+
4453
4823
  }
4454
- };
4824
+
4825
+ const keyCtrlPtn = `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`;
4826
+ if (g_headerObj.keyRetryDef === C_KEY_RETRY) {
4827
+ g_headerObj.keyRetry = setIntVal(getKeyCtrlVal(g_keyObj[`keyRetry${keyCtrlPtn}`]), g_headerObj.keyRetryDef);
4828
+ }
4829
+ if (g_headerObj.keyTitleBackDef === C_KEY_TITLEBACK) {
4830
+ g_headerObj.keyTitleBack = setIntVal(getKeyCtrlVal(g_keyObj[`keyTitleBack${keyCtrlPtn}`]), g_headerObj.keyTitleBackDef);
4831
+ }
4832
+ }
4833
+
4834
+ // スクロール設定用の配列を入れ替え
4835
+ g_settings.scrolls = structuredClone(
4836
+ typeof g_keyObj[`scrollDir${g_keyObj.currentKey}_${g_keyObj.currentPtn}`] === C_TYP_OBJECT ?
4837
+ Object.keys(g_keyObj[`scrollDir${g_keyObj.currentKey}_${g_keyObj.currentPtn}`]) : g_keyObj.scrollName_def
4838
+ );
4839
+
4840
+ // アシスト設定の配列を入れ替え
4841
+ g_settings.autoPlays = (typeof g_keyObj[`assistPos${g_keyObj.currentKey}_${g_keyObj.currentPtn}`] === C_TYP_OBJECT ?
4842
+ g_autoPlaysBase.concat(Object.keys(g_keyObj[`assistPos${g_keyObj.currentKey}_${g_keyObj.currentPtn}`])) :
4843
+ g_autoPlaysBase.concat());
4844
+
4845
+ // 速度、ゲージ、スクロール、アシスト設定のカーソル位置調整
4846
+ if (_initFlg) {
4847
+ g_stateObj.speed = g_headerObj.initSpeeds[g_stateObj.scoreId];
4848
+ g_settings.speedNum = getCurrentNo(g_settings.speeds, g_stateObj.speed);
4849
+ g_settings.gaugeNum = 0;
4850
+ }
4851
+ g_settings.scrollNum = getCurrentNo(g_settings.scrolls, g_stateObj.scroll);
4852
+ g_settings.autoPlayNum = getCurrentNo(g_settings.autoPlays, g_stateObj.autoPlay);
4853
+
4854
+ // ---------------------------------------------------
4855
+ // 3. 名称の設定
4856
+
4857
+ // 譜面名設定 (Difficulty)
4858
+ const difWidth = parseFloat(lnkDifficulty.style.width);
4859
+ const difNames = [`${getKeyName(g_keyObj.currentKey)} ${getStgDetailName('key')} / ${g_headerObj.difLabels[g_stateObj.scoreId]}`];
4860
+ lnkDifficulty.style.fontSize = `${getFontSize(difNames[0], difWidth, getBasicFont(), g_limitObj.setLblSiz)}px`;
4861
+
4862
+ if (g_headerObj.makerView) {
4863
+ difNames.push(`(${g_headerObj.creatorNames[g_stateObj.scoreId]})`);
4864
+ difNames.forEach((difName, j) => {
4865
+ const tmpSize = getFontSize(difName, difWidth, getBasicFont(), 14);
4866
+ difNames[j] = `<span style="font-size:${tmpSize}px">${difName}</span>`;
4867
+ });
4868
+ }
4869
+ lnkDifficulty.innerHTML = difNames.join(``);
4870
+
4871
+ // 速度設定 (Speed)
4872
+ setSetting(0, `speed`, ` ${g_lblNameObj.multi}`);
4873
+ if (g_headerObj.scoreDetailUse) {
4874
+ drawSpeedGraph(g_stateObj.scoreId);
4875
+ drawDensityGraph(g_stateObj.scoreId);
4876
+ makeDifInfo(g_stateObj.scoreId);
4877
+ }
4878
+
4879
+ // リバース設定 (Reverse, Scroll)
4880
+ if (g_headerObj.scrollUse) {
4881
+ g_stateObj.scroll = g_settings.scrolls[g_settings.scrollNum];
4882
+ const [visibleScr, hiddenScr] = (g_settings.scrolls.length > 1 ? [`scroll`, `reverse`] : [`reverse`, `scroll`]);
4883
+ document.getElementById(`${visibleScr}Sprite`).style.display = C_DIS_INHERIT;
4884
+ document.getElementById(`${hiddenScr}Sprite`).style.display = C_DIS_NONE;
4885
+ setSetting(0, visibleScr);
4886
+
4887
+ g_shortcutObj.option.KeyR.id = g_settings.scrolls.includes(`Reverse`) ?
4888
+ g_shortcutObj.option.KeyR.exId : g_shortcutObj.option.KeyR.dfId;
4889
+
4890
+ if (g_settings.scrolls.length > 1) {
4891
+ setReverseView(document.querySelector(`#btnReverse`));
4892
+ }
4893
+ } else {
4894
+ g_settings.scrolls = structuredClone(g_keyObj.scrollName_def);
4895
+ setSetting(0, `reverse`);
4896
+ }
4897
+
4898
+ // オート・アシスト設定 (AutoPlay)
4899
+ g_stateObj.autoPlay = g_settings.autoPlays[g_settings.autoPlayNum];
4900
+ lnkAutoPlay.textContent = getStgDetailName(g_stateObj.autoPlay);
4901
+
4902
+ // ゲージ設定 (Gauge)
4903
+ const defaultCustomGauge = g_gaugeOptionObj.custom0 || g_gaugeOptionObj.customDefault;
4904
+ if (hasVal(defaultCustomGauge)) {
4905
+ g_gaugeOptionObj.custom = (g_gaugeOptionObj[`custom${g_stateObj.scoreId}`] || defaultCustomGauge).concat();
4906
+ g_gaugeOptionObj.varCustom = (g_gaugeOptionObj[`varCustom${g_stateObj.scoreId}`] || g_gaugeOptionObj.varCustom0 || g_gaugeOptionObj.varCustomDefault).concat();
4907
+ }
4908
+ setGauge(0);
4909
+
4910
+ // ユーザカスタムイベント(初期)
4911
+ g_customJsObj.difficulty.forEach(func => func(_initFlg, g_canLoadDifInfoFlg));
4912
+
4913
+ // ---------------------------------------------------
4914
+ // 4. 譜面初期情報ロード許可フラグの設定
4915
+ g_canLoadDifInfoFlg = true;
4916
+ };
4917
+
4918
+ /**
4919
+ * 設定・オプション画面のラベル・ボタン処理の描画
4920
+ * @param {Object} _sprite 基準とするスプライト(ここで指定する座標は、そのスプライトからの相対位置)
4921
+ */
4922
+ const createOptionWindow = _sprite => {
4923
+
4924
+ // 各ボタン用のスプライトを作成
4925
+ const optionsprite = createOptionSprite(_sprite);
4926
+
4927
+ // 設定毎に個別のスプライトを作成し、その中にラベル・ボタン類を配置
4928
+ const spriteList = setSpriteList(g_settingPos.option);
4929
+
4930
+ // ---------------------------------------------------
4931
+ // 難易度 (Difficulty)
4932
+ // 縦位置: 0
4933
+ spriteList.difficulty.appendChild(createLblSetting(`Difficulty`, -5));
4934
+
4455
4935
  const lnkDifficulty = makeSettingLblCssButton(`lnkDifficulty`, ``, 0, _ => changeDifficulty(), {
4456
4936
  y: -10, h: g_limitObj.setLblHeight + 10, cxtFunc: _ => changeDifficulty(-1),
4457
4937
  });
@@ -4575,276 +5055,6 @@ const createOptionWindow = _sprite => {
4575
5055
  g_shortcutObj.option.KeyQ.id = g_settings.scoreDetailCursors[0];
4576
5056
  };
4577
5057
 
4578
- /**
4579
- * 譜面基礎データの取得
4580
- * @param {number} _scoreId
4581
- */
4582
- const getScoreBaseData = _scoreId => {
4583
- const arrowCnts = sumData(g_detailObj.arrowCnt[_scoreId]);
4584
- const frzCnts = sumData(g_detailObj.frzCnt[_scoreId]);
4585
- return {
4586
- arrowCnts: arrowCnts,
4587
- frzCnts: frzCnts,
4588
- apm: Math.round((arrowCnts + frzCnts) / (g_detailObj.playingFrame[_scoreId] / g_fps / 60)),
4589
- playingTime: transFrameToTimer(g_detailObj.playingFrame[_scoreId]),
4590
- };
4591
- };
4592
-
4593
- /**
4594
- * 速度変化グラフの描画
4595
- * @param {number} _scoreId
4596
- */
4597
- const drawSpeedGraph = _scoreId => {
4598
- const startFrame = g_detailObj.startFrame[_scoreId];
4599
- const playingFrame = g_detailObj.playingFrameWithBlank[_scoreId];
4600
- const speedObj = {
4601
- speed: { frame: [0], speed: [1], cnt: 0, strokeColor: g_graphColorObj.speed },
4602
- boost: { frame: [0], speed: [1], cnt: 0, strokeColor: g_graphColorObj.boost }
4603
- };
4604
-
4605
- Object.keys(speedObj).forEach(speedType => {
4606
- let frame = speedObj[speedType].frame;
4607
- let speed = speedObj[speedType].speed;
4608
- const speedData = g_detailObj[`${speedType}Data`][_scoreId];
4609
-
4610
- if (speedData !== undefined) {
4611
- for (let i = 0; i < speedData.length; i += 2) {
4612
- if (speedData[i] >= startFrame) {
4613
- frame.push(speedData[i] - startFrame);
4614
- speed.push(speedData[i + 1]);
4615
- }
4616
- speedObj[speedType].cnt++;
4617
- }
4618
- frame.push(playingFrame);
4619
- speed.push(speed[speed.length - 1]);
4620
- }
4621
- });
4622
-
4623
- const canvas = document.querySelector(`#graphSpeed`);
4624
- const context = canvas.getContext(`2d`);
4625
- drawBaseLine(context);
4626
-
4627
- Object.keys(speedObj).forEach((speedType, j) => {
4628
- context.beginPath();
4629
- let preY;
4630
-
4631
- for (let i = 0; i < speedObj[speedType].frame.length; i++) {
4632
- const x = speedObj[speedType].frame[i] * (g_limitObj.graphWidth - 30) / playingFrame + 30;
4633
- const y = (speedObj[speedType].speed[i] - 1) * -90 + 105;
4634
-
4635
- context.lineTo(x, preY);
4636
- context.lineTo(x, y);
4637
- preY = y;
4638
- }
4639
-
4640
- context.lineWidth = 1;
4641
- context.strokeStyle = speedObj[speedType].strokeColor;
4642
- context.stroke();
4643
-
4644
- const lineX = (speedType === `speed`) ? 125 : 210;
4645
- context.beginPath();
4646
- context.moveTo(lineX, 215);
4647
- context.lineTo(lineX + 30, 215);
4648
- context.stroke();
4649
- context.font = `${g_limitObj.difSelectorSiz}px ${getBasicFont()}`;
4650
- context.fillText(speedType, lineX + 35, 218);
4651
-
4652
- updateScoreDetailLabel(`Speed`, `${speedType}S`, speedObj[speedType].cnt, j, g_lblNameObj[`s_${speedType}`]);
4653
- });
4654
- };
4655
-
4656
- /**
4657
- * 譜面密度グラフの描画
4658
- * @param {number} _scoreId
4659
- */
4660
- const drawDensityGraph = _scoreId => {
4661
-
4662
- const canvas = document.querySelector(`#graphDensity`);
4663
- const context = canvas.getContext(`2d`);
4664
- drawBaseLine(context);
4665
- for (let j = 0; j < g_limitObj.densityDivision; j++) {
4666
- context.beginPath();
4667
- [``, `2Push`, `3Push`].forEach(val => {
4668
- context.fillStyle = (g_detailObj.maxDensity[_scoreId].includes(j) ? g_graphColorObj[`max${val}`] : g_graphColorObj[`default${val}`]);
4669
- context.fillRect(16 * j * 16 / g_limitObj.densityDivision + 30, 195 - 9 * g_detailObj[`density${val}Data`][_scoreId][j] / 10,
4670
- 15.5 * 16 / g_limitObj.densityDivision, 9 * g_detailObj[`density${val}Diff`][_scoreId][j] / 10
4671
- );
4672
- });
4673
- context.stroke();
4674
- }
4675
-
4676
- const lineNames = [`Single`, `Chord`, `Triad+`];
4677
- Object.keys(g_graphColorObj).filter(val => val.indexOf(`max`) !== -1).forEach((val, j) => {
4678
- const lineX = 70 + j * 70;
4679
-
4680
- context.beginPath();
4681
- context.lineWidth = 3;
4682
- context.fillStyle = g_rankObj.rankColorAllPerfect;
4683
- context.strokeStyle = g_graphColorObj[val];
4684
- context.moveTo(lineX, 215);
4685
- context.lineTo(lineX + 20, 215);
4686
- context.stroke();
4687
- context.font = `${g_limitObj.difSelectorSiz}px ${getBasicFont()}`;
4688
- context.fillText(lineNames[j], lineX + 20, 218);
4689
- });
4690
-
4691
- const obj = getScoreBaseData(_scoreId);
4692
- updateScoreDetailLabel(`Density`, `APM`, obj.apm, 0, g_lblNameObj.s_apm);
4693
- updateScoreDetailLabel(`Density`, `Time`, obj.playingTime, 1, g_lblNameObj.s_time);
4694
- updateScoreDetailLabel(`Density`, `Arrow`, obj.arrowCnts, 3, g_lblNameObj.s_arrow);
4695
- updateScoreDetailLabel(`Density`, `Frz`, obj.frzCnts, 4, g_lblNameObj.s_frz);
4696
- };
4697
-
4698
- /**
4699
- * 譜面明細内の補足情報の登録・更新
4700
- * @param {string} _name 表示する譜面明細のラベル
4701
- * @param {string} _label
4702
- * @param {string} _value
4703
- * @param {number} _pos 表示位置
4704
- * @param {string} _labelname
4705
- */
4706
- const updateScoreDetailLabel = (_name, _label, _value, _pos = 0, _labelname = _label) => {
4707
- const baseLabel = (_bLabel, _bLabelname, _bAlign) =>
4708
- document.querySelector(`#detail${_name}`).appendChild(
4709
- createDivCss2Label(`${_bLabel}`, `${_bLabelname}`, {
4710
- x: 10, y: 105 + _pos * 20, w: 100, h: 20, siz: g_limitObj.difSelectorSiz, align: _bAlign,
4711
- })
4712
- );
4713
- if (document.querySelector(`#data${_label}`) === null) {
4714
- baseLabel(`lbl${_label}`, `${_labelname}`, C_ALIGN_LEFT);
4715
- baseLabel(`data${_label}`, `${_value}`, C_ALIGN_RIGHT);
4716
- } else {
4717
- document.querySelector(`#data${_label}`).textContent = `${_value}`;
4718
- }
4719
- };
4720
-
4721
- /**
4722
- * グラフの縦軸を描画
4723
- * @param {object} _context
4724
- * @param {number} _resolution
4725
- */
4726
- const drawBaseLine = (_context, _resolution = 10) => {
4727
- _context.clearRect(0, 0, g_limitObj.graphWidth, g_limitObj.graphHeight);
4728
-
4729
- for (let j = 0; j <= 2 * _resolution; j += 5) {
4730
- drawLine(_context, j / _resolution, `main`, 2);
4731
- for (let k = 1; k < 5; k++) {
4732
- drawLine(_context, (j + k) / _resolution, `sub`, 2);
4733
- }
4734
- }
4735
- };
4736
-
4737
- /**
4738
- * グラフ上に目盛を表示
4739
- * @param {object} _context
4740
- * @param {number} _y
4741
- * @param {string} _lineType
4742
- * @param {number} _fixed
4743
- */
4744
- const drawLine = (_context, _y, _lineType, _fixed = 0) => {
4745
- const lineY = (_y - 1) * -90 + 105;
4746
- _context.beginPath();
4747
- _context.moveTo(30, lineY);
4748
- _context.lineTo(g_limitObj.graphWidth, lineY);
4749
- _context.lineWidth = 1;
4750
-
4751
- if (_lineType === `main`) {
4752
- const textBaseObj = document.querySelector(`#lnkDifficulty`);
4753
- const textColor = window.getComputedStyle(textBaseObj, ``).color;
4754
- _context.strokeStyle = textColor;
4755
- _context.font = `12px ${getBasicFont()}`;
4756
- _context.fillStyle = textColor;
4757
- _context.fillText(_y.toFixed(_fixed), 0, lineY + 4);
4758
- } else {
4759
- _context.strokeStyle = `#646464`;
4760
- }
4761
- _context.stroke();
4762
- };
4763
-
4764
- /**
4765
- * 譜面の難易度情報用ラベル作成
4766
- * @param {number} _scoreId
4767
- */
4768
- const makeDifInfoLabels = _scoreId => {
4769
-
4770
- // ツール難易度
4771
- const detailToolDif = document.querySelector(`#detailToolDif`);
4772
- /**
4773
- * 譜面の難易度情報ラベルの作成
4774
- * @param {string} _lbl
4775
- * @param {string} _data
4776
- * @param {object} _obj
4777
- */
4778
- const makeDifInfoLabel = (_lbl, _data, { x = 130, y = 25, w = 125, h = 35, siz = g_limitObj.difSelectorSiz, ...rest } = {}) =>
4779
- createDivCss2Label(_lbl, _data, { x, y, w, h, siz, align: C_ALIGN_LEFT, ...rest });
4780
-
4781
- let printData = ``;
4782
- for (let j = 0; j < g_detailObj.arrowCnt.length; j++) {
4783
- const obj = getScoreBaseData(j);
4784
- printData +=
4785
- // 譜面番号
4786
- `[${j + 1}]\t` +
4787
- // ツール値
4788
- `${g_detailObj.toolDif[j].tool}\t` +
4789
- // 同時
4790
- `${g_detailObj.toolDif[j].douji}\t` +
4791
- // 縦連
4792
- `${g_detailObj.toolDif[j].tate}\t` +
4793
- // 総矢印数
4794
- `${(obj.arrowCnts + obj.frzCnts)}\t` +
4795
- // 矢印
4796
- `${obj.arrowCnts}\t` +
4797
- // フリーズアロー
4798
- `${obj.frzCnts}\t` +
4799
- // APM
4800
- `${obj.apm}\t` +
4801
- // 時間(分秒)
4802
- `${obj.playingTime}\r\n`;
4803
- }
4804
- multiAppend(detailToolDif,
4805
- makeDifInfoLabel(`lblTooldif`, g_lblNameObj.s_level, g_lblPosObj.lblTooldif),
4806
- makeDifInfoLabel(`dataTooldif`, ``, g_lblPosObj.dataTooldif),
4807
- makeDifInfoLabel(`lblDouji`, g_lblNameObj.s_douji, g_lblPosObj.lblDouji),
4808
- makeDifInfoLabel(`lblTate`, g_lblNameObj.s_tate, g_lblPosObj.lblTate),
4809
- makeDifInfoLabel(`dataDouji`, ``, g_lblPosObj.dataDouji),
4810
- makeDifInfoLabel(`dataTate`, ``, g_lblPosObj.dataTate),
4811
- makeDifInfoLabel(`lblArrowInfo`, g_lblNameObj.s_cnts, g_lblPosObj.lblArrowInfo),
4812
- makeDifInfoLabel(`dataArrowInfo`, ``, g_lblPosObj.dataArrowInfo),
4813
- makeDifInfoLabel(`lblArrowInfo2`, ``, g_lblPosObj.lblArrowInfo2),
4814
- makeDifInfoLabel(`dataArrowInfo2`, ``, g_lblPosObj.dataArrowInfo2),
4815
- makeDifLblCssButton(`lnkDifInfo`, g_lblNameObj.s_print, 8, _ => {
4816
- copyTextToClipboard(
4817
- `****** ${g_lblNameObj.s_printTitle} [${g_version}] ******\r\n\r\n`
4818
- + `\t${g_lblNameObj.s_printHeader}\r\n\r\n${printData}`, g_msgInfoObj.I_0003
4819
- );
4820
- }, g_lblPosObj.lnkDifInfo),
4821
- );
4822
- createScText(lnkDifInfo, `DifInfo`, { targetLabel: `lnkDifInfo`, x: -10 });
4823
- };
4824
-
4825
- /**
4826
- * 譜面の難易度情報更新
4827
- * @param {number} _scoreId
4828
- */
4829
- const makeDifInfo = _scoreId => {
4830
-
4831
- const arrowCnts = sumData(g_detailObj.arrowCnt[_scoreId]);
4832
- const frzCnts = sumData(g_detailObj.frzCnt[_scoreId]);
4833
- const push3CntStr = (g_detailObj.toolDif[_scoreId].push3.length === 0 ? `None` : `(${g_detailObj.toolDif[_scoreId].push3})`);
4834
-
4835
- if (document.querySelector(`#lblTooldif`) === null) {
4836
- makeDifInfoLabels(_scoreId);
4837
- }
4838
- dataTooldif.textContent = g_detailObj.toolDif[_scoreId].tool;
4839
- dataDouji.textContent = g_detailObj.toolDif[_scoreId].douji;
4840
- dataTate.textContent = g_detailObj.toolDif[_scoreId].tate;
4841
- lblArrowInfo2.innerHTML = g_lblNameObj.s_linecnts.split(`{0}`).join(g_detailObj.toolDif[_scoreId].push3cnt);
4842
- dataArrowInfo.innerHTML = `${arrowCnts + frzCnts} <span style="font-size:${g_limitObj.difSelectorSiz}px;">(${arrowCnts} + ${frzCnts})</span>`;
4843
- dataArrowInfo2.innerHTML = `<br>(${g_detailObj.arrowCnt[_scoreId]})<br><br>
4844
- (${g_detailObj.frzCnt[_scoreId]})<br><br>
4845
- ${push3CntStr}`.split(`,`).join(`/`);
4846
- };
4847
-
4848
5058
  // ---------------------------------------------------
4849
5059
  // 速度モーション (Motion)
4850
5060
  // 縦位置: 3
@@ -4877,25 +5087,6 @@ const createOptionWindow = _sprite => {
4877
5087
  spriteList.scroll.style.pointerEvents = C_DIS_NONE;
4878
5088
  }
4879
5089
 
4880
- const setReverse = _btn => {
4881
- if (!g_settings.scrolls.includes(`Reverse`)) {
4882
- g_settings.reverseNum = (g_settings.reverseNum + 1) % 2;
4883
- g_stateObj.reverse = g_settings.reverses[g_settings.reverseNum];
4884
- setReverseView(_btn);
4885
- }
4886
- };
4887
-
4888
- const setReverseView = _btn => {
4889
- _btn.classList.replace(g_cssObj[`button_Rev${g_settings.reverses[(g_settings.reverseNum + 1) % 2]}`],
4890
- g_cssObj[`button_Rev${g_settings.reverses[g_settings.reverseNum]}`]);
4891
- if (!g_settings.scrolls.includes(`Reverse`)) {
4892
- _btn.textContent = `${g_lblNameObj.Reverse}:${getStgDetailName(g_stateObj.reverse)}`;
4893
- } else {
4894
- _btn.textContent = `X`;
4895
- setReverseDefault();
4896
- }
4897
- };
4898
-
4899
5090
  // ---------------------------------------------------
4900
5091
  // ミラー・ランダム (Shuffle)
4901
5092
  // 縦位置: 5.5
@@ -4914,165 +5105,6 @@ const createOptionWindow = _sprite => {
4914
5105
  // ゲージ設定詳細 縦位置: ゲージ設定+1
4915
5106
  spriteList.gauge.appendChild(createDivCss2Label(`lblGauge2`, ``, g_lblPosObj.lblGauge2));
4916
5107
 
4917
- /**
4918
- * ゲージ設定メイン
4919
- * @param {number} _scrollNum
4920
- */
4921
- const setGauge = _scrollNum => {
4922
-
4923
- // カーソルを動かさない場合は先にゲージ設定をリロード
4924
- if (_scrollNum === 0) {
4925
- gaugeChange(g_settings.gaugeNum);
4926
- }
4927
- setSetting(_scrollNum, `gauge`);
4928
-
4929
- // カーソルを動かす場合は設定変更後にゲージ設定を再設定
4930
- if (_scrollNum !== 0) {
4931
- gaugeChange(g_settings.gaugeNum);
4932
- }
4933
- lblGauge2.innerHTML = gaugeFormat(g_stateObj.lifeMode,
4934
- g_stateObj.lifeBorder, g_stateObj.lifeRcv, g_stateObj.lifeDmg, g_stateObj.lifeInit, g_stateObj.lifeVariable);
4935
- };
4936
-
4937
- /**
4938
- * ゲージ設定の切替処理
4939
- * @param {number} _gaugeNum
4940
- */
4941
- const gaugeChange = _gaugeNum => {
4942
- const tmpScoreId = g_stateObj.scoreId;
4943
-
4944
- /**
4945
- * ゲージ詳細変更
4946
- * @param {object} _baseProperty
4947
- * @param {string} _setProperty
4948
- * @param {number} _magnification
4949
- */
4950
- const setLife = (_baseProperty, _setProperty, _magnification = 1) => {
4951
- if (setVal(_baseProperty[tmpScoreId], ``, C_TYP_FLOAT) !== ``) {
4952
- g_stateObj[_setProperty] = _baseProperty[tmpScoreId] * _magnification;
4953
- }
4954
- };
4955
-
4956
- /**
4957
- * ゲージ詳細一括変更
4958
- * @param {object} _baseObj
4959
- * @param {object} _obj
4960
- */
4961
- const setLifeCategory = (_baseObj, { _magInit = 1, _magRcv = 1, _magDmg = 1 } = {}) => {
4962
- setLife(_baseObj.lifeInits, `lifeInit`, _magInit);
4963
- setLife(_baseObj.lifeRecoverys, `lifeRcv`, _magRcv);
4964
- setLife(_baseObj.lifeDamages, `lifeDmg`, _magDmg);
4965
- };
4966
-
4967
- /**
4968
- * ライフモード切替
4969
- * @param {object} _baseObj
4970
- */
4971
- const changeLifeMode = (_baseObj) => {
4972
- if (_baseObj.lifeBorders[tmpScoreId] === `x`) {
4973
- g_stateObj.lifeBorder = 0;
4974
- g_stateObj.lifeMode = C_LFE_SURVIVAL;
4975
- } else {
4976
- g_stateObj.lifeBorder = _baseObj.lifeBorders[tmpScoreId];
4977
- g_stateObj.lifeMode = C_LFE_BORDER;
4978
- }
4979
- };
4980
-
4981
- // ゲージ初期化
4982
- if (_gaugeNum === 0) {
4983
- if (hasVal(g_headerObj.lifeBorders[tmpScoreId])) {
4984
- changeLifeMode(g_headerObj);
4985
- g_gaugeType = (g_gaugeOptionObj.custom.length > 0 ? C_LFE_CUSTOM : g_stateObj.lifeMode);
4986
-
4987
- g_stateObj.lifeVariable = g_gaugeOptionObj[`var${g_gaugeType}`][_gaugeNum];
4988
- g_settings.gauges = structuredClone(g_gaugeOptionObj[g_gaugeType.toLowerCase()]);
4989
- g_stateObj.gauge = g_settings.gauges[g_settings.gaugeNum];
4990
- }
4991
- setLifeCategory(g_headerObj);
4992
-
4993
- } else {
4994
- // 設定されたゲージ設定、カーソルに合わせて設定値を更新
4995
- g_stateObj.lifeVariable = g_gaugeOptionObj[`var${g_gaugeType}`][_gaugeNum];
4996
- if (g_gaugeOptionObj.custom.length === 0 ||
4997
- g_gaugeOptionObj.defaultList.includes(g_gaugeOptionObj[`defaultGauge${tmpScoreId}`])) {
4998
- const gType = (g_gaugeType === C_LFE_CUSTOM ?
4999
- toCapitalize(g_gaugeOptionObj[`defaultGauge${tmpScoreId}`]) : g_gaugeType);
5000
- g_stateObj.lifeMode = g_gaugeOptionObj[`type${gType}`][_gaugeNum];
5001
- g_stateObj.lifeBorder = g_gaugeOptionObj[`clear${gType}`][_gaugeNum];
5002
- g_stateObj.lifeInit = g_gaugeOptionObj[`init${gType}`][_gaugeNum];
5003
- g_stateObj.lifeRcv = g_gaugeOptionObj[`rcv${gType}`][_gaugeNum];
5004
- g_stateObj.lifeDmg = g_gaugeOptionObj[`dmg${gType}`][_gaugeNum];
5005
- }
5006
- }
5007
-
5008
- // ゲージ設定(Light, Easy)の初期化
5009
- if (g_stateObj.gauge === `Light` || g_stateObj.gauge === `Easy`) {
5010
- setLifeCategory(g_headerObj, { _magRcv: 2 });
5011
- }
5012
-
5013
- // ゲージ設定別に個別設定した場合はここで設定を上書き
5014
- // 譜面ヘッダー:gaugeXXX で設定した値がここで適用される
5015
- if (hasVal(g_gaugeOptionObj[`gauge${g_stateObj.gauge}s`])) {
5016
- const tmpGaugeObj = g_gaugeOptionObj[`gauge${g_stateObj.gauge}s`];
5017
- if (hasVal(tmpGaugeObj.lifeBorders[tmpScoreId])) {
5018
- changeLifeMode(tmpGaugeObj);
5019
- }
5020
- setLifeCategory(tmpGaugeObj);
5021
- }
5022
- };
5023
-
5024
- /**
5025
- * ゲージ設定の詳細表示を整形
5026
- */
5027
- const gaugeFormat = (_mode, _border, _rcv, _dmg, _init, _lifeValFlg) => {
5028
- const initVal = g_headerObj.maxLifeVal * _init / 100;
5029
- const borderVal = (_mode === C_LFE_BORDER && _border !== 0 ?
5030
- Math.round(g_headerObj.maxLifeVal * _border / 100) : `-`);
5031
-
5032
- let lifeValCss = ``;
5033
- if (_lifeValFlg === C_FLG_ON) {
5034
- lifeValCss = ` settings_lifeVal`;
5035
- }
5036
-
5037
- // 整形用にライフ初期値を整数、回復・ダメージ量を小数第1位で丸める
5038
- const init = Math.round(initVal);
5039
- const border = (borderVal !== `-` ? borderVal : `-`);
5040
- const rcv = Math.round(_rcv * 100) / 100;
5041
- const dmg = Math.round(_dmg * 100) / 100;
5042
-
5043
- return `<div id="gaugeDivCover" class="settings_gaugeDivCover">
5044
- <div id="lblGaugeDivTable" class="settings_gaugeDivTable">
5045
- <div id="lblGaugeStart" class="settings_gaugeDivTableCol settings_gaugeStart">
5046
- ${g_lblNameObj.g_start}
5047
- </div>
5048
- <div id="lblGaugeBorder" class="settings_gaugeDivTableCol settings_gaugeEtc">
5049
- ${g_lblNameObj.g_border}
5050
- </div>
5051
- <div id="lblGaugeRecovery" class="settings_gaugeDivTableCol settings_gaugeEtc">
5052
- ${g_lblNameObj.g_recovery}
5053
- </div>
5054
- <div id="lblGaugeDamage" class="settings_gaugeDivTableCol settings_gaugeEtc">
5055
- ${g_lblNameObj.g_damage}
5056
- </div>
5057
- </div>
5058
- <div id="dataGaugeDivTable" class="settings_gaugeDivTable">
5059
- <div id="dataGaugeStart" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeStart">
5060
- ${init}/${g_headerObj.maxLifeVal}
5061
- </div>
5062
- <div id="dataGaugeBorder" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeEtc">
5063
- ${border}
5064
- </div>
5065
- <div id="dataGaugeRecovery" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeEtc${lifeValCss}">
5066
- ${rcv}
5067
- </div>
5068
- <div id="dataGaugeDamage" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeEtc${lifeValCss}">
5069
- ${dmg}
5070
- </div>
5071
- </div>
5072
- </div>
5073
- `;
5074
- };
5075
-
5076
5108
  if (g_headerObj.gaugeUse) {
5077
5109
  multiAppend(spriteList.gauge,
5078
5110
  makeSettingLblCssButton(`lnkGauge`, ``, 0, _ => setGauge(1), { cxtFunc: _ => setGauge(-1) }),
@@ -5129,195 +5161,11 @@ const createOptionWindow = _sprite => {
5129
5161
  // 縦位置: 12.5
5130
5162
  createGeneralSetting(spriteList.volume, `volume`, { unitName: g_lblNameObj.percent });
5131
5163
 
5132
- /**
5133
- * 譜面初期化処理
5134
- * - 譜面の基本設定(キー数、初期速度、リバース、ゲージ設定)をここで行う
5135
- * - g_canLoadDifInfoFlg は譜面初期化フラグで、初期化したくない場合は対象画面にて false にしておく
5136
- * (Display設定画面、キーコンフィグ画面では通常OFF)
5137
- * この関数を実行後、このフラグはONに戻るようになっている
5138
- * - [キーコン]->[初期化]->[名称設定]の順に配置する。
5139
- * 初期化処理にてキー数関連の設定を行っているため、この順序で無いとデータが正しく格納されない
5140
- */
5141
- const setDifficulty = (_initFlg) => {
5142
-
5143
- const getCurrentNo = (_list, _target) => roundZero(_list.findIndex(item => item === _target));
5144
-
5145
- // ---------------------------------------------------
5146
- // 1. キーコンフィグ設定 (KeyConfig)
5147
- g_keyObj.currentKey = g_headerObj.keyLabels[g_stateObj.scoreId];
5148
- const isNotSameKey = (g_keyObj.prevKey !== g_keyObj.currentKey);
5149
-
5150
- if (g_headerObj.dummyScoreNos !== undefined) {
5151
- g_stateObj.dummyId = setIntVal(g_headerObj.dummyScoreNos[g_stateObj.scoreId], ``);
5152
- }
5153
- // 特殊キーフラグ
5154
- g_stateObj.extraKeyFlg = g_headerObj.keyExtraList.includes(g_keyObj.currentKey);
5155
-
5156
- // ---------------------------------------------------
5157
- // 2. 初期化設定
5158
-
5159
- // 保存した設定の再読込条件(設定画面切り替え時はスキップ)
5160
- // ローカルストレージで保存した設定を呼び出し
5161
- if ((g_canLoadDifInfoFlg && (isNotSameKey && g_stateObj.dataSaveFlg)) || _initFlg) {
5162
-
5163
- if (isNotSameKey && g_keyObj.prevKey !== `Dummy`) {
5164
- // キーパターン初期化
5165
- g_keyObj.currentPtn = 0;
5166
- g_keycons.keySwitchNum = 0;
5167
- }
5168
- const hasKeyStorage = localStorage.getItem(`danonicw-${g_keyObj.currentKey}k`);
5169
- let storageObj, addKey = ``;
5170
-
5171
- if (!g_stateObj.extraKeyFlg) {
5172
-
5173
- // キー別のローカルストレージの初期設定 ※特殊キーは除く
5174
- g_localKeyStorage = hasKeyStorage ? JSON.parse(hasKeyStorage) : {
5175
- reverse: C_FLG_OFF,
5176
- keyCtrl: [[]],
5177
- keyCtrlPtn: 0,
5178
- setColor: [],
5179
- };
5180
- storageObj = g_localKeyStorage;
5181
-
5182
- } else {
5183
- storageObj = g_localStorage;
5184
- addKey = g_keyObj.currentKey;
5185
- }
5186
- if (isNotSameKey) {
5187
- getKeyReverse(storageObj, addKey);
5188
-
5189
- // キーコンフィグ初期値設定
5190
- if (storageObj[`keyCtrlPtn${addKey}`] === undefined) {
5191
- storageObj[`keyCtrlPtn${addKey}`] = 0;
5192
- }
5193
- getKeyCtrl(storageObj, addKey);
5194
-
5195
- // カラーセット初期値設定
5196
- if (storageObj[`setColor${addKey}`] === undefined) {
5197
- storageObj[`setColor${addKey}`] = [];
5198
- }
5199
- if (storageObj[`setColor${addKey}`].length > 0) {
5200
- g_keycons.colorTypes = addValtoArray(g_keycons.colorTypes, g_keycons.colorSelf);
5201
- resetColorType({ _fromObj: storageObj, _from: addKey, _to: g_keycons.colorSelf });
5202
- resetColorType({ _fromObj: storageObj, _from: addKey, _toObj: g_dfColorObj, _to: g_keycons.colorSelf });
5203
-
5204
- } else {
5205
- if (g_localStorage.colorType === g_keycons.colorSelf) {
5206
- g_colorType = `Default`;
5207
- }
5208
- g_keycons.colorTypes = g_keycons.colorTypes.filter(val => val !== g_keycons.colorSelf);
5209
- }
5210
-
5211
- const keyCtrlPtn = `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`;
5212
-
5213
- // カラーグループ、シャッフルグループの設定
5214
- g_keycons.groups.forEach(type => {
5215
- resetGroupList(type, keyCtrlPtn);
5216
- if (g_keyObj.currentPtn === -1) {
5217
- const storageKeyName = storageObj[`${type}${addKey}`] || storageObj[`${type}${g_keyObj.currentKey}_-1_-1`];
5218
- if (storageKeyName !== undefined) {
5219
- g_keyObj[`${type}${g_keyObj.currentKey}_-1`] = structuredClone(storageKeyName);
5220
- }
5221
- g_keyObj[`${type}${g_keyObj.currentKey}_-1_-1`] = structuredClone(g_keyObj[`${type}${g_keyObj.currentKey}_-1`]);
5222
- } else {
5223
- g_keyObj[`${type}${keyCtrlPtn}`] = structuredClone(g_keyObj[`${type}${keyCtrlPtn}_0`]);
5224
- }
5225
- });
5226
-
5227
- }
5228
-
5229
- const keyCtrlPtn = `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`;
5230
- if (g_headerObj.keyRetryDef === C_KEY_RETRY) {
5231
- g_headerObj.keyRetry = setIntVal(getKeyCtrlVal(g_keyObj[`keyRetry${keyCtrlPtn}`]), g_headerObj.keyRetryDef);
5232
- }
5233
- if (g_headerObj.keyTitleBackDef === C_KEY_TITLEBACK) {
5234
- g_headerObj.keyTitleBack = setIntVal(getKeyCtrlVal(g_keyObj[`keyTitleBack${keyCtrlPtn}`]), g_headerObj.keyTitleBackDef);
5235
- }
5236
- }
5237
-
5238
- // スクロール設定用の配列を入れ替え
5239
- g_settings.scrolls = structuredClone(
5240
- typeof g_keyObj[`scrollDir${g_keyObj.currentKey}_${g_keyObj.currentPtn}`] === C_TYP_OBJECT ?
5241
- Object.keys(g_keyObj[`scrollDir${g_keyObj.currentKey}_${g_keyObj.currentPtn}`]) : g_keyObj.scrollName_def
5242
- );
5243
-
5244
- // アシスト設定の配列を入れ替え
5245
- g_settings.autoPlays = (typeof g_keyObj[`assistPos${g_keyObj.currentKey}_${g_keyObj.currentPtn}`] === C_TYP_OBJECT ?
5246
- g_autoPlaysBase.concat(Object.keys(g_keyObj[`assistPos${g_keyObj.currentKey}_${g_keyObj.currentPtn}`])) :
5247
- g_autoPlaysBase.concat());
5248
-
5249
- // 速度、ゲージ、スクロール、アシスト設定のカーソル位置調整
5250
- if (_initFlg) {
5251
- g_stateObj.speed = g_headerObj.initSpeeds[g_stateObj.scoreId];
5252
- g_settings.speedNum = getCurrentNo(g_settings.speeds, g_stateObj.speed);
5253
- g_settings.gaugeNum = 0;
5254
- }
5255
- g_settings.scrollNum = getCurrentNo(g_settings.scrolls, g_stateObj.scroll);
5256
- g_settings.autoPlayNum = getCurrentNo(g_settings.autoPlays, g_stateObj.autoPlay);
5257
-
5258
- // ---------------------------------------------------
5259
- // 3. 名称の設定
5260
-
5261
- // 譜面名設定 (Difficulty)
5262
- const difWidth = parseFloat(lnkDifficulty.style.width);
5263
- const difNames = [`${getKeyName(g_keyObj.currentKey)} ${getStgDetailName('key')} / ${g_headerObj.difLabels[g_stateObj.scoreId]}`];
5264
- lnkDifficulty.style.fontSize = `${getFontSize(difNames[0], difWidth, getBasicFont(), g_limitObj.setLblSiz)}px`;
5265
-
5266
- if (g_headerObj.makerView) {
5267
- difNames.push(`(${g_headerObj.creatorNames[g_stateObj.scoreId]})`);
5268
- difNames.forEach((difName, j) => {
5269
- const tmpSize = getFontSize(difName, difWidth, getBasicFont(), 14);
5270
- difNames[j] = `<span style="font-size:${tmpSize}px">${difName}</span>`;
5271
- });
5272
- }
5273
- lnkDifficulty.innerHTML = difNames.join(``);
5274
-
5275
- // 速度設定 (Speed)
5276
- setSetting(0, `speed`, ` ${g_lblNameObj.multi}`);
5277
- if (g_headerObj.scoreDetailUse) {
5278
- drawSpeedGraph(g_stateObj.scoreId);
5279
- drawDensityGraph(g_stateObj.scoreId);
5280
- makeDifInfo(g_stateObj.scoreId);
5281
- }
5282
-
5283
- // リバース設定 (Reverse, Scroll)
5284
- if (g_headerObj.scrollUse) {
5285
- g_stateObj.scroll = g_settings.scrolls[g_settings.scrollNum];
5286
- const [visibleScr, hiddenScr] = (g_settings.scrolls.length > 1 ? [`scroll`, `reverse`] : [`reverse`, `scroll`]);
5287
- spriteList[visibleScr].style.display = C_DIS_INHERIT;
5288
- spriteList[hiddenScr].style.display = C_DIS_NONE;
5289
- setSetting(0, visibleScr);
5290
-
5291
- g_shortcutObj.option.KeyR.id = g_settings.scrolls.includes(`Reverse`) ?
5292
- g_shortcutObj.option.KeyR.exId : g_shortcutObj.option.KeyR.dfId;
5293
-
5294
- if (g_settings.scrolls.length > 1) {
5295
- setReverseView(document.querySelector(`#btnReverse`));
5296
- }
5297
- } else {
5298
- g_settings.scrolls = structuredClone(g_keyObj.scrollName_def);
5299
- setSetting(0, `reverse`);
5300
- }
5301
-
5302
- // オート・アシスト設定 (AutoPlay)
5303
- g_stateObj.autoPlay = g_settings.autoPlays[g_settings.autoPlayNum];
5304
- lnkAutoPlay.textContent = getStgDetailName(g_stateObj.autoPlay);
5305
-
5306
- // ゲージ設定 (Gauge)
5307
- const defaultCustomGauge = g_gaugeOptionObj.custom0 || g_gaugeOptionObj.customDefault;
5308
- if (hasVal(defaultCustomGauge)) {
5309
- g_gaugeOptionObj.custom = (g_gaugeOptionObj[`custom${g_stateObj.scoreId}`] || defaultCustomGauge).concat();
5310
- g_gaugeOptionObj.varCustom = (g_gaugeOptionObj[`varCustom${g_stateObj.scoreId}`] || g_gaugeOptionObj.varCustom0 || g_gaugeOptionObj.varCustomDefault).concat();
5311
- }
5312
- setGauge(0);
5313
-
5314
- // ユーザカスタムイベント(初期)
5315
- g_customJsObj.difficulty.forEach(func => func(_initFlg, g_canLoadDifInfoFlg));
5316
-
5317
- // ---------------------------------------------------
5318
- // 4. 譜面初期情報ロード許可フラグの設定
5319
- g_canLoadDifInfoFlg = true;
5320
- };
5164
+ // 譜面番号の再取得
5165
+ g_stateObj.scoreId = getNextDifficulty(g_stateObj.scoreId, 0);
5166
+ const keyLists = g_headerObj.viewLists.map(j => g_headerObj.keyLabels[j]);
5167
+ g_headerObj.viewKeyLists = keyLists.sort((a, b) => parseInt(a) - parseInt(b));
5168
+ g_headerObj.difSelectorUse = getDifSelectorUse(g_rootObj.difSelectorUse);
5321
5169
 
5322
5170
  // 設定画面の一通りのオブジェクトを作成後に譜面・速度・ゲージ設定をまとめて行う
5323
5171
  setDifficulty(false);
@@ -5440,11 +5288,9 @@ const setSetting = (_scrollNum, _settingName, _unitName = ``, _roundNum = 0) =>
5440
5288
  }
5441
5289
 
5442
5290
  if (_scrollNum > 0) {
5443
- settingNum = (settingNum === settingMax ?
5444
- 0 : (settingNum + _scrollNum > settingMax ? settingMax : settingNum + _scrollNum));
5291
+ settingNum = (settingNum === settingMax ? 0 : Math.min(settingNum + _scrollNum, settingMax));
5445
5292
  } else if (_scrollNum < 0) {
5446
- settingNum = (settingNum === 0 ?
5447
- settingMax : (settingNum + _scrollNum <= 0 ? 0 : settingNum + _scrollNum));
5293
+ settingNum = (settingNum === 0 ? settingMax : Math.max(settingNum + _scrollNum, 0));
5448
5294
  }
5449
5295
  g_stateObj[_settingName] = settingList[settingNum];
5450
5296
  g_settings[`${_settingName}Num`] = settingNum;
@@ -5486,6 +5332,184 @@ const setReverseDefault = _ => {
5486
5332
  g_settings.reverseNum = 0;
5487
5333
  };
5488
5334
 
5335
+ const setReverse = _btn => {
5336
+ if (!g_settings.scrolls.includes(`Reverse`)) {
5337
+ g_settings.reverseNum = (g_settings.reverseNum + 1) % 2;
5338
+ g_stateObj.reverse = g_settings.reverses[g_settings.reverseNum];
5339
+ setReverseView(_btn);
5340
+ }
5341
+ };
5342
+
5343
+ const setReverseView = _btn => {
5344
+ _btn.classList.replace(g_cssObj[`button_Rev${g_settings.reverses[(g_settings.reverseNum + 1) % 2]}`],
5345
+ g_cssObj[`button_Rev${g_settings.reverses[g_settings.reverseNum]}`]);
5346
+ if (!g_settings.scrolls.includes(`Reverse`)) {
5347
+ _btn.textContent = `${g_lblNameObj.Reverse}:${getStgDetailName(g_stateObj.reverse)}`;
5348
+ } else {
5349
+ _btn.textContent = `X`;
5350
+ setReverseDefault();
5351
+ }
5352
+ };
5353
+
5354
+ /**
5355
+ * ゲージ設定メイン
5356
+ * @param {number} _scrollNum
5357
+ */
5358
+ const setGauge = _scrollNum => {
5359
+
5360
+ // カーソルを動かさない場合は先にゲージ設定をリロード
5361
+ if (_scrollNum === 0) {
5362
+ gaugeChange(g_settings.gaugeNum);
5363
+ }
5364
+ setSetting(_scrollNum, `gauge`);
5365
+
5366
+ // カーソルを動かす場合は設定変更後にゲージ設定を再設定
5367
+ if (_scrollNum !== 0) {
5368
+ gaugeChange(g_settings.gaugeNum);
5369
+ }
5370
+ lblGauge2.innerHTML = gaugeFormat(g_stateObj.lifeMode,
5371
+ g_stateObj.lifeBorder, g_stateObj.lifeRcv, g_stateObj.lifeDmg, g_stateObj.lifeInit, g_stateObj.lifeVariable);
5372
+ };
5373
+
5374
+ /**
5375
+ * ゲージ設定の切替処理
5376
+ * @param {number} _gaugeNum
5377
+ */
5378
+ const gaugeChange = _gaugeNum => {
5379
+ const tmpScoreId = g_stateObj.scoreId;
5380
+
5381
+ /**
5382
+ * ゲージ詳細変更
5383
+ * @param {object} _baseProperty
5384
+ * @param {string} _setProperty
5385
+ * @param {number} _magnification
5386
+ */
5387
+ const setLife = (_baseProperty, _setProperty, _magnification = 1) => {
5388
+ if (setVal(_baseProperty[tmpScoreId], ``, C_TYP_FLOAT) !== ``) {
5389
+ g_stateObj[_setProperty] = _baseProperty[tmpScoreId] * _magnification;
5390
+ }
5391
+ };
5392
+
5393
+ /**
5394
+ * ゲージ詳細一括変更
5395
+ * @param {object} _baseObj
5396
+ * @param {object} _obj
5397
+ */
5398
+ const setLifeCategory = (_baseObj, { _magInit = 1, _magRcv = 1, _magDmg = 1 } = {}) => {
5399
+ setLife(_baseObj.lifeInits, `lifeInit`, _magInit);
5400
+ setLife(_baseObj.lifeRecoverys, `lifeRcv`, _magRcv);
5401
+ setLife(_baseObj.lifeDamages, `lifeDmg`, _magDmg);
5402
+ };
5403
+
5404
+ /**
5405
+ * ライフモード切替
5406
+ * @param {object} _baseObj
5407
+ */
5408
+ const changeLifeMode = (_baseObj) => {
5409
+ if (_baseObj.lifeBorders[tmpScoreId] === `x`) {
5410
+ g_stateObj.lifeBorder = 0;
5411
+ g_stateObj.lifeMode = C_LFE_SURVIVAL;
5412
+ } else {
5413
+ g_stateObj.lifeBorder = _baseObj.lifeBorders[tmpScoreId];
5414
+ g_stateObj.lifeMode = C_LFE_BORDER;
5415
+ }
5416
+ };
5417
+
5418
+ // ゲージ初期化
5419
+ if (_gaugeNum === 0) {
5420
+ if (hasVal(g_headerObj.lifeBorders[tmpScoreId])) {
5421
+ changeLifeMode(g_headerObj);
5422
+ g_gaugeType = (g_gaugeOptionObj.custom.length > 0 ? C_LFE_CUSTOM : g_stateObj.lifeMode);
5423
+
5424
+ g_stateObj.lifeVariable = g_gaugeOptionObj[`var${g_gaugeType}`][_gaugeNum];
5425
+ g_settings.gauges = structuredClone(g_gaugeOptionObj[g_gaugeType.toLowerCase()]);
5426
+ g_stateObj.gauge = g_settings.gauges[g_settings.gaugeNum];
5427
+ }
5428
+ setLifeCategory(g_headerObj);
5429
+
5430
+ } else {
5431
+ // 設定されたゲージ設定、カーソルに合わせて設定値を更新
5432
+ g_stateObj.lifeVariable = g_gaugeOptionObj[`var${g_gaugeType}`][_gaugeNum];
5433
+ if (g_gaugeOptionObj.custom.length === 0 ||
5434
+ g_gaugeOptionObj.defaultList.includes(g_gaugeOptionObj[`defaultGauge${tmpScoreId}`])) {
5435
+ const gType = (g_gaugeType === C_LFE_CUSTOM ?
5436
+ toCapitalize(g_gaugeOptionObj[`defaultGauge${tmpScoreId}`]) : g_gaugeType);
5437
+ g_stateObj.lifeMode = g_gaugeOptionObj[`type${gType}`][_gaugeNum];
5438
+ g_stateObj.lifeBorder = g_gaugeOptionObj[`clear${gType}`][_gaugeNum];
5439
+ g_stateObj.lifeInit = g_gaugeOptionObj[`init${gType}`][_gaugeNum];
5440
+ g_stateObj.lifeRcv = g_gaugeOptionObj[`rcv${gType}`][_gaugeNum];
5441
+ g_stateObj.lifeDmg = g_gaugeOptionObj[`dmg${gType}`][_gaugeNum];
5442
+ }
5443
+ }
5444
+
5445
+ // ゲージ設定(Light, Easy)の初期化
5446
+ if (g_stateObj.gauge === `Light` || g_stateObj.gauge === `Easy`) {
5447
+ setLifeCategory(g_headerObj, { _magRcv: 2 });
5448
+ }
5449
+
5450
+ // ゲージ設定別に個別設定した場合はここで設定を上書き
5451
+ // 譜面ヘッダー:gaugeXXX で設定した値がここで適用される
5452
+ if (hasVal(g_gaugeOptionObj[`gauge${g_stateObj.gauge}s`])) {
5453
+ const tmpGaugeObj = g_gaugeOptionObj[`gauge${g_stateObj.gauge}s`];
5454
+ if (hasVal(tmpGaugeObj.lifeBorders[tmpScoreId])) {
5455
+ changeLifeMode(tmpGaugeObj);
5456
+ }
5457
+ setLifeCategory(tmpGaugeObj);
5458
+ }
5459
+ };
5460
+
5461
+ /**
5462
+ * ゲージ設定の詳細表示を整形
5463
+ */
5464
+ const gaugeFormat = (_mode, _border, _rcv, _dmg, _init, _lifeValFlg) => {
5465
+ const initVal = g_headerObj.maxLifeVal * _init / 100;
5466
+ const borderVal = (_mode === C_LFE_BORDER && _border !== 0 ?
5467
+ Math.round(g_headerObj.maxLifeVal * _border / 100) : `-`);
5468
+
5469
+ let lifeValCss = ``;
5470
+ if (_lifeValFlg === C_FLG_ON) {
5471
+ lifeValCss = ` settings_lifeVal`;
5472
+ }
5473
+
5474
+ // 整形用にライフ初期値を整数、回復・ダメージ量を小数第1位で丸める
5475
+ const init = Math.round(initVal);
5476
+ const border = (borderVal !== `-` ? borderVal : `-`);
5477
+ const rcv = Math.round(_rcv * 100) / 100;
5478
+ const dmg = Math.round(_dmg * 100) / 100;
5479
+
5480
+ return `<div id="gaugeDivCover" class="settings_gaugeDivCover">
5481
+ <div id="lblGaugeDivTable" class="settings_gaugeDivTable">
5482
+ <div id="lblGaugeStart" class="settings_gaugeDivTableCol settings_gaugeStart">
5483
+ ${g_lblNameObj.g_start}
5484
+ </div>
5485
+ <div id="lblGaugeBorder" class="settings_gaugeDivTableCol settings_gaugeEtc">
5486
+ ${g_lblNameObj.g_border}
5487
+ </div>
5488
+ <div id="lblGaugeRecovery" class="settings_gaugeDivTableCol settings_gaugeEtc">
5489
+ ${g_lblNameObj.g_recovery}
5490
+ </div>
5491
+ <div id="lblGaugeDamage" class="settings_gaugeDivTableCol settings_gaugeEtc">
5492
+ ${g_lblNameObj.g_damage}
5493
+ </div>
5494
+ </div>
5495
+ <div id="dataGaugeDivTable" class="settings_gaugeDivTable">
5496
+ <div id="dataGaugeStart" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeStart">
5497
+ ${init}/${g_headerObj.maxLifeVal}
5498
+ </div>
5499
+ <div id="dataGaugeBorder" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeEtc">
5500
+ ${border}
5501
+ </div>
5502
+ <div id="dataGaugeRecovery" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeEtc${lifeValCss}">
5503
+ ${rcv}
5504
+ </div>
5505
+ <div id="dataGaugeDamage" class="settings_gaugeDivTableCol settings_gaugeVal settings_gaugeEtc${lifeValCss}">
5506
+ ${dmg}
5507
+ </div>
5508
+ </div>
5509
+ </div>
5510
+ `;
5511
+ };
5512
+
5489
5513
  /**
5490
5514
  * 保存済みキーコンフィグ取得処理
5491
5515
  * @param {object} _localStorage 保存先のローカルストレージ名
@@ -9535,11 +9559,9 @@ const mainInit = _ => {
9535
9559
  musicStartFlg = false;
9536
9560
  }
9537
9561
  if (musicStartFlg) {
9538
- const tmpVolume = (g_audio.volume + (3 * g_stateObj.volume / 100) / 1000);
9539
- g_audio.volume = (tmpVolume > 1 ? 1 : tmpVolume);
9562
+ g_audio.volume = Math.min((g_audio.volume + (3 * g_stateObj.volume / 100) / 1000), 1);
9540
9563
  } else if (isFadeOutArea) {
9541
- const tmpVolume = (g_audio.volume - (3 * g_stateObj.volume / 100 * C_FRM_AFTERFADE / g_scoreObj.fadeOutTerm) / 1000);
9542
- g_audio.volume = (tmpVolume < 0 ? 0 : tmpVolume);
9564
+ g_audio.volume = Math.max((g_audio.volume - (3 * g_stateObj.volume / 100 * C_FRM_AFTERFADE / g_scoreObj.fadeOutTerm) / 1000), 0);
9543
9565
  }
9544
9566
 
9545
9567
  // ユーザカスタムイベント(フレーム毎)
@@ -9917,8 +9939,10 @@ const changeStepY = (_frameNum) => {
9917
9939
  * フリーズアローヒット時の描画変更
9918
9940
  * @param {number} _j
9919
9941
  * @param {number} _k
9942
+ * @param {string} _name
9943
+ * @param {number} _difFrame
9920
9944
  */
9921
- const changeHitFrz = (_j, _k, _name) => {
9945
+ const changeHitFrz = (_j, _k, _name, _difFrame = 0) => {
9922
9946
  const frzNo = `${_j}_${_k}`;
9923
9947
  const frzName = `${_name}${frzNo}`;
9924
9948
  const currentFrz = g_attrObj[frzName];
@@ -9967,6 +9991,8 @@ const changeHitFrz = (_j, _k, _name) => {
9967
9991
  $id(`frzHitTop${_j}`).background = g_workObj.frzHitColors[_j];
9968
9992
  }
9969
9993
  }
9994
+
9995
+ g_customJsObj[`judg_${_name}Hit`].forEach(func => func(_difFrame));
9970
9996
  };
9971
9997
 
9972
9998
  /**
@@ -10053,7 +10079,7 @@ const judgeArrow = _j => {
10053
10079
  }
10054
10080
 
10055
10081
  if (_difCnt <= g_judgObj.frzJ[g_judgPosObj.sfsf]) {
10056
- changeHitFrz(_j, fcurrentNo, `frz`);
10082
+ changeHitFrz(_j, fcurrentNo, `frz`, _difFrame);
10057
10083
  } else {
10058
10084
  changeFailedFrz(_j, fcurrentNo);
10059
10085
  if (g_headerObj.frzStartjdgUse) {