コード例 #1
0
        public static void NotifyMatchWillBegin(string matchInfoJson)
        {
            Dictionary <string, object> matchInfoDict = DeserializeJSONToDictionary(matchInfoJson);

            Debug.Log(string.Format(LogFormat, $"Match info: {matchInfoJson}"));

            try
            {
                Match matchInfo = new Match(matchInfoDict);

                if (asyncDelegate != null)
                {
                    asyncDelegate.OnMatchWillBegin(matchInfo);
                }
                else if (syncDelegate != null)
                {
                    // We must re-initialize the sync delegate on Android for each match.
#if UNITY_ANDROID
                    SyncDelegateInitializer.Initialize(syncDelegate);
#endif
                    syncDelegate.OnMatchWillBegin(matchInfo);
                }
            }
            catch (Exception e)
            {
                Debug.LogError(string.Format(LogFormat, $"Error retrieving the match info! Error={e}"));
                throw;
            }
        }
コード例 #2
0
    /// <summary>
    /// This method is called when a user starts a match from Skillz
    /// This method is required to impelement.
    /// </summary>
    private void OnMatchWillBegin(String matchInfoJsonString)
    {
        Dictionary <string, object> matchInfoDict = DeserializeJSONToDictionary(matchInfoJsonString);

        SkillzSDK.Match matchInfo = new SkillzSDK.Match(matchInfoDict);

        if (_delegate != null)
        {
            _delegate.OnMatchWillBegin(matchInfo);
        }
        else
        {
            // We must re-initialize the sync delegate on Android for each match.
            #if UNITY_ANDROID
            Skillz.InitializeSyncDelegate(_syncDelegate);
            #endif
            _syncDelegate.OnMatchWillBegin(matchInfo);
        }
    }