feat:场景视图添加属性编辑,添加轮廓显示
This commit is contained in:
48
UIFrame/Patch/PatchTextLocalizorRefreshTexts.cs
Normal file
48
UIFrame/Patch/PatchTextLocalizorRefreshTexts.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using HarmonyLib;
|
||||
using SodaCraft.Localizations;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
namespace UIFrame.Patch
|
||||
{
|
||||
[HarmonyPatch(typeof(TextLocalizor), "RefreshTexts")]
|
||||
public static class PatchTextLocalizorRefreshTexts
|
||||
{
|
||||
private static readonly FieldInfo tmpTextField = AccessTools.Field(typeof(TextLocalizor), "tmpText");
|
||||
private static readonly FieldInfo textField = AccessTools.Field(typeof(TextLocalizor), "text");
|
||||
|
||||
public static void Postfix(TextLocalizor __instance)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tmpText = tmpTextField.GetValue(__instance) as TMP_Text;
|
||||
var text = textField.GetValue(__instance) as Text;
|
||||
if (tmpText)
|
||||
{
|
||||
// if (GameOriginMainMenuUI.titleText != null)
|
||||
// tmpText.text = GameOriginMainMenuUI.titleText;
|
||||
Utilities.ConfigApply.ApplyOverwrite(tmpText.transform, GameOriginMainMenuUI.titleTextTransform);
|
||||
}
|
||||
|
||||
if (text)
|
||||
{
|
||||
// if (GameOriginMainMenuUI.titleText != null)
|
||||
// text.text = GameOriginMainMenuUI.titleText;
|
||||
Utilities.ConfigApply.ApplyOverwrite(text.transform, GameOriginMainMenuUI.titleTextTransform);
|
||||
}
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
Debug.LogError($"Error in PatchTextLocalizorRefreshTexts: {ex.Message}\n{ex.StackTrace}");
|
||||
}
|
||||
}
|
||||
|
||||
public static bool Prefix(TextLocalizor __instance)
|
||||
{
|
||||
Debug.Log($"{__instance.Key}");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user