少年修仙传客户端代码仓库
hch
5 天以前 50e53441950268933694eeb5aad36147bbe1014d
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
using vnxbqy.UI;
using System;
using System.Collections.Generic;
using UnityEngine.UI;
 
//主界面的鲜花 和 喜糖图标
class ReceiveFlowerBtn : ILBehaviour
{
    Button button;
    Button sugarBtn;
    Button divorceBtn;
    protected override void Awake()
    {
        button = proxy.GetWidgtEx<Button>("Btn_Flower");
        sugarBtn = proxy.GetWidgtEx<Button>("Btn_Sugar");
        divorceBtn = proxy.GetWidgtEx<Button>("Btn_Divorce");
        
        button.SetListener(()=> {
            WindowCenter.Instance.OpenIL<FlowerFeedbackWin>();
        });
 
        sugarBtn.SetListener(() => {
            WindowCenter.Instance.OpenIL<WeddingSugarWin>();
        });
 
        divorceBtn.SetListener(() => {
            WindowCenter.Instance.OpenIL<WeddingAnswerDivorceWin>();
        });
 
        WindowCenter.Instance.windowAfterOpenEvent += OnAfterWindowOpen;
        FlowerGiftModel.Instance.OnReceiveFlower += OnReceiveFlower;
        WeddingModel.Instance.OnUpdateCandy += UpdateCandyList;
        WeddingModel.Instance.OnCoupleInfo += OnCoupleInfo;
    }
 
    private void OnAfterWindowOpen(Window _window)
    {
        if (_window.name == "MainInterfaceWin")
        {
            if (CrossServerUtility.IsCrossServerOneVsOne() || ArenaManager.isArenaClient)
            {
                button.SetActiveIL(false);
                sugarBtn.SetActiveIL(false);
                divorceBtn.SetActiveIL(false);
                return;
            }
            button.SetActiveIL(FlowerGiftModel.Instance.flowersReceive.Keys.Count > 0);
            sugarBtn.SetActiveIL(WeddingModel.Instance.candyInfoList.Count > 0);
            divorceBtn.SetActiveIL(WeddingModel.Instance.m_BreakRequestID != PlayerDatas.Instance.baseData.PlayerID &&
                WeddingModel.Instance.m_BreakRequestTime > 0);
        }
    }
 
    protected override void OnDestroy() 
    {
        WindowCenter.Instance.windowAfterOpenEvent -= OnAfterWindowOpen;
        FlowerGiftModel.Instance.OnReceiveFlower -= OnReceiveFlower;
        WeddingModel.Instance.OnUpdateCandy -= UpdateCandyList;
        WeddingModel.Instance.OnCoupleInfo -= OnCoupleInfo;
    }
 
    void OnReceiveFlower()
    {
        button.SetActiveIL(FlowerGiftModel.Instance.flowersReceive.Keys.Count > 0);
    }
 
    void UpdateCandyList(int pa, int pb)
    {
        sugarBtn.SetActiveIL(WeddingModel.Instance.candyInfoList.Count > 0);
    }
 
    void OnCoupleInfo()
    {
        divorceBtn.SetActiveIL(WeddingModel.Instance.m_BreakRequestID != PlayerDatas.Instance.baseData.PlayerID &&
            WeddingModel.Instance.m_BreakRequestTime > 0);
    }
}