danoniplus 30.0.1 → 30.1.1

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/02/11
7
+ * Revised : 2023/02/14
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 30.0.1`;
12
- const g_revisedDate = `2023/02/11`;
11
+ const g_version = `Ver 30.1.1`;
12
+ const g_revisedDate = `2023/02/14`;
13
13
  const g_alphaVersion = ``;
14
14
 
15
15
  // カスタム用バージョン (danoni_custom.js 等で指定可)
@@ -224,6 +224,19 @@ const setAttrs = (_baseObj, { ...rest } = {}) =>
224
224
  */
225
225
  const getNumAttr = (_baseObj, _attrkey) => parseFloat(_baseObj.getAttribute(_attrkey));
226
226
 
227
+ /**
228
+ * 文字列に埋め込まれた変数を展開
229
+ * @param {string} _str
230
+ */
231
+ const convertStrToVal = _str => {
232
+ const strs = _str.split(`}`).join(`{`).split(`{`);
233
+ let convStrs = ``;
234
+ for (let j = 0; j < strs.length; j += 2) {
235
+ convStrs += escapeHtmlForEnabledTag(strs[j]);
236
+ convStrs += setVal(strs[j + 1], ``, C_TYP_CALC);
237
+ }
238
+ return convStrs;
239
+ };
227
240
 
228
241
  /*-----------------------------------------------------------*/
229
242
  /* 値や配列のチェック・変換 */
@@ -1445,14 +1458,19 @@ const makeSpriteData = (_data, _calcFrame = _frame => _frame) => {
1445
1458
  const tmpObj = {
1446
1459
  path: escapeHtml(tmpSpriteData[2] ?? ``, g_escapeStr.escapeCode), // 画像パス or テキスト
1447
1460
  class: escapeHtml(tmpSpriteData[3] ?? ``), // CSSクラス
1448
- left: setVal(tmpSpriteData[4], 0, C_TYP_CALC), // X座標
1449
- top: setVal(tmpSpriteData[5], 0, C_TYP_CALC), // Y座標
1450
- width: setIntVal(tmpSpriteData[6]), // spanタグの場合は font-size
1451
- height: escapeHtml(tmpSpriteData[7] ?? ``), // spanタグの場合は color(文字列可)
1461
+ left: setVal(tmpSpriteData[4], `0`).includes(`{`) ?
1462
+ `${setVal(tmpSpriteData[4], 0)}` : `{${setVal(tmpSpriteData[4], 0)}}`, // X座標
1463
+ top: setVal(tmpSpriteData[5], `0`).includes(`{`) ?
1464
+ `${setVal(tmpSpriteData[5], 0)}` : `{${setVal(tmpSpriteData[5], 0)}}`, // Y座標
1465
+ width: `${setIntVal(tmpSpriteData[6])}`, // spanタグの場合は font-size
1466
+ height: `${escapeHtml(tmpSpriteData[7] ?? ``)}`, // spanタグの場合は color(文字列可)
1452
1467
  opacity: setVal(tmpSpriteData[8], 1, C_TYP_FLOAT),
1453
1468
  animationName: escapeHtml(setVal(tmpSpriteData[9], C_DIS_NONE)),
1454
1469
  animationDuration: setIntVal(tmpSpriteData[10]) / g_fps,
1455
1470
  };
1471
+ if (setVal(tmpSpriteData[11], g_presetObj.animationFillMode) !== undefined) {
1472
+ tmpObj.animationFillMode = setVal(tmpSpriteData[11], g_presetObj.animationFillMode);
1473
+ }
1456
1474
  if (g_headerObj.autoPreload) {
1457
1475
  if (checkImage(tmpObj.path)) {
1458
1476
  if (g_headerObj.syncBackPath) {
@@ -1468,15 +1486,38 @@ const makeSpriteData = (_data, _calcFrame = _frame => _frame) => {
1468
1486
  checkDuplicatedObjects(spriteData[tmpFrame]);
1469
1487
 
1470
1488
  const emptyPatterns = [``, `[loop]`, `[jump]`];
1489
+ const colorObjFlg = tmpSpriteData[2]?.startsWith(`[c]`) || false;
1471
1490
  spriteData[tmpFrame][addFrame] = {
1472
1491
  depth: tmpDepth,
1473
- command: tmpObj.path,
1474
- jumpFrame: tmpObj.class,
1475
- maxLoop: tmpObj.left,
1476
- animationName: tmpObj.animationName,
1477
- htmlText: emptyPatterns.includes(tmpObj.path) ?
1478
- `` : (checkImage(tmpObj.path) ? makeSpriteImage(tmpObj) : makeSpriteText(tmpObj)),
1479
1492
  };
1493
+
1494
+ if (colorObjFlg) {
1495
+ // [c]始まりの場合、カラーオブジェクト用の作成準備を行う
1496
+ const data = tmpObj.path.slice(`[c]`.length).split(`/`);
1497
+ spriteData[tmpFrame][addFrame].colorObjInfo = {
1498
+ x: tmpObj.left, y: tmpObj.top, w: tmpObj.width, h: tmpObj.height,
1499
+ rotate: setVal(data[0], `0`), opacity: tmpObj.opacity,
1500
+ background: makeColorGradation(setVal(data[1], `#ffffff`), { _defaultColorgrd: false }),
1501
+ animationName: tmpObj.animationName,
1502
+ animationDuration: `${tmpObj.animationDuration}s`,
1503
+ };
1504
+ spriteData[tmpFrame][addFrame].colorObjId = `${tmpFrame}_${addFrame}`;
1505
+ spriteData[tmpFrame][addFrame].colorObjClass = setVal(tmpObj.class, undefined);
1506
+ if (tmpObj.animationFillMode !== undefined) {
1507
+ spriteData[tmpFrame][addFrame].colorObjInfo.animationFillMode = tmpObj.animationFillMode;
1508
+ }
1509
+
1510
+ } else if (emptyPatterns.includes(tmpObj.path)) {
1511
+ // ループ、フレームジャンプ、空の場合の処理
1512
+ spriteData[tmpFrame][addFrame].command = tmpObj.path;
1513
+ spriteData[tmpFrame][addFrame].jumpFrame = tmpObj.class;
1514
+ spriteData[tmpFrame][addFrame].maxLoop = tmpObj.left;
1515
+ spriteData[tmpFrame][addFrame].htmlText = ``;
1516
+ } else {
1517
+ // それ以外の画像、テキストの場合
1518
+ spriteData[tmpFrame][addFrame].animationName = tmpObj.animationName;
1519
+ spriteData[tmpFrame][addFrame].htmlText = (checkImage(tmpObj.path) ? makeSpriteImage(tmpObj) : makeSpriteText(tmpObj));
1520
+ }
1480
1521
  }
1481
1522
  });
1482
1523
 
@@ -1517,7 +1558,16 @@ const drawBaseSpriteData = (_spriteData, _name, _condition = true) => {
1517
1558
  }
1518
1559
  } else {
1519
1560
  if (_condition) {
1520
- baseSprite.innerHTML = _spriteData.htmlText;
1561
+ if (_spriteData.colorObjInfo !== undefined) {
1562
+ const colorObjClass = _spriteData.colorObjClass?.split(`/`) ?? [];
1563
+ const id = `${_name}${_spriteData.depth}${_spriteData.colorObjId}`;
1564
+ [`x`, `y`, `w`, `h`].forEach(val => _spriteData.colorObjInfo[val] = convertStrToVal(_spriteData.colorObjInfo[val]));
1565
+ baseSprite.appendChild(
1566
+ createColorObject2(id, _spriteData.colorObjInfo, ...colorObjClass)
1567
+ );
1568
+ } else {
1569
+ baseSprite.innerHTML = convertStrToVal(_spriteData.htmlText);
1570
+ }
1521
1571
  }
1522
1572
  }
1523
1573
  };
@@ -3871,13 +3921,7 @@ const titleInit = _ => {
3871
3921
  if (g_headerObj.commentVal !== ``) {
3872
3922
 
3873
3923
  // コメント文の加工
3874
- const comments = g_headerObj.commentVal.split(`}`).join(`{`).split(`{`);
3875
- let convCommentVal = ``;
3876
- for (let j = 0; j < comments.length; j += 2) {
3877
- convCommentVal += escapeHtmlForEnabledTag(comments[j]);
3878
- convCommentVal += setVal(comments[j + 1], ``, C_TYP_CALC);
3879
- }
3880
-
3924
+ const convCommentVal = convertStrToVal(g_headerObj.commentVal);
3881
3925
  if (g_headerObj.commentExternal) {
3882
3926
  if (document.querySelector(`#commentArea`) !== null) {
3883
3927
  commentArea.innerHTML = convCommentVal;
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Source by tickle
7
7
  * Created : 2019/11/19
8
- * Revised : 2023/02/11 (v30.0.1)
8
+ * Revised : 2023/02/14 (v30.1.1)
9
9
  *
10
10
  * https://github.com/cwtickle/danoniplus
11
11
  */
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
  /**
3
3
  * Dancing☆Onigiri 設定用jsファイル
4
- * Template Update: 2022/03/25 (v27.1.0)
4
+ * Template Update: 2023/02/14 (v30.1.1)
5
5
  *
6
6
  * このファイルでは、作品全体に対しての初期設定を行うことができます。
7
7
  * 譜面データ側で個別に同様の項目が設定されている場合は、譜面データ側の設定が優先されます。
@@ -187,6 +187,14 @@ g_presetObj.customDesignUse = {
187
187
  */
188
188
  //g_presetObj.customImageList = [`ball`, `square`];
189
189
 
190
+ /**
191
+ * 背景・マスクモーションで利用する「animationFillMode」のデフォルト値
192
+ * - none : 初期画像へ戻す
193
+ * - forwards : アニメーション100%の状態を維持(デフォルト)
194
+ * - backwards : アニメーション 0%の状態に戻す
195
+ */
196
+ //g_presetObj.animationFillMode = `none`;
197
+
190
198
 
191
199
  /*
192
200
  ------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "30.0.1",
3
+ "version": "30.1.1",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "index.js",
6
6
  "scripts": {