```csharp public abstract class BaseUI : MonoBehaviour { private Transform _CachedTransform; public Transform cachedTransform { get { if (_CachedTransform == null) _CachedTransform = this.transform; return _CachedTransform; } }
private GameObject _CachedGameobject; public GameObject cachedGameobject { get { if (_CachedGameobject == null) _CachedGameobject = this.gameObject; return _CachedGameobject; } }
protected EnumObjectState state = EnumObjectState.None; public event StateChangedEvent StateChanged;
public EnumObjectState State { get { return this.state; } set { if (value != state) { EnumObjectState oldState = value; state = value; if (StateChanged != null) StateChanged(this, state, oldState); } } }
```csharp public class UIManager : Singleton { private Dictionary dicOpenedUIs = null; private Stack stackOpeningUIs = null;
public override void Init() { dicOpenedUIs = new Dictionary(); stackOpeningUIs = new Stack(); }
public T GetUI(EnumUIType type) where T : BaseUI { GameObject retObj = GetUIObject(type); if (retObj != null) return retObj.GetComponent(); return null; }
public GameObject GetUIObject(EnumUIType type) { if (!dicOpenedUIs.TryGetValue(type, out GameObject retObj)) throw new Exception("dicOpenedUIs TryGetValue Failure! _uiType :" + type.ToString()); return retObj; }
public void PreloadUI(EnumUIType[] uiTypes) { foreach (var uiType in uiTypes) PreloadUI(uiType); }
public enum EnumUIType : int { NOne= -1, StartUI, WarUI }
public static class UIPathDefines { public const string UI_PREFAB = "UIPrefab/"; public const string UI_CONTROLS_PREFAB = "UIPrefab/Control/"; public const string UI_SUBUI_PREFAB = "UIPrefab/SubUI/"; public const string UI_ICON = "UI/Icon";
public static System.Type GetUIScriptByType(EnumUIType type) { switch (type) { case EnumUIType.StartUI: return typeof(StratUI); case EnumUIType.WarUI: return typeof(WarUI); default: Debug.Log("No This UIType : " + type.ToString()); break; } return null; } } } ```
Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ...
[详细]