Ejemplo n.º 1
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         this._Failed();
     }
     else
     {
         DebugMenu.Log("API", "homeapi:{" + www.text + "}");
         WebAPI.JSON_BodyResponse <FlowNode_HomeApi.JSON_HomeApiResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_HomeApi.JSON_HomeApiResponse> >(www.text);
         DebugUtility.Assert(jsonObject != null, "res == null");
         Network.RemoveAPI();
         if (jsonObject.body != null && jsonObject.body.player != null)
         {
             MonoSingleton <GameManager> .Instance.Player.ValidGpsGift       = jsonObject.body.player.areamail_enabled != 0;
             MonoSingleton <GameManager> .Instance.Player.ValidFriendPresent = jsonObject.body.player.present_granted != 0;
             MultiInvitationReceiveWindow.SetBadge(jsonObject.body.player.multi_inv != 0);
             MonoSingleton <GameManager> .Instance.Player.FirstChargeStatus = jsonObject.body.player.charge_bonus;
         }
         else
         {
             MonoSingleton <GameManager> .Instance.Player.ValidGpsGift       = false;
             MonoSingleton <GameManager> .Instance.Player.ValidFriendPresent = false;
             MultiInvitationReceiveWindow.SetBadge(false);
             MonoSingleton <GameManager> .Instance.Player.FirstChargeStatus = 0;
         }
         if (jsonObject.body != null && jsonObject.body.pubinfo != null)
         {
             LoginNewsInfo.SetPubInfo(jsonObject.body.pubinfo);
         }
         this._Success();
     }
 }
Ejemplo n.º 2
0
 public override void OnSuccess(WWWResult www)
 {
     if (Network.IsError)
     {
         this.OnRetry();
     }
     else
     {
         WebAPI.JSON_BodyResponse <FlowNode_ReqLoginPack.JSON_ReqLoginPackResponse> jsonObject = JSONParser.parseJSONObject <WebAPI.JSON_BodyResponse <FlowNode_ReqLoginPack.JSON_ReqLoginPackResponse> >(www.text);
         if (jsonObject.body == null)
         {
             this.OnRetry();
         }
         else
         {
             GameManager instance = MonoSingleton <GameManager> .Instance;
             instance.Player.ResetQuestChallenges();
             instance.ResetJigenQuests();
             if (!instance.Deserialize(jsonObject.body.quests))
             {
                 this.OnFailed();
             }
             else
             {
                 if (instance.IsRelogin)
                 {
                     instance.Player.DeleteTrophies(jsonObject.body.trophyprogs);
                     instance.Player.DeleteTrophies(jsonObject.body.bingoprogs);
                 }
                 LoginNewsInfo.SetPubInfo(jsonObject.body.pubinfo);
                 this.reflectTrophyProgs(jsonObject.body.trophyprogs);
                 this.reflectTrophyProgs(jsonObject.body.bingoprogs);
                 this.reflectLoginTrophyProgs();
                 if (jsonObject.body.channel != 0)
                 {
                     GlobalVars.CurrentChatChannel.Set(jsonObject.body.channel);
                 }
                 if (jsonObject.body.support != 0L)
                 {
                     GlobalVars.SelectedSupportUnitUniqueID.Set(jsonObject.body.support);
                 }
                 if (!string.IsNullOrEmpty(jsonObject.body.device_id))
                 {
                     BootLoader.GetAccountManager().SetDeviceId((string)null, jsonObject.body.device_id);
                 }
                 if (jsonObject.body.is_pending == 1)
                 {
                     FlowNode_Variable.Set("REDRAW_GACHA_PENDING", "1");
                 }
                 else
                 {
                     FlowNode_Variable.Set("REDRAW_GACHA_PENDING", "0");
                 }
                 FlowNode_Variable.Set("SHOW_CHAPTER", "0");
                 Network.RemoveAPI();
                 instance.Player.OnLogin();
                 instance.IsRelogin = false;
                 this.Success();
             }
         }
     }
 }