private void OnRepeated(Hotfix_LT.Data.LTGTriggerType type, string param) { //直接触发 var temp = Hotfix_LT.Data.TaskTemplateManager.Instance.GetLimitedTimeGiftByTypeAndParam(type, param); if (temp != null) { TriggerLimitedTimeGift(temp); } }
/// <summary> /// 统一的触发接口 /// </summary> public void CheckLimitedTimeGiftTrigger(Hotfix_LT.Data.LTGTriggerType type, string param = null) { EB.Debug.Log("检测触发:{0};参数:{1}", type, param); switch (type) { case Hotfix_LT.Data.LTGTriggerType.TimeStamp: case Hotfix_LT.Data.LTGTriggerType.StarUp: OnTimer(type, param); //时间检测时触发 break; case Hotfix_LT.Data.LTGTriggerType.Draw: case Hotfix_LT.Data.LTGTriggerType.DrawSame: case Hotfix_LT.Data.LTGTriggerType.DrawFail: OnRepeated(type, param); //可反复触发 break; default: { //单触发,仅会触发一次 bool isTrigger = false; var data = Hotfix_LT.Data.TaskTemplateManager.Instance.GetLimitedTimeGiftByTypeAndParam(type, param); if (data != null) { switch (data.TriggerType) { case Hotfix_LT.Data.LTGTriggerType.Level: case Hotfix_LT.Data.LTGTriggerType.Main: case Hotfix_LT.Data.LTGTriggerType.Challenge: case Hotfix_LT.Data.LTGTriggerType.UltimateTrial: CanTrigger(data, out isTrigger); ; break; default: EB.Debug.LogError("LTChargeManger CheckLimitedTimeGiftTrigger Fail!"); ; break; } } if (isTrigger && data != null) { TriggerLimitedTimeGift(data); } } break; } }
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]); } } }