public override void OnSuccess(WWWResult www) { if (Network.IsError) { switch (Network.ErrCode) { case Network.EErrCode.NoGacha: this.OnFailed(); break; case Network.EErrCode.GachaCostShort: this.OnBack(); break; case Network.EErrCode.GachaItemMax: this.OnBack(); break; case Network.EErrCode.GachaPaidLimitOver: this.PaidGachaLimitOver(); break; default: this.OnRetry(); break; } } else { WebAPI.JSON_BodyResponse <Json_GachaResult> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaResult> >(www.text); DebugUtility.Assert(jsonObject != null, "res == null"); Network.RemoveAPI(); try { MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body); } catch (Exception ex) { DebugUtility.LogException(ex); this.Failure(); return; } List <GachaDropData> gachaDropDataList = new List <GachaDropData>(); foreach (Json_DropInfo json in jsonObject.body.add) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { gachaDropDataList.Add(gachaDropData); } } List <GachaDropData> a_dropMails = new List <GachaDropData>(); if (jsonObject.body.addMail != null) { foreach (Json_DropInfo json in jsonObject.body.addMail) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { a_dropMails.Add(gachaDropData); } } } GachaReceiptData a_receipt = new GachaReceiptData(); a_receipt.Deserialize(jsonObject.body.receipt); GachaResultData.Init(gachaDropDataList, a_dropMails, a_receipt); CultureInfo.CurrentCulture.TextInfo.ToTitleCase(a_receipt.type); AnalyticsManager.TrackSummonComplete(); MonoSingleton <GameManager> .Instance.Player.OnGacha(this.mCurrentGachaType, this.mCurrentNum); this.StartCoroutine(this.AsyncGachaResultData(gachaDropDataList)); } }
public override void OnSuccess(WWWResult www) { if (Network.IsError) { Network.EErrCode errCode = Network.ErrCode; this.OnRetry(); } else { WebAPI.JSON_BodyResponse <Json_PendingGachaResponse> res = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_PendingGachaResponse> >(www.text); DebugUtility.Assert(res != null, "res == null"); Network.RemoveAPI(); if (res.body == null) { return; } List <GachaDropData> gachaDropDataList = new List <GachaDropData>(); foreach (Json_DropInfo json in res.body.add) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { gachaDropDataList.Add(gachaDropData); } } List <GachaDropData> a_dropMails = new List <GachaDropData>(); if (res.body.add_mail != null) { foreach (Json_DropInfo json in res.body.add_mail) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { a_dropMails.Add(gachaDropData); } } } for (int index = 0; index < gachaDropDataList.Count; ++index) { if (gachaDropDataList[index].type == GachaDropData.Type.ConceptCard) { GlobalVars.IsDirtyConceptCardData.Set(true); break; } } GachaReceiptData a_receipt = new GachaReceiptData(); a_receipt.iname = res.body.gacha.gname; int a_redraw_rest = 0; if (res.body.rest > 0) { a_redraw_rest = res.body.rest; } GachaResultData.Init(gachaDropDataList, a_dropMails, (List <int>)null, a_receipt, false, a_redraw_rest <= 0 ? 0 : 1, a_redraw_rest); bool flag = false; if ((MonoSingleton <GameManager> .Instance.Player.TutorialFlags & 1L) != 0L) { string empty = string.Empty; if (a_redraw_rest > 0) { if (res.body.gacha.time_end > Network.GetServerTime()) { flag = true; } else { empty = LocalizedText.Get("sys.GACHA_REDRAW_CAUTION_OUTOF_PERIOD"); } } else { empty = LocalizedText.Get("sys.GACHA_REDRAW_CAUTION_LIMIT_UPPER"); } if (!flag) { UIUtility.SystemMessage(empty, (UIUtility.DialogResultEvent)(go => this.ExecGacha(res.body.gacha.gname)), (GameObject)null, true, -1); return; } } this.StartCoroutine(this.AsyncGachaResultData(gachaDropDataList)); } }
public override void OnSuccess(WWWResult www) { if (Network.IsError) { Network.EErrCode errCode = Network.ErrCode; switch (errCode) { case Network.EErrCode.NoGacha: this.OnFailed(); break; case Network.EErrCode.GachaCostShort: this.OnBack(); break; case Network.EErrCode.GachaItemMax: this.OnBack(); break; case Network.EErrCode.GachaPaidLimitOver: this.PaidGachaLimitOver(); break; default: if (errCode == Network.EErrCode.GachaOutofPeriod) { this.OutofPeriod(); break; } this.OnRetry(); break; } } else { WebAPI.JSON_BodyResponse <Json_GachaResult> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaResult> >(www.text); DebugUtility.Assert(jsonObject != null, "res == null"); Network.RemoveAPI(); ItemData itemDataByItemId1 = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID("IT_US_SUMMONS_01"); int num1 = itemDataByItemId1 != null ? itemDataByItemId1.Num : 0; try { MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body); } catch (Exception ex) { DebugUtility.LogException(ex); this.Failure(); return; } ItemData itemDataByItemId2 = MonoSingleton <GameManager> .Instance.Player.FindItemDataByItemID("IT_US_SUMMONS_01"); int num2 = itemDataByItemId2 != null ? itemDataByItemId2.Num : 0; List <int> a_summonCoins = new List <int>(); a_summonCoins.Add(num1); a_summonCoins.Add(num2); List <GachaDropData> gachaDropDataList = new List <GachaDropData>(); if (jsonObject.body.add != null && jsonObject.body.add.Length > 0) { foreach (Json_DropInfo json in jsonObject.body.add) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { gachaDropDataList.Add(gachaDropData); } } } List <GachaDropData> a_dropMails = new List <GachaDropData>(); if (jsonObject.body.add_mail != null) { foreach (Json_DropInfo json in jsonObject.body.add_mail) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { a_dropMails.Add(gachaDropData); } } } for (int index = 0; index < gachaDropDataList.Count; ++index) { if (gachaDropDataList[index].type == GachaDropData.Type.ConceptCard) { GlobalVars.IsDirtyConceptCardData.Set(true); break; } } GachaReceiptData a_receipt = new GachaReceiptData(); a_receipt.Deserialize(jsonObject.body.receipt); GachaResultData.Init(gachaDropDataList, a_dropMails, a_summonCoins, a_receipt, this.mUseOneMore, jsonObject.body.is_pending, jsonObject.body.rest); if (!GachaResultData.IsRedrawGacha || GachaResultData.IsRedrawGacha && this.API == FlowNode_ExecGacha2.ExecType.DECISION) { MyMetaps.TrackSpend(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(a_receipt.type), a_receipt.iname, a_receipt.val); MonoSingleton <GameManager> .Instance.Player.OnGacha(this.mCurrentGachaType, gachaDropDataList.Count); } if (this.API == FlowNode_ExecGacha2.ExecType.DECISION) { FlowNode_Variable.Set("REDRAW_GACHA_PENDING", string.Empty); GachaResultData.Reset(); this.Success(); } else { this.StartCoroutine(this.AsyncGachaResultData(gachaDropDataList)); } } }
public static void Init(List <GachaDropData> a_drops = null, List <GachaDropData> a_dropMails = null, GachaReceiptData a_receipt = null) { GachaResultData.Reset(); if (a_drops != null) { GachaResultData.drops_ = a_drops; } if (a_dropMails != null) { GachaResultData.dropMails_ = a_dropMails; } GachaResultData.excites_ = GachaResultData.CalcExcites(a_drops); if (a_receipt != null) { GachaResultData.receipt = a_receipt; } using (List <GachaDropData> .Enumerator enumerator = GachaResultData.drops_.GetEnumerator()) { while (enumerator.MoveNext()) { GachaDropData current = enumerator.Current; current.excites = GachaResultData.CalcExcitesForDrop(current); } } }
public static void Init(List <GachaDropData> a_drops = null, List <GachaDropData> a_dropMails = null, List <int> a_summonCoins = null, GachaReceiptData a_receipt = null, bool a_use_onemore = false, int a_is_pending = -1, int a_redraw_rest = -1) { GachaResultData.Reset(); if (a_drops != null) { GachaResultData.drops_ = a_drops; } if (a_dropMails != null) { GachaResultData.dropMails_ = a_dropMails; } if (a_summonCoins != null) { GachaResultData.summonCoins_ = a_summonCoins; } GachaResultData.excites_ = GachaResultData.CalcExcites(a_drops); if (a_receipt != null) { GachaResultData.receipt = a_receipt; } using (List <GachaDropData> .Enumerator enumerator = GachaResultData.drops_.GetEnumerator()) { while (enumerator.MoveNext()) { GachaDropData current = enumerator.Current; current.excites = GachaResultData.CalcExcitesForDrop(current); } } GachaResultData.use_one_more_ = a_use_onemore; GachaResultData.m_is_pending = a_is_pending; GachaResultData.m_redraw_rest = a_redraw_rest; }
public override void OnSuccess(WWWResult www) { if (Network.IsError) { if (Network.ErrCode == Network.EErrCode.NoGacha) { this.OnFailed(); } else { this.OnRetry(); } } else { WebAPI.JSON_BodyResponse <Json_GachaResult> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <Json_GachaResult> >(www.text); DebugUtility.Assert(jsonObject != null, "res == null"); Network.RemoveAPI(); try { MonoSingleton <GameManager> .Instance.Deserialize(jsonObject.body); } catch (Exception ex) { DebugUtility.LogException(ex); this.Failure(); return; } List <GachaDropData> a_drops = new List <GachaDropData>(); if (jsonObject.body.add != null && jsonObject.body.add.Length > 0) { foreach (Json_DropInfo json in jsonObject.body.add) { GachaDropData gachaDropData = new GachaDropData(); if (gachaDropData.Deserialize(json)) { a_drops.Add(gachaDropData); } } } GachaReceiptData a_receipt = new GachaReceiptData(); a_receipt.Deserialize(jsonObject.body.receipt); GachaResultData.Init(a_drops, (List <GachaDropData>)null, (List <int>)null, a_receipt, false, jsonObject.body.is_pending, jsonObject.body.rest); MyMetaps.TrackSpend(CultureInfo.CurrentCulture.TextInfo.ToTitleCase(a_receipt.type), a_receipt.iname, a_receipt.val); if (this.API == FlowNode_ExecTutorialGacha.ExecType.DECISION) { this.Success(); } else { GachaDropData drop = GachaResultData.drops[0]; if (drop == null) { DebugUtility.LogError("召喚結果が存在しません"); this.Failure(); } else { this.StartCoroutine(this.AsyncDownload(drop.unit)); } } } }