using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
using System;
|
using vnxbqy.UI;
|
|
public class ItemTimeUtility : Singleton<ItemTimeUtility>
|
{
|
|
LogicUpdate logicUpdate;
|
|
Dictionary<string, DateTime> auctionEndTimes = new Dictionary<string, DateTime>();
|
Dictionary<string, DateTime> useEndTimes = new Dictionary<string, DateTime>();
|
|
PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
|
public ItemTimeUtility()
|
{
|
logicUpdate = new LogicUpdate(1f);
|
logicUpdate.Start(OnUpdate);
|
}
|
|
public void AddUseEndTime(string guid, DateTime endTime)
|
{
|
useEndTimes[guid] = endTime;
|
}
|
|
public void RemoveUseEndTime(string guid)
|
{
|
if (useEndTimes.ContainsKey(guid))
|
{
|
useEndTimes.Remove(guid);
|
}
|
}
|
|
public void AddAuctionEndTime(string guid, DateTime endTime)
|
{
|
auctionEndTimes[guid] = endTime;
|
}
|
|
public void RemoveAuctionEndTime(string guid)
|
{
|
if (auctionEndTimes.ContainsKey(guid))
|
{
|
auctionEndTimes.Remove(guid);
|
}
|
}
|
|
private void OnUpdate()
|
{
|
foreach (var item in auctionEndTimes)
|
{
|
if (TimeUtility.ServerNow > item.Value)
|
{
|
ProcessAuctionOverdue(item.Key);
|
}
|
}
|
}
|
|
private void ProcessAuctionOverdue(string guid)
|
{
|
ItemOperateUtility.Instance.ProcessOverdueItem(guid);
|
}
|
|
}
|