using vnxbqy.UI;
|
using System.Collections.Generic;
|
using UnityEngine.UI;
|
|
public class GarbageCollectionCell : ILBehaviour
|
{
|
Text btnText;
|
Button colButton;
|
Text taskName;
|
Text taskPro;
|
UIEffect uiEffect;
|
Image overState;
|
|
protected override void Awake()
|
{
|
colButton = proxy.GetWidgtEx<Button>("colButton");
|
btnText = proxy.GetWidgtEx<Text>("btnText");
|
taskName = proxy.GetWidgtEx<Text>("taskName");
|
taskPro = proxy.GetWidgtEx<Text>("taskPro");
|
uiEffect = proxy.GetWidgtEx<UIEffect>("uieffect");
|
overState = proxy.GetWidgtEx<Image>("overstate");
|
}
|
|
|
//index档位字典的数组索引
|
public void Display(int id)
|
{
|
var config = ILActGarbageTaskConfig.Get(id);
|
if (config == null) return;
|
|
taskName.text = config.Title;
|
var taskInfo = HolidayRefuseClassificationModel.Instance.TryGetTaskInfo(id);
|
|
var isEnoughHandCol = false; //是否足够手动收集
|
var curProcess = taskInfo.x - taskInfo.y * config.FinishNeedValue;
|
if (config.isShowProcess == 0)
|
{
|
taskPro.text = string.Empty;
|
}
|
else
|
{
|
taskPro.text = UIHelper.AppendColor(curProcess >= config.FinishNeedValue ? TextColType.Green : TextColType.Red, curProcess.ToString(), true) + "/" + config.FinishNeedValue;
|
}
|
|
if (config.AutoProduce == 0 && curProcess >= config.FinishNeedValue)
|
{
|
//手动领取,且未完成总次数
|
isEnoughHandCol = true;
|
}
|
|
if (config.FinishTimeMax != 0 && taskInfo.y >= config.FinishTimeMax)
|
{
|
overState.SetActiveIL(true);
|
colButton.SetActiveIL(false);
|
}
|
else
|
{
|
overState.SetActiveIL(false);
|
colButton.SetActiveIL(true);
|
}
|
|
uiEffect.Stop();
|
if (isEnoughHandCol)
|
{
|
uiEffect.Play();
|
if (config.isShowMax == 0)
|
{
|
btnText.text = Language.Get("GarbageCollect2");
|
}
|
else
|
{
|
btnText.text = Language.Get("GarbageCollect2") + "(" + (config.FinishTimeMax - taskInfo.y) + ")";
|
}
|
|
colButton.SetListener(() => {
|
HolidayRefuseClassificationModel.Instance.SendActGarbageGetTaskAward(id);
|
|
});
|
}
|
else
|
{
|
btnText.text = Language.Get("GarbageCollect1");
|
colButton.SetListener(()=> {
|
if (!FuncOpen.Instance.IsFuncOpen(config.FuncID))
|
{
|
FuncOpen.Instance.ProcessorFuncErrorTip(config.FuncID);
|
return;
|
}
|
|
WindowJumpMgr.Instance.WindowJumpTo((JumpUIType)config.JumpID);
|
|
});
|
}
|
|
}
|
|
}
|