Пример #1
0
        internal void HandleMatchEvent(Types.MultiplayerEvent eventType, string matchId,
                                       NativeTurnBasedMatch match)
        {
            // Capture the current value of the delegate to protect against racing updates.
            var currentDelegate = mMatchDelegate;

            if (currentDelegate == null)
            {
                return;
            }

            // Ignore REMOVED events - this plugin has no use for them.
            if (eventType == Types.MultiplayerEvent.REMOVED)
            {
                Logger.d("Ignoring REMOVE event for match " + matchId);
                return;
            }

            bool shouldAutolaunch = eventType == Types.MultiplayerEvent.UPDATED_FROM_APP_LAUNCH;

            match.ReferToMe();
            Callbacks.AsCoroutine(WaitForLogin(() =>
                                               { currentDelegate(match.AsTurnBasedMatch(mNativeClient.GetUserId()), shouldAutolaunch);
                                                 match.ForgetMe(); }));
        }
        internal void HandleMatchEvent(Types.MultiplayerEvent eventType, string matchId, NativeTurnBasedMatch match)
        {
            Action <GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch, bool> currentDelegate = mMatchDelegate;

            if (currentDelegate != null)
            {
                if (eventType == Types.MultiplayerEvent.REMOVED)
                {
                    Logger.d("Ignoring REMOVE event for match " + matchId);
                }
                else
                {
                    bool shouldAutolaunch = eventType == Types.MultiplayerEvent.UPDATED_FROM_APP_LAUNCH;
                    match.ReferToMe();
                    Callbacks.AsCoroutine(WaitForLogin(delegate
                    {
                        currentDelegate(match.AsTurnBasedMatch(mNativeClient.GetUserId()), shouldAutolaunch);
                        match.ForgetMe();
                    }));
                }
            }
        }