public void onResult(AndroidJavaObject result)
            {
                GooglePlayGames.OurUtils.Logger.d("OnStateResultProxy.onResult, result=" + result);

                int statusCode = GetStatusCode(result);

                GooglePlayGames.OurUtils.Logger.d("OnStateResultProxy: status code is " + statusCode);

                if (result == null)
                {
                    GooglePlayGames.OurUtils.Logger.e("OnStateResultProxy: result is null.");
                    return;
                }

                GooglePlayGames.OurUtils.Logger.d("OnstateResultProxy: retrieving result objects...");
                AndroidJavaObject loadedResult   = result.NullSafeCall("getLoadedResult");
                AndroidJavaObject conflictResult = result.NullSafeCall("getConflictResult");

                GooglePlayGames.OurUtils.Logger.d("Got result objects.");
                GooglePlayGames.OurUtils.Logger.d("loadedResult = " + loadedResult);
                GooglePlayGames.OurUtils.Logger.d("conflictResult = " + conflictResult);

                if (conflictResult != null)
                {
                    GooglePlayGames.OurUtils.Logger.d("OnStateResultProxy: processing conflict.");
                    int    stateKey   = conflictResult.Call <int>("getStateKey");
                    string ver        = conflictResult.Call <string>("getResolvedVersion");
                    byte[] localData  = ToByteArray(conflictResult.NullSafeCall("getLocalData"));
                    byte[] serverData = ToByteArray(conflictResult.NullSafeCall("getServerData"));
                    GooglePlayGames.OurUtils.Logger.d("OnStateResultProxy: conflict args parsed, calling.");
                    OnStateConflict(stateKey, ver, localData, serverData);
                }
                else if (loadedResult != null)
                {
                    GooglePlayGames.OurUtils.Logger.d("OnStateResultProxy: processing normal load.");
                    int    stateKey  = loadedResult.Call <int>("getStateKey");
                    byte[] localData = ToByteArray(loadedResult.NullSafeCall("getLocalData"));
                    GooglePlayGames.OurUtils.Logger.d("OnStateResultProxy: loaded args parsed, calling.");
                    OnStateLoaded(statusCode, stateKey, localData);
                }
                else
                {
                    GooglePlayGames.OurUtils.Logger.e("OnStateResultProxy: both loadedResult and conflictResult are null!");
                }
            }
Exemple #2
0
            public void onResult(AndroidJavaObject result)
            {
                Logger.d("OnStateResultProxy.onResult, result=" + (object)result);
                int statusCode = AndroidAppStateClient.GetStatusCode(result);

                Logger.d("OnStateResultProxy: status code is " + (object)statusCode);
                if (result == null)
                {
                    Logger.e("OnStateResultProxy: result is null.");
                }
                else
                {
                    Logger.d("OnstateResultProxy: retrieving result objects...");
                    AndroidJavaObject target1 = result.NullSafeCall("getLoadedResult");
                    AndroidJavaObject target2 = result.NullSafeCall("getConflictResult");
                    Logger.d("Got result objects.");
                    Logger.d("loadedResult = " + (object)target1);
                    Logger.d("conflictResult = " + (object)target2);
                    if (target2 != null)
                    {
                        Logger.d("OnStateResultProxy: processing conflict.");
                        int    stateKey        = (int)target2.Call <int>("getStateKey", new object[0]);
                        string resolvedVersion = (string)target2.Call <string>("getResolvedVersion", new object[0]);
                        byte[] byteArray1      = AndroidAppStateClient.ToByteArray(target2.NullSafeCall("getLocalData"));
                        byte[] byteArray2      = AndroidAppStateClient.ToByteArray(target2.NullSafeCall("getServerData"));
                        Logger.d("OnStateResultProxy: conflict args parsed, calling.");
                        this.OnStateConflict(stateKey, resolvedVersion, byteArray1, byteArray2);
                    }
                    else if (target1 != null)
                    {
                        Logger.d("OnStateResultProxy: processing normal load.");
                        int    stateKey  = (int)target1.Call <int>("getStateKey", new object[0]);
                        byte[] byteArray = AndroidAppStateClient.ToByteArray(target1.NullSafeCall("getLocalData"));
                        Logger.d("OnStateResultProxy: loaded args parsed, calling.");
                        this.OnStateLoaded(statusCode, stateKey, byteArray);
                    }
                    else
                    {
                        Logger.e("OnStateResultProxy: both loadedResult and conflictResult are null!");
                    }
                }
            }