Skip to content

Commit

Permalink
修bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TianMengLucky committed Aug 20, 2023
1 parent 639c7d7 commit 7b1846f
Showing 1 changed file with 39 additions and 18 deletions.
57 changes: 39 additions & 18 deletions NextShip/Patches/MainUIPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<SpriteRenderer>();
TIS_Logo_SpriteRenderer = TIS_Logo.AddComponent<SpriteRenderer>();
Au_Logo_SpriteRenderer = Au_Logo.GetComponent<SpriteRenderer>();

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);
Expand All @@ -65,19 +66,18 @@ private static void Init_DestroyGameObject()
private static void Create()
{
InitGameObject();

Au_Logo.AddComponent<BoxCollider2D>().size = Au_Logo_SpriteRenderer.size;

LeftPanel.DestroyComponents<AspectSize>();

var auLogoPassiveButton = Au_Logo.AddComponent<PassiveButton>(); ;

var auLogoPassiveButton = Au_Logo.AddComponent<PassiveButton>();
;
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);
Expand All @@ -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)
Expand All @@ -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);
}
}

0 comments on commit 7b1846f

Please sign in to comment.