From 7b1846f5dcc4a6685728a5213fcd6e97582370cf Mon Sep 17 00:00:00 2001 From: Bilibili_MengChu <2133404320@qq.com> Date: Mon, 21 Aug 2023 02:13:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NextShip/Patches/MainUIPatch.cs | 57 ++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/NextShip/Patches/MainUIPatch.cs b/NextShip/Patches/MainUIPatch.cs index 8d9c5e8..2362468 100644 --- a/NextShip/Patches/MainUIPatch.cs +++ b/NextShip/Patches/MainUIPatch.cs @@ -21,34 +21,35 @@ public static class MainUIPatch private static GameObject TIS_Logo; private static GameObject BackGround; private static GameObject LeftPanel; - + private static SpriteRenderer BackGround_SpriteRenderer; private static SpriteRenderer TIS_Logo_SpriteRenderer; private static SpriteRenderer Au_Logo_SpriteRenderer; - + public static Sprite TIS_Logo_Sprite; public static Sprite NextShipText_Sprite; public static Sprite Au_Logo_Sprite; public static Sprite TOHE_Sprite; - + public static bool ChangeStyle; - + + private static void InitGameObject() { BackGround = new GameObject("TIS_BackGround"); TIS_Logo = new GameObject("TIS_Logo"); - + Ambience = GameObject.Find("Ambience"); Au_Logo = GameObject.Find("LOGO-AU"); LeftPanel = GameObject.Find("LeftPanel"); - + BackGround_SpriteRenderer = BackGround.AddComponent(); TIS_Logo_SpriteRenderer = TIS_Logo.AddComponent(); Au_Logo_SpriteRenderer = Au_Logo.GetComponent(); Au_Logo_Sprite = Au_Logo_SpriteRenderer.sprite; - + TIS_Logo_Sprite = SpriteUtils.LoadSpriteFromResources("NextShip.Resources.Logo.Banner.png", 300f); NextShipText_Sprite = SpriteUtils.LoadSpriteFromResources("NextShip.Resources.Logo.NextShipText.png", 100f); TOHE_Sprite = SpriteUtils.LoadSpriteFromResources("NextShip.Resources.Logo.TOHE-BG.jpg", 179f); @@ -65,19 +66,18 @@ private static void Init_DestroyGameObject() private static void Create() { InitGameObject(); - + Au_Logo.AddComponent().size = Au_Logo_SpriteRenderer.size; - + LeftPanel.DestroyComponents(); - - var auLogoPassiveButton = Au_Logo.AddComponent(); ; + + var auLogoPassiveButton = Au_Logo.AddComponent(); + ; auLogoPassiveButton.OnClick.AddListener((UnityAction)Au_Logo_OnClick); auLogoPassiveButton.OnMouseOut = new UnityEvent(); - auLogoPassiveButton.OnMouseOut.AddListener((UnityAction)(() => Info("Out"))); auLogoPassiveButton.OnMouseOver = new UnityEvent(); - auLogoPassiveButton.OnMouseOver.AddListener((UnityAction)(() => Info("Over"))); - + TIS_Logo.transform.position = new Vector3(2f, -0.2f, 0); TIS_Logo.transform.localScale = new Vector3(1.1f, 1.5f, 1); @@ -97,10 +97,10 @@ public static void UpdateMainUI() { TIS_Logo.SetActive(!ChangeStyle); BackGround.gameObject.SetActive(ChangeStyle); - + Au_Logo_SpriteRenderer.sprite = ChangeStyle ? NextShipText_Sprite : Au_Logo_Sprite; } - + [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))] [HarmonyPostfix] public static void MainMenuManager_Start_Postfix_Patch(MainMenuManager __instance) @@ -116,13 +116,34 @@ public static void MainMenuManager_Start_Postfix_Patch(MainMenuManager __instanc Exception(e); } } - + [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.LateUpdate))] [HarmonyPostfix] public static void MainMenuManager_Update_Postfix_Patch(MainMenuManager __instance) { } + + [ + HarmonyPatch(typeof(MainMenuManager)), + HarmonyPatch(nameof(MainMenuManager.OpenGameModeMenu)), + HarmonyPatch(nameof(MainMenuManager.OpenAccountMenu)), + HarmonyPatch(nameof(MainMenuManager.OpenCredits)), + HarmonyPostfix + ] + public static void OpenMenuPostfix() + { + if (TIS_Logo) TIS_Logo.SetActive(false); + } - + + [ + HarmonyPatch(typeof(MainMenuManager)), + HarmonyPatch(nameof(MainMenuManager.ResetScreen)), + HarmonyPostfix + ] + public static void ResetScreenPostfix() + { + if (TIS_Logo) TIS_Logo.SetActive(false); + } } \ No newline at end of file