53 lines
1.2 KiB
C#
53 lines
1.2 KiB
C#
using Gameplay;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
public class UITaskNode: UINode
|
|
{
|
|
public Image imgBg;
|
|
public Image imgRequirement;
|
|
public TMP_Text txtTaskDesc;
|
|
public TMP_Text txtTaskProcess;
|
|
public Image imgTaskProcess;
|
|
public Button btnClaim;
|
|
public Button btnGoTo;
|
|
public Button btnCantGet;
|
|
public Button btnClaimed;
|
|
|
|
private TaskInfo _taskInfo;
|
|
|
|
public override void SetData(object data)
|
|
{
|
|
_taskInfo = data as TaskInfo;
|
|
if (_taskInfo == null)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
public void Refresh()
|
|
{
|
|
if (_taskInfo == null) return;
|
|
|
|
var cfg = _taskInfo.Cfg;
|
|
_RefreshBg();
|
|
_RefreshTaskContent();
|
|
}
|
|
|
|
private void _RefreshBg()
|
|
{
|
|
var color = imgBg.color;
|
|
var alpha = _taskInfo.Status == TaskState.Claimed ? 127f : 210f;
|
|
imgBg.color = new Color(color.r, color.b, color.g, alpha);
|
|
}
|
|
|
|
private void _RefreshTaskContent()
|
|
{
|
|
var desc = CommonUtils.GetLocalizeText(_taskInfo.Cfg.Describe);
|
|
txtTaskDesc.text = desc;
|
|
|
|
|
|
var curCount = TaskManager.Instance.GetTaskCountById(_taskInfo.TaskID);
|
|
|
|
}
|
|
} |