少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
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>();
    }
 
}