private void CanTrigger(Hotfix_LT.Data.LimitedTimeGiftTemplate data, out bool isTrigger) { isTrigger = false; string triggerId; if ((!DataLookupsCache.Instance.SearchDataByID <string>(string.Format("userLimitedTimeGift.{0}.triggerId", data.ID), out triggerId) && string.IsNullOrEmpty(triggerId))) { //不存在才触发 isTrigger = true; } }
private void TriggerLimitedTimeGift(Hotfix_LT.Data.LimitedTimeGiftTemplate data) { //额度检测 int PayoutID = 0; float Recharge = LTChargeManager.CumulativeRecharge; float Weighting = Hotfix_LT.Data.NewGameConfigTemplateManager.Instance.GetGameConfigValue("LimitTimeGiftWeighting"); //本地额度运用 Recharge = Recharge / Mathf.Max(Weighting, 1f); float LocalWeighting = GetLocalWeighting(Recharge); if (LocalWeighting > 0) { Recharge = Recharge - LocalWeighting; } EB.IAP.Item item = null; for (int i = 0; i < data.GiftList.Count; ++i) { if (EB.Sparx.Hub.Instance.WalletManager.GetGiftItem(data.GiftList[i], out item)) { PayoutID = item.payoutId; if (item.cost * 100 > Recharge) { break; } } } if (PayoutID > 0) { ArrayList ArrTemp; DataLookupsCache.Instance.SearchDataByID <ArrayList>(string.Format("userLimitedTimeGift.{0}.data", data.ID), out ArrTemp); int count = 0; if (ArrTemp != null) { for (int j = 0; j < ArrTemp.Count; ++j) { int PID = EB.Dot.Integer("payoutId", ArrTemp[j], 0); if (PID == PayoutID) { int OverTime = EB.Dot.Integer("overTime", ArrTemp[j], 0); if (EB.Time.Now < OverTime) { count++; } } } if (item != null && item.limitNum > 0 && count >= item.limitNum) { return; } } Api.RequestTriggerLimitedTimeGift(data.ID, PayoutID, delegate(Hashtable result) { if (result != null) { DataLookupsCache.Instance.CacheData(result); ReflashLimitedTimeGiftInfo(); if (!GuideNodeManager.IsGuide && !ShowGiftList.Contains(PayoutID)) { ShowGiftList.Enqueue(PayoutID); } //增加本地额度 SetLocalWeightingList(data.ID); } }); } }
private void OnTimer(Hotfix_LT.Data.LTGTriggerType type, string param) { //时间类型由进入游戏后读表检测触发 List <Hotfix_LT.Data.LimitedTimeGiftTemplate> temps; if (param != null) { Hotfix_LT.Data.LimitedTimeGiftTemplate temp = Hotfix_LT.Data.TaskTemplateManager.Instance.GetLimitedTimeGiftByTypeAndParam(type, param); temps = new List <Hotfix_LT.Data.LimitedTimeGiftTemplate>() { temp }; } else { temps = Hotfix_LT.Data.TaskTemplateManager.Instance.GetLimitedTimeGiftListByType(type); } string triggerId; for (int i = 0; i < temps.Count; ++i) { //存在则检测是否需要再次触发 if (temps[i].TriggerOpenTime > EB.Time.Now) { continue; } if (DataLookupsCache.Instance.SearchDataByID <string>(string.Format("userLimitedTimeGift.{0}.triggerId", temps[i].ID), out triggerId) && !string.IsNullOrEmpty(triggerId)) { ArrayList ArrTemp; DataLookupsCache.Instance.SearchDataByID <ArrayList>(string.Format("userLimitedTimeGift.{0}.data", temps[i].ID), out ArrTemp); if (ArrTemp != null) { //for (int j = 0; j < ArrTemp.Count; ++j) //{ // int PayoutID = EB.Dot.Integer("payoutId", ArrTemp[j], 0); // if (EB.Sparx.Hub.Instance.WalletManager.GetGiftItem(PayoutID)) // { // int OverTime = EB.Dot.Integer("overTime", ArrTemp[j], 0); // if (temps[i].TriggerOpenTime > OverTime) // { // TriggerLimitedTimeGift(temps[i]); // } // else if (temps[i].TriggerOpenTime == 0 && !string.IsNullOrEmpty(temps[i].TargetParameter)) // { // var str = temps[i].TargetParameter.Split(','); // if (EB.Time.Now > OverTime - temps[i].Duration + int.Parse(str[str.Length - 1])) // { // TriggerLimitedTimeGift(temps[i]); // } // } // } //} if (ArrTemp.Count == 0) { continue; } int PayoutID = EB.Dot.Integer("payoutId", ArrTemp[0], 0); if (EB.Sparx.Hub.Instance.WalletManager.GetGiftItem(PayoutID)) { int OverTime = EB.Dot.Integer("overTime", ArrTemp[0], 0); if (temps[i].TriggerOpenTime > OverTime) { TriggerLimitedTimeGift(temps[i]); } else if (temps[i].TriggerOpenTime == 0 && !string.IsNullOrEmpty(temps[i].TargetParameter)) { if (temps[i].TargetParameter.Contains(",")) { var str = temps[i].TargetParameter.Split(','); if (EB.Time.Now > OverTime - temps[i].Duration + int.Parse(str[str.Length - 1])) { TriggerLimitedTimeGift(temps[i]); } } else { if (EB.Time.Now > OverTime) { TriggerLimitedTimeGift(temps[i]); } } } } } } else//不存在则直接触发 { TriggerLimitedTimeGift(temps[i]); } } }