danoniplus 28.1.2 → 28.2.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 +110 -62
  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 : 2022/10/02
7
+ * Revised : 2022/10/04
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 28.1.2`;
12
- const g_revisedDate = `2022/10/02`;
11
+ const g_version = `Ver 28.2.0`;
12
+ const g_revisedDate = `2022/10/04`;
13
13
  const g_alphaVersion = ``;
14
14
 
15
15
  // カスタム用バージョン (danoni_custom.js 等で指定可)
@@ -1811,6 +1811,12 @@ const initialControl = async () => {
1811
1811
  makeDedupliArray(g_rootObj.keyExtraList.split(`,`), g_headerObj.undefinedKeyLists) : g_headerObj.undefinedKeyLists),
1812
1812
  });
1813
1813
 
1814
+ // デフォルトのカラー・シャッフルグループ設定を退避
1815
+ [`color`, `shuffle`].forEach(type => {
1816
+ const tmpName = Object.keys(g_keyObj).filter(val => val.startsWith(type));
1817
+ tmpName.forEach(property => g_dfKeyObj[property] = structuredClone(g_keyObj[property]));
1818
+ });
1819
+
1814
1820
  // 自動横幅拡張設定
1815
1821
  if (g_headerObj.autoSpread) {
1816
1822
  const widthList = [g_sWidth, g_presetObj.autoMinWidth ?? g_keyObj.minWidth];
@@ -2402,11 +2408,6 @@ const preheaderConvert = _dosObj => {
2402
2408
  // 背景・マスクモーションのパス指定方法を他の設定に合わせる設定
2403
2409
  obj.syncBackPath = setBoolVal(_dosObj.syncBackPath ?? g_presetObj.syncBackPath);
2404
2410
 
2405
- [`color`, `shuffle`].forEach(type => {
2406
- const tmpName = Object.keys(g_keyObj).filter(val => val.startsWith(type) && val.endsWith(`_0`));
2407
- tmpName.forEach(property => g_dfKeyObj[property] = structuredClone(g_keyObj[property]));
2408
- });
2409
-
2410
2411
  return obj;
2411
2412
  };
2412
2413
 
@@ -3378,6 +3379,7 @@ const keysConvert = (_dosObj, { keyExtraList = _dosObj.keyExtraList.split(`,`) }
3378
3379
  let tmpMinPatterns = 1;
3379
3380
  const keyheader = _name + _key;
3380
3381
  const dfPtn = setIntVal(g_keyObj.dfPtnNum);
3382
+
3381
3383
  if (hasVal(_dosObj[keyheader])) {
3382
3384
  const tmpArray = splitLF2(_dosObj[keyheader]);
3383
3385
  tmpMinPatterns = tmpArray.length;
@@ -3392,6 +3394,49 @@ const keysConvert = (_dosObj, { keyExtraList = _dosObj.keyExtraList.split(`,`) }
3392
3394
  }
3393
3395
  loopFunc(k, keyheader);
3394
3396
  }
3397
+
3398
+ } else if (errCd !== `` && g_keyObj[`${keyheader}_0`] === undefined) {
3399
+ makeWarningWindow(g_msgInfoObj[errCd].split(`{0}`).join(_key));
3400
+ }
3401
+ return tmpMinPatterns;
3402
+ };
3403
+
3404
+ /**
3405
+ * 新キー用複合パラメータ(特殊)
3406
+ * @param {string} _key キー数
3407
+ * @param {string} _name 名前
3408
+ * @param {object} _obj errCd エラーコード
3409
+ * @returns 最小パターン数
3410
+ */
3411
+ const newKeyTripleParam = (_key, _name, { errCd = `` } = {}) => {
3412
+ let tmpMinPatterns = 1;
3413
+ const keyheader = _name + _key;
3414
+ const dfPtn = setIntVal(g_keyObj.dfPtnNum);
3415
+
3416
+ if (hasVal(_dosObj[keyheader])) {
3417
+ const tmpArray = splitLF2(_dosObj[keyheader]);
3418
+ tmpMinPatterns = tmpArray.length;
3419
+ for (let k = 0; k < tmpMinPatterns; k++) {
3420
+ if (existParam(tmpArray[k], `${keyheader}_${k + dfPtn}`)) {
3421
+ continue;
3422
+ }
3423
+ if (g_keyObj[`${_name}${tmpArray[k]}_0`] !== undefined) {
3424
+
3425
+ // 他のキーパターン (例: |shuffle8i=8_0| ) を指定した場合、該当があれば既存パターンからコピー
3426
+ let m = 0;
3427
+ while (g_keyObj[`${_name}${tmpArray[k]}_${m}`] !== undefined) {
3428
+ g_keyObj[`${keyheader}_${k + dfPtn}_${m}`] = structuredClone(g_keyObj[`${_name}${tmpArray[k]}_${m}`]);
3429
+ m++;
3430
+ }
3431
+ } else {
3432
+
3433
+ // 通常の指定方法 (例: |shuffle8i=1,1,1,2,0,0,0,0/1,1,1,1,0,0,0,0| )の場合の取り込み
3434
+ tmpArray[k].split(`/`).forEach((list, m) =>
3435
+ g_keyObj[`${keyheader}_${k + dfPtn}_${m}`] = list.split(`,`).map(n => parseInt(n, 10)));
3436
+ }
3437
+ g_keyObj[`${keyheader}_${k + dfPtn}`] = structuredClone(g_keyObj[`${keyheader}_${k + dfPtn}_0`]);
3438
+ }
3439
+
3395
3440
  } else if (errCd !== `` && g_keyObj[`${keyheader}_0`] === undefined) {
3396
3441
  makeWarningWindow(g_msgInfoObj[errCd].split(`{0}`).join(_key));
3397
3442
  }
@@ -3450,15 +3495,6 @@ const keysConvert = (_dosObj, { keyExtraList = _dosObj.keyExtraList.split(`,`) }
3450
3495
  }
3451
3496
  };
3452
3497
 
3453
- /**
3454
- * 子構成配列へのコピー
3455
- * @param {number} _k
3456
- * @param {string} _header
3457
- * @returns
3458
- */
3459
- const copyChildArray = (_k, _header) =>
3460
- g_keyObj[`${_header}_${_k + g_keyObj.dfPtnNum}_0`] = copyArray2d(g_keyObj[`${_header}_${_k + g_keyObj.dfPtnNum}`]);
3461
-
3462
3498
  // 対象キー毎に処理
3463
3499
  keyExtraList.forEach(newKey => {
3464
3500
  let tmpDivPtn = [];
@@ -3483,10 +3519,7 @@ const keysConvert = (_dosObj, { keyExtraList = _dosObj.keyExtraList.split(`,`) }
3483
3519
  g_keyObj[`minWidth${newKey}`] = _dosObj[`minWidth${newKey}`] ?? g_keyObj[`minWidth${newKey}`] ?? g_keyObj.minWidthDefault;
3484
3520
 
3485
3521
  // 矢印色パターン (colorX_Y)
3486
- tmpMinPatterns = newKeyMultiParam(newKey, `color`, toNumber, {
3487
- errCd: `E_0101`,
3488
- loopFunc: (k, keyheader) => copyChildArray(k, keyheader),
3489
- });
3522
+ tmpMinPatterns = newKeyTripleParam(newKey, `color`, { errCd: `E_0101` });
3490
3523
 
3491
3524
  // 読込変数の接頭辞 (charaX_Y)
3492
3525
  tmpMinPatterns = newKeyMultiParam(newKey, `chara`, toString, { errCd: `E_0102` });
@@ -3560,9 +3593,7 @@ const keysConvert = (_dosObj, { keyExtraList = _dosObj.keyExtraList.split(`,`) }
3560
3593
  newKeySingleParam(newKey, `transKey`, C_TYP_STRING);
3561
3594
 
3562
3595
  // シャッフルグループ (shuffleX_Y)
3563
- newKeyMultiParam(newKey, `shuffle`, toNumber, {
3564
- loopFunc: (k, keyheader) => copyChildArray(k, keyheader),
3565
- });
3596
+ newKeyTripleParam(newKey, `shuffle`);
3566
3597
 
3567
3598
  // スクロールパターン (scrollX_Y)
3568
3599
  // |scroll(newKey)=Cross::1,1,-1,-1,-1,1,1/Split::1,1,1,-1,-1,-1,-1$...|
@@ -5277,14 +5308,12 @@ const getKeyCtrl = (_localStorage, _extraKeyName = ``) => {
5277
5308
  });
5278
5309
 
5279
5310
  [`color`, `shuffle`].forEach(type => {
5280
- if (isUpdate) {
5281
- let maxPtn = 0;
5282
- while (g_keyObj[`${type}${basePtn}_${maxPtn}`] !== undefined) {
5283
- maxPtn++;
5284
- }
5285
- for (let j = 0; j < maxPtn; j++) {
5286
- g_keyObj[`${type}${copyPtn}_${j}`] = copyArray2d(g_keyObj[`${type}${basePtn}_${j}`]);
5287
- }
5311
+ let maxPtn = 0;
5312
+ while (g_keyObj[`${type}${basePtn}_${maxPtn}`] !== undefined) {
5313
+ maxPtn++;
5314
+ }
5315
+ for (let j = 0; j < maxPtn; j++) {
5316
+ g_keyObj[`${type}${copyPtn}_${j}`] = copyArray2d(g_keyObj[`${type}${basePtn}_${j}`]);
5288
5317
  }
5289
5318
  });
5290
5319
  }
@@ -5352,11 +5381,9 @@ const resetGroupList = (_type, _keyCtrlPtn) => {
5352
5381
  g_keycons[`${_type}Groups`] = [0];
5353
5382
 
5354
5383
  if (g_keyObj.currentPtn === -1) {
5355
- g_keycons[`${_type}GroupNum`] = -1;
5356
5384
  g_keycons[`${_type}Groups`] = addValtoArray(g_keycons[`${_type}Groups`], -1);
5357
- } else {
5358
- g_keycons[`${_type}GroupNum`] = 0;
5359
5385
  }
5386
+ g_keycons[`${_type}GroupNum`] = (g_keyObj.currentPtn === -1 ? -1 : 0);
5360
5387
  while (g_keyObj[`${_type}${_keyCtrlPtn}_${k}`] !== undefined) {
5361
5388
  g_keycons[`${_type}Groups`].push(k);
5362
5389
  k++;
@@ -5606,9 +5633,6 @@ const keyConfigInit = (_kcType = g_kcType) => {
5606
5633
  const maxLeftPos = Math.max(divideCnt, posMax - divideCnt - 2) / 2;
5607
5634
  const maxLeftX = Math.min(0, (kWidth - C_ARW_WIDTH) / 2 - maxLeftPos * g_keyObj.blank);
5608
5635
 
5609
- // カラーグループ、シャッフルグループの再設定
5610
- [`color`, `shuffle`].forEach(type => resetGroupList(type, keyCtrlPtn));
5611
-
5612
5636
  /**
5613
5637
  * keyconSpriteのスクロール位置調整
5614
5638
  * @param {number} _targetX
@@ -5859,10 +5883,9 @@ const keyConfigInit = (_kcType = g_kcType) => {
5859
5883
  const makeGroupButton = (_type, { baseX = g_sWidth * 5 / 6 - 20, cssName } = {}) => {
5860
5884
  if (g_headerObj[`${_type}Use`] && g_keycons[`${_type}Groups`].length > 1) {
5861
5885
  const typeName = toCapitalize(_type);
5862
- const num = g_keycons[`${_type}GroupNum`] === -1 ? g_keycons.groupSelf : g_keycons[`${_type}GroupNum`] + 1;
5863
5886
  multiAppend(divRoot,
5864
5887
  makeKCButtonHeader(`lbl${_type}Group`, `${typeName}Group`, { x: baseX - 10, y: 37 }, cssName),
5865
- makeKCButton(`lnk${typeName}Group`, `${num}`, _ => setGroup(_type), {
5888
+ makeKCButton(`lnk${typeName}Group`, ``, _ => setGroup(_type), {
5866
5889
  x: baseX, y: 50, w: g_sWidth / 18, title: g_msgObj[`${_type}Group`], cxtFunc: _ => setGroup(_type, -1),
5867
5890
  }),
5868
5891
  makeMiniKCButton(`lnk${typeName}Group`, `L`, _ => setGroup(_type, -1), { x: baseX - 10, y: 50 }),
@@ -6093,16 +6116,53 @@ const keyConfigInit = (_kcType = g_kcType) => {
6093
6116
  const lblTransKey = hasVal(g_keyObj[`transKey${keyCtrlPtn}`]) ?
6094
6117
  `(${g_keyObj[`transKey${keyCtrlPtn}`] ?? ''})` : ``;
6095
6118
 
6096
- // パターン検索
6097
- const searchPattern = (_tempPtn, _sign, _transKeyUse = false, _keyCheck = `keyCtrl`) => {
6098
- while (hasVal(g_keyObj[`${_keyCheck}${g_keyObj.currentKey}_${_tempPtn}`]) &&
6099
- _transKeyUse === false) {
6100
- _tempPtn += _sign;
6101
- if (g_keyObj[`keyCtrl${g_keyObj.currentKey}_${_tempPtn}`] === undefined) {
6102
- break;
6119
+ /**
6120
+ * キーパターン検索
6121
+ * @param {number} _tempPtn
6122
+ * @param {number} _sign
6123
+ * @param {boolean} _transKeyUse
6124
+ * @returns
6125
+ */
6126
+ const searchPattern = (_tempPtn, _sign, _transKeyUse = false) => {
6127
+ let nextPtn = _tempPtn + _sign;
6128
+
6129
+ const searchStart = _ => {
6130
+ nextPtn = 0;
6131
+ while (hasVal(g_keyObj[`keyCtrl${g_keyObj.currentKey}_${nextPtn}`])) {
6132
+ nextPtn -= _sign;
6133
+ }
6134
+ nextPtn += _sign;
6135
+ };
6136
+
6137
+ if (hasVal(g_keyObj[`keyCtrl${g_keyObj.currentKey}_${nextPtn}`])) {
6138
+ } else {
6139
+ searchStart();
6140
+ }
6141
+ if (!_transKeyUse) {
6142
+ while (hasVal(g_keyObj[`transKey${g_keyObj.currentKey}_${nextPtn}`])) {
6143
+ nextPtn += _sign;
6144
+ }
6145
+ if (!hasVal(g_keyObj[`keyCtrl${g_keyObj.currentKey}_${nextPtn}`])) {
6146
+ searchStart();
6103
6147
  }
6104
6148
  }
6105
- return _tempPtn;
6149
+ return nextPtn;
6150
+ };
6151
+
6152
+ /**
6153
+ * キーパターン変更時処理
6154
+ * @param {number} _sign
6155
+ */
6156
+ const changePattern = (_sign = 1) => {
6157
+
6158
+ // キーパターンの変更
6159
+ g_keyObj.currentPtn = searchPattern(g_keyObj.currentPtn, _sign, g_headerObj.transKeyUse);
6160
+
6161
+ // カラーグループ、シャッフルグループの再設定
6162
+ [`color`, `shuffle`].forEach(type => resetGroupList(type, `${g_keyObj.currentKey}_${g_keyObj.currentPtn}`));
6163
+
6164
+ // キーコンフィグ画面を再呼び出し
6165
+ keyConfigInit();
6106
6166
  };
6107
6167
 
6108
6168
  // ユーザカスタムイベント(初期)
@@ -6125,24 +6185,12 @@ const keyConfigInit = (_kcType = g_kcType) => {
6125
6185
 
6126
6186
  // パターン変更ボタン描画(右回り)
6127
6187
  createCss2Button(`btnPtnChangeR`, `>>`, _ => true, Object.assign(g_lblPosObj.btnPtnChangeR, {
6128
- resetFunc: _ => {
6129
- const tempPtn = searchPattern(g_keyObj.currentPtn + 1, 1, g_headerObj.transKeyUse, `transKey`);
6130
- g_keyObj.currentPtn = (g_keyObj[`keyCtrl${g_keyObj.currentKey}_${tempPtn}`] !== undefined ?
6131
- tempPtn : (g_keyObj[`keyCtrl${g_keyObj.currentKey}_-1`] !== undefined ? -1 : 0));
6132
-
6133
- keyConfigInit();
6134
- },
6188
+ resetFunc: _ => changePattern(),
6135
6189
  }), g_cssObj.button_Setting),
6136
6190
 
6137
6191
  // パターン変更ボタン描画(左回り)
6138
6192
  createCss2Button(`btnPtnChangeL`, `<<`, _ => true, Object.assign(g_lblPosObj.btnPtnChangeL, {
6139
- resetFunc: _ => {
6140
- const tempPtn = searchPattern(g_keyObj.currentPtn - 1, -1, g_headerObj.transKeyUse, `transKey`);
6141
- g_keyObj.currentPtn = (g_keyObj[`keyCtrl${g_keyObj.currentKey}_${tempPtn}`] !== undefined ?
6142
- tempPtn : searchPattern(searchPattern(0, 1) - 1, -1, g_headerObj.transKeyUse, `transKey`));
6143
-
6144
- keyConfigInit();
6145
- },
6193
+ resetFunc: _ => changePattern(-1),
6146
6194
  }), g_cssObj.button_Setting),
6147
6195
 
6148
6196
  // キーコンフィグリセットボタン描画
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "28.1.2",
3
+ "version": "28.2.0",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "index.js",
6
6
  "scripts": {