|
using vnxbqy.UI;
|
using UnityEngine;
|
using System.Collections.Generic;
|
/// <summary>
|
/// logic工程的窗口基类
|
/// </summary>
|
public class ILWindow
|
{
|
|
static Dictionary<string, ILWindowProxy> windows = new Dictionary<string, ILWindowProxy>();
|
|
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
|
|
/// <summary>
|
/// 释放窗口资源
|
/// </summary>
|
private void Dipose()
|
{
|
proxy = null;
|
}
|
|
public Transform transform {
|
get { return proxy.transform; }
|
}
|
|
public GameObject gameObject {
|
get { return proxy.gameObject; }
|
}
|
|
protected T GetWidgt<T>(string name) where T : Component
|
{
|
return proxy.GetWidgtEx<T>(name);
|
}
|
|
protected void CloseWin<T>() where T : ILWindow
|
{
|
WindowCenter.Instance.CloseIL<T>();
|
}
|
|
protected void CloseWinEx<T>() where T : Window
|
{
|
WindowCenter.Instance.CloseEx<T>();
|
}
|
|
}
|