using vnxbqy.UI;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using System;
|
using UnityEngine.UI;
|
|
public class LivenessRewardData
|
{
|
public DailyLivenessRewardConfig config;
|
public int state;//0-未达成条件 1-可领取 2-已领取
|
}
|
|
|
public class LivenessRewardWin : Window
|
{
|
[SerializeField] Button CloseBtn;
|
[SerializeField] Image m_LivenessBarMask;
|
[SerializeField] Text m_LivenessText;
|
[SerializeField] CyclicScroll m_LivenessRewardScroll;
|
private DailyQuestModel m_DailyQuestModel { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } }
|
|
protected override void AddListeners()
|
{
|
CloseBtn.AddListener(() => CloseImmediately());
|
}
|
|
protected override void BindController()
|
{
|
|
}
|
|
protected override void OnAfterClose()
|
{
|
m_DailyQuestModel.activeValueRewardGotEvent -= ShowLivenessRewardScroll;
|
m_DailyQuestModel.currentActiveValueUpdateEvent -= RefreshLiveness;
|
|
|
}
|
|
protected override void OnAfterOpen()
|
{
|
|
}
|
|
protected override void OnPreClose()
|
{
|
m_LivenessRewardScroll.Dispose();
|
}
|
|
protected override void OnPreOpen()
|
{
|
m_DailyQuestModel.activeValueRewardGotEvent += ShowLivenessRewardScroll;
|
m_DailyQuestModel.currentActiveValueUpdateEvent += RefreshLiveness;
|
ShowLivenessRewardScroll();
|
RefreshLiveness();
|
}
|
|
private void RefreshLiveness()
|
{
|
float Per = (float)m_DailyQuestModel.currentActiveValue / m_DailyQuestModel.dailyQuestTotalActiveValue;
|
m_LivenessBarMask.fillAmount = Per;
|
m_LivenessText.text = StringUtility.Contact(m_DailyQuestModel.currentActiveValue, "/", m_DailyQuestModel.dailyQuestTotalActiveValue);
|
}
|
|
private void ShowLivenessRewardScroll(int UnKnow = 0)
|
{
|
var DataList = m_DailyQuestModel.GetLivenessRewardDatas();
|
m_LivenessRewardScroll.Init(DataList);
|
}
|
}
|