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);
|
});
|
|
}
|
}
|
}
|
}
|
|