using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; using UObject = UnityEngine.Object; namespace XGame { public class CharacterSwitchController : MonoBehaviour { private const string ConfigResourcePath = "Config/CharacterConfig"; private const string SelectedCharacterKey = "CharacterSwitch.SelectedCharacterId"; private const string PrefabPath = "Assets/Game/Art/UI/Prefab/UI_CharacterSwitch.prefab"; private CharacterConfigData config; private CharacterConfigItem currentConfig; private GameObject currentCharacter; private Transform characterRoot; private string errorText; // UGUI 引用(替换原 IMGUI 绘制) private GameObject uiPanel; // 实例化的 UI 根 private GameObject selectPanel; // Panel_Select private Transform listChars; // List_Chars private GameObject itemTemplate; // Item_Char private TMP_Text errorLabel; // Txt_Error private TMP_Text toggleLabel; // Txt_Toggle private readonly List