少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 9203f8bd22b3cf3fa9bfd537fd16b2e86d7223b1
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Snxxz.UI;
using UnityEngine.UI;
using TableConfig;
namespace EnhancedUI.EnhancedScroller
{
    public class RoleStrongerCell : ScrollerUI
    {
        RolePromoteModel m_Model;
        RolePromoteModel model
        {
            get
            {
                return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<RolePromoteModel>());
            }
        }
 
        RoleParticularModel m_RoleParticularModel;
        RoleParticularModel roleParticularModel
        {
            get
            {
                return m_RoleParticularModel ?? (m_RoleParticularModel = ModelCenter.Instance.GetModel<RoleParticularModel>());
            }
        }
 
        [SerializeField] Image funcIcon;
        [SerializeField] Text presentFightPowerTxt;
        [SerializeField] Transform m_ContainerStrongerLabel;
        [SerializeField] Text strongerFightPowerTxt;
        [SerializeField] Text targetTxt;
        [SerializeField] Text m_FuncTxt;
        [SerializeField] Button strongerBtn;
        [SerializeField] GameObject reachTxtObj;
        [SerializeField] GameObject reachImgObj;
 
        public override void Refresh(CellView cell)
        {
            int funcType = cell.index;
            int presentTargetValue = 0;
            bool reached = false;
            var cfg = model.GetPresentRoleStronger(funcType, out presentTargetValue, out reached);
            strongerBtn.onClick.RemoveAllListeners();
            if (cfg != null)
            {
                var highestStage = model.IsHighestStage(funcType, cfg.id) && reached;
                funcIcon.SetSprite(cfg.Icon);
                m_FuncTxt.text = cfg.Name;
                ulong _presentFightPower = 0;
                _presentFightPower = roleParticularModel.GetFuncFightPower(funcType);
                presentFightPowerTxt.text = Language.Get("RolePromoteNowFight", _presentFightPower);
 
                strongerFightPowerTxt.text = StringUtility.Contact(_presentFightPower >= (ulong)cfg.recommendFightPower ? Language.Get("RolePromoteMoreFight") : Language.Get("RolePromoteBetterFight"),
                    _presentFightPower >= (ulong)cfg.recommendFightPower ? cfg.strongerFightPower : cfg.recommendFightPower);
                strongerFightPowerTxt.color = _presentFightPower >= (ulong)cfg.recommendFightPower ?
                    UIHelper.GetUIColor(TextColType.Red) : UIHelper.GetUIColor(TextColType.Green, true);
                if (!highestStage)
                {
                    if (funcType == (int)FuncPowerType.Human
                        || funcType == (int)FuncPowerType.Demon
                        || funcType == (int)FuncPowerType.Fairy)
                    {
                        targetTxt.text = StringUtility.Contact(cfg.desc, "(", UIHelper.GetTextColorByItemColor(presentTargetValue > 0 ? TextColType.Green : TextColType.Red,
                            presentTargetValue.ToString()), "/", 1, ")");
                    }
                    else
                    {
                        targetTxt.text = StringUtility.Contact(cfg.desc, "(", UIHelper.GetTextColorByItemColor(presentTargetValue >= cfg.targetValue ? TextColType.Green : TextColType.Red,
                            presentTargetValue.ToString()), "/", cfg.targetValue, ")");
                    }
                }
 
                reachTxtObj.SetActive(highestStage);
                reachImgObj.SetActive(highestStage);
                targetTxt.gameObject.SetActive(!highestStage);
                strongerBtn.gameObject.SetActive(!highestStage);
                m_ContainerStrongerLabel.gameObject.SetActive(!highestStage);
 
                strongerBtn.onClick.AddListener(() =>
                {
                    WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)cfg.OpenUI);
                });
 
            }
        }
    }
}