コード例 #1
0
    public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener) {
        Logger.d("UpdateState, slot=" + slot);
        using (var apiClient = GetApiClient(mServices)) {
            AppStateManager.CallStatic("update", apiClient, slot, data);
        }

        // Updates on android always succeed - at very least they are written to local disk.
        if (listener != null) {
            PlayGamesHelperObject.RunOnGameThread(() => listener.OnStateSaved(true, slot));
        }
    }
コード例 #2
0
        // called from game thread
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
        {
            Logger.d(string.Format("AndroidClient.UpdateState, slot={0}, data={1}",
                                   slot, Logger.describe(data)));
            CallClientApi("update state, slot=" + slot, () => {
                mGHManager.CallGmsApi("appstate.AppStateManager", null, "update", slot, data);
            }, null);

            // On Android, cloud writes always succeeds (because, in the worst case,
            // data gets cached locally to send to the cloud later)
            listener.OnStateSaved(true, slot);
        }
コード例 #3
0
        // called from game thread
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
        {
            Logger.d(string.Format("AndroidClient.UpdateState, slot={0}, data={1}",
                                   slot, Logger.describe(data)));
            CallAppStateClientApi("update state, slot=" + slot, (AndroidJavaObject c) => {
                c.Call("updateState", slot, data);
            }, null);

            // On Android, cloud writes always succeed (because, at worst, they get cached
            // locally to send to the cloud later)
            listener.OnStateSaved(true, slot);
        }
コード例 #4
0
 /// <summary>
 /// Writes app state (cloud save) data to the server.
 /// </summary>
 /// <param name='slot'>
 /// The app state slot number. The exact number of slots and their size can be seen
 /// in the Google Play Games documentation. Slot 0 is always available, and is at
 /// least 128K long.
 /// </param>
 /// <param name='data'>
 /// The data to write.
 /// </param>
 public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
 {
     if (!IsAuthenticated())
     {
         Logger.e("UpdateState can only be called after authentication.");
         if (listener != null)
         {
             listener.OnStateSaved(false, slot);
         }
         return;
     }
     mClient.UpdateState(slot, data, listener);
 }
コード例 #5
0
 public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
 {
     Logger.d(string.Format("AndroidClient.UpdateState, slot={0}, data={1}", slot, Logger.describe(data)));
     this.CallClientApi("update state, slot=" + slot, delegate
     {
         this.mGHManager.CallGmsApi("appstate.AppStateManager", null, "update", new object[]
         {
             slot,
             data
         });
     }, null);
     listener.OnStateSaved(true, slot);
 }
コード例 #6
0
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
        {
            GooglePlayGames.OurUtils.Logger.d("UpdateState, slot=" + slot);
            using (var apiClient = GetApiClient(mServices)) {
                AppStateManager.CallStatic("update", apiClient, slot, data);
            }

            // Updates on android always succeed - at very least they are written to local disk.
            if (listener != null)
            {
                PlayGamesHelperObject.RunOnGameThread(() => listener.OnStateSaved(true, slot));
            }
        }
コード例 #7
0
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
        {
            Misc.CheckNotNull(listener);

            lock (GameServicesLock) {
                if (mAuthState != AuthState.Authenticated)
                {
                    Logger.e("You can only call UpdateState after the user has successfully logged in");
                    listener.OnStateSaved(false, slot);
                }

                mAppStateClient.UpdateState(slot, data, listener);
            }
        }
コード例 #8
0
ファイル: IOSClient.cs プロジェクト: matthewAURA/SlashRunner
        private static void UpdateStateCallback(bool success, int slot)
        {
            OnStateLoadedListener listener = GetListener(slot);

            Logger.d("IOSClient.UpdateStateCallback, slot=" + slot + ", success=" + success);
            if (null != listener)
            {
                Logger.d("IOSClient.UpdateStateCallback calling OnSLL.OnStateSaved");
                listener.OnStateSaved(success, slot);
            }
            else
            {
                Logger.d("IOSClient.UpdateStateCallback: no OnSLL to call!");
            }
        }
コード例 #9
0
 public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
 {
     Logger.d("UpdateState, slot=" + (object)slot);
     using (AndroidJavaObject apiClient = AndroidAppStateClient.GetApiClient(this.mServices))
         ((AndroidJavaObject)AndroidAppStateClient.AppStateManager).CallStatic("update", new object[3]
         {
             (object)apiClient,
             (object)slot,
             (object)data
         });
     if (listener == null)
     {
         return;
     }
     PlayGamesHelperObject.RunOnGameThread((Action)(() => listener.OnStateSaved(true, slot)));
 }
コード例 #10
0
    public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener) {
        Misc.CheckNotNull(listener);

        lock (GameServicesLock) {
            if (mAuthState != AuthState.Authenticated) {
                Logger.e("You can only call UpdateState after the user has successfully logged in");
                listener.OnStateSaved(false, slot);
            }

            mAppStateClient.UpdateState(slot, data, listener);
        }
    }
コード例 #11
0
        /// <summary>
        /// Writes app state (cloud save) data to the server.
        /// </summary>
        /// <param name='slot'>
        /// The app state slot number. The exact number of slots and their size can be seen
        /// in the Google Play Games documentation. Slot 0 is always available, and is at
        /// least 128K long.
        /// </param>
        /// <param name='data'>
        /// The data to write.
        /// </param>
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
        {
            if (!IsAuthenticated())
            {
                Logger.e("UpdateState can only be called after authentication.");
                if (listener != null)
                {
                    listener.OnStateSaved(false, slot);
                }

                return;
            }

            mClient.UpdateState(slot, data, listener);
        }
コード例 #12
0
        // called from game thread
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener)
        {
            Logger.d(string.Format("AndroidClient.UpdateState, slot={0}, data={1}",
                slot, Logger.describe(data)));
            CallClientApi("update state, slot=" + slot, () => {
                mGHManager.CallGmsApi("appstate.AppStateManager", null, "update", slot, data);
            }, null);

            // On Android, cloud writes always succeeds (because, in the worst case,
            // data gets cached locally to send to the cloud later)
            listener.OnStateSaved(true, slot);
        }
コード例 #13
0
        // called from game thread
        public void UpdateState(int slot, byte[] data, OnStateLoadedListener listener) {
            Logger.d(string.Format("AndroidClient.UpdateState, slot={0}, data={1}",
                slot, Logger.describe(data)));
            CallAppStateClientApi("update state, slot=" + slot, (AndroidJavaObject c) => {
                c.Call("updateState", slot, data);
            }, null);

            // On Android, cloud writes always succeed (because, at worst, they get cached
            // locally to send to the cloud later)
            listener.OnStateSaved(true, slot);
        }