using System.Collections; using System.Collections.Generic; using UnityEngine; using System; using vnxbqy.UI; public class ItemTimeUtility : Singleton { LogicUpdate logicUpdate; Dictionary auctionEndTimes = new Dictionary(); Dictionary useEndTimes = new Dictionary(); PackModel packModel { get { return ModelCenter.Instance.GetModel(); } } 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); } }