danoniplus 42.1.0 → 42.1.2

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 +39 -17
  2. package/package.json +1 -1
package/js/danoni_main.js CHANGED
@@ -4,12 +4,12 @@
4
4
  *
5
5
  * Source by tickle
6
6
  * Created : 2018/10/08
7
- * Revised : 2025/06/07
7
+ * Revised : 2025/06/08
8
8
  *
9
9
  * https://github.com/cwtickle/danoniplus
10
10
  */
11
- const g_version = `Ver 42.1.0`;
12
- const g_revisedDate = `2025/06/07`;
11
+ const g_version = `Ver 42.1.2`;
12
+ const g_revisedDate = `2025/06/08`;
13
13
 
14
14
  // カスタム用バージョン (danoni_custom.js 等で指定可)
15
15
  let g_localVersion = ``;
@@ -1206,6 +1206,7 @@ const reviseCssText = _str => {
1206
1206
  /*-----------------------------------------------------------*/
1207
1207
  /* 色・グラデーション設定 */
1208
1208
  /*-----------------------------------------------------------*/
1209
+ const g_ctx = document.createElement(`canvas`).getContext(`2d`);
1209
1210
 
1210
1211
  /**
1211
1212
  * 対象のカラーコードが明暗どちらかを判定 (true: 明色, false: 暗色)
@@ -1225,9 +1226,8 @@ const checkLightOrDark = _colorStr => {
1225
1226
  * @returns {string}
1226
1227
  */
1227
1228
  const colorNameToCode = _color => {
1228
- const cxt = document.createElement(`canvas`).getContext(`2d`);
1229
- cxt.fillStyle = _color;
1230
- return cxt.fillStyle;
1229
+ g_ctx.fillStyle = _color;
1230
+ return g_ctx.fillStyle;
1231
1231
  };
1232
1232
 
1233
1233
  /**
@@ -1365,11 +1365,24 @@ const getBasicFont = (_priorityFont = ``) =>
1365
1365
  * @returns {number}
1366
1366
  */
1367
1367
  const getStrWidth = (_str, _fontsize, _font) => {
1368
- const ctx = document.createElement(`canvas`).getContext(`2d`);
1369
- ctx.font = `${wUnit(_fontsize)} ${_font}`;
1370
- return ctx.measureText(unEscapeHtml(_str)).width;
1368
+ g_ctx.font = `${wUnit(_fontsize)} ${_font}`;
1369
+ return g_ctx.measureText(unEscapeHtml(_str)).width;
1371
1370
  };
1372
1371
 
1372
+ /**
1373
+ * Canvas上で使用する絵文字を取得
1374
+ * - HTMLのdiv要素に絵文字を設定することで、Canvas上で使用できるようにする
1375
+ * @param {string} _str
1376
+ * @returns {string}
1377
+ */
1378
+ const getEmojiForCanvas = _str => {
1379
+ const div = document.createElement(`div`);
1380
+ div.innerHTML = _str;
1381
+ const result = div.innerHTML;
1382
+ div.remove();
1383
+ return result;
1384
+ }
1385
+
1373
1386
  /**
1374
1387
  * 指定した横幅に合ったフォントサイズを取得
1375
1388
  * @param {string} _str
@@ -3016,13 +3029,22 @@ const getMusicUrl = _scoreId =>
3016
3029
  * @returns {string}
3017
3030
  */
3018
3031
  const getFullMusicUrl = (_musicUrl = ``) => {
3019
- let url = `${g_rootPath}../${g_headerObj.musicFolder}/${_musicUrl}`;
3020
- if (_musicUrl.indexOf(C_MRK_CURRENT_DIRECTORY) !== -1) {
3021
- url = _musicUrl.split(C_MRK_CURRENT_DIRECTORY)[1];
3022
- } else if (g_headerObj.musicFolder.indexOf(C_MRK_CURRENT_DIRECTORY) !== -1) {
3023
- url = `${g_headerObj.musicFolder.split(C_MRK_CURRENT_DIRECTORY)[1]}/${_musicUrl}`;
3032
+ let baseMusicUrl = _musicUrl;
3033
+ let baseDir = `../${g_headerObj.musicFolder}/`;
3034
+
3035
+ if (_musicUrl.includes(C_MRK_CURRENT_DIRECTORY)) {
3036
+ // musicUrl, musicFolder両方にカレントパス指定がある場合は、musicUrlの値を優先
3037
+
3038
+ } else if (g_headerObj.musicFolder.includes(C_MRK_CURRENT_DIRECTORY)) {
3039
+ // musicFolderにカレントパス指定がある場合は、ファイル名にmusicFolderの値も含める
3040
+ baseMusicUrl = `${g_headerObj.musicFolder}/${_musicUrl}`;
3041
+ }
3042
+ if (g_headerObj.musicFolder.includes(C_MRK_CURRENT_DIRECTORY)) {
3043
+ // musicFolderにカレントパス指定がある場合は、ディレクトリは指定しない
3044
+ baseDir = ``;
3024
3045
  }
3025
- return url;
3046
+ const [musicFile, musicPath] = getFilePath(baseMusicUrl, baseDir);
3047
+ return `${musicPath}${musicFile}`;
3026
3048
  }
3027
3049
 
3028
3050
  /**
@@ -13985,7 +14007,7 @@ const resultInit = () => {
13985
14007
  { x: 280, dy: -15, hy: 0, siz: 20, color: `#999999`, align: C_ALIGN_CENTER });
13986
14008
  drawText(unEscapeHtml(mTitleForView[0]), { hy: 1 });
13987
14009
  drawText(unEscapeHtml(mTitleForView[1]), { hy: 2 });
13988
- drawText(`📝 ${unEscapeHtml(g_headerObj.tuning)} / 🎵 ${unEscapeHtml(artistName)}`, { hy: mTitleForView[1] !== `` ? 3 : 2, siz: 12 });
14010
+ drawText(`${getEmojiForCanvas(`📝`)} ${unEscapeHtml(g_headerObj.tuning)} / ${getEmojiForCanvas(`🎵`)} ${unEscapeHtml(artistName)}`, { hy: mTitleForView[1] !== `` ? 3 : 2, siz: 12 });
13989
14011
  drawText(unEscapeHtml(difDataForImage), { hy: 4 });
13990
14012
 
13991
14013
  if (playStyleData.length > 60) {
@@ -14126,7 +14148,7 @@ const resultInit = () => {
14126
14148
  // リトライ
14127
14149
  resetCommonBtn(`btnRetry`, g_lblNameObj.b_retry, g_lblPosObj.btnRsRetry, loadMusic, g_cssObj.button_Reset),
14128
14150
 
14129
- createCss2Button(`btnCopyImage`, `📷`, () => true,
14151
+ createCss2Button(`btnCopyImage`, `📷`, () => true,
14130
14152
  Object.assign(g_lblPosObj.btnRsCopyImage, {
14131
14153
  resetFunc: () => copyResultImageData(g_msgInfoObj.I_0001),
14132
14154
  }), g_cssObj.button_Default_NoColor),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "danoniplus",
3
- "version": "42.1.0",
3
+ "version": "42.1.2",
4
4
  "description": "Dancing☆Onigiri (CW Edition) - Web-based Rhythm Game",
5
5
  "main": "./js/danoni_main.js",
6
6
  "scripts": {