yyl
8 小时以前 ca72a86a38c255c51df9d9376bf86bdeda92deb6
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
 
//主界面的右边栏缩进功能
public class RightFuncInHome : MonoBehaviour
{
 
    [SerializeField] ClickScreenOtherSpaceEvent clickScreenOtherSpaceEvent;
    [SerializeField] RectTransform funcCol;
    [SerializeField] RectTransform showPoint;
    [SerializeField] RectTransform hidePoint;
    [SerializeField] Button closeBtn;
    [SerializeField] Button storeBtn;
    [SerializeField] Button monthCardBtn;
    [SerializeField] Button dayMissionBtn;
    [SerializeField] Button battlePassBtn;
    [SerializeField] Button llmjBtn; //历练秘笈
    [SerializeField] Button signBtn;
 
    static string listenWindowName = "";   //监听关闭时再显示
 
    bool isShow = false;
    void Awake()
    {
        monthCardBtn.AddListener(() =>
        {
            //用于监听界面,打开时缩进右边功能栏,关闭时显示
            // ListenWindow("");
            InvestModel.Instance.BuyInvest(InvestModel.monthCardType);
        });
        storeBtn.AddListener(() =>
        {
            //用于监听界面,打开时缩进右边功能栏,关闭时显示
            ListenWindow("StoreBaseWin");
            UIManager.Instance.OpenWindow<StoreBaseWin>();
        });
 
        clickScreenOtherSpaceEvent.AddListener(() =>
        {
            if (isShow)
            {
                isShow = !isShow;
                ShowFuncCol(isShow);
            }
        });
        closeBtn.AddListener(() =>
        {
            ShowFuncCol(false);
        });
 
        UIManager.Instance.OnCloseWindow -= OnCloseWindow;
        UIManager.Instance.OnCloseWindow += OnCloseWindow;
 
        dayMissionBtn.AddListener(() =>
        {
            //用于监听界面,打开时缩进右边功能栏,关闭时显示
            ListenWindow("DayMissionBaseWin");
            UIManager.Instance.OpenWindow<DayMissionBaseWin>();
        });
 
        battlePassBtn.AddListener(() =>
        {
            //用于监听界面,打开时缩进右边功能栏,关闭时显示
            ListenWindow("BattlePassBaseWin");
            UIManager.Instance.OpenWindow<BattlePassBaseWin>();
        });
 
        llmjBtn.AddListener(() =>
        {
            //用于监听界面,打开时缩进右边功能栏,关闭时显示
            ListenWindow("ExpSecretCollectionWin");
            UIManager.Instance.OpenWindow<ExpSecretCollectionWin>();
        });
 
        signBtn.AddListener(() =>
        {
            //用于监听界面,打开时缩进右边功能栏,关闭时显示
            ListenWindow("SignWin");
            UIManager.Instance.OpenWindow<SignWin>();
        });
    }
 
    void ShowBtns()
    {
        storeBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store));
        dayMissionBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.DayMission));
        battlePassBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.BattlePass));
        llmjBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.LLMJ));
        signBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.DaySign));
        // monthCardBtn.SetActive(FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.MonthCard));
    }
 
 
    //显隐功能栏
    public void ShowFuncCol(bool _isShow)
    {
        isShow = _isShow;
        funcCol?.DOLocalMove(isShow ? showPoint.localPosition : hidePoint.localPosition, 0.3f);
        if (isShow)
        {
            ShowBtns();
        }
    }
 
    void OnCloseWindow(UIBase win)
    {
        if (win.name == listenWindowName)
        {
            ShowFuncCol(true);
            listenWindowName = "";
        }
    }
 
    //用于监听界面,打开时缩进右边功能栏,关闭时显示
    void ListenWindow(string _listenWindowName)
    {
        ShowFuncCol(false);
        listenWindowName = _listenWindowName;
    }
 
    public static void RemoveListenWindow()
    {
        listenWindowName = "";
    }
 
    //外部使用
    public static void ListenWindowEx(string _listenWindowName)
    {
        listenWindowName = _listenWindowName;
    }
}