少年修仙传客户端代码仓库
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
 
using UnityEngine;
using UnityEngine.UI;
 
//砍树获得装备界面
namespace vnxbqy.UI
{
    public class FunctionEnterCell : CellView
    {
        [SerializeField] Image funcImg;
        [SerializeField] Text stateTxt; //解锁状态或者次数
        [SerializeField] Text nameTxt;
        [SerializeField] RedpointBehaviour redpoint;
        [SerializeField] Button funcBtn;
        
        CutTreeModel cutTreeModel { get { return ModelCenter.Instance.GetModel<CutTreeModel>(); } }
        DailyQuestModel model { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } }
 
        public void Display(int funcID)
        {
            this.gameObject.name = StringUtility.Contact("FunctionEnterCell_", funcID);
            funcImg.SetSprite("FuncEnter_" + funcID);
            nameTxt.text = FuncOpenLVConfig.Get(funcID).Remark;
            if (FuncOpen.Instance.IsFuncOpen(funcID))
            {
                if (cutTreeModel.funcIDToDailyIDDic.ContainsKey(funcID))
                {
                    int dailyID = cutTreeModel.funcIDToDailyIDDic[funcID];
                    var completedTimes = model.GetDailyQuestCompletedTimes(dailyID);
                    var totalTimes = model.GetDailyQuestTotalTimes(dailyID);
 
                    stateTxt.color = UIHelper.GetUIColor(TextColType.NavyBrown, true);
 
                    string tipName = Language.Get("DailyQuestTimes");
                    switch ((DailyQuestType)dailyID)
                    {
                        case DailyQuestType.ArenaPK:
                            stateTxt.text = tipName + UIHelper.AppendColor(ArenaManager.isArenaOver ? TextColType.Red : TextColType.Green, ArenaManager.ShowLeftTimes, true);
                            break;
                        default:
                            stateTxt.text = tipName + UIHelper.AppendColor(completedTimes >= totalTimes ? TextColType.Red : TextColType.Green, (totalTimes >= completedTimes ? totalTimes - completedTimes : 0).ToString(), true);
                            break;
                    }
 
                    //红点 1.优先日常里的各自任务红点 2.配置红点
                    DailyQuestData questData = null;
                    model.TryGetDailyQuest(dailyID, out questData);
                    redpoint.redpointId = questData != null ? questData.redpoint.id : 0;
                }
                else
                {
                    stateTxt.text = string.Empty;
                    redpoint.redpointId = cutTreeModel.funcRedpointDic.ContainsKey(funcID) ? cutTreeModel.funcRedpointDic[funcID] : 0;
                }
            }
            else
            {
                redpoint.redpointId = 0;
                stateTxt.text = Language.Get("Petwin6");
                stateTxt.color = UIHelper.GetUIColor(TextColType.Red, true);
            }
 
            funcBtn.AddListener(() => {
                if (!FuncOpen.Instance.IsFuncOpen(funcID))
                { 
                    FuncOpen.Instance.ProcessorFuncErrorTip(funcID);
                    return;
                }
                WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)FuncOpenLVConfig.Get(funcID).windowJumpID);
                WindowJumpMgr.Instance.ClearJumpData();
            });
        }
 
 
 
 
    }
 
}