diff --git a/OpenTaiko/Lang/de/lang.json b/OpenTaiko/Lang/de/lang.json index 777629fb..d983e6fa 100644 --- a/OpenTaiko/Lang/de/lang.json +++ b/OpenTaiko/Lang/de/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "Charakter", "HEYA_DAN": "Dan-Titel", "HEYA_NAMEPLATE": "Namensschild-Titel", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "Name: {0}", diff --git a/OpenTaiko/Lang/en/lang.json b/OpenTaiko/Lang/en/lang.json index 5a4c0ba4..a5181c6a 100644 --- a/OpenTaiko/Lang/en/lang.json +++ b/OpenTaiko/Lang/en/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "Character", "HEYA_DAN": "Dan Title", "HEYA_NAMEPLATE": "Nameplate Title", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "Name: {0}", diff --git a/OpenTaiko/Lang/es/lang.json b/OpenTaiko/Lang/es/lang.json index c85f6d97..62b211fd 100644 --- a/OpenTaiko/Lang/es/lang.json +++ b/OpenTaiko/Lang/es/lang.json @@ -445,6 +445,8 @@ "HEYA_CHARA": "Personaje", "HEYA_DAN": "Título de Dan", "HEYA_NAMEPLATE": "Título de la placa", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "Name: {0}", diff --git a/OpenTaiko/Lang/fr/lang.json b/OpenTaiko/Lang/fr/lang.json index 91d26a39..da5e1637 100644 --- a/OpenTaiko/Lang/fr/lang.json +++ b/OpenTaiko/Lang/fr/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "Personnage", "HEYA_DAN": "Titre Dan", "HEYA_NAMEPLATE": "Titre", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "Name: {0}", diff --git a/OpenTaiko/Lang/ja/lang.json b/OpenTaiko/Lang/ja/lang.json index 7266122f..0d4feaf8 100644 --- a/OpenTaiko/Lang/ja/lang.json +++ b/OpenTaiko/Lang/ja/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "キャラクター", "HEYA_DAN": "段位称号", "HEYA_NAMEPLATE": "名札称号", + "HEYA_NAME": "名前", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "名前:{0}", diff --git a/OpenTaiko/Lang/ko/lang.json b/OpenTaiko/Lang/ko/lang.json index ba937c6e..ea8b0600 100644 --- a/OpenTaiko/Lang/ko/lang.json +++ b/OpenTaiko/Lang/ko/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "캐릭터", "HEYA_DAN": "단위 제목", "HEYA_NAMEPLATE": "칭호 타이틀", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "이름: {0}", diff --git a/OpenTaiko/Lang/nl/lang.json b/OpenTaiko/Lang/nl/lang.json index 2d061961..fb5eb4fe 100644 --- a/OpenTaiko/Lang/nl/lang.json +++ b/OpenTaiko/Lang/nl/lang.json @@ -440,6 +440,8 @@ "HEYA_CHARA": "Character", "HEYA_DAN": "Dan Title", "HEYA_NAMEPLATE": "Nameplate Title", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "Name: {0}", diff --git a/OpenTaiko/Lang/ru/lang.json b/OpenTaiko/Lang/ru/lang.json index d3fc352c..8d69af86 100644 --- a/OpenTaiko/Lang/ru/lang.json +++ b/OpenTaiko/Lang/ru/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "Персонаж", "HEYA_DAN": "Ранг дан", "HEYA_NAMEPLATE": "Ранг таблички", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "Имя: {0}", diff --git a/OpenTaiko/Lang/zh/lang.json b/OpenTaiko/Lang/zh/lang.json index d6d0dc1b..8440f1d6 100644 --- a/OpenTaiko/Lang/zh/lang.json +++ b/OpenTaiko/Lang/zh/lang.json @@ -444,6 +444,8 @@ "HEYA_CHARA": "角色", "HEYA_DAN": "段位称号", "HEYA_NAMEPLATE": "名牌称号", + "HEYA_NAME": "Name", + "HEYA_NAME_INFO": "Type your name (Confirm to save, Cancel to discard changes):", // {0}: Asset name "HEYA_DESCRIPTION_NAME": "姓名:{0}", diff --git a/OpenTaiko/src/Common/CSkin.cs b/OpenTaiko/src/Common/CSkin.cs index d746464e..5bf7c5c7 100644 --- a/OpenTaiko/src/Common/CSkin.cs +++ b/OpenTaiko/src/Common/CSkin.cs @@ -6882,21 +6882,21 @@ internal class CSkin : IDisposable { #region Heya case "Heya_Main_Menu_X": { string[] strSplit = strParam.Split(','); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < Math.Min(6, strSplit.Length); i++) { Heya_Main_Menu_X[i] = int.Parse(strSplit[i]); } break; } case "Heya_Main_Menu_Y": { string[] strSplit = strParam.Split(','); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < Math.Min(6, strSplit.Length); i++) { Heya_Main_Menu_Y[i] = int.Parse(strSplit[i]); } break; } case "Heya_Main_Menu_Font_Offset": { string[] strSplit = strParam.Split(','); - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 2; i++) { Heya_Main_Menu_Font_Offset[i] = int.Parse(strSplit[i]); } break; @@ -9164,8 +9164,8 @@ internal class CSkin : IDisposable { #region Heya - public int[] Heya_Main_Menu_X = new int[] { 164, 164, 164, 164, 164 }; - public int[] Heya_Main_Menu_Y = new int[] { 26, 106, 186, 266, 346 }; + public int[] Heya_Main_Menu_X = new int[] { 164, 164, 164, 164, 164, 164 }; + public int[] Heya_Main_Menu_Y = new int[] { 26, 106, 186, 266, 346, 426 }; public int[] Heya_Main_Menu_Font_Offset = new int[] { 0, 14 }; public int Heya_Center_Menu_Box_Count = 11; public int[] Heya_Center_Menu_Box_X = new int[] { -890, -588, -286, 16, 318, 620, 922, 1224, 1526, 1828, 2130 }; diff --git a/OpenTaiko/src/Common/ImGuiDebugWindow.cs b/OpenTaiko/src/Common/ImGuiDebugWindow.cs index 851e5a64..44a2a66f 100644 --- a/OpenTaiko/src/Common/ImGuiDebugWindow.cs +++ b/OpenTaiko/src/Common/ImGuiDebugWindow.cs @@ -100,7 +100,7 @@ public static class ImGuiDebugWindow { ImGui.Text("Unknown: " + OpenTaiko.InputManager.InputDevices.Count(device => device.CurrentType == InputDeviceType.Unknown)); foreach (IInputDevice device in OpenTaiko.InputManager.InputDevices) { - if (ImGui.TreeNodeEx(device.CurrentType.ToString() + " (ID " + device.ID + " / Name: " + device.Name + ")")) { + if (ImGui.TreeNodeEx(device.CurrentType.ToString() + " (ID " + device.ID + " / Name: " + device.Name + " / GUID: " + device.GUID + ")")) { switch (device.CurrentType) { case InputDeviceType.Keyboard: var keyboard = (CInputKeyboard)device; diff --git a/OpenTaiko/src/Helpers/HBlackBackdrop.cs b/OpenTaiko/src/Helpers/HBlackBackdrop.cs new file mode 100644 index 00000000..055808f0 --- /dev/null +++ b/OpenTaiko/src/Helpers/HBlackBackdrop.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenTaiko { + public static class HBlackBackdrop { + public static void Draw(int opacity = 255) { + if (OpenTaiko.Tx.Tile_Black != null) { + OpenTaiko.Tx.Tile_Black.Opacity = opacity; + for (int i = 0; i <= SampleFramework.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) { + for (int j = 0; j <= SampleFramework.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) { + OpenTaiko.Tx.Tile_Black.t2D描画(i, j); + } + } + OpenTaiko.Tx.Tile_Black.Opacity = 255; + } + } + } +} diff --git a/OpenTaiko/src/Stages/01.StartUp/CStage起動.cs b/OpenTaiko/src/Stages/01.StartUp/CStage起動.cs index 7ff1237f..1de8334d 100644 --- a/OpenTaiko/src/Stages/01.StartUp/CStage起動.cs +++ b/OpenTaiko/src/Stages/01.StartUp/CStage起動.cs @@ -181,14 +181,7 @@ internal class CStage起動 : CStage { #endregion } else if (OpenTaiko.ConfigIsNew && !bLanguageSelected) // Prompt language selection if Config.ini is newly generated { - if (OpenTaiko.Tx.Tile_Black != null) { - OpenTaiko.Tx.Tile_Black.Opacity = 255; - for (int i = 0; i <= SampleFramework.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) { - for (int j = 0; j <= SampleFramework.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) { - OpenTaiko.Tx.Tile_Black.t2D描画(i, j); - } - } - } + HBlackBackdrop.Draw(); int x = langSelectOffset[0]; int y = langSelectOffset[1]; diff --git a/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs b/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs index 56465325..bc763126 100644 --- a/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs +++ b/OpenTaiko/src/Stages/04.Config/CStageコンフィグ.cs @@ -377,15 +377,8 @@ internal class CStageコンフィグ : CStage { actCalibrationMode.Update(); actCalibrationMode.Draw(); } else if (actList.ScoreIniImportThreadIsActive) { - if (OpenTaiko.Tx.Tile_Black != null) { - OpenTaiko.Tx.Tile_Black.Opacity = 191; - for (int i = 0; i <= SampleFramework.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) { - for (int j = 0; j <= SampleFramework.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) { - OpenTaiko.Tx.Tile_Black.t2D描画(i, j); - } - } - OpenTaiko.Tx.Tile_Black.Opacity = 255; - } + HBlackBackdrop.Draw(191); + using (var prvFont = HPrivateFastFont.tInstantiateMainFont(OpenTaiko.Skin.Config_Font_Scale)) { using (var status_text = new CTexture(prvFont.DrawText( CScoreIni_Importer.Status, diff --git a/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs b/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs index 2067a697..1b619475 100644 --- a/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs +++ b/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs @@ -14,6 +14,14 @@ class CStageHeya : CStage { base.ChildActivities.Add(this.PuchiChara = new PuchiChara()); } + private enum CurrentMenu : int { + ReturnToMenu = -1, + Puchi, + Chara, + Dan, + Title, + Name + } public override void Activate() { if (base.IsActivated) @@ -38,17 +46,16 @@ class CStageHeya : CStage { #region [Main menu] - this.ttkMainMenuOpt = new TitleTextureKey[5]; + this.ttkMainMenuOpt = new TitleTextureKey[6]; this.ttkMainMenuOpt[0] = new TitleTextureKey(CLangManager.LangInstance.GetString("MENU_RETURN"), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); this.ttkMainMenuOpt[1] = new TitleTextureKey(CLangManager.LangInstance.GetString("HEYA_PUCHI"), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); this.ttkMainMenuOpt[2] = new TitleTextureKey(CLangManager.LangInstance.GetString("HEYA_CHARA"), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); this.ttkMainMenuOpt[3] = new TitleTextureKey(CLangManager.LangInstance.GetString("HEYA_DAN"), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); this.ttkMainMenuOpt[4] = new TitleTextureKey(CLangManager.LangInstance.GetString("HEYA_NAMEPLATE"), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); - //for (int i = 1; i < ttkMainMenuOpt.Length; i++) - //{ - // this.ttkMainMenuOpt[i] = new TitleTextureKey(CLangManager.LangInstance.GetString(1030 + i), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); - //} + this.ttkMainMenuOpt[5] = new TitleTextureKey(CLangManager.LangInstance.GetString("HEYA_NAME"), this.pfHeyaFont, Color.White, Color.DarkGreen, 1000); + + this.textInputInfo = new TitleTextureKey(CLangManager.LangInstance.GetString("HEYA_NAME_INFO"), this.pfHeyaFont, Color.White, Color.Black, 1000); #endregion @@ -108,7 +115,7 @@ class CStageHeya : CStage { #endregion // -1 : Main Menu, >= 0 : See Main menu opt - iCurrentMenu = -1; + iCurrentMenu = CurrentMenu.ReturnToMenu; iMainMenuCurrent = 0; #region [PuchiChara stuff] @@ -141,6 +148,12 @@ class CStageHeya : CStage { #endregion + #region [Name stuff] + textInput = new CTextInput("", 64); + textInput.Text = OpenTaiko.SaveFileInstances[iPlayer].data.Name; + textInputTitle = new TitleTextureKey("", pfHeyaFont, Color.White, Color.Black, 1000); + #endregion + this.tResetOpts(); this.PuchiChara.IdleAnimation(); @@ -183,7 +196,7 @@ class CStageHeya : CStage { for (int i = 0; i < this.ttkMainMenuOpt.Length; i++) { CTexture tmpTex = TitleTextureKey.ResolveTitleTexture(this.ttkMainMenuOpt[i]); - if (iCurrentMenu != -1 || iMainMenuCurrent != i) { + if (iCurrentMenu != CurrentMenu.ReturnToMenu || iMainMenuCurrent != i) { tmpTex.color4 = CConversion.ColorToColor4(Color.DarkGray); OpenTaiko.Tx.Heya_Side_Menu?.tUpdateColor4(CConversion.ColorToColor4(Color.DarkGray)); } else { @@ -219,9 +232,9 @@ class CStageHeya : CStage { OpenTaiko.Tx.Characters_Heya_Render[iCharacterCurrent].vcScaleRatio.X = renderRatioX; OpenTaiko.Tx.Characters_Heya_Render[iCharacterCurrent].vcScaleRatio.Y = renderRatioY; } - if (iCurrentMenu == 0 || iCurrentMenu == 1) OpenTaiko.Tx.Heya_Render_Field?.t2D描画(0, 0); - if (iCurrentMenu == 0) OpenTaiko.Tx.Puchichara[iPuchiCharaCurrent].render?.t2D描画(0, 0); - if (iCurrentMenu == 1) OpenTaiko.Tx.Characters_Heya_Render[iCharacterCurrent]?.t2D描画(OpenTaiko.Skin.Characters_Heya_Render_Offset[iCharacterCurrent][0] * renderRatioX, OpenTaiko.Skin.Characters_Heya_Render_Offset[iCharacterCurrent][1] * renderRatioY); + if (iCurrentMenu == CurrentMenu.Puchi || iCurrentMenu == CurrentMenu.Chara) OpenTaiko.Tx.Heya_Render_Field?.t2D描画(0, 0); + if (iCurrentMenu == CurrentMenu.Puchi) OpenTaiko.Tx.Puchichara[iPuchiCharaCurrent].render?.t2D描画(0, 0); + if (iCurrentMenu == CurrentMenu.Chara) OpenTaiko.Tx.Characters_Heya_Render[iCharacterCurrent]?.t2D描画(OpenTaiko.Skin.Characters_Heya_Render_Offset[iCharacterCurrent][0] * renderRatioX, OpenTaiko.Skin.Characters_Heya_Render_Offset[iCharacterCurrent][1] * renderRatioY); #endregion @@ -229,7 +242,7 @@ class CStageHeya : CStage { #region [Petit chara] - if (iCurrentMenu == 0) { + if (iCurrentMenu == CurrentMenu.Puchi) { for (int i = -(OpenTaiko.Skin.Heya_Center_Menu_Box_Count / 2); i < (OpenTaiko.Skin.Heya_Center_Menu_Box_Count / 2) + 1; i++) { int pos = (iPuchiCharaCount * 5 + iPuchiCharaCurrent + i) % iPuchiCharaCount; @@ -294,7 +307,7 @@ class CStageHeya : CStage { #region [Character] - if (iCurrentMenu == 1) { + if (iCurrentMenu == CurrentMenu.Chara) { for (int i = -(OpenTaiko.Skin.Heya_Center_Menu_Box_Count / 2); i < (OpenTaiko.Skin.Heya_Center_Menu_Box_Count / 2) + 1; i++) { int pos = (iCharacterCount * 5 + iCharacterCurrent + i) % iCharacterCount; @@ -356,7 +369,7 @@ class CStageHeya : CStage { #region [Dan title] - if (iCurrentMenu == 2) { + if (iCurrentMenu == CurrentMenu.Dan) { for (int i = -(OpenTaiko.Skin.Heya_Side_Menu_Count / 2); i < (OpenTaiko.Skin.Heya_Side_Menu_Count / 2) + 1; i++) { int pos = (this.ttkDanTitles.Length * 5 + iDanTitleCurrent + i) % this.ttkDanTitles.Length; @@ -364,11 +377,11 @@ class CStageHeya : CStage { if (i != 0) { tmpTex.color4 = CConversion.ColorToColor4(Color.DarkGray); - OpenTaiko.Tx.Heya_Side_Menu.color4 = CConversion.ColorToColor4(Color.DarkGray); + OpenTaiko.Tx.Heya_Side_Menu?.tUpdateColor4(CConversion.ColorToColor4(Color.DarkGray)); //TJAPlayer3.Tx.NamePlateBase.color4 = CConversion.ColorToColor4(Color.DarkGray); } else { tmpTex.color4 = CConversion.ColorToColor4(Color.White); - OpenTaiko.Tx.Heya_Side_Menu.color4 = CConversion.ColorToColor4(Color.White); + OpenTaiko.Tx.Heya_Side_Menu?.tUpdateColor4(CConversion.ColorToColor4(Color.White)); //TJAPlayer3.Tx.NamePlateBase.color4 = CConversion.ColorToColor4(Color.White); } @@ -397,7 +410,7 @@ class CStageHeya : CStage { #region [Title plate] - if (iCurrentMenu == 3) { + if (iCurrentMenu == CurrentMenu.Title) { for (int i = -(OpenTaiko.Skin.Heya_Side_Menu_Count / 2); i < (OpenTaiko.Skin.Heya_Side_Menu_Count / 2) + 1; i++) { int pos = (this.ttkTitles.Length * 5 + iTitleCurrent + i) % this.ttkTitles.Length; @@ -443,6 +456,19 @@ class CStageHeya : CStage { } } + if (iCurrentMenu == CurrentMenu.Name) { + textInput.Update(); + + HBlackBackdrop.Draw(191); + + if (textInput.Text != textInputTitle.str) { textInputTitle = new TitleTextureKey(textInput.Text, pfHeyaFont, Color.White, Color.Black, 1000); } + CTexture text_tex = TitleTextureKey.ResolveTitleTexture(textInputTitle); + CTexture text_info = TitleTextureKey.ResolveTitleTexture(textInputInfo); + + text_info.t2D_DisplayImage_AnchorCenter(960, 540); + text_tex.t2D_DisplayImage_AnchorCenter(960, 540 + text_info.szTextureSize.Height); + } + #endregion #endregion @@ -464,8 +490,8 @@ class CStageHeya : CStage { #region [Asset description] if (this.ttkInfoSection == null || this.ttkInfoSection.str == "") { - if (iCurrentMenu == 0) CHeyaDisplayAssetInformations.DisplayPuchicharaInfo(this.pfHeyaFont, OpenTaiko.Tx.Puchichara[iPuchiCharaCurrent]); - if (iCurrentMenu == 1) CHeyaDisplayAssetInformations.DisplayCharacterInfo(this.pfHeyaFont, OpenTaiko.Tx.Characters[iCharacterCurrent]); + if (iCurrentMenu == CurrentMenu.Puchi) CHeyaDisplayAssetInformations.DisplayPuchicharaInfo(this.pfHeyaFont, OpenTaiko.Tx.Puchichara[iPuchiCharaCurrent]); + if (iCurrentMenu == CurrentMenu.Chara) CHeyaDisplayAssetInformations.DisplayCharacterInfo(this.pfHeyaFont, OpenTaiko.Tx.Characters[iCharacterCurrent]); } #endregion @@ -539,19 +565,22 @@ class CStageHeya : CStage { ESelectStatus ess = ESelectStatus.SELECTED; // Return to main menu - if (iCurrentMenu == -1 && iMainMenuCurrent == 0) { + if (iCurrentMenu == CurrentMenu.ReturnToMenu && iMainMenuCurrent == 0) { OpenTaiko.Skin.soundHeyaBGM.tStop(); this.eフェードアウト完了時の戻り値 = E戻り値.タイトルに戻る; this.actFOtoTitle.tフェードアウト開始(); base.ePhaseID = CStage.EPhase.Common_FADEOUT; - } else if (iCurrentMenu == -1) { - iCurrentMenu = iMainMenuCurrent - 1; + } else if (iCurrentMenu == CurrentMenu.ReturnToMenu) { + iCurrentMenu = (CurrentMenu)iMainMenuCurrent - 1; - if (iCurrentMenu == 0) { + if (iCurrentMenu == CurrentMenu.Puchi) { this.tUpdateUnlockableTextChara(); this.tUpdateUnlockableTextPuchi(); } - } else if (iCurrentMenu == 0) { + else if (iCurrentMenu == CurrentMenu.Name) { + textInput.Text = OpenTaiko.SaveFileInstances[iPlayer].data.Name; + } + } else if (iCurrentMenu == CurrentMenu.Puchi) { ess = this.tSelectPuchi(); if (ess == ESelectStatus.SELECTED) { @@ -562,7 +591,7 @@ class CStageHeya : CStage { OpenTaiko.SaveFileInstances[iPlayer].tApplyHeyaChanges(); OpenTaiko.Tx.Puchichara[iPuchiCharaCurrent].welcome.tPlay(); - iCurrentMenu = -1; + iCurrentMenu = CurrentMenu.ReturnToMenu; this.tResetOpts(); } else if (ess == ESelectStatus.SUCCESS) { //TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Add(TJAPlayer3.Skin.Puchicharas_Name[iPuchiCharaCurrent]); @@ -573,7 +602,7 @@ class CStageHeya : CStage { OpenTaiko.SaveFileInstances[iPlayer].tSpendCoins(OpenTaiko.Tx.Puchichara[iPuchiCharaCurrent].unlock.Values[0]); } - } else if (iCurrentMenu == 1) { + } else if (iCurrentMenu == CurrentMenu.Chara) { ess = this.tSelectChara(); if (ess == ESelectStatus.SELECTED) { @@ -593,7 +622,7 @@ class CStageHeya : CStage { OpenTaiko.SaveFileInstances[iPlayer].tApplyHeyaChanges(); - iCurrentMenu = -1; + iCurrentMenu = CurrentMenu.ReturnToMenu; this.tResetOpts(); } else if (ess == ESelectStatus.SUCCESS) { OpenTaiko.SaveFileInstances[iPlayer].data.UnlockedCharacters.Add(OpenTaiko.Skin.Characters_DirName[iCharacterCurrent]); @@ -602,7 +631,7 @@ class CStageHeya : CStage { OpenTaiko.SaveFileInstances[iPlayer].tSpendCoins(OpenTaiko.Tx.Characters[iCharacterCurrent].unlock.Values[0]); // Play modal animation here ? } - } else if (iCurrentMenu == 2) { + } else if (iCurrentMenu == CurrentMenu.Dan) { bool iG = false; int cs = 0; @@ -619,9 +648,9 @@ class CStageHeya : CStage { OpenTaiko.SaveFileInstances[iPlayer].tApplyHeyaChanges(); - iCurrentMenu = -1; + iCurrentMenu = CurrentMenu.ReturnToMenu; this.tResetOpts(); - } else if (iCurrentMenu == 3) { + } else if (iCurrentMenu == CurrentMenu.Title) { OpenTaiko.SaveFileInstances[iPlayer].data.Title = this.ttkTitles[iTitleCurrent].str; if (OpenTaiko.SaveFileInstances[iPlayer].data.UnlockedNameplateIds != null @@ -645,7 +674,15 @@ class CStageHeya : CStage { OpenTaiko.SaveFileInstances[iPlayer].tApplyHeyaChanges(); - iCurrentMenu = -1; + iCurrentMenu = CurrentMenu.ReturnToMenu; + this.tResetOpts(); + } + else if (iCurrentMenu == CurrentMenu.Name) { + OpenTaiko.SaveFileInstances[iPlayer].data.Name = textInput.Text; + OpenTaiko.SaveFileInstances[iPlayer].tApplyHeyaChanges(); + OpenTaiko.NamePlate.tNamePlateRefreshTitles(iPlayer); + + iCurrentMenu = CurrentMenu.ReturnToMenu; this.tResetOpts(); } @@ -657,18 +694,19 @@ class CStageHeya : CStage { OpenTaiko.Skin.SoundBanapas.tPlay(); // To change with a more appropriate sfx sooner or later #endregion - } else if (OpenTaiko.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Escape) || + } + else if (OpenTaiko.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Escape) || OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.Cancel)) { OpenTaiko.Skin.soundCancelSFX.tPlay(); - if (iCurrentMenu == -1) { + if (iCurrentMenu == CurrentMenu.ReturnToMenu) { OpenTaiko.Skin.soundHeyaBGM.tStop(); this.eフェードアウト完了時の戻り値 = E戻り値.タイトルに戻る; this.actFOtoTitle.tフェードアウト開始(); base.ePhaseID = CStage.EPhase.Common_FADEOUT; } else { - iCurrentMenu = -1; + iCurrentMenu = CurrentMenu.ReturnToMenu; this.ttkInfoSection = null; this.tResetOpts(); } @@ -719,7 +757,7 @@ class CStageHeya : CStage { private int iDanTitleCurrent; private int iTitleCurrent; - private int iCurrentMenu; + private CurrentMenu iCurrentMenu; private void tResetOpts() { // Retrieve titles if they exist @@ -764,20 +802,28 @@ class CStageHeya : CStage { ScrollMode = off; ScrollCounter.CurrentValue = 0; - if (iCurrentMenu == -1) - iMainMenuCurrent = (this.ttkMainMenuOpt.Length + iMainMenuCurrent + off) % this.ttkMainMenuOpt.Length; - else if (iCurrentMenu == 0) { - iPuchiCharaCurrent = (iPuchiCharaCount + iPuchiCharaCurrent + off) % iPuchiCharaCount; - tUpdateUnlockableTextPuchi(); - } else if (iCurrentMenu == 1) { - iCharacterCurrent = (iCharacterCount + iCharacterCurrent + off) % iCharacterCount; - tUpdateUnlockableTextChara(); - } else if (iCurrentMenu == 2) - iDanTitleCurrent = (this.ttkDanTitles.Length + iDanTitleCurrent + off) % this.ttkDanTitles.Length; - else if (iCurrentMenu == 3) - iTitleCurrent = (this.ttkTitles.Length + iTitleCurrent + off) % this.ttkTitles.Length; - else - return false; + switch (iCurrentMenu) { + case CurrentMenu.ReturnToMenu: + iMainMenuCurrent = (this.ttkMainMenuOpt.Length + iMainMenuCurrent + off) % this.ttkMainMenuOpt.Length; + break; + case CurrentMenu.Puchi: + iPuchiCharaCurrent = (iPuchiCharaCount + iPuchiCharaCurrent + off) % iPuchiCharaCount; + tUpdateUnlockableTextPuchi(); + break; + case CurrentMenu.Chara: + iCharacterCurrent = (iCharacterCount + iCharacterCurrent + off) % iCharacterCount; + tUpdateUnlockableTextChara(); + break; + case CurrentMenu.Dan: + iDanTitleCurrent = (this.ttkDanTitles.Length + iDanTitleCurrent + off) % this.ttkDanTitles.Length; + break; + case CurrentMenu.Title: + iTitleCurrent = (this.ttkTitles.Length + iTitleCurrent + off) % this.ttkTitles.Length; + break; + default: + return false; + + } return true; } @@ -922,6 +968,11 @@ class CStageHeya : CStage { private int iPuchiCharaCount; private int iCharacterCount; + private TitleTextureKey textInputInfo; + private TitleTextureKey textInputTitle; + private CTextInput textInput; + private bool isInputtingText; + private CCounter ScrollCounter; private const int SideInterval_X = 10; private const int SideInterval_Y = 70; diff --git a/OpenTaiko/src/Stages/11.Heya/CTextInput.cs b/OpenTaiko/src/Stages/11.Heya/CTextInput.cs new file mode 100644 index 00000000..5c826794 --- /dev/null +++ b/OpenTaiko/src/Stages/11.Heya/CTextInput.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FDK; +using ImGuiNET; + +namespace OpenTaiko { + public class CTextInput { + public CTextInput() { } + /// + /// + /// + /// Text to start with. Changes as user inputs text. + /// Max length in bytes that the string can be. + public CTextInput(string text, uint max_length) : base() { + Text = text; + MaxLength = max_length; + } + + /// + /// Returns true if the user presses Enter to confirm their text. + /// + public bool Update() { + ImGui.SetNextWindowSize(new(300,150)); + + ImGui.Begin("Text Input", ImGuiWindowFlags.NoResize); + ImGui.SetKeyboardFocusHere(); + if (ImGui.InputText("text :)", ref Text, MaxLength, ImGuiInputTextFlags.EnterReturnsTrue)) return true; + ImGui.Text("This window is only visible in Debug mode.\nThis will never show on a Release build.\nDon't run multiple CInputText at once!"); + + ImGui.End(); + + return false; + } + + public string Text = ""; + /// + /// Length in bytes, not char count. + /// + public uint MaxLength = 64; + } +}