From e4f6338a6349b7b0ad6e4e812a74b826a3d99fa3 Mon Sep 17 00:00:00 2001 From: Takkkom <76614532+Takkkom@users.noreply.github.com> Date: Sat, 28 Oct 2023 18:09:06 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=84=E3=82=8D=E3=81=84=E3=82=8D=E6=94=B9?= =?UTF-8?q?=E5=96=8415=20(#516)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * PopupMenuのエッジを修正 * プリセット可能なランダム背景に対応 * PresetのHelperを追加 --- OpenTaiko/src/Common/CSkin.cs | 1 - OpenTaiko/src/Databases/DBSkinPreset.cs | 26 ++++++- OpenTaiko/src/Helpers/HScenePreset.cs | 70 +++++++++++++++++++ .../src/Stages/01.StartUp/TextureLoader.cs | 8 --- .../05.SongSelect/CActSelectPopupMenu.cs | 4 +- .../src/Stages/06.SongLoading/FastRender.cs | 4 -- .../07.Game/Taiko/CAct演奏DrumsDancer.cs | 49 ++----------- .../07.Game/Taiko/CAct演奏DrumsFooter.cs | 8 ++- .../Stages/07.Game/Taiko/CAct演奏DrumsMob.cs | 38 ++++++---- .../07.Game/Taiko/CAct演奏DrumsRunner.cs | 7 +- .../Stages/07.Game/Taiko/CAct演奏Drums背景.cs | 35 +--------- 11 files changed, 141 insertions(+), 109 deletions(-) create mode 100644 OpenTaiko/src/Helpers/HScenePreset.cs diff --git a/OpenTaiko/src/Common/CSkin.cs b/OpenTaiko/src/Common/CSkin.cs index 5cb7b923..64c224f3 100644 --- a/OpenTaiko/src/Common/CSkin.cs +++ b/OpenTaiko/src/Common/CSkin.cs @@ -9126,7 +9126,6 @@ namespace TJAPlayer3 #endregion #region Mob - public int Game_Mob_Ptn = 1; public int Game_Mob_Beat, Game_Mob_Ptn_Beat = 1; #endregion diff --git a/OpenTaiko/src/Databases/DBSkinPreset.cs b/OpenTaiko/src/Databases/DBSkinPreset.cs index a60f7465..cec0b728 100644 --- a/OpenTaiko/src/Databases/DBSkinPreset.cs +++ b/OpenTaiko/src/Databases/DBSkinPreset.cs @@ -16,16 +16,28 @@ namespace TJAPlayer3 UpperBackground = null; LowerBackground = null; DancerSet = null; + FooterSet = null; + MobSet = null; + RunnerSet = null; } [JsonProperty("UP")] - public string UpperBackground; + public string[] UpperBackground; [JsonProperty("DOWN")] - public string LowerBackground; + public string[] LowerBackground; [JsonProperty("DANCER")] - public string DancerSet; + public string[] DancerSet; + + [JsonProperty("FOOTER")] + public string[] FooterSet; + + [JsonProperty("MOB")] + public string[] MobSet; + + [JsonProperty("RUNNER")] + public string[] RunnerSet; } public class SkinPreset { @@ -33,6 +45,8 @@ namespace TJAPlayer3 { Regular = new Dictionary(); Dan = new Dictionary(); + Tower = new Dictionary(); + AI = new Dictionary(); } @@ -42,6 +56,12 @@ namespace TJAPlayer3 [JsonProperty("Dan")] public Dictionary Dan; + [JsonProperty("Tower")] + public Dictionary Tower; + + [JsonProperty("AI")] + public Dictionary AI; + } } } diff --git a/OpenTaiko/src/Helpers/HScenePreset.cs b/OpenTaiko/src/Helpers/HScenePreset.cs new file mode 100644 index 00000000..0159a1e9 --- /dev/null +++ b/OpenTaiko/src/Helpers/HScenePreset.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Drawing; +using FDK; + + +namespace TJAPlayer3 +{ + class HScenePreset + { + public static DBSkinPreset.SkinScene GetBGPreset() + { + string presetSection = ""; + if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower) + { + presetSection = "Tower"; + } + else if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan) + { + presetSection = "Dan"; + } + else if (TJAPlayer3.ConfigIni.bAIBattleMode) + { + presetSection = "AI"; + } + else + { + presetSection = "Regular"; + } + + object _ps = null; + + switch (presetSection) + { + case "Regular": + _ps = TJAPlayer3.Skin.Game_SkinScenes.Regular; + break; + case "Dan": + _ps = TJAPlayer3.Skin.Game_SkinScenes.Dan; + break; + case "Tower": + _ps = TJAPlayer3.Skin.Game_SkinScenes.Tower; + break; + case "AI": + _ps = TJAPlayer3.Skin.Game_SkinScenes.AI; + break; + default: + break; + }; + + var preset = (_ps != null + && TJAPlayer3.stage選曲.r確定された曲.strScenePreset != null + && ((Dictionary)_ps).ContainsKey(TJAPlayer3.stage選曲.r確定された曲.strScenePreset)) + ? ((Dictionary)_ps)[TJAPlayer3.stage選曲.r確定された曲.strScenePreset] + : null; + + if (_ps != null + && TJAPlayer3.DTX.scenePreset != null + && ((Dictionary)_ps).ContainsKey(TJAPlayer3.DTX.scenePreset)) // If currently selected song has valid SCENEPRESET metadata within TJA + { + preset = ((Dictionary)_ps)[TJAPlayer3.DTX.scenePreset]; + } + + return preset; + } + } +} \ No newline at end of file diff --git a/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs b/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs index 9f7c714b..6ea59e7c 100644 --- a/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs +++ b/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs @@ -481,13 +481,6 @@ namespace TJAPlayer3 #region Mob - TJAPlayer3.Skin.Game_Mob_Ptn = TJAPlayer3.t連番画像の枚数を数える(CSkin.Path(BASE + GAME + MOB)); - Mob = new CTexture[TJAPlayer3.Skin.Game_Mob_Ptn]; - for (int i = 0; i < TJAPlayer3.Skin.Game_Mob_Ptn; i++) - { - Mob[i] = TxC(GAME + MOB + i.ToString() + ".png"); - } - #endregion #region Taiko @@ -2495,7 +2488,6 @@ namespace TJAPlayer3 #region モブ - public CTexture[] Mob; #endregion #region 太鼓 public CTexture[] Taiko_Base, diff --git a/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs b/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs index b32c7d37..6c5d48fa 100644 --- a/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs +++ b/OpenTaiko/src/Stages/05.SongSelect/CActSelectPopupMenu.cs @@ -417,8 +417,8 @@ namespace TJAPlayer3 } //font.t文字列描画( (int)(340 * Scale.X), (int)(80 + i * 32), s, bValueBold, 1.0f * Scale.Y); using (var bmpStr = bValueBold ? - prvFont.DrawText(s, Color.White, Color.Black, null, Color.Yellow, Color.OrangeRed, 0) : - prvFont.DrawText(s, Color.White, Color.Black, null, 0)) + prvFont.DrawText(s, Color.White, Color.Black, null, Color.Yellow, Color.OrangeRed, 30) : + prvFont.DrawText(s, Color.White, Color.Black, null, 30)) { using (var ctStr = TJAPlayer3.tテクスチャの生成(bmpStr, false)) { diff --git a/OpenTaiko/src/Stages/06.SongLoading/FastRender.cs b/OpenTaiko/src/Stages/06.SongLoading/FastRender.cs index 8a4006d9..4b0bd001 100644 --- a/OpenTaiko/src/Stages/06.SongLoading/FastRender.cs +++ b/OpenTaiko/src/Stages/06.SongLoading/FastRender.cs @@ -24,10 +24,6 @@ namespace TJAPlayer3 }*/ NullCheckAndRender(ref TJAPlayer3.Tx.Effects_GoGoSplash); - for (int i = 0; i < TJAPlayer3.Skin.Game_Mob_Ptn; i++) - { - NullCheckAndRender(ref TJAPlayer3.Tx.Mob[i]); - } //NullCheckAndRender(ref TJAPlayer3.Tx.PuchiChara); diff --git a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsDancer.cs b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsDancer.cs index 33caaf64..d8d53bc4 100644 --- a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsDancer.cs +++ b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsDancer.cs @@ -22,48 +22,10 @@ namespace TJAPlayer3 { //this.ct踊り子モーション = new CCounter(); - string presetSection = ""; - if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower) - { - } - else if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan) - { - presetSection = "Dan"; - } - else if (TJAPlayer3.ConfigIni.bAIBattleMode) - { - } - else - { - presetSection = "Regular"; - } + if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower || TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan) + return; - object _ps = null; - - switch (presetSection) - { - case "Regular": - _ps = TJAPlayer3.Skin.Game_SkinScenes.Regular; - break; - case "Dan": - _ps = TJAPlayer3.Skin.Game_SkinScenes.Dan; - break; - default: - break; - }; - - var preset = (_ps != null - && TJAPlayer3.stage選曲.r確定された曲.strScenePreset != null - && ((Dictionary)_ps).ContainsKey(TJAPlayer3.stage選曲.r確定された曲.strScenePreset)) - ? ((Dictionary)_ps)[TJAPlayer3.stage選曲.r確定された曲.strScenePreset] - : null; - - if (_ps != null - && TJAPlayer3.DTX.scenePreset != null - && ((Dictionary)_ps).ContainsKey(TJAPlayer3.DTX.scenePreset)) // If currently selected song has valid SCENEPRESET metadata within TJA - { - preset = ((Dictionary)_ps)[TJAPlayer3.DTX.scenePreset]; - } + var preset = HScenePreset.GetBGPreset(); Random random = new Random(); Dancer = new CTexture[5][]; @@ -74,7 +36,7 @@ namespace TJAPlayer3 var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}"); if (dirs.Length > 0) { - var _presetPath = (preset != null) ? $@"{dancerOrigindir}" + preset.DancerSet : ""; + var _presetPath = (preset != null && preset.DancerSet != null) ? $@"{dancerOrigindir}" + preset.DancerSet[random.Next(0, preset.DancerSet.Length)] : ""; var path = (preset != null && System.IO.Directory.Exists(_presetPath)) ? _presetPath : dirs[random.Next(0, dirs.Length)]; @@ -107,6 +69,9 @@ namespace TJAPlayer3 public override void DeActivate() { + if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower || TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan) + return; + //this.ct踊り子モーション = null; for (int i = 0; i < 5; i++) diff --git a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsFooter.cs b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsFooter.cs index b7489860..7f4c4296 100644 --- a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsFooter.cs +++ b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsFooter.cs @@ -20,6 +20,7 @@ namespace TJAPlayer3 public override void Activate() { var footerDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.FOOTER}"); + var preset = HScenePreset.GetBGPreset(); if (System.IO.Directory.Exists(footerDir)) { @@ -28,9 +29,12 @@ namespace TJAPlayer3 var upDirs = System.IO.Directory.GetFiles(footerDir); if (upDirs.Length > 0) { - var upPath = upDirs[random.Next(0, upDirs.Length)]; + var _presetPath = (preset != null && preset.FooterSet != null) ? $@"{footerDir}" + preset.FooterSet[random.Next(0, preset.FooterSet.Length)] + ".png" : ""; + var path = (preset != null && System.IO.File.Exists(_presetPath)) + ? _presetPath + : upDirs[random.Next(0, upDirs.Length)]; - Mob_Footer = TJAPlayer3.tテクスチャの生成(upPath); + Mob_Footer = TJAPlayer3.tテクスチャの生成(path); } } diff --git a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsMob.cs b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsMob.cs index 9c2d27bd..90fd92ec 100644 --- a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsMob.cs +++ b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsMob.cs @@ -19,7 +19,25 @@ namespace TJAPlayer3 public override void Activate() { - RandomMob = TJAPlayer3.Random.Next(TJAPlayer3.Skin.Game_Mob_Ptn); + var mobDir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.MOB}"); + var preset = HScenePreset.GetBGPreset(); + + if (System.IO.Directory.Exists(mobDir)) + { + Random random = new Random(); + + var upDirs = System.IO.Directory.GetFiles(mobDir); + if (upDirs.Length > 0) + { + var _presetPath = (preset != null && preset.MobSet != null) ? $@"{mobDir}" + preset.MobSet[random.Next(0, preset.MobSet.Length)] + ".png" : ""; + var path = (preset != null && System.IO.File.Exists(_presetPath)) + ? _presetPath + : upDirs[random.Next(0, upDirs.Length)]; + + Mob = TJAPlayer3.tテクスチャの生成(path); + } + } + nMobBeat = TJAPlayer3.Skin.Game_Mob_Beat; base.Activate(); @@ -44,17 +62,8 @@ namespace TJAPlayer3 { if(!TJAPlayer3.stage演奏ドラム画面.bDoublePlay) { - if (TJAPlayer3.Skin.Game_Mob_Ptn != 0 && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Tower && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan) + if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Tower && TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan) { - - /* - TJAPlayer3.act文字コンソール.tPrint(0, 0, C文字コンソール.Eフォント種別.白, ctMob.n現在の値.ToString()); - TJAPlayer3.act文字コンソール.tPrint(0, 20, C文字コンソール.Eフォント種別.白, ctMobPtn.n現在の値.ToString()); - TJAPlayer3.act文字コンソール.tPrint(0, 30, C文字コンソール.Eフォント種別.白, ((int)ctMobPtn.n現在の値).ToString()); - TJAPlayer3.act文字コンソール.tPrint(0, 40, C文字コンソール.Eフォント種別.白, TJAPlayer3.stage演奏ドラム画面.actGauge.db現在のゲージ値[0].ToString()); - TJAPlayer3.act文字コンソール.tPrint(0, 10, C文字コンソール.Eフォント種別.白, Math.Sin((float)this.ctMob.n現在の値 * (Math.PI / 180)).ToString()); - */ - if (HGaugeMethods.UNSAFE_IsRainbow(0)) { @@ -66,9 +75,10 @@ namespace TJAPlayer3 nNowMobCounter = 0; } + int moveHeight = (int)(70 * (TJAPlayer3.Skin.Resolution[1] / 720.0)); - if (TJAPlayer3.Tx.Mob[RandomMob] != null) - TJAPlayer3.Tx.Mob[RandomMob].t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (TJAPlayer3.Tx.Mob[RandomMob].szテクスチャサイズ.Height - 70)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * 70)); + if (Mob != null) + Mob.t2D描画(0, (TJAPlayer3.Skin.Resolution[1] - (Mob.szテクスチャサイズ.Height - moveHeight)) + -((float)Math.Sin(nNowMobCounter * (Math.PI / 180)) * moveHeight)); } @@ -78,9 +88,9 @@ namespace TJAPlayer3 } #region[ private ] //----------------- + public CTexture Mob; private float nNowMobCounter; private float nMobBeat; - private int RandomMob; //----------------- #endregion } diff --git a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsRunner.cs b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsRunner.cs index 9cae3bb3..35f25450 100644 --- a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsRunner.cs +++ b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏DrumsRunner.cs @@ -64,6 +64,8 @@ namespace TJAPlayer3 stRunners[i].ct進行 = new CCounter(); } + var preset = HScenePreset.GetBGPreset(); + Random random = new Random(); var dancerOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.RUNNER}"); @@ -72,7 +74,10 @@ namespace TJAPlayer3 var dirs = System.IO.Directory.GetDirectories($@"{dancerOrigindir}"); if (dirs.Length > 0) { - var path = dirs[random.Next(0, dirs.Length)]; + var _presetPath = (preset != null && preset.RunnerSet != null) ? $@"{dancerOrigindir}" + preset.RunnerSet[random.Next(0, preset.RunnerSet.Length)] : ""; + var path = (preset != null && System.IO.Directory.Exists(_presetPath)) + ? _presetPath + : dirs[random.Next(0, dirs.Length)]; LoadRunnerConifg(path); Runner = TJAPlayer3.tテクスチャの生成($@"{path}{Path.DirectorySeparatorChar}Runner.png"); diff --git a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏Drums背景.cs b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏Drums背景.cs index 293120b4..3cec08f9 100644 --- a/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏Drums背景.cs +++ b/OpenTaiko/src/Stages/07.Game/Taiko/CAct演奏Drums背景.cs @@ -105,7 +105,7 @@ namespace TJAPlayer3 return; var bgOrigindir = CSkin.Path($"{TextureLoader.BASE}{TextureLoader.GAME}{TextureLoader.BACKGROUND}"); - string presetSection = ""; + var preset = HScenePreset.GetBGPreset(); if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Tower) { bgOrigindir += "Tower"; @@ -113,7 +113,6 @@ namespace TJAPlayer3 else if (TJAPlayer3.stage選曲.n確定された曲の難易度[0] == (int)Difficulty.Dan) { bgOrigindir += "Dan"; - presetSection = "Dan"; } else if (TJAPlayer3.ConfigIni.bAIBattleMode) { @@ -122,34 +121,6 @@ namespace TJAPlayer3 else { bgOrigindir += "Normal"; - presetSection = "Regular"; - } - - object _ps = null; - - switch (presetSection) - { - case "Regular": - _ps = TJAPlayer3.Skin.Game_SkinScenes.Regular; - break; - case "Dan": - _ps = TJAPlayer3.Skin.Game_SkinScenes.Dan; - break; - default: - break; - }; - - var preset = (_ps != null - && TJAPlayer3.stage選曲.r確定された曲.strScenePreset != null - && ((Dictionary)_ps).ContainsKey(TJAPlayer3.stage選曲.r確定された曲.strScenePreset)) - ? ((Dictionary)_ps)[TJAPlayer3.stage選曲.r確定された曲.strScenePreset] - : null; - - if (_ps != null - && TJAPlayer3.DTX.scenePreset != null - && ((Dictionary)_ps).ContainsKey(TJAPlayer3.DTX.scenePreset)) // If currently selected song has valid SCENEPRESET metadata within TJA - { - preset = ((Dictionary)_ps)[TJAPlayer3.DTX.scenePreset]; } Random random = new Random(); @@ -159,7 +130,7 @@ namespace TJAPlayer3 var upDirs = System.IO.Directory.GetDirectories($@"{bgOrigindir}{Path.DirectorySeparatorChar}Up"); // If there is a preset upper background and this preset exists on the skin use it, else random upper background - var _presetPath = (preset != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Up{Path.DirectorySeparatorChar}" + preset.UpperBackground : ""; + var _presetPath = (preset != null && preset.UpperBackground != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Up{Path.DirectorySeparatorChar}" + preset.UpperBackground[random.Next(0, preset.UpperBackground.Length)] : ""; var upPath = (preset != null && System.IO.Directory.Exists(_presetPath)) ? _presetPath : upDirs[random.Next(0, upDirs.Length)]; @@ -179,7 +150,7 @@ namespace TJAPlayer3 var downDirs = System.IO.Directory.GetDirectories($@"{bgOrigindir}{Path.DirectorySeparatorChar}Down"); // If there is a preset lower background and this preset exists on the skin use it, else random upper background - var _presetPath = (preset != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Down{Path.DirectorySeparatorChar}" + preset.LowerBackground : ""; + var _presetPath = (preset != null && preset.LowerBackground != null) ? $@"{bgOrigindir}{Path.DirectorySeparatorChar}Down{Path.DirectorySeparatorChar}" + preset.LowerBackground[random.Next(0, preset.LowerBackground.Length)] : ""; var downPath = (preset != null && System.IO.Directory.Exists(_presetPath)) ? _presetPath : downDirs[random.Next(0, downDirs.Length)];