protected void Initialize() { Dix = DixInfo.Load(); try { GameData = RaqnData.LoadOrCreate <RaqnData>(Dix.Id + ".json", true); //GeneralStats = StatContainer.LoadOrDie("General"); } catch (Exception _ex) { Debug.LogException(_ex); Debug.LogError("Could not load DixData. Quitting app! (Exception :" + _ex.Message + ")"); RealQuit(); } Api = new RaqnApi(Dix.Id, Dix.Secret); Api.OnStartSuccess += OnLogin_Success; Api.OnStartError += OnLogin_Error; Api.OnLoginSuccess += OnLogin_Success; Api.OnLoginError += OnLogin_Error; Api.OnPlaySuccess += OnPlay_Success; Api.OnPlayError += OnPlay_Error; ApiSession = new RaqnApiSession(); local_login = RaqnStorage.LoadJson <RaqnLogin>("cache/login.dat", false, Dix.Secret); local_license = RaqnStorage.LoadJson <RaqnLicense>("cache/license.dat", false, Dix.Secret); }
public void State_PlayReady() { GUI_SetMessage("Listo para jugar!"); GUI_Hide(); login = Raqn.CurrentLogin(); gui_avatar.gameObject.GetComponent <RaqnAvatar>().SetAvatar(login.user.profile.avatar); gui_avatar.GetComponentInChildren <TextMeshProUGUI>().text = "@" + login.user.profile.nickname; gui_avatar.gameObject.SetActive(true); gui_button_play.gameObject.SetActive(true); EventSystem.current.SetSelectedGameObject(gui_button_play.gameObject); }
public void State_Starting() { GUI_Hide(); gui_loading.gameObject.SetActive(true); GUI_SetMessage("Inicializando..."); login = Raqn.CurrentLogin(); if (login != null) { State_ShowLogin(); } else { State_AskLogin("Usa tu cuenta RAQN"); } }
protected void OnLogin_Success() { ApiSession = Api.GetSession(); if (ApiUser == null || ApiSession == null) { OnLogin_Error(ResponseStatus.ERR_FORMATTING); return; } RaqnTime.SetSyncDelta(ApiSession.started); local_login = ApiSession.logins[0]; RaqnStorage.SaveJson <RaqnLogin>("cache/login.dat", local_login, false, Dix.Secret); Api.LicenseCurrent(Dix.Id, (lic) => { OnLicense_Success(lic); }, (_err) => { OnLicense_Error(_err); }); if (OnLogin != null) { OnLogin(); } }