Merge remote-tracking branch 'origin/6.18' into 6.18

# Conflicts:
#	MiraAPI/Resources/Menu_Button.png
This commit is contained in:
XtraCube committed 2024-06-20 17:20:05 -04:00
commit a0b3b78830
5 files changed
+53 -6

No files matched your search

+10
View File
@@ -14,6 +14,16 @@
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2024.3.5</GameVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="Resources\NextButton.png" />
<None Remove="Resources\NextButtonActive.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\NextButton.png" />
<EmbeddedResource Include="Resources\NextButtonActive.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Reactor" Version="2.2.0" />
@@ -1,11 +1,9 @@
using HarmonyLib;
using MiraAPI.GameOptions;
using Reactor.Utilities;
using MiraAPI.Utilities.Assets;
using Reactor.Utilities.Extensions;
using System.Collections.Generic;
using System.Linq;
using MiraAPI.GameOptions.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
namespace MiraAPI.Patches.Options;
@@ -13,11 +11,47 @@ namespace MiraAPI.Patches.Options;
public static class GameSettingMenuPatches
{
public static int currentSelectedMod = 0;
[HarmonyPrefix]
[HarmonyPatch(nameof(GameSettingMenu.Start))]
public static void StartPrefix(GameSettingMenu __instance)
{
__instance.MenuDescriptionText.transform.parent.gameObject.SetActive(false);
Transform helpThing = __instance.transform.FindChild("What Is This?");
GameObject tmpText = GameObject.Instantiate(helpThing.transform.FindChild("InfoText"), helpThing.parent).gameObject;
tmpText.GetComponent<TextTranslatorTMP>().Destroy();
tmpText.name = "SelectedMod";
tmpText.transform.localPosition = new Vector3(-3.3382f, -0.4019f, -2f);
TextMeshPro tmp = tmpText.GetComponent<TextMeshPro>();
tmp.text = "Mira API";
tmp.fontSizeMax = 3;
tmp.fontSize = 3;
tmp.alignment = TextAlignmentOptions.Center;
GameObject nextButton = GameObject.Instantiate(__instance.BackButton, __instance.BackButton.transform.parent).gameObject;
nextButton.transform.localPosition = new Vector3(-2.2663f, -0.4037f, -25f);
nextButton.name = "NextButton";
nextButton.transform.FindChild("Inactive").gameObject.GetComponent<SpriteRenderer>().sprite = MiraAssets.NextButton.LoadAsset();
nextButton.transform.FindChild("Active").gameObject.GetComponent<SpriteRenderer>().sprite = MiraAssets.NextButtonActive.LoadAsset();
nextButton.gameObject.GetComponent<PassiveButton>().OnClick.AddListener((UnityAction)(() =>
{
currentSelectedMod += 1;
}));
GameObject backButton = GameObject.Instantiate(nextButton, __instance.BackButton.transform.parent).gameObject;
nextButton.transform.localPosition = new Vector3(-4.4209f, -0.4037f, -25f);
nextButton.name = "BackButton";
nextButton.transform.FindChild("Active").gameObject.GetComponent<SpriteRenderer>().flipX = nextButton.transform.FindChild("Inactive").gameObject.GetComponent<SpriteRenderer>().flipX = true;
backButton.gameObject.GetComponent<PassiveButton>().OnClick.RemoveAllListeners();
backButton.gameObject.GetComponent<PassiveButton>().OnClick.AddListener((UnityAction)(() =>
{
currentSelectedMod -= 1;
}));
__instance.GamePresetsButton.gameObject.SetActive(false);
}
/*public static void CreateOptionsFor(GameSettingMenu __instance, ToggleOption togglePrefab, NumberOption numberPrefab, StringOption stringPrefab, Transform container,
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

+3
View File
@@ -3,5 +3,8 @@
public static class MiraAssets
{
public static readonly LoadableResourceAsset Empty = new("", "");
public static readonly LoadableResourceAsset NextButton = new("NextButton.png", "MiraAPI.Resources.");
public static readonly LoadableResourceAsset NextButtonActive = new("NextButtonActive.png", "MiraAPI.Resources.");
}
}