danoniplus 49.6.1 → 50.0.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 +75 -3
- package/js/lib/danoni_constants.js +22 -1
- 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 : 2026/08/
|
|
7
|
+
* Revised : 2026/08/24
|
|
8
8
|
*
|
|
9
9
|
* https://github.com/cwtickle/danoniplus
|
|
10
10
|
*/
|
|
11
|
-
const g_version = `Ver
|
|
12
|
-
const g_revisedDate = `2026/08/
|
|
11
|
+
const g_version = `Ver 50.0.0`;
|
|
12
|
+
const g_revisedDate = `2026/08/24`;
|
|
13
13
|
|
|
14
14
|
// カスタム用バージョン (danoni_custom.js 等で指定可)
|
|
15
15
|
let g_localVersion = ``;
|
|
@@ -8461,6 +8461,7 @@ const setDifficulty = (_initFlg) => {
|
|
|
8461
8461
|
|
|
8462
8462
|
// ユーザカスタムイベント(初期)
|
|
8463
8463
|
safeExecuteCustomHooks(`g_customJsObj.difficulty`, g_customJsObj.difficulty, _initFlg, g_canLoadDifInfoFlg);
|
|
8464
|
+
resolveKeyFamily();
|
|
8464
8465
|
|
|
8465
8466
|
// 設定サマリー表示の更新
|
|
8466
8467
|
updateSettingSummary();
|
|
@@ -8470,6 +8471,77 @@ const setDifficulty = (_initFlg) => {
|
|
|
8470
8471
|
g_canLoadDifInfoFlg = true;
|
|
8471
8472
|
};
|
|
8472
8473
|
|
|
8474
|
+
/**
|
|
8475
|
+
* keyLabelの系統ごとに、選択時に強制したい設定値・選択/離脱時の個別処理を登録する
|
|
8476
|
+
* @param {string} _name 系統名
|
|
8477
|
+
* @param {(key: string) => boolean} _match この系統に属するkeyLabelかどうか
|
|
8478
|
+
* @param {object} [_fields] path -> 値 or 値を返す関数(単純代入で済むもの)
|
|
8479
|
+
* @param {object} [_hooks] { onAcquire, onRelease } 選択/離脱の瞬間に1回だけ呼ばれる(複合処理用)
|
|
8480
|
+
* @param {object} [_appliers] path -> 個別の適用関数(単純代入で済まないfields用)
|
|
8481
|
+
*/
|
|
8482
|
+
const registerKeyFamily = (_name, _match, _fields = {}, _hooks = {}, _appliers = {}) => {
|
|
8483
|
+
g_familyObj.families.push({ name: _name, match: _match, fields: _fields, appliers: _appliers, ..._hooks });
|
|
8484
|
+
};
|
|
8485
|
+
|
|
8486
|
+
/**
|
|
8487
|
+
* 現在のキー状態に応じて適用すべき設定群を判定し、
|
|
8488
|
+
* 各パラメータの値・スナップショット・フックを管理・適用する
|
|
8489
|
+
*/
|
|
8490
|
+
const resolveKeyFamily = () => {
|
|
8491
|
+
// 1. 現在のキーに一致するファミリーを検索(見つからなければ null = 標準状態)
|
|
8492
|
+
const newFamily = g_familyObj.families.find(f => f.match(g_keyObj.currentKey)) ?? null;
|
|
8493
|
+
|
|
8494
|
+
// 2. ファミリーが切り替わった瞬間(入場・離脱)にフック(固有の副作用)を実行
|
|
8495
|
+
if (newFamily !== g_familyObj.currentFamily) {
|
|
8496
|
+
g_familyObj.currentFamily?.onRelease?.();
|
|
8497
|
+
newFamily?.onAcquire?.();
|
|
8498
|
+
g_familyObj.currentFamily = newFamily;
|
|
8499
|
+
}
|
|
8500
|
+
|
|
8501
|
+
// 3. 登録されているすべてのファミリーが持つパス(プロパティ)の全リストを取得
|
|
8502
|
+
const allPaths = new Set(g_familyObj.families.flatMap(f => Object.keys(f.fields)));
|
|
8503
|
+
allPaths.forEach(path => {
|
|
8504
|
+
const spec = newFamily?.fields[path];
|
|
8505
|
+
// 該当プロパティのカスタム処理があれば優先し、なければ通常のプロパティ代入を使用
|
|
8506
|
+
const applier = g_familyObj.families.map(f => f.appliers[path]).find(Boolean) ?? (v => setPathVal(path, v));
|
|
8507
|
+
|
|
8508
|
+
if (spec !== undefined) {
|
|
8509
|
+
// 【変更値の適用】現在のファミリーにそのプロパティの設定がある場合
|
|
8510
|
+
// 初めて書き換えるプロパティの場合のみ、元の値をスナップショット(初期値)として退避
|
|
8511
|
+
if (!g_familyObj.ownership[path]) {
|
|
8512
|
+
g_familyObj.snapshot[path] = getPathVal(path);
|
|
8513
|
+
g_familyObj.ownership[path] = true;
|
|
8514
|
+
}
|
|
8515
|
+
// 関数なら評価し、値ならそのまま適用値とする
|
|
8516
|
+
applyIfChanged(path, typeof spec === `function` ? spec() : spec, applier);
|
|
8517
|
+
} else if (g_familyObj.ownership[path]) {
|
|
8518
|
+
// 【標準への復元】別のファミリーに移行し、かつ元々自分が書き換えていたプロパティの場合
|
|
8519
|
+
// スナップショットから元の値(初期値)を復元し、オーナーシップを解放
|
|
8520
|
+
applyIfChanged(path, g_familyObj.snapshot[path], applier);
|
|
8521
|
+
g_familyObj.ownership[path] = false;
|
|
8522
|
+
}
|
|
8523
|
+
// ownership[path]がfalseのままなら、標準同士の切り替えでも一切触らない
|
|
8524
|
+
});
|
|
8525
|
+
};
|
|
8526
|
+
|
|
8527
|
+
/**
|
|
8528
|
+
* 値に変更がある場合のみ、代入またはカスタム処理を実行してキャッシュを更新する
|
|
8529
|
+
* @param {string} _path 設定のパス
|
|
8530
|
+
* @param {string|number} _value 適用する値
|
|
8531
|
+
* @param {Function} _applier 実際の適用処理を行う関数
|
|
8532
|
+
*/
|
|
8533
|
+
const applyIfChanged = (_path, _value, _applier) => {
|
|
8534
|
+
// すでに同じ値が適用済みの場合は、無駄な再描画や再代入を防ぐためスキップ
|
|
8535
|
+
if (g_familyObj.appliedPaths.has(_path) && g_familyObj.applied[_path] === _value) return;
|
|
8536
|
+
|
|
8537
|
+
// 適用値をキャッシュに保存
|
|
8538
|
+
g_familyObj.applied[_path] = _value;
|
|
8539
|
+
g_familyObj.appliedPaths.add(_path);
|
|
8540
|
+
|
|
8541
|
+
// 実際の反映処理(値の代入、または画像再描画などの副作用)を実行
|
|
8542
|
+
_applier(_value);
|
|
8543
|
+
};
|
|
8544
|
+
|
|
8473
8545
|
/**
|
|
8474
8546
|
* 設定・オプション画面のラベル・ボタン処理の描画
|
|
8475
8547
|
* @param {Object} _sprite 基準とするスプライト(ここで指定する座標は、そのスプライトからの相対位置)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Source by tickle
|
|
7
7
|
* Created : 2019/11/19
|
|
8
|
-
* Revised : 2026/08/
|
|
8
|
+
* Revised : 2026/08/24 (v50.0.0)
|
|
9
9
|
*
|
|
10
10
|
* https://github.com/cwtickle/danoniplus
|
|
11
11
|
*/
|
|
@@ -5273,6 +5273,27 @@ const g_skinJsObj = {
|
|
|
5273
5273
|
result: [],
|
|
5274
5274
|
};
|
|
5275
5275
|
|
|
5276
|
+
const g_root = {
|
|
5277
|
+
get g_diffObj() { return g_diffObj; },
|
|
5278
|
+
get g_posObj() { return g_posObj; },
|
|
5279
|
+
get g_headerObj() { return g_headerObj; },
|
|
5280
|
+
get g_stateObj() { return g_stateObj; },
|
|
5281
|
+
get g_keycons() { return g_keycons; },
|
|
5282
|
+
};
|
|
5283
|
+
const getPathVal = _path => _path.split(`.`).reduce((o, k) => o?.[k], g_root);
|
|
5284
|
+
const setPathVal = (_path, _value) => {
|
|
5285
|
+
const keys = _path.split(`.`);
|
|
5286
|
+
const last = keys.pop();
|
|
5287
|
+
const target = keys.reduce((o, k) => o?.[k], g_root);
|
|
5288
|
+
if (target == null || !Object.hasOwn(target, last)) {
|
|
5289
|
+
console.warn(`setPathVal: path not found for "${_path}"`);
|
|
5290
|
+
return;
|
|
5291
|
+
}
|
|
5292
|
+
target[last] = _value;
|
|
5293
|
+
};
|
|
5294
|
+
|
|
5295
|
+
const g_familyObj = { families: [], currentFamily: null, ownership: {}, snapshot: {}, applied: {}, appliedPaths: new Set() };
|
|
5296
|
+
|
|
5276
5297
|
const g_errorCache = {
|
|
5277
5298
|
'g_customJsObj.titleEnterFrame': [],
|
|
5278
5299
|
'g_customJsObj.mainEnterFrame': [],
|