少年修仙传客户端代码仓库
hch
2025-04-03 c154ac0832fe4379a00d3e1cda700e7d2a7383c7
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
using System;
using vnxbqy.UI;
using UnityEngine;
using UnityEngine.UI;
 
public class StoreWinFix : ILBehaviour
{
    Transform otherCoins;
    Transform gongdeObj;    
    Text gongdeNum;     //共用替换
    Image moneyImg;     //共用替换
    GetWayTrigger wayObj;   //共用替换
 
    StoreModel model { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
    protected override void Awake()
    {
        otherCoins = proxy.GetWidgtEx<Transform>("FollowStoreBottom");
        gongdeObj = proxy.GetWidgtEx<Transform>("GongDeBG");
        gongdeNum = proxy.GetWidgtEx<Text>("gongdeNum");
        moneyImg = proxy.GetWidgtEx<Image>("moneyImg");
        wayObj = proxy.GetWidgtEx<GetWayTrigger>("way");
        //var launchWin = WindowCenter.Instance.Get<LaunchWin>();
    }
    protected override void OnEnable()
    {
        PlayerDatas.Instance.playerDataRefreshEvent += OnRefreshPlayerInfo;
        UIFixModel.Instance.OnStoreRefreshUIEvent += OnStoreRefreshUI;
    }
 
 
    protected override void OnDisable()
    {
        PlayerDatas.Instance.playerDataRefreshEvent -= OnRefreshPlayerInfo;
        UIFixModel.Instance.OnStoreRefreshUIEvent -= OnStoreRefreshUI;
    }
    
 
    private void OnRefreshPlayerInfo(PlayerDataType refreshType)
    {
        switch (refreshType)
        {
            case PlayerDataType.default14:
                RefreshCoins();
                break;
            case PlayerDataType.default43:
                RefreshCoins();
                break;
            default:
                break;
        }
    }
 
    void RefreshCoins()
    {
        if (model.storeFuncType == StoreFunc.MysteryStore)
        { 
            gongdeNum.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(HeroControler.Instance.GetMoneyCntIL(35));
            moneyImg.SetIconWithMoneyType(35);
        }
        else if (model.storeFuncType == StoreFunc.GrowStrongerStore)
        {
            gongdeNum.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(HeroControler.Instance.GetMoneyCntIL(34));
            moneyImg.SetIconWithMoneyType(34);
        }
        else if (model.storeFuncType == StoreFunc.CommonStore)
        {
            gongdeNum.text = ItemLogicUtility.Instance.OnChangeCoinsUnit(UIHelper.GetMoneyCnt(50));
            moneyImg.SetIconWithMoneyType(50);
        }
    }
 
    void OnStoreRefreshUI()
    {
        otherCoins.SetActiveIL(model.storeFuncType == StoreFunc.IntegralStore || model.storeFuncType == StoreFunc.DayStore);
        gongdeObj.SetActiveIL(model.storeFuncType == StoreFunc.MysteryStore 
                                || model.storeFuncType == StoreFunc.GrowStrongerStore
                                || model.storeFuncType == StoreFunc.CommonStore);
 
        if (model.storeFuncType == StoreFunc.MysteryStore)
        {
            wayObj.SetItemId(530);
        }
        else if (model.storeFuncType == StoreFunc.GrowStrongerStore)
        {
            wayObj.SetItemId(520);
        }
        else if (model.storeFuncType == StoreFunc.CommonStore)
        {
            wayObj.SetItemId(660);
        }
        
        RefreshCoins();
    }
}