From 68bc38186c6d03dbb0dd08add339dbd6aa4598ac Mon Sep 17 00:00:00 2001 From: 0auBSQ <58159635+0auBSQ@users.noreply.github.com> Date: Mon, 29 Jul 2024 00:04:45 +0900 Subject: [PATCH] Puchichara, Character unlock modals and few fixes about lua nameplates --- .../Modules/Modal/README.md | 10 +++--- .../Modules/Modal/Script.lua | 35 ++++++++++++++++--- OpenTaiko/src/Stages/01.StartUp/CCharacter.cs | 7 ++-- .../src/Stages/01.StartUp/CPuchichara.cs | 2 +- .../src/Stages/01.StartUp/TextureLoader.cs | 2 +- OpenTaiko/src/Stages/11.Heya/CStageHeya.cs | 4 +-- OpenTaiko/src/Stages/CNamePlate.cs | 12 +++---- 7 files changed, 50 insertions(+), 22 deletions(-) diff --git a/OpenTaiko/System/Open-World Memories/Modules/Modal/README.md b/OpenTaiko/System/Open-World Memories/Modules/Modal/README.md index 0529c6c8..0a6db115 100644 --- a/OpenTaiko/System/Open-World Memories/Modules/Modal/README.md +++ b/OpenTaiko/System/Open-World Memories/Modules/Modal/README.md @@ -18,15 +18,15 @@ Includes the following arguments: - (object) modal_info: Asset related information, modal_type dependent: > Coins -> (long) modal_info: The coin value of the play -> Character -> Puchichara +> Character -> (CCharacter) modal_info: The unlocked character information data (never nil) +> Puchichara -> (CPuchichara) modal_info: The unlocked puchichara information data (never nil) > Title -> (NameplateUnlockable) modal_info: The unlocked nameplate information data (never nil) > Song -> (SongNode?) modal_info: The unlocked song information data (can be nil) - (object) modal_visual_ref: Asset related visuals (or extra info), modal_type dependent: > Coins -> (long) modal_visual_ref: The total count of coins after the play -> Character -> Puchichara +> Character -> (CTexture?) modal_visual_ref: The character render as displayed in my room (can be nil) +> Puchichara -> nil > Title -> (LuaNamePlateScript) modal_visual_ref: A reference to the Nameplate Lua script (never nil except if broken skin) > Song -> (CTexture?) modal_visual_ref: The song preimage, with the size value set to the same value as in the song select menu (can be nil) ``` @@ -45,4 +45,4 @@ For displayables, played at each result screen Draw() iteration ## Types -TBD \ No newline at end of file +TBD diff --git a/OpenTaiko/System/Open-World Memories/Modules/Modal/Script.lua b/OpenTaiko/System/Open-World Memories/Modules/Modal/Script.lua index 9012f2f8..cc0ca5d3 100644 --- a/OpenTaiko/System/Open-World Memories/Modules/Modal/Script.lua +++ b/OpenTaiko/System/Open-World Memories/Modules/Modal/Script.lua @@ -63,12 +63,18 @@ function registerNewModal(player, rarity, modal_type, modal_asset_informations, modal_sfx_coin:PlayStart() elseif modal_type == 1 then - -- Character + -- Character + -- > modal_asset_informations: CCharacter + -- > modal_asset_visual_references: CTexture? _modal_header = getLocalizedString("MODAL_TITLE_CHARA") + _modal_body = modal_current_info.metadata:tGetName() elseif modal_type == 2 then - -- Puchichara + -- Puchichara + -- > modal_asset_informations: CPuchichara + -- > modal_asset_visual_references: _modal_header = getLocalizedString("MODAL_TITLE_PUCHI") + _modal_body = modal_current_info.metadata:tGetName() elseif modal_type == 3 then -- Title @@ -83,6 +89,7 @@ function registerNewModal(player, rarity, modal_type, modal_asset_informations, -- > modal_asset_informations: CSongListNode -- > modal_asset_visual_references: CTexture (Preimage) _modal_header = getLocalizedString("MODAL_TITLE_SONG") + _modal_body = modal_current_info.ldTitle:GetString("") end @@ -157,15 +164,33 @@ function draw() tx_header:t2D_DisplayImage_AnchorCenter(960,180) - - if modal_current_type == 3 then + if modal_current_type == 1 then + -- Character + if modal_current_visual ~= nil then + modal_current_visual:t2D_DisplayImage(0,260) + end + tx_body = getTextTex(ttk_modal_body, false, false) + tx_body:t2D_DisplayImage_AnchorCenter(960,390) + elseif modal_current_type == 2 then + -- Puchichara + if modal_current_info.tx ~= nil then + modal_current_info.tx:t2D_DisplayImage_AnchorCenter(960,490) + end + tx_body = getTextTex(ttk_modal_body, false, false) + tx_body:t2D_DisplayImage_AnchorCenter(960,790) + elseif modal_current_type == 3 then + -- Nameplate Title tx_title = getTextTex(ttk_modal_body, false, false) modal_current_visual:DrawTitlePlate(960, 490, 255, modal_current_info.Value.nameplateInfo.iType, tx_title, modal_current_rarity, modal_current_info.Key) elseif modal_current_type == 4 then + -- Song if modal_current_visual ~= nil then modal_current_visual:t2D_DisplayImage_AnchorCenter(960,490) end - else + tx_body = getTextTex(ttk_modal_body, false, false) + tx_body:t2D_DisplayImage_AnchorCenter(960,790) + else + -- Custom modals for custom unlockables in the future?? tx_body = getTextTex(ttk_modal_body, false, false) tx_body:t2D_DisplayImage_AnchorCenter(960,490) end diff --git a/OpenTaiko/src/Stages/01.StartUp/CCharacter.cs b/OpenTaiko/src/Stages/01.StartUp/CCharacter.cs index ad5ba115..abce4929 100644 --- a/OpenTaiko/src/Stages/01.StartUp/CCharacter.cs +++ b/OpenTaiko/src/Stages/01.StartUp/CCharacter.cs @@ -4,6 +4,7 @@ public DBCharacter.CharacterEffect effect; public DBUnlockables.CUnlockConditions unlock; public string _path; + public int _idx; public float GetEffectCoinMultiplier() { float mult = 1f; @@ -31,7 +32,8 @@ new Modal( Modal.EModalType.Character, HRarity.tRarityToModalInt(metadata.Rarity), - metadata.tGetName() + this, + TJAPlayer3.Tx.Characters_Heya_Render[_idx] ), _player); @@ -43,8 +45,9 @@ TJAPlayer3.SaveFileInstances[player].tApplyHeyaChanges(); } - public CCharacter(string path) { + public CCharacter(string path, int i) { _path = path; + _idx = i; // Character metadata if (File.Exists($@"{path}{Path.DirectorySeparatorChar}Metadata.json")) diff --git a/OpenTaiko/src/Stages/01.StartUp/CPuchichara.cs b/OpenTaiko/src/Stages/01.StartUp/CPuchichara.cs index 109020e3..3eeb5e93 100644 --- a/OpenTaiko/src/Stages/01.StartUp/CPuchichara.cs +++ b/OpenTaiko/src/Stages/01.StartUp/CPuchichara.cs @@ -38,7 +38,7 @@ namespace TJAPlayer3 { new Modal( Modal.EModalType.Puchichara, HRarity.tRarityToModalInt(metadata.Rarity), - metadata.tGetName() + this ), _player); diff --git a/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs b/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs index 022a0e3a..b563c560 100644 --- a/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs +++ b/OpenTaiko/src/Stages/01.StartUp/TextureLoader.cs @@ -1317,7 +1317,7 @@ namespace TJAPlayer3 { } } - Characters[i] = new CCharacter(charaDirs[i]); + Characters[i] = new CCharacter(charaDirs[i], i); } diff --git a/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs b/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs index a4e08ac8..f9c69c8e 100644 --- a/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs +++ b/OpenTaiko/src/Stages/11.Heya/CStageHeya.cs @@ -613,7 +613,7 @@ namespace TJAPlayer3 { TJAPlayer3.SaveFileInstances[iPlayer].data.DanGold = iG; TJAPlayer3.SaveFileInstances[iPlayer].data.DanType = cs; - TJAPlayer3.NamePlate.tNamePlateRefreshTitles(iPlayer); + TJAPlayer3.NamePlate.tNamePlateRefreshTitles(0); TJAPlayer3.SaveFileInstances[iPlayer].tApplyHeyaChanges(); @@ -639,7 +639,7 @@ namespace TJAPlayer3 { } - TJAPlayer3.NamePlate.tNamePlateRefreshTitles(iPlayer); + TJAPlayer3.NamePlate.tNamePlateRefreshTitles(0); TJAPlayer3.SaveFileInstances[iPlayer].tApplyHeyaChanges(); diff --git a/OpenTaiko/src/Stages/CNamePlate.cs b/OpenTaiko/src/Stages/CNamePlate.cs index bb6c6c96..e7e14fc5 100644 --- a/OpenTaiko/src/Stages/CNamePlate.cs +++ b/OpenTaiko/src/Stages/CNamePlate.cs @@ -36,16 +36,16 @@ title = CLangManager.LangInstance.GetString("AI_TITLE"); dan = stages[Math.Max(0, TJAPlayer3.ConfigIni.nAILevel - 1)] + "面"; } else { - name = TJAPlayer3.SaveFileInstances[player].data.Name; - title = TJAPlayer3.SaveFileInstances[player].data.Title; - dan = TJAPlayer3.SaveFileInstances[player].data.Dan; + name = TJAPlayer3.SaveFileInstances[actualPlayer].data.Name; + title = TJAPlayer3.SaveFileInstances[actualPlayer].data.Title; + dan = TJAPlayer3.SaveFileInstances[actualPlayer].data.Dan; } bIsPrevAI[player] = isAI; if (TJAPlayer3.SaveFileInstances[player].data.DanGold) - lcNamePlate.SetInfos(player, name, title, $"{dan}", TJAPlayer3.SaveFileInstances[player].data); + lcNamePlate.SetInfos(player, name, title, $"{dan}", TJAPlayer3.SaveFileInstances[actualPlayer].data); else - lcNamePlate.SetInfos(player, name, title, dan, TJAPlayer3.SaveFileInstances[player].data); + lcNamePlate.SetInfos(player, name, title, dan, TJAPlayer3.SaveFileInstances[actualPlayer].data); } @@ -62,7 +62,7 @@ } bIsPrevAI[basePlayer] = isAI; - lcNamePlate.Draw(x, y, Opacity, basePlayer, player); + lcNamePlate.Draw(x, y, Opacity, basePlayer, TJAPlayer3.P1IsBlue() ? 1 : 0); } private bool[] bIsPrevAI = new bool[5];