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