diff --git a/OpenTaiko/src/Common/OpenTaiko.cs b/OpenTaiko/src/Common/OpenTaiko.cs index f3dcae32..f145ca9d 100755 --- a/OpenTaiko/src/Common/OpenTaiko.cs +++ b/OpenTaiko/src/Common/OpenTaiko.cs @@ -331,10 +331,6 @@ namespace OpenTaiko { private set; } - public static COpenEncyclopedia stageOpenEncyclopedia { - get; - private set; - } public static CStage曲読み込み stage曲読み込み { get; private set; @@ -361,10 +357,6 @@ namespace OpenTaiko { get; private set; } - public static string strコンパクトモードファイル { - get; - private set; - } public static CTimer Timer { get; private set; @@ -799,27 +791,6 @@ namespace OpenTaiko { #endregion break; - case (int)CStageタイトル.E戻り値.ENCYCLOPEDIA: - #region [Online Lounge] - //----------------------------- - r現在のステージ.DeActivate(); - if (!ConfigIni.PreAssetsLoading) { - r現在のステージ.ReleaseManagedResource(); - r現在のステージ.ReleaseUnmanagedResource(); - } - Trace.TraceInformation("----------------------"); - Trace.TraceInformation("■ Open Encyclopedia"); - stageOpenEncyclopedia.Activate(); - if (!ConfigIni.PreAssetsLoading) { - stageOpenEncyclopedia.CreateManagedResource(); - stageOpenEncyclopedia.CreateUnmanagedResource(); - } - r直前のステージ = r現在のステージ; - r現在のステージ = stageOpenEncyclopedia; - //----------------------------- - #endregion - break; - case (int)CStageタイトル.E戻り値.CONFIG: #region [ *** ] //----------------------------- @@ -2156,7 +2127,6 @@ for (int i = 0; i < 3; i++) { stageHeya = new CStageHeya(); stageOnlineLounge = new CStageOnlineLounge(); stageTowerSelect = new CStageTowerSelect(); - stageOpenEncyclopedia = new COpenEncyclopedia(); stage曲読み込み = new CStage曲読み込み(); stage演奏ドラム画面 = new CStage演奏ドラム画面(); stage結果 = new CStage結果(); @@ -2176,7 +2146,6 @@ for (int i = 0; i < 3; i++) { this.listトップレベルActivities.Add(stageHeya); this.listトップレベルActivities.Add(stageOnlineLounge); this.listトップレベルActivities.Add(stageTowerSelect); - this.listトップレベルActivities.Add(stageOpenEncyclopedia); this.listトップレベルActivities.Add(stage曲読み込み); this.listトップレベルActivities.Add(stage演奏ドラム画面); this.listトップレベルActivities.Add(stage結果); diff --git a/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs b/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs index 88b67963..bdcee212 100644 --- a/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs +++ b/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs @@ -27,7 +27,6 @@ namespace OpenTaiko { public static string MODALS = @$"11_Modals{Path.DirectorySeparatorChar}"; public static string ONLINELOUNGE = @$"12_OnlineLounge{Path.DirectorySeparatorChar}"; public static string TOWERSELECT = @$"13_TowerSelect{Path.DirectorySeparatorChar}"; - public static string OPENENCYCLOPEDIA = @$"15_OpenEncyclopedia{Path.DirectorySeparatorChar}"; // InGame public static string DANCER = @$"2_Dancer{Path.DirectorySeparatorChar}"; @@ -1314,15 +1313,6 @@ namespace OpenTaiko { #endregion - #region [15_OpenEncyclopedia] - - //OpenEncyclopedia_Background = TxC(OPENENCYCLOPEDIA + @"Background.png"); - OpenEncyclopedia_Context = TxC(OPENENCYCLOPEDIA + @"Context.png"); - OpenEncyclopedia_Side_Menu = TxC(OPENENCYCLOPEDIA + @"Side_Menu.png"); - OpenEncyclopedia_Return_Box = TxC(OPENENCYCLOPEDIA + @"Return_Box.png"); - - #endregion - if (OpenTaiko.ConfigIni.PreAssetsLoading) { foreach (var act in OpenTaiko.app.listトップレベルActivities) { act.CreateManagedResource(); @@ -2898,16 +2888,6 @@ Result_Mountain = new CTexture[4]*/; #endregion - #region [15_OpenEncyclopedia] - - public CTexture - //OpenEncyclopedia_Background, - OpenEncyclopedia_Context, - OpenEncyclopedia_Return_Box, - OpenEncyclopedia_Side_Menu; - - #endregion - #region [ 解放用 ] public List listTexture = new List(); diff --git a/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs b/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs deleted file mode 100644 index 4957019c..00000000 --- a/OpenTaiko/src/Stages/15.OpenEncyclopedia/CEncyclopediaControler.cs +++ /dev/null @@ -1,234 +0,0 @@ -using System.Drawing; -using FDK; -using static OpenTaiko.CActSelect曲リスト; - -namespace OpenTaiko { - class CEncyclopediaControler { - - public CEncyclopediaControler() { - _callStack = new Stack(); - _idxStack = new Stack(); - - _current = OpenTaiko.Databases.DBEncyclopediaMenus.data; - - _lang = CLangManager.fetchLang(); - - tResetIndexes(); - tReloadFonts(); - tReallocateCurrentAccordingly(); - } - - #region [Fonts] - - private void tReloadFonts() { - _pfEncyclopediaMenu?.Dispose(); - _pfEncyclopediaMenu = HPrivateFastFont.tInstantiateMainFont(OpenTaiko.Skin.OpenEncyclopedia_Font_EncyclopediaMenu_Size); - } - - #endregion - - #region [Menu files parsing] - - private string _GetPathTextFile(string parent) { - string _expected = parent + Path.DirectorySeparatorChar + _lang + ".txt"; - string _default = parent + Path.DirectorySeparatorChar + CLangManager.DefaultLanguage.Item1 + ".txt"; - - if (File.Exists(_expected)) - return _expected; - return _default; - } - - private string _GetSectionContents(int key, bool _fetchingMenus) { - try { - string _path = _GetPathTextFile(@$"{OpenTaiko.strEXEのあるフォルダ}Encyclopedia{Path.DirectorySeparatorChar}" + (_fetchingMenus ? @$"Menus{Path.DirectorySeparatorChar}" : @$"Pages{Path.DirectorySeparatorChar}") + key.ToString()); - - return File.ReadAllText(_path); - } catch { - return "[File not found]"; - } - } - - private string _GetImagePath(int key) { - return @$"{OpenTaiko.strEXEのあるフォルダ}Encyclopedia{Path.DirectorySeparatorChar}Images{Path.DirectorySeparatorChar}" + key.ToString() + @".png"; - } - - #endregion - - #region [Memory management] - - private void tFreeRessources(bool pages) { - if (pages) { - if (Pages != null) { - for (int i = 0; i < Pages.Length; i++) { - Pages[i].Item3?.Dispose(); - } - } - } - } - - private void tReallocateSubMenus() { - tFreeRessources(false); - - int _count = _current.Menus.Length + 1; - Submenus = new (int, CTexture)[_count]; - - Submenus[0].Item1 = -1; - Submenus[0].Item2 = TitleTextureKey.ResolveTitleTexture( - new TitleTextureKey(CLangManager.LangInstance.GetString("MENU_RETURN"), _pfEncyclopediaMenu, Color.White, Color.Brown, 1000)); - - for (int i = 1; i < _count; i++) { - int _idx = i - 1; // Excluding return - var _menu = _current.Menus[_idx]; - Submenus[i].Item1 = _menu.Key; - Submenus[i].Item2 = TitleTextureKey.ResolveTitleTexture( - new TitleTextureKey(_GetSectionContents(_menu.Key, true), _pfEncyclopediaMenu, Color.White, Color.Brown, 1000)); - } - } - - private void tReallocatePages() { - tFreeRessources(true); - - if (_current.Pages == null) { - Pages = new (int, CTexture, CTexture)[0]; - return; // Menus and Pages are null - } - - int _count = _current.Pages.Length; - Pages = new (int, CTexture, CTexture)[_count]; - - for (int i = 0; i < _count; i++) { - var _page = _current.Pages[i]; - Pages[i].Item1 = _page; - Pages[i].Item2 = TitleTextureKey.ResolveTitleTexture( - new TitleTextureKey(_GetSectionContents(_page, false), _pfEncyclopediaMenu, Color.White, Color.Brown, 1000)); - Pages[i].Item3 = OpenTaiko.tテクスチャの生成(_GetImagePath(_page)); - } - } - - #endregion - - #region [Input handlers] - - // Bool return value = "Back to main menu ?" - public bool tHandleBack() { - if (_callStack.Count() <= 0) - return true; - - var _oldIndex = _idxStack.Pop(); - - if (tArePagesOpened()) - PageIndex = 0; - else - MenuIndex = _oldIndex; - - _current = _callStack.Pop(); - - tReallocateCurrentAccordingly(); - - return false; - } - - // Bool return value = ("Went forward ?", "Back to main menu ?" - public (bool, bool) tHandleEnter() { - // If not page and not return button - if (!tArePagesOpened() && MenuIndex != 0) { - _callStack.Push(_current); - _idxStack.Push(MenuIndex); - _current = _current.Menus[MenuIndex - 1].Value; - - bool _hasPages = tArePagesOpened(); - - if (_hasPages) - PageIndex = 0; - else - tResetIndexes(); - - tReallocateCurrentAccordingly(); - - if (_hasPages) - tUpdatePageIndex(); - - return (true, false); - } - var _mainMenu = tHandleBack(); - return (false, _mainMenu); - } - - public void tHandleLeft() { - tMove(tArePagesOpened(), -1); - } - - public void tHandleRight() { - tMove(tArePagesOpened(), 1); - } - - - #endregion - - #region [private utils methods] - - private void tUpdatePageIndex() { - PageText = TitleTextureKey.ResolveTitleTexture( - new TitleTextureKey((PageIndex + 1).ToString() + "/" + Pages.Length.ToString(), _pfEncyclopediaMenu, Color.White, Color.Brown, 1000)); - } - - private void tMove(bool pages, int count) { - if (pages) { - if (Pages.Length > 0) { - PageIndex = (PageIndex + count + Pages.Length) % Pages.Length; - tUpdatePageIndex(); - } - - } else { - if (Submenus.Length > 0) - MenuIndex = (MenuIndex + count + Submenus.Length) % Submenus.Length; - } - } - - private void tResetIndexes() { - MenuIndex = 0; - PageIndex = 0; - } - - private void tReallocateCurrentAccordingly() { - if (tIsMenu(_current)) - tReallocateSubMenus(); - else - tReallocatePages(); - } - - #endregion - - #region [public utils methods] - - public bool tArePagesOpened() { - return (!tIsMenu(_current)); - } - - public bool tIsMenu(DBEncyclopediaMenus.EncyclopediaMenu menu) { - return (!(menu.Menus == null || menu.Menus.Length == 0)); - } - - #endregion - - #region [public variables] - - public (int, CTexture)[] Submenus; - public (int, CTexture, CTexture)[] Pages; - public CTexture PageText; - public int MenuIndex; - public int PageIndex; - - #endregion - - #region [private variables] - - private Stack _callStack; - private Stack _idxStack; - private DBEncyclopediaMenus.EncyclopediaMenu _current; - private string _lang; - private static CCachedFontRenderer _pfEncyclopediaMenu; - - #endregion - } -} diff --git a/OpenTaiko/src/Stages/15.OpenEncyclopedia/COpenEncyclopedia.cs b/OpenTaiko/src/Stages/15.OpenEncyclopedia/COpenEncyclopedia.cs deleted file mode 100644 index e1691a4f..00000000 --- a/OpenTaiko/src/Stages/15.OpenEncyclopedia/COpenEncyclopedia.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System.Drawing; -using FDK; - -// Minimalist menu class to use for custom menus -namespace OpenTaiko { - class COpenEncyclopedia : CStage { - public COpenEncyclopedia() { - base.eStageID = EStage.TEMPLATE; - base.ePhaseID = CStage.EPhase.Common_NORMAL; - - // Load CActivity objects here - // base.list子Activities.Add(this.act = new CAct()); - - base.ChildActivities.Add(this.actFOtoTitle = new CActFIFOBlack()); - - } - - public override void Activate() { - // On activation - - if (base.IsActivated) - return; - - base.ePhaseID = CStage.EPhase.Common_NORMAL; - this.eフェードアウト完了時の戻り値 = EReturnValue.Continuation; - - OpenTaiko.Skin.soundEncyclopediaBGM?.tPlay(); - - _controler = new CEncyclopediaControler(); - - Background = new ScriptBG(CSkin.Path($"{TextureLoader.BASE}{TextureLoader.OPENENCYCLOPEDIA}Script.lua")); - Background.Init(); - - base.Activate(); - } - - public override void DeActivate() { - // On de-activation - - OpenTaiko.tDisposeSafely(ref Background); - - base.DeActivate(); - } - - public override void CreateManagedResource() { - // Ressource allocation - - base.CreateManagedResource(); - } - - public override void ReleaseManagedResource() { - // Ressource freeing - - base.ReleaseManagedResource(); - } - - public override int Draw() { - #region [Fetch variables] - - _arePagesOpened = _controler.tArePagesOpened(); - bool _backToMain = false; - - #endregion - - #region [Displayables] - - Background.Update(); - Background.Draw(); - - //OpenEncyclopedia_Background?.t2D描画(0, 0); - - if (_arePagesOpened) { - OpenTaiko.Tx.OpenEncyclopedia_Context?.t2D描画(0, 0); - - if (_controler.Pages.Length > 0) { - var _page = _controler.Pages[_controler.PageIndex]; - - _page.Item2?.t2D中心基準描画(OpenTaiko.Skin.OpenEncyclopedia_Context_Item2[0], OpenTaiko.Skin.OpenEncyclopedia_Context_Item2[1]); - if (_page.Item3 != null) { - _page.Item3.vcScaleRatio.X = OpenTaiko.Skin.Resolution[0] / (2f * _page.Item3.szTextureSize.Width); - _page.Item3.vcScaleRatio.Y = OpenTaiko.Skin.Resolution[1] / (2f * _page.Item3.szTextureSize.Height); - _page.Item3.t2D描画(OpenTaiko.Skin.OpenEncyclopedia_Context_Item3[0], OpenTaiko.Skin.OpenEncyclopedia_Context_Item3[1]); - } - _controler.PageText?.t2D下中央基準描画(OpenTaiko.Skin.OpenEncyclopedia_Context_PageText[0], OpenTaiko.Skin.OpenEncyclopedia_Context_PageText[1]); - } - } - - for (int i = -7; i < 7; i++) { - var _pos = (_controler.MenuIndex + i + (_controler.Submenus.Length * 7)) % _controler.Submenus.Length; - var _menu = _controler.Submenus[_pos]; - - if (i != 0) { - OpenTaiko.Tx.OpenEncyclopedia_Return_Box?.tUpdateColor4(CConversion.ColorToColor4(Color.DarkGray)); - OpenTaiko.Tx.OpenEncyclopedia_Side_Menu?.tUpdateColor4(CConversion.ColorToColor4(Color.DarkGray)); - _menu.Item2?.tUpdateColor4(CConversion.ColorToColor4(Color.DarkGray)); - } else { - OpenTaiko.Tx.OpenEncyclopedia_Return_Box?.tUpdateColor4(CConversion.ColorToColor4(Color.White)); - OpenTaiko.Tx.OpenEncyclopedia_Side_Menu?.tUpdateColor4(CConversion.ColorToColor4(Color.White)); - _menu.Item2?.tUpdateColor4(CConversion.ColorToColor4(Color.White)); - } - - int x = OpenTaiko.Skin.OpenEncyclopedia_Side_Menu[0] + OpenTaiko.Skin.OpenEncyclopedia_Side_Menu_Move[0] * i; - int y = OpenTaiko.Skin.OpenEncyclopedia_Side_Menu[1] + OpenTaiko.Skin.OpenEncyclopedia_Side_Menu_Move[1] * i; - - if (_pos == 0) - OpenTaiko.Tx.OpenEncyclopedia_Return_Box?.t2D中心基準描画(x, y); - else - OpenTaiko.Tx.OpenEncyclopedia_Side_Menu?.t2D中心基準描画(x, y); - _menu.Item2?.t2D中心基準描画( - x + OpenTaiko.Skin.OpenEncyclopedia_Side_Menu_Text_Offset[0], - y + OpenTaiko.Skin.OpenEncyclopedia_Side_Menu_Text_Offset[1]); - } - - #endregion - - #region [Inputs] - - if (OpenTaiko.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.RightArrow) || - OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.RightChange)) { - _controler.tHandleRight(); - OpenTaiko.Skin.soundChangeSFX.tPlay(); - } else if (OpenTaiko.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.LeftArrow) || - OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.LeftChange)) { - _controler.tHandleLeft(); - OpenTaiko.Skin.soundChangeSFX.tPlay(); - } else if (OpenTaiko.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Escape) || - OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.Cancel)) { - _backToMain = _controler.tHandleBack(); - OpenTaiko.Skin.soundCancelSFX.tPlay(); - } else if (OpenTaiko.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Return) || - OpenTaiko.Pad.bPressed(EInstrumentPad.Drums, EPad.Decide)) { - var (_b1, _b2) = _controler.tHandleEnter(); - _backToMain = _b2; - - if (_b1) - OpenTaiko.Skin.soundDecideSFX.tPlay(); - else - OpenTaiko.Skin.soundCancelSFX.tPlay(); - } - - #endregion - - #region [Postprocessing] - - if (_backToMain) { - OpenTaiko.Skin.soundEncyclopediaBGM?.tStop(); - this.eフェードアウト完了時の戻り値 = EReturnValue.ReturnToTitle; - this.actFOtoTitle.tフェードアウト開始(); - base.ePhaseID = CStage.EPhase.Common_FADEOUT; - } - - #endregion - - - #region [FadeOut] - - // Menu exit fade out transition - switch (base.ePhaseID) { - case CStage.EPhase.Common_FADEOUT: - if (this.actFOtoTitle.Draw() == 0) { - break; - } - return (int)this.eフェードアウト完了時の戻り値; - - } - - #endregion - - return 0; - } - - #region [Private] - - private ScriptBG Background; - - private CEncyclopediaControler _controler; - private bool _arePagesOpened; - - public EReturnValue eフェードアウト完了時の戻り値; - public CActFIFOBlack actFOtoTitle; - - #endregion - } -}