using asap.core; using cfg; using game; using LitJson; using System; using System.Collections.Generic; using UnityEngine; namespace GameCore { // public class TotalRechargeData // { // public int eventID; // public int progress; // public int vip; // public int oldProgress; // } // public class TotalRechargeManager // { // public const string TotalRechargeDataKey = "EventTotalRecharge"; // public TotalRechargeData GetEventData() // { // var totalRechargeData = new TotalRechargeData(); // // string data = PlayFabMgr.Instance.GetLocalData(TotalRechargeDataKey); // if (!string.IsNullOrEmpty(data)) // { // try // { // totalRechargeData = Newtonsoft.Json.JsonConvert.DeserializeObject(data); // if (totalRechargeData.vip > 10) // { // totalRechargeData.vip = 10; // } // } // catch (Exception e) // { // Debug.LogError(e); // totalRechargeData = new TotalRechargeData(); // } // } // FishingEvent tr = GContext.container.Resolve().GetEventByTypeAndSubType(12, 1); // // if (tr != null && totalRechargeData.eventID != tr.ID) // { // totalRechargeData = new TotalRechargeData(); // totalRechargeData.eventID = tr.ID; // totalRechargeData.vip = GContext.container.Resolve().PriceLv; // if (totalRechargeData.vip > 10) // { // totalRechargeData.vip = 10; // } // SaveTotalRechargeData(totalRechargeData); // } // return totalRechargeData; // } // // public void GetTotalReward(RewardType rewardType, string textValue) // { // var totalRechargeData = GetEventData(); // List rewardIDs = new List(); // var tables = GContext.container.Resolve(); // var eventTotalRecharge = GetEventTotalRecharge(totalRechargeData); // var taskIds = eventTotalRecharge.TaskList; // var vip = totalRechargeData.vip; // int oldProgress = totalRechargeData.oldProgress; // int newProgress = totalRechargeData.progress; // int taskCount = taskIds.Count; // for (int i = 0; i < taskCount; i++) // { // int taskId = taskIds[i]; // CommonTask commonTask = tables.TbCommonTask.GetOrDefault(taskId); // if (commonTask == null) // { // continue; // } // int iapid = commonTask.TaskParam[vip]; // var iap = tables.TbIAPItemList.GetOrDefault(iapid); // if (oldProgress < iap.VIPPoint && newProgress >= iap.VIPPoint) // { // int rewardID = commonTask.TaskReward[vip]; // rewardIDs.Add(rewardID); // #if AGG // using (var e = GEvent.GameEvent("event_totalrecharge")) // { // e.AddContent("task_id", taskId) // .AddContent("reward_id", rewardID); // } // #endif // } // } // if (rewardIDs.Count > 0) // { // PlayerItemData playerItemData = GContext.container.Resolve(); // var itemData = playerItemData.GetItemByDropListLureInflation(null, rewardIDs); // var showData = new ShowData(itemData, rewardType); // showData.textValue = textValue; // GContext.Publish(showData); // playerItemData.AddItem(itemData, null); // } // totalRechargeData.oldProgress = totalRechargeData.progress; // SaveTotalRechargeData(totalRechargeData); // } // // public void AddProgress(int progress) // { // TotalRechargeData totalRechargeData = GetEventData(); // if (CheckTotalRechargeOpen(totalRechargeData)) // { // totalRechargeData.progress += progress; // SaveTotalRechargeData(totalRechargeData); // } // } // public bool CheckTotalRechargeOpen() // { // TotalRechargeData totalRechargeData = GetEventData(); // return CheckTotalRechargeOpen(totalRechargeData); // } // EventTotalRecharge GetEventTotalRecharge(TotalRechargeData totalRechargeData) // { // if (totalRechargeData == null || totalRechargeData.eventID == 0) // { // return null; // } // var _tables = GContext.container.Resolve(); // FishingEvent fishingEvent = _tables.TbFishingEvent.GetOrDefault(totalRechargeData.eventID); // if (fishingEvent == null) // { // return null; // } // return _tables.TbEventTotalRecharge[fishingEvent.RedirectID]; // } // public bool CheckTotalRechargeOpen(TotalRechargeData totalRechargeData) // { // if (totalRechargeData == null || totalRechargeData.eventID == 0) // { // return false; // } // var _tables = GContext.container.Resolve(); // FishingEvent fishingEvent = _tables.TbFishingEvent.GetOrDefault(totalRechargeData.eventID); // if (fishingEvent == null) // { // return false; // } // LimitedTime limitedTime = fishingEvent.TimeDefinition as LimitedTime; // var startTime = DateTime.Parse(limitedTime.StartTime); // var endTime = DateTime.Parse(limitedTime.EndTime); // var curTime = ZZTimeHelper.UtcNow(); // if (curTime < startTime || curTime > endTime) // { // if (totalRechargeData.oldProgress != totalRechargeData.progress) // { // RewardType rewardType = RewardType.FishBoxFlyRestore; // string textValue = LocalizationMgr.GetText("UI_FishingRewardPanel_101042"); // GetTotalReward(rewardType, textValue); // } // return false; // } // var eventTotalRecharge = GetEventTotalRecharge(totalRechargeData); // var taskIds = eventTotalRecharge.TaskList; // var vip = totalRechargeData.vip; // int oldProgress = totalRechargeData.oldProgress; // int taskCount = taskIds.Count; // int taskId = taskIds[^1]; // CommonTask commonTask = _tables.TbCommonTask.GetOrDefault(taskId); // if (commonTask == null) // { // return false; // } // int iapid = commonTask.TaskParam[vip]; // var iap = _tables.TbIAPItemList.GetOrDefault(iapid); // // return totalRechargeData.oldProgress < iap.VIPPoint; // } // // void SaveTotalRechargeData(TotalRechargeData totalRechargeData) // { // PlayFabMgr.Instance.UpdateUserDataValue(TotalRechargeDataKey, JsonMapper.ToJson(totalRechargeData)); // } // } }