using vnxbqy.UI; using UnityEngine; using System.Collections.Generic; /// /// logic工程的窗口基类 /// public class ILWindow { static Dictionary windows = new Dictionary(); public static void SetProxy(string name, ILWindowProxy proxy1) { windows[name] = proxy1; } protected ILWindowProxy proxy { get {return windows[this.GetType().Name];} set { windows[this.GetType().Name] = value;} } #region 窗口的生命周期,仅为了方便子类重写联想与结构的定义,注意子类不重写,父类也不会调用,所以不要在这些方法里写代码 protected virtual void OnActived() { } protected virtual void LateUpdate() { } protected virtual void BindController() { } protected virtual void AddListeners() { } protected virtual void OnPreOpen() { } protected virtual void OnAfterOpen() { } protected virtual void OnPreClose() { } protected virtual void OnAfterClose() { } protected virtual void OnDestroy() { } #endregion /// /// 释放窗口资源 /// private void Dipose() { proxy = null; } public Transform transform { get { return proxy.transform; } } public GameObject gameObject { get { return proxy.gameObject; } } protected T GetWidgt(string name) where T : Component { return proxy.GetWidgtEx(name); } protected void CloseWin() where T : ILWindow { WindowCenter.Instance.CloseIL(); } protected void CloseWinEx() where T : Window { WindowCenter.Instance.CloseEx(); } }