//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Friday, March 16, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System;
|
|
namespace vnxbqy.UI
|
{
|
|
|
public class DailyQuestActionTimer : SingletonMonobehaviour<DailyQuestActionTimer>
|
|
{
|
DailyQuestModel model { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } }
|
public event Action RefreshDailyQuestState;
|
int lastCheckMinute = -5;
|
float timer = 0f;
|
bool checkValid = false;
|
|
public void Begin()
|
{
|
timer = 0f;
|
lastCheckMinute = -5;
|
checkValid = FuncOpen.Instance.IsFuncOpen(78);
|
}
|
|
private void LateUpdate()
|
{
|
if (!checkValid)
|
{
|
return;
|
}
|
|
timer += Time.deltaTime;
|
if (timer > 1f)
|
{
|
timer = 0f;
|
var minute = TimeUtility.ServerNow.Minute;
|
if (minute % 5 == 0 && lastCheckMinute != minute)
|
{
|
lastCheckMinute = minute;
|
model.UpdateRedpoints();
|
if(RefreshDailyQuestState != null)
|
{
|
RefreshDailyQuestState();
|
}
|
}
|
}
|
|
}
|
|
|
}
|
|
}
|