using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MemorialBiography")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MemorialBiography")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("06c24108-06fa-4ab8-8edf-d7f0550cb478")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MemorialBiography;
[BepInPlugin("cc.lymone.HoL.MemorialBiography", "MemorialBiography", "1.0.0")]
public class MemorialBiography : BaseUnityPlugin
{
private void Start()
{
Harmony.CreateAndPatchAll(typeof(MemorialBiography), (string)null);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(H_CiTang_PanelA), "Start")]
public static void CopyMemberEventPanel()
{
GameObject obj = GameObject.Find("AllUI/AllPanel");
Transform val = obj.transform.Find("H_CiTang_Panel");
Transform val2 = ((Component)val).transform.Find("PanelB");
GameObject val3 = Object.Instantiate<GameObject>(((Component)val2).gameObject, val);
((Object)val3).name = "EventPanel";
Transform obj2 = obj.transform.Find("ZupuPanel").Find("MemberEventPanel").Find("PanelA")
.Find("AllJiShi")
.Find("Viewport")
.Find("Content")
.Find("InfoShow");
Transform val4 = val3.transform.Find("AllCanSelect").Find("Viewport").Find("Content");
((Object)Object.Instantiate<GameObject>(((Component)obj2).gameObject, val4)).name = "InfoShow";
Object.Destroy((Object)(object)val3.GetComponent<H_CiTang_PanelB>());
val3.transform.SetSiblingIndex(val2.GetSiblingIndex());
val3.AddComponent<EventPanel>();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(H_CiTang_PanelA), "AddBT")]
public static bool PanelA_AddBT_Patch(H_CiTang_PanelA __instance)
{
((Component)((Component)__instance).transform.parent.Find("EventPanel")).gameObject.SetActive(false);
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(H_CiTang_PanelA), "CloseBT")]
public static bool PanelA_CloseBT_Patch(H_CiTang_PanelA __instance)
{
((Component)((Component)__instance).transform.parent.Find("EventPanel")).gameObject.SetActive(false);
return true;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(H_CiTang_Panel), "OnEnableShow")]
public static void Panel_Init_Patch(H_CiTang_Panel __instance)
{
if (Object.op_Implicit((Object)(object)((Component)__instance).transform.Find("EventPanel")))
{
((Component)((Component)__instance).transform.Find("EventPanel")).gameObject.SetActive(false);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(PerPaiWeiBT), "ClickBT")]
public static bool PerPaiWeiBT_ClickBT_Patch(PerPaiWeiBT __instance)
{
if (__instance.ShowID == 0)
{
if (((Component)((Component)__instance).transform.parent.parent.parent.parent.parent.Find("PanelB")).gameObject.activeSelf)
{
((Component)((Component)__instance).transform.parent.parent.parent.parent.parent.Find("PanelB")).GetComponent<H_CiTang_PanelB>().RemovePaiWeiBT(int.Parse(((Object)__instance).name));
}
else
{
((Component)((Component)__instance).transform.parent.parent.parent.parent.parent.Find("EventPanel")).GetComponent<EventPanel>().name = int.Parse(((Object)__instance).name);
if (((Component)((Component)__instance).transform.parent.parent.parent.parent.parent.Find("EventPanel")).gameObject.activeSelf)
{
((Component)((Component)__instance).transform.parent.parent.parent.parent.parent.Find("EventPanel")).GetComponent<EventPanel>().OnEnableShow_JiShi();
}
else
{
((Component)((Component)__instance).transform.parent.parent.parent.parent.parent.Find("EventPanel")).gameObject.SetActive(true);
}
}
}
else if (__instance.ShowID == 1)
{
((Component)((Component)__instance).transform.parent.parent.parent.parent).GetComponent<H_CiTang_PanelB>().AddPaiWeiBT(int.Parse(((Object)__instance).name));
}
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(Event_2_PanelA), "SureBT")]
public static bool Create_PaiWei_PrePatch(ref (int number, string text) __state, Event_2_PanelA __instance)
{
__state.number = Mainload.Member_Ci.Count;
int value = Traverse.Create((object)__instance).Field("MemberIndex").GetValue<int>();
__state.text = Mainload.Member_now[value][36];
return true;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Event_2_PanelA), "SureBT")]
public static void Create_PaiWei_PostPatch(ref (int number, string text) __state)
{
if (__state.number + 1 == Mainload.Member_Ci.Count)
{
Mainload.Member_Ci[Mainload.Member_Ci.Count - 1].Add(__state.text);
}
}
}
public class EventPanel : MonoBehaviour
{
public int name = -1;
public void Start()
{
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Expected O, but got Unknown
if (Mainload.SetData[4] == 0)
{
((Component)((Component)this).transform.Find("TipA")).GetComponent<Text>().fontSize = 18;
}
else
{
((Component)((Component)this).transform.Find("TipA")).GetComponent<Text>().fontSize = 16;
}
((Component)((Component)this).transform.Find("TipA")).GetComponent<Text>().text = AllText.Text_UIA[1133][Mainload.SetData[4]];
((UnityEvent)((Component)((Component)this).transform.Find("CloseBT")).GetComponent<Button>().onClick).AddListener(new UnityAction(CloseBT));
}
public void OnEnable()
{
OnEnableShow_JiShi();
}
public void OnEnableShow_JiShi()
{
//IL_033c: Unknown result type (might be due to invalid IL or missing references)
string[] array = new string[0];
if (name != -1 && Mainload.Member_Ci[name].Count > 3)
{
array = Mainload.Member_Ci[name][3].Split(new char[1] { '|' });
}
else
{
string text = Mainload.Member_Ci[name][0].Split(new char[1] { '|' })[3].Split(new char[1] { '@' })[0].Split(new char[1] { '~' })[3];
array = new string[1] { text + "@-1@null@null" };
}
string text2 = "null";
for (int i = 0; i < array.Length; i++)
{
string text3 = ((int.Parse(array[i].Split(new char[1] { '@' })[1]) < 0) ? AllText.Text_UIA[1223][Mainload.SetData[4]].Replace("@", array[i].Split(new char[1] { '@' })[0]) : AllText.Text_UIA[1222][Mainload.SetData[4]].Replace("@", array[i].Split(new char[1] { '@' })[0]).Replace("$", AllText.Text_AllMemberEvent[int.Parse(array[i].Split(new char[1] { '@' })[1])][Mainload.SetData[4]].Split(new char[1] { '|' })[0].Replace("@", array[i].Split(new char[1] { '@' })[2]).Replace("$", array[i].Split(new char[1] { '@' })[3])));
text2 = ((!(text2 == "null")) ? (text2 + "\n" + text3) : text3);
}
if (text2 == "null")
{
((Component)((Component)this).transform.Find("AllCanSelect").Find("Viewport").Find("Content")
.Find("InfoShow")).GetComponent<Text>().text = " ";
}
else
{
((Component)((Component)this).transform.Find("AllCanSelect").Find("Viewport").Find("Content")
.Find("InfoShow")).GetComponent<Text>().text = text2;
}
LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)((Component)this).transform.Find("AllCanSelect").Find("Viewport").Find("Content")
.Find("InfoShow")).GetComponent<RectTransform>());
((Component)((Component)this).transform.Find("AllCanSelect").Find("Viewport").Find("Content")).GetComponent<RectTransform>().SetSizeWithCurrentAnchors((Axis)1, 50f + ((Component)((Component)this).transform.Find("AllCanSelect").Find("Viewport").Find("Content")
.Find("InfoShow")).GetComponent<RectTransform>().sizeDelta.y);
}
public void CloseBT()
{
name = -1;
((Component)this).gameObject.SetActive(false);
}
}