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 Coroutine SendPlayData(RaqnData _pd, string _user, Action OnReady = null, Action <string> OnError = null) { RaqnRequest _req = new RaqnRequest("/play/data/update"); _req.SetField <string>("user", _user); _req.SetField <string>("format", "RAW"); _req.SetField <RaqnData>("data", _pd); if (OnReady != null) { _req.OnSuccess += RaqnUtils.ActionWrapper <RaqnResponse>(OnReady); } if (OnError != null) { _req.OnError += OnError; } return(Raqn.Instance.StartCoroutine(SendRequest(_req))); }