using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("派系滑动ui4.8版本")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("派系滑动ui4.8版本")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a95f7405-f5cd-4ef1-9299-765ce535b8bb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace 派系滑动ui4._8版本;
[BepInPlugin("UIhuadongmod", "UIhuadongmod", "1.0.0")]
public class 模组加载项 : BaseUnityPlugin
{
private void Awake()
{
初始化单例();
}
private void 初始化单例()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
GameObject val = new GameObject("派系场景排序UI");
Object.DontDestroyOnLoad((Object)(object)val);
派系场景排序UI 派系场景排序UI2 = val.AddComponent<派系场景排序UI>();
}
}
public class SingletonMono<T> : MonoBehaviour where T : MonoBehaviour
{
private static T _instance;
private static readonly object _lock = new object();
private static bool _applicationIsQuitting = false;
public static T Instance
{
get
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
if (_applicationIsQuitting)
{
Debug.LogWarning((object)$"[Singleton] {typeof(T)} 已销毁,返回 null");
return default(T);
}
lock (_lock)
{
if ((Object)(object)_instance == (Object)null)
{
_instance = Object.FindObjectOfType<T>();
if ((Object)(object)_instance == (Object)null)
{
GameObject val = new GameObject(typeof(T).Name);
_instance = val.AddComponent<T>();
}
}
return _instance;
}
}
}
protected virtual bool DontDestroyOnLoadScene => true;
protected virtual void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = (T)(object)((this is T) ? this : null);
if (DontDestroyOnLoadScene)
{
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
SceneManager.sceneLoaded += OnSceneLoadedInternal;
SceneManager.sceneUnloaded += OnSceneUnloadedInternal;
OnSingletonAwake();
}
else if ((Object)(object)_instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
protected virtual void OnDestroy()
{
if ((Object)(object)_instance == (Object)(object)this)
{
SceneManager.sceneLoaded -= OnSceneLoadedInternal;
SceneManager.sceneUnloaded -= OnSceneUnloadedInternal;
OnSingletonDestroy();
_instance = default(T);
}
}
protected virtual void OnApplicationQuit()
{
_applicationIsQuitting = true;
}
private void OnSceneLoadedInternal(Scene scene, LoadSceneMode mode)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
OnSceneLoaded(scene, mode);
}
private void OnSceneUnloadedInternal(Scene scene)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
OnSceneUnloaded(scene);
}
protected virtual void OnSingletonAwake()
{
}
protected virtual void OnSingletonDestroy()
{
}
protected virtual void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
}
protected virtual void OnSceneUnloaded(Scene scene)
{
}
}
public class 派系场景排序UI : SingletonMono<派系场景排序UI>
{
private bool _scrollRectAdded = false;
private List<GameObject> _debugPlaceholders = new List<GameObject>();
protected override bool DontDestroyOnLoadScene => true;
protected override void OnSingletonAwake()
{
Debug.Log((object)"派系排序UI 初始化完成");
}
protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
Debug.Log((object)$"场景加载完成: {((Scene)(ref scene)).name},模式: {mode}");
Debug.Log((object)$"场景加载完成: {((Scene)(ref scene)).name},模式: {mode}");
((MonoBehaviour)this).StartCoroutine(延迟设置ScrollRect());
RefreshFactionList();
}
private IEnumerator 延迟设置ScrollRect()
{
yield return null;
yield return null;
TrySetupScrollRect();
}
protected override void OnSceneUnloaded(Scene scene)
{
Debug.Log((object)("场景卸载: " + ((Scene)(ref scene)).name));
_scrollRectAdded = false;
ClearCache();
}
protected override void OnSingletonDestroy()
{
Debug.Log((object)"派系排序UI 销毁");
}
private void TrySetupScrollRect()
{
if (!_scrollRectAdded)
{
GameObject val = GameObject.Find("ConsoleGameUI/TitleSafe/TitleSafeScale/PlacementUI/UnitsUI/ExpandedFactionMover/ExpandedUI");
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)"没找到 ExpandedUI 物体");
return;
}
SetupScrollRect(val);
_scrollRectAdded = true;
}
}
private void SetupScrollRect(GameObject target1)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Expected O, but got Unknown
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
RectTransform component = target1.GetComponent<RectTransform>();
Transform parent = target1.transform.parent;
Vector3 localPosition = ((Transform)component).localPosition;
Vector2 sizeDelta = component.sizeDelta;
Vector2 anchorMin = component.anchorMin;
Vector2 anchorMax = component.anchorMax;
Vector2 pivot = component.pivot;
GameObject val = new GameObject("ScrollRect1", new Type[1] { typeof(RectTransform) });
RectTransform component2 = val.GetComponent<RectTransform>();
val.transform.SetParent(parent, false);
component2.anchorMin = anchorMin;
component2.anchorMax = anchorMax;
component2.pivot = pivot;
component2.sizeDelta = sizeDelta;
((Transform)component2).localPosition = localPosition;
ScrollRect val2 = val.AddComponent<ScrollRect>();
val2.horizontal = false;
val2.vertical = true;
val2.movementType = (MovementType)1;
val2.elasticity = 0.1f;
val2.inertia = true;
val2.decelerationRate = 0.135f;
val2.scrollSensitivity = 20f;
GameObject val3 = new GameObject("Viewport", new Type[1] { typeof(RectTransform) });
val3.transform.SetParent(val.transform, false);
RectTransform component3 = val3.GetComponent<RectTransform>();
component3.anchorMin = Vector2.zero;
component3.anchorMax = Vector2.one;
component3.offsetMin = Vector2.zero;
component3.offsetMax = Vector2.zero;
component3.pivot = new Vector2(0.5f, 1f);
RectMask2D val4 = val3.AddComponent<RectMask2D>();
target1.transform.SetParent(val3.transform, false);
val4.padding = new Vector4(0f, -257f, 0f, 0f);
GameObject val5 = GameObject.Find("ConsoleGameUI/TitleSafe/TitleSafeScale/PlacementUI/UnitsUI/ExpandedFactionMover/ScrollRect1/Viewport/ExpandedUI/Factions");
RectTransform component4 = val5.GetComponent<RectTransform>();
RectTransform component5 = target1.GetComponent<RectTransform>();
component5.pivot = new Vector2(0.5f, 1f);
component5.anchorMin = new Vector2(0f, 1f);
component5.anchorMax = new Vector2(1f, 1f);
component5.anchoredPosition = Vector2.zero;
val2.content = component4;
val2.viewport = component3;
}
private IEnumerator 延迟生成占位符()
{
yield return (object)new WaitForEndOfFrame();
GenerateDebugPlaceholders(70);
}
private void GenerateDebugPlaceholders(int count = 20)
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = GameObject.Find("ConsoleGameUI/TitleSafe/TitleSafeScale/PlacementUI/UnitsUI/ExpandedFactionMover/ScrollRect1/Viewport/ExpandedUI/Factions/LandfallFactions");
Transform val = ((obj != null) ? obj.transform : null);
if ((Object)(object)val == (Object)null)
{
Debug.LogWarning((object)"找不到 LandfallFactions 节点,无法生成占位符!");
return;
}
foreach (GameObject debugPlaceholder in _debugPlaceholders)
{
if ((Object)(object)debugPlaceholder != (Object)null)
{
Object.Destroy((Object)(object)debugPlaceholder);
}
}
_debugPlaceholders.Clear();
for (int i = 0; i < count; i++)
{
GameObject val2 = new GameObject($"DebugBtn_{i}", new Type[1] { typeof(RectTransform) });
val2.transform.SetParent(val, false);
LayoutElement val3 = val2.AddComponent<LayoutElement>();
val3.minHeight = 60f;
val3.preferredHeight = 60f;
Image val4 = val2.AddComponent<Image>();
((Graphic)val4).color = new Color(Random.Range(0.2f, 0.8f), Random.Range(0.2f, 0.8f), Random.Range(0.2f, 0.8f), 0.8f);
_debugPlaceholders.Add(val2);
}
Debug.Log((object)$"已在 LandfallFactions 生成 {count} 个占位按钮用于测试滑动。");
LayoutRebuilder.ForceRebuildLayoutImmediate((RectTransform)(object)((val is RectTransform) ? val : null));
}
private void RefreshFactionList()
{
}
private void ClearCache()
{
}
}