D:\ValheimDev\Dumps\Old\assembly_valheim\ZPlayFabMatchmaking.cs D:\ValheimDev\Dumps\Latest\assembly_valheim\ZPlayFabMatchmaking.cs
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using PartyCSharpSDK; using PartyCSharpSDK;
using PlayFab; using PlayFab;
using PlayFab.ClientModels; using PlayFab.ClientModels;
using PlayFab.MultiplayerModels; using PlayFab.MultiplayerModels;
using PlayFab.Party; using PlayFab.Party;
using UnityEngine; using UnityEngine;
   
public class ZPlayFabMatchmaking public class ZPlayFabMatchmaking
{ {
    public static event ZPlayFabMatchmakeServerStarted ServerStarted;     public static event ZPlayFabMatchmakeServerStarted ServerStarted;
   
    public static event ZPlayFabMatchmakeServerStopped ServerStopped;     public static event ZPlayFabMatchmakeServerStopped ServerStopped;
   
    public static event ZPlayFabMatchmakeLobbyLeftCallback LobbyLeft;     public static event ZPlayFabMatchmakeLobbyLeftCallback LobbyLeft;
   
    public static ZPlayFabMatchmaking instance     public static ZPlayFabMatchmaking instance
    {     {
        get         get
        {         {
            if (ZPlayFabMatchmaking.m_instance == null)             if (ZPlayFabMatchmaking.m_instance == null)
            {             {
                ZPlayFabMatchmaking.m_instance = new ZPlayFabMatchmaking();                 ZPlayFabMatchmaking.m_instance = new ZPlayFabMatchmaking();
            }             }
            return ZPlayFabMatchmaking.m_instance;             return ZPlayFabMatchmaking.m_instance;
        }         }
    }     }
   
    public static string JoinCode { get; internal set; }     public static string JoinCode { get; internal set; }
   
    public static string MyXboxUserId { get; set; } = "";     public static string MyXboxUserId { get; set; } = "";
   
    public static string PublicIP     public static string PublicIP
    {     {
        get         get
        {         {
            object mtx = ZPlayFabMatchmaking.m_mtx;             object mtx = ZPlayFabMatchmaking.m_mtx;
            string publicIP;             string publicIP;
            lock (mtx)             lock (mtx)
            {             {
                publicIP = ZPlayFabMatchmaking.m_publicIP;                 publicIP = ZPlayFabMatchmaking.m_publicIP;
            }             }
            return publicIP;             return publicIP;
        }         }
        private set         private set
        {         {
            object mtx = ZPlayFabMatchmaking.m_mtx;             object mtx = ZPlayFabMatchmaking.m_mtx;
            lock (mtx)             lock (mtx)
            {             {
                ZPlayFabMatchmaking.m_publicIP = value;                 ZPlayFabMatchmaking.m_publicIP = value;
            }             }
        }         }
    }     }
   
    public static void Initialize(bool isServer)     public static void Initialize(bool isServer)
    {     {
        ZPlayFabMatchmaking.JoinCode = (isServer ? "" : "000000");         ZPlayFabMatchmaking.JoinCode = (isServer ? "" : "000000");
    }     }
   
    public void Update(float deltaTime)     public void Update(float deltaTime)
    {     {
        if (this.ReconnectNetwork(deltaTime))         if (this.ReconnectNetwork(deltaTime))
        {         {
            return;             return;
        }         }
        this.RefreshLobby(deltaTime);         this.RefreshLobby(deltaTime);
        this.RetryJoinCodeUniquenessCheck(deltaTime);         this.RetryJoinCodeUniquenessCheck(deltaTime);
        this.UpdateActiveLobbySearches(deltaTime);         this.UpdateActiveLobbySearches(deltaTime);
        this.UpdateBackgroundLobbySearches(deltaTime);         this.UpdateBackgroundLobbySearches(deltaTime);
    }     }
   
    private bool IsJoinedToNetwork()     private bool IsJoinedToNetwork()
    {     {
        return this.m_serverData != null && !string.IsNullOrEmpty(this.m_serverData.networkId);         return this.m_serverData != null && !string.IsNullOrEmpty(this.m_serverData.networkId);
    }     }
   
    private bool IsReconnectNetworkTimerActive()     private bool IsReconnectNetworkTimerActive()
    {     {
        return this.m_lostNetworkRetryIn > 0f;         return this.m_lostNetworkRetryIn > 0f;
    }     }
   
    private void StartReconnectNetworkTimer(int code = -1)     private void StartReconnectNetworkTimer(int code = -1)
    {     {
        this.m_lostNetworkRetryIn = 30f;         this.m_lostNetworkRetryIn = 30f;
        if (ZPlayFabMatchmaking.DoFastRecovery(code))         if (ZPlayFabMatchmaking.DoFastRecovery(code))
        {         {
            ZLog.Log("PlayFab host fast recovery");             ZLog.Log("PlayFab host fast recovery");
            this.m_lostNetworkRetryIn = 12f;             this.m_lostNetworkRetryIn = 12f;
        }         }
    }     }
   
    private static bool DoFastRecovery(int code)     private static bool DoFastRecovery(int code)
    {     {
        return code == 63 || code == 11;         return code == 63 || code == 11;
    }     }
   
    private void StopReconnectNetworkTimer()     private void StopReconnectNetworkTimer()
    {     {
        this.m_isResettingNetwork = false;         this.m_isResettingNetwork = false;
        this.m_lostNetworkRetryIn = -1f;         this.m_lostNetworkRetryIn = -1f;
        if (this.m_serverData != null && !this.IsJoinedToNetwork())         if (this.m_serverData != null && !this.IsJoinedToNetwork())
        {         {
            this.CreateAndJoinNetwork();             this.CreateAndJoinNetwork();
        }         }
    }     }
   
    private bool ReconnectNetwork(float deltaTime)     private bool ReconnectNetwork(float deltaTime)
    {     {
        if (!this.IsReconnectNetworkTimerActive())         if (!this.IsReconnectNetworkTimerActive())
        {         {
            if (this.IsJoinedToNetwork() && !PlayFabMultiplayerManager.Get().IsConnectedToNetworkState())             if (this.IsJoinedToNetwork() && !PlayFabMultiplayerManager.Get().IsConnectedToNetworkState())
            {             {
                PlayFabMultiplayerManager.Get().ResetParty();                 PlayFabMultiplayerManager.Get().ResetParty();
                this.StartReconnectNetworkTimer(-1);                 this.StartReconnectNetworkTimer(-1);
                this.m_serverData.networkId = null;                 this.m_serverData.networkId = null;
            }             }
            return false;             return false;
        }         }
        this.m_lostNetworkRetryIn -= deltaTime;         this.m_lostNetworkRetryIn -= deltaTime;
        if (this.m_lostNetworkRetryIn <= 0f)         if (this.m_lostNetworkRetryIn <= 0f)
        {         {
            ZLog.Log(string.Format("PlayFab reconnect server '{0}'", this.m_serverData.serverName));             ZLog.Log(string.Format("PlayFab reconnect server '{0}'", this.m_serverData.serverName));
            this.m_isConnectingToNetwork = false;             this.m_isConnectingToNetwork = false;
            this.m_serverData.networkId = null;             this.m_serverData.networkId = null;
            this.StopReconnectNetworkTimer();             this.StopReconnectNetworkTimer();
        }         }
        else if (!this.m_isConnectingToNetwork && !this.m_isResettingNetwork && this.m_lostNetworkRetryIn <= 12f)         else if (!this.m_isConnectingToNetwork && !this.m_isResettingNetwork && this.m_lostNetworkRetryIn <= 12f)
        {         {
            PlayFabMultiplayerManager.Get().ResetParty();             PlayFabMultiplayerManager.Get().ResetParty();
            this.m_isResettingNetwork = true;             this.m_isResettingNetwork = true;
            this.m_isConnectingToNetwork = false;             this.m_isConnectingToNetwork = false;
        }         }
        return true;         return true;
    }     }
   
    private void StartRefreshLobbyTimer()     private void StartRefreshLobbyTimer()
    {     {
        this.m_refreshLobbyTimer = UnityEngine.Random.Range(540f, 840f);         this.m_refreshLobbyTimer = UnityEngine.Random.Range(540f, 840f);
    }     }
   
    private void RefreshLobby(float deltaTime)     private void RefreshLobby(float deltaTime)
    {     {
        if (this.m_serverData == null || this.m_serverData.networkId == null)         if (this.m_serverData == null || this.m_serverData.networkId == null)
        {         {
            return;             return;
        }         }
        bool flag = this.m_serverData.isDedicatedServer && string.IsNullOrEmpty(this.m_serverData.serverIp) && !string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP);         bool flag = this.m_serverData.isDedicatedServer && string.IsNullOrEmpty(this.m_serverData.serverIp) && !string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP);
        this.m_refreshLobbyTimer -= deltaTime;         this.m_refreshLobbyTimer -= deltaTime;
        if (this.m_refreshLobbyTimer < 0f || flag)         if (this.m_refreshLobbyTimer < 0f || flag)
        {         {
            this.StartRefreshLobbyTimer();             this.StartRefreshLobbyTimer();
            UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest             UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest
            {             {
                LobbyId = this.m_serverData.lobbyId                 LobbyId = this.m_serverData.lobbyId
            };             };
            if (flag)             if (flag)
            {             {
                this.m_serverData.serverIp = this.GetServerIP();                 this.m_serverData.serverIp = this.GetServerIP();
                ZLog.Log("Updating lobby with public IP " + this.m_serverData.serverIp);                 ZLog.Log("Updating lobby with public IP " + this.m_serverData.serverIp);
                Dictionary<string, string> dictionary = new Dictionary<string, string>();                 Dictionary<string, string> dictionary = new Dictionary<string, string>();
                dictionary["string_key10"] = this.m_serverData.serverIp;                 dictionary["string_key10"] = this.m_serverData.serverIp;
                Dictionary<string, string> dictionary2 = dictionary;                 Dictionary<string, string> dictionary2 = dictionary;
                updateLobbyRequest.SearchData = dictionary2;                 updateLobbyRequest.SearchData = dictionary2;
            }             }
            PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, delegate(LobbyEmptyResult _)             PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, delegate(LobbyEmptyResult _)
            {             {
                ZLog.Log(string.Format("Lobby {0} for world '{1}' and network {2} refreshed", this.m_serverData.lobbyId, this.m_serverData.serverName, this.m_serverData.networkId));                 ZLog.Log(string.Format("Lobby {0} for world '{1}' and network {2} refreshed", this.m_serverData.lobbyId, this.m_serverData.serverName, this.m_serverData.networkId));
            }, new Action<PlayFabError>(this.OnRefreshFailed), null, null);             }, new Action<PlayFabError>(this.OnRefreshFailed), null, null);
        }         }
    }     }
   
    private void OnRefreshFailed(PlayFabError err)     private void OnRefreshFailed(PlayFabError err)
    {     {
        this.CreateLobby(true, delegate(CreateLobbyResult _)         this.CreateLobby(true, delegate(CreateLobbyResult _)
        {         {
            ZLog.Log(string.Format("Lobby {0} for world '{1}' recreated", this.m_serverData.lobbyId, this.m_serverData.serverName));             ZLog.Log(string.Format("Lobby {0} for world '{1}' recreated", this.m_serverData.lobbyId, this.m_serverData.serverName));
        }, delegate(PlayFabError err)         }, delegate(PlayFabError err)
        {         {
            ZLog.LogWarning(string.Format("Failed to refresh lobby {0} for world '{1}': {2}", this.m_serverData.lobbyId, this.m_serverData.serverName, err.GenerateErrorReport()));             ZLog.LogWarning(string.Format("Failed to refresh lobby {0} for world '{1}': {2}", this.m_serverData.lobbyId, this.m_serverData.serverName, err.GenerateErrorReport()));
        });         });
    }     }
   
    private void RetryJoinCodeUniquenessCheck(float deltaTime)     private void RetryJoinCodeUniquenessCheck(float deltaTime)
    {     {
        if (this.m_retryIn > 0f)         if (this.m_retryIn > 0f)
        {         {
            this.m_retryIn -= deltaTime;             this.m_retryIn -= deltaTime;
            if (this.m_retryIn <= 0f)             if (this.m_retryIn <= 0f)
            {             {
                this.CheckJoinCodeIsUnique();                 this.CheckJoinCodeIsUnique();
            }             }
        }         }
    }     }
   
    private void UpdateActiveLobbySearches(float deltaTime)     private void UpdateActiveLobbySearches(float deltaTime)
    {     {
        for (int i = 0; i < this.m_activeSearches.Count; i++)         for (int i = 0; i < this.m_activeSearches.Count; i++)
        {         {
            ZPlayFabLobbySearch zplayFabLobbySearch = this.m_activeSearches[i];             ZPlayFabLobbySearch zplayFabLobbySearch = this.m_activeSearches[i];
            if (zplayFabLobbySearch.IsDone)             if (zplayFabLobbySearch.IsDone)
            {             {
                this.m_activeSearches.RemoveAt(i);                 this.m_activeSearches.RemoveAt(i);
                i--;                 i--;
            }             }
            else             else
            {             {
                zplayFabLobbySearch.Update(deltaTime);                 zplayFabLobbySearch.Update(deltaTime);
            }             }
        }         }
    }     }
   
    private void UpdateBackgroundLobbySearches(float deltaTime)     private void UpdateBackgroundLobbySearches(float deltaTime)
    {     {
        if (this.m_submitBackgroundSearchIn >= 0f)         if (this.m_submitBackgroundSearchIn >= 0f)
        {         {
            this.m_submitBackgroundSearchIn -= deltaTime;             this.m_submitBackgroundSearchIn -= deltaTime;
            return;             return;
        }         }
        if (this.m_pendingSearches.Count > 0)         if (this.m_pendingSearches.Count > 0)
        {         {
            this.m_submitBackgroundSearchIn = 2f;             this.m_submitBackgroundSearchIn = 2f;
            ZPlayFabLobbySearch zplayFabLobbySearch = this.m_pendingSearches.Dequeue();             ZPlayFabLobbySearch zplayFabLobbySearch = this.m_pendingSearches.Dequeue();
            zplayFabLobbySearch.FindLobby();             zplayFabLobbySearch.FindLobby();
            this.m_activeSearches.Add(zplayFabLobbySearch);             this.m_activeSearches.Add(zplayFabLobbySearch);
        }         }
    }     }
   
    private void OnFailed(string what, PlayFabError error)     private void OnFailed(string what, PlayFabError error)
    {     {
        ZLog.LogError("PlayFab " + what + " failed: " + error.ToString());         ZLog.LogError("PlayFab " + what + " failed: " + error.ToString());
        this.UnregisterServer();         this.UnregisterServer();
    }     }
   
    private void OnSessionUpdated(ZPlayFabMatchmaking.State newState)     private void OnSessionUpdated(ZPlayFabMatchmaking.State newState)
    {     {
        this.m_state = newState;         this.m_state = newState;
        switch (this.m_state)         switch (this.m_state)
        {         {
        case ZPlayFabMatchmaking.State.Creating:         case ZPlayFabMatchmaking.State.Creating:
            ZLog.Log(string.Format("Session \"{0}\" registered with join code {1}", this.m_serverData.serverName, ZPlayFabMatchmaking.JoinCode));             ZLog.Log(string.Format("Session \"{0}\" registered with join code {1}", this.m_serverData.serverName, ZPlayFabMatchmaking.JoinCode));
            this.m_retries = 100;             this.m_retries = 100;
            this.CheckJoinCodeIsUnique();             this.CheckJoinCodeIsUnique();
            return;             return;
        case ZPlayFabMatchmaking.State.RegenerateJoinCode:         case ZPlayFabMatchmaking.State.RegenerateJoinCode:
            this.RegenerateLobbyJoinCode();             this.RegenerateLobbyJoinCode();
            ZLog.Log(string.Format("Created new join code {0} for session \"{1}\"", ZPlayFabMatchmaking.JoinCode, this.m_serverData.serverName));             ZLog.Log(string.Format("Created new join code {0} for session \"{1}\"", ZPlayFabMatchmaking.JoinCode, this.m_serverData.serverName));
            return;             return;
        case ZPlayFabMatchmaking.State.Active:         case ZPlayFabMatchmaking.State.Active:
        {         {
            ZPlayFabMatchmakeServerStarted serverStarted = ZPlayFabMatchmaking.ServerStarted;             ZPlayFabMatchmakeServerStarted serverStarted = ZPlayFabMatchmaking.ServerStarted;
            if (serverStarted != null)             if (serverStarted != null)
            {             {
                serverStarted(this.m_serverData.remotePlayerId);                 serverStarted(this.m_serverData.remotePlayerId);
            }             }
            ZLog.Log(string.Format("Session \"{0}\" with join code {1} is active with {2} player(s)", this.m_serverData.serverName, ZPlayFabMatchmaking.JoinCode, this.m_serverData.numPlayers));             ZLog.Log(string.Format("Session \"{0}\" with join code {1} is active with {2} player(s)", this.m_serverData.serverName, ZPlayFabMatchmaking.JoinCode, this.m_serverData.numPlayers));
            return;             return;
        }         }
        default:         default:
            return;             return;
        }         }
    }     }
   
    private void UpdateNumPlayers(string info)     private void UpdateNumPlayers(string info)
    {     {
        this.m_serverData.numPlayers = ZPlayFabSocket.NumSockets();         this.m_serverData.numPlayers = ZPlayFabSocket.NumSockets();
        if (!this.m_serverData.isDedicatedServer)         if (!this.m_serverData.isDedicatedServer)
        {         {
            this.m_serverData.numPlayers += 1U;             this.m_serverData.numPlayers += 1U;
        }         }
        ZLog.Log(string.Format("{0} server \"{1}\" that has join code {2}, now {3} player(s)", new object[]         ZLog.Log(string.Format("{0} server \"{1}\" that has join code {2}, now {3} player(s)", new object[]
        {         {
            info,             info,
            this.m_serverData.serverName,             this.m_serverData.serverName,
            ZPlayFabMatchmaking.JoinCode,             ZPlayFabMatchmaking.JoinCode,
            this.m_serverData.numPlayers             this.m_serverData.numPlayers
        }));         }));
    }     }
   
    private void OnRemotePlayerLeft(object sender, PlayFabPlayer player)     private void OnRemotePlayerLeft(object sender, PlayFabPlayer player)
    {     {
        ZPlayFabSocket.LostConnection(player);         ZPlayFabSocket.LostConnection(player);
        this.UpdateNumPlayers("Player connection lost");         this.UpdateNumPlayers("Player connection lost");
    }     }
   
    private void OnRemotePlayerJoined(object sender, PlayFabPlayer player)     private void OnRemotePlayerJoined(object sender, PlayFabPlayer player)
    {     {
        this.StopReconnectNetworkTimer();         this.StopReconnectNetworkTimer();
        ZPlayFabSocket.QueueConnection(player);         ZPlayFabSocket.QueueConnection(player);
        this.UpdateNumPlayers("Player joined");         this.UpdateNumPlayers("Player joined");
    }     }
   
    private void OnNetworkJoined(object sender, string networkId)     private void OnNetworkJoined(object sender, string networkId)
    {     {
        ZLog.Log(string.Format("Joined PlayFab Party network with ID \"{0}\"", networkId));         ZLog.Log(string.Format("Joined PlayFab Party network with ID \"{0}\"", networkId));
        if (this.m_serverData.networkId == null || this.m_serverData.networkId != networkId)         if (this.m_serverData.networkId == null || this.m_serverData.networkId != networkId)
        {         {
            this.m_serverData.networkId = networkId;             this.m_serverData.networkId = networkId;
            this.CreateLobby(false, new Action<CreateLobbyResult>(this.OnCreateLobbySuccess), delegate(PlayFabError error)             this.CreateLobby(false, new Action<CreateLobbyResult>(this.OnCreateLobbySuccess), delegate(PlayFabError error)
            {             {
                this.OnFailed("create lobby", error);                 this.OnFailed("create lobby", error);
            });             });
        }         }
        this.m_isConnectingToNetwork = false;         this.m_isConnectingToNetwork = false;
        this.m_isResettingNetwork = false;         this.m_isResettingNetwork = false;
        this.StopReconnectNetworkTimer();         this.StopReconnectNetworkTimer();
        this.StartRefreshLobbyTimer();         this.StartRefreshLobbyTimer();
    }     }
   
    private void CreateLobby(bool refresh, Action<CreateLobbyResult> resultCallback, Action<PlayFabError> errorCallback)     private void CreateLobby(bool refresh, Action<CreateLobbyResult> resultCallback, Action<PlayFabError> errorCallback)
    {     {
        PlayFab.MultiplayerModels.EntityKey entityKeyForLocalUser = ZPlayFabMatchmaking.GetEntityKeyForLocalUser();         PlayFab.MultiplayerModels.EntityKey entityKeyForLocalUser = ZPlayFabMatchmaking.GetEntityKeyForLocalUser();
        List<Member> list = new List<Member>         List<Member> list = new List<Member>
        {         {
            new Member             new Member
            {             {
                MemberEntity = entityKeyForLocalUser                 MemberEntity = entityKeyForLocalUser
            }             }
        };         };
        Dictionary<string, string> dictionary = new Dictionary<string, string>();         Dictionary<string, string> dictionary = new Dictionary<string, string>();
        string text = PlayFabAttrKey.HavePassword.ToKeyString();         string text = PlayFabAttrKey.HavePassword.ToKeyString();
        dictionary[text] = this.m_serverData.havePassword.ToString();         dictionary[text] = this.m_serverData.havePassword.ToString();
        string text2 = PlayFabAttrKey.WorldName.ToKeyString();         string text2 = PlayFabAttrKey.WorldName.ToKeyString();
        dictionary[text2] = this.m_serverData.worldName;         dictionary[text2] = this.m_serverData.worldName;
        string text3 = PlayFabAttrKey.NetworkId.ToKeyString();         string text3 = PlayFabAttrKey.NetworkId.ToKeyString();
        dictionary[text3] = this.m_serverData.networkId;         dictionary[text3] = this.m_serverData.networkId;
        Dictionary<string, string> dictionary2 = dictionary;         Dictionary<string, string> dictionary2 = dictionary;
        string text4 = "";         string text4 = "";
        Dictionary<string, string> dictionary3;         Dictionary<string, string> dictionary3;
        if (ServerOptionsGUI.TryConvertModifierKeysToCompactKVP<Dictionary<string, string>>(this.m_serverData.modifiers, out dictionary3))         if (ServerOptionsGUI.TryConvertModifierKeysToCompactKVP<Dictionary<string, string>>(this.m_serverData.modifiers, out dictionary3))
        {         {
            text4 = StringUtils.EncodeDictionaryAsString(dictionary3, false);             text4 = StringUtils.EncodeDictionaryAsString(dictionary3, false);
        }         }
        Dictionary<string, string> dictionary4 = new Dictionary<string, string>();         Dictionary<string, string> dictionary4 = new Dictionary<string, string>();
        dictionary4["string_key9"] = DateTime.UtcNow.Ticks.ToString();         dictionary4["string_key9"] = DateTime.UtcNow.Ticks.ToString();
        dictionary4["string_key5"] = this.m_serverData.serverName;         dictionary4["string_key5"] = this.m_serverData.serverName;
        dictionary4["string_key3"] = this.m_serverData.isCommunityServer.ToString();         dictionary4["string_key3"] = this.m_serverData.isCommunityServer.ToString();
        dictionary4["string_key4"] = this.m_serverData.joinCode;         dictionary4["string_key4"] = this.m_serverData.joinCode;
        dictionary4["string_key2"] = refresh.ToString();         dictionary4["string_key2"] = refresh.ToString();
        dictionary4["string_key1"] = this.m_serverData.remotePlayerId;         dictionary4["string_key1"] = this.m_serverData.remotePlayerId;
        dictionary4["string_key6"] = this.m_serverData.gameVersion.ToString();         dictionary4["string_key6"] = this.m_serverData.gameVersion.ToString();
        dictionary4["string_key14"] = text4;         dictionary4["string_key14"] = text4;
        dictionary4["number_key13"] = this.m_serverData.networkVersion.ToString();         dictionary4["number_key13"] = this.m_serverData.networkVersion.ToString();
        dictionary4["string_key7"] = this.m_serverData.isDedicatedServer.ToString();         dictionary4["string_key7"] = this.m_serverData.isDedicatedServer.ToString();
        dictionary4["string_key8"] = this.m_serverData.xboxUserId;         dictionary4["string_key8"] = this.m_serverData.xboxUserId;
        dictionary4["string_key10"] = this.m_serverData.serverIp;         dictionary4["string_key10"] = this.m_serverData.serverIp;
        dictionary4["number_key11"] = ZPlayFabMatchmaking.GetSearchPage().ToString();         dictionary4["number_key11"] = ZPlayFabMatchmaking.GetSearchPage().ToString();
        dictionary4["string_key12"] = (PrivilegeManager.CanCrossplay ? "None" : PrivilegeManager.GetCurrentPlatform().ToString());         dictionary4["string_key12"] = (PrivilegeManager.CanCrossplay ? "None" : PrivilegeManager.GetCurrentPlatform().ToString());
        Dictionary<string, string> dictionary5 = dictionary4;         Dictionary<string, string> dictionary5 = dictionary4;
        CreateLobbyRequest createLobbyRequest = new CreateLobbyRequest();         CreateLobbyRequest createLobbyRequest = new CreateLobbyRequest();
        createLobbyRequest.AccessPolicy = new AccessPolicy?(AccessPolicy.Public);         createLobbyRequest.AccessPolicy = new AccessPolicy?(AccessPolicy.Public);
        createLobbyRequest.MaxPlayers = 10U;         createLobbyRequest.MaxPlayers = 10U;
        createLobbyRequest.Members = list;         createLobbyRequest.Members = list;
        createLobbyRequest.Owner = entityKeyForLocalUser;         createLobbyRequest.Owner = entityKeyForLocalUser;
        createLobbyRequest.LobbyData = dictionary2;         createLobbyRequest.LobbyData = dictionary2;
        createLobbyRequest.SearchData = dictionary5;         createLobbyRequest.SearchData = dictionary5;
        if (this.m_serverData.isCommunityServer)         if (this.m_serverData.isCommunityServer)
        {         {
            ZPlayFabMatchmaking.AddNameSearchFilter(dictionary5, this.m_serverData.serverName);             ZPlayFabMatchmaking.AddNameSearchFilter(dictionary5, this.m_serverData.serverName);
        }         }
        PlayFabMultiplayerAPI.CreateLobby(createLobbyRequest, resultCallback, errorCallback, null, null);         PlayFabMultiplayerAPI.CreateLobby(createLobbyRequest, resultCallback, errorCallback, null, null);
    }     }
   
    private static int GetSearchPage()     private static int GetSearchPage()
    {     {
        return UnityEngine.Random.Range(0, 4);         return UnityEngine.Random.Range(0, 4);
    }     }
   
    internal static PlayFab.MultiplayerModels.EntityKey GetEntityKeyForLocalUser()     internal static PlayFab.MultiplayerModels.EntityKey GetEntityKeyForLocalUser()
    {     {
        PlayFab.ClientModels.EntityKey entity = PlayFabManager.instance.Entity;         PlayFab.ClientModels.EntityKey entity = PlayFabManager.instance.Entity;
        return new PlayFab.MultiplayerModels.EntityKey         return new PlayFab.MultiplayerModels.EntityKey
        {         {
            Id = entity.Id,             Id = entity.Id,
            Type = entity.Type             Type = entity.Type
        };         };
    }     }
   
    private void OnCreateLobbySuccess(CreateLobbyResult result)     private void OnCreateLobbySuccess(CreateLobbyResult result)
    {     {
        ZLog.Log(string.Format("Created PlayFab lobby with ID \"{0}\", ConnectionString \"{1}\" and owned by \"{2}\"", result.LobbyId, result.ConnectionString, this.m_serverData.remotePlayerId));         ZLog.Log(string.Format("Created PlayFab lobby with ID \"{0}\", ConnectionString \"{1}\" and owned by \"{2}\"", result.LobbyId, result.ConnectionString, this.m_serverData.remotePlayerId));
        this.m_serverData.lobbyId = result.LobbyId;         this.m_serverData.lobbyId = result.LobbyId;
        this.OnSessionUpdated(ZPlayFabMatchmaking.State.Creating);         this.OnSessionUpdated(ZPlayFabMatchmaking.State.Creating);
    }     }
   
    private void GenerateJoinCode()     private void GenerateJoinCode()
    {     {
        ZPlayFabMatchmaking.JoinCode = UnityEngine.Random.Range(0, (int)Math.Pow(10.0, 6.0)).ToString("D" + 6U.ToString());         ZPlayFabMatchmaking.JoinCode = UnityEngine.Random.Range(0, (int)Math.Pow(10.0, 6.0)).ToString("D" + 6U.ToString());
        this.m_serverData.joinCode = ZPlayFabMatchmaking.JoinCode;         this.m_serverData.joinCode = ZPlayFabMatchmaking.JoinCode;
    }     }
   
    private void RegenerateLobbyJoinCode()     private void RegenerateLobbyJoinCode()
    {     {
        this.GenerateJoinCode();         this.GenerateJoinCode();
        UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest();         UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest();
        updateLobbyRequest.LobbyId = this.m_serverData.lobbyId;         updateLobbyRequest.LobbyId = this.m_serverData.lobbyId;
        Dictionary<string, string> dictionary = new Dictionary<string, string>();         Dictionary<string, string> dictionary = new Dictionary<string, string>();
        dictionary["string_key4"] = ZPlayFabMatchmaking.JoinCode;         dictionary["string_key4"] = ZPlayFabMatchmaking.JoinCode;
        updateLobbyRequest.SearchData = dictionary;         updateLobbyRequest.SearchData = dictionary;
        PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, new Action<LobbyEmptyResult>(this.OnSetLobbyJoinCodeSuccess), delegate(PlayFabError error)         PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, new Action<LobbyEmptyResult>(this.OnSetLobbyJoinCodeSuccess), delegate(PlayFabError error)
        {         {
            this.OnFailed("set lobby join-code", error);             this.OnFailed("set lobby join-code", error);
        }, null, null);         }, null, null);
    }     }
   
    private void OnSetLobbyJoinCodeSuccess(LobbyEmptyResult _)     private void OnSetLobbyJoinCodeSuccess(LobbyEmptyResult _)
    {     {
        this.CheckJoinCodeIsUnique();         this.CheckJoinCodeIsUnique();
    }     }
   
    private void CheckJoinCodeIsUnique()     private void CheckJoinCodeIsUnique()
    {     {
        PlayFabMultiplayerAPI.FindLobbies(new FindLobbiesRequest         PlayFabMultiplayerAPI.FindLobbies(new FindLobbiesRequest
        {         {
            Filter = string.Format("{0} eq '{1}'", "string_key4", ZPlayFabMatchmaking.JoinCode)             Filter = string.Format("{0} eq '{1}'", "string_key4", ZPlayFabMatchmaking.JoinCode)
        }, new Action<FindLobbiesResult>(this.OnCheckJoinCodeSuccess), delegate(PlayFabError error)         }, new Action<FindLobbiesResult>(this.OnCheckJoinCodeSuccess), delegate(PlayFabError error)
        {         {
            this.OnFailed("find lobbies", error);             this.OnFailed("find lobbies", error);
        }, null, null);         }, null, null);
    }     }
   
    private void ScheduleJoinCodeCheck()     private void ScheduleJoinCodeCheck()
    {     {
        this.m_retryIn = 1f;         this.m_retryIn = 1f;
    }     }
   
    private void OnCheckJoinCodeSuccess(FindLobbiesResult result)     private void OnCheckJoinCodeSuccess(FindLobbiesResult result)
    {     {
        if (result.Lobbies.Count == 0)         if (result.Lobbies.Count == 0)
        {         {
            if (this.m_retries > 0)             if (this.m_retries > 0)
            {             {
                this.m_retries--;                 this.m_retries--;
                ZLog.Log("Retry join-code check " + this.m_retries.ToString());                 ZLog.Log("Retry join-code check " + this.m_retries.ToString());
                this.ScheduleJoinCodeCheck();                 this.ScheduleJoinCodeCheck();
                return;                 return;
            }             }
            ZLog.LogWarning("Zero lobbies returned, should be at least one");             ZLog.LogWarning("Zero lobbies returned, should be at least one");
            this.UnregisterServer();             this.UnregisterServer();
            return;             return;
        }         }
        else         else
        {         {
            if (result.Lobbies.Count == 1 && result.Lobbies[0].Owner.Id == ZPlayFabMatchmaking.GetEntityKeyForLocalUser().Id)             if (result.Lobbies.Count == 1 && result.Lobbies[0].Owner.Id == ZPlayFabMatchmaking.GetEntityKeyForLocalUser().Id)
            {             {
                this.ActivateSession();                 this.ActivateSession();
                return;                 return;
            }             }
            this.OnSessionUpdated(ZPlayFabMatchmaking.State.RegenerateJoinCode);             this.OnSessionUpdated(ZPlayFabMatchmaking.State.RegenerateJoinCode);
            return;             return;
        }         }
    }     }
   
    private void ActivateSession()     private void ActivateSession()
    {     {
        UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest();         UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest();
        updateLobbyRequest.LobbyId = this.m_serverData.lobbyId;         updateLobbyRequest.LobbyId = this.m_serverData.lobbyId;
        Dictionary<string, string> dictionary = new Dictionary<string, string>();         Dictionary<string, string> dictionary = new Dictionary<string, string>();
        dictionary["string_key2"] = true.ToString();         dictionary["string_key2"] = true.ToString();
        updateLobbyRequest.SearchData = dictionary;         updateLobbyRequest.SearchData = dictionary;
        PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, new Action<LobbyEmptyResult>(this.OnActivateLobbySuccess), delegate(PlayFabError error)         PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, new Action<LobbyEmptyResult>(this.OnActivateLobbySuccess), delegate(PlayFabError error)
        {         {
            this.OnFailed("activate lobby", error);             this.OnFailed("activate lobby", error);
        }, null, null);         }, null, null);
    }     }
   
    private void OnActivateLobbySuccess(LobbyEmptyResult _)     private void OnActivateLobbySuccess(LobbyEmptyResult _)
    {     {
        this.OnSessionUpdated(ZPlayFabMatchmaking.State.Active);         this.OnSessionUpdated(ZPlayFabMatchmaking.State.Active);
    }     }
   
    public void RegisterServer(string name, bool havePassword, bool isCommunityServer, GameVersion gameVersion, List<string> modifiers, uint networkVersion, string worldName, bool needServerAccount = true)     public void RegisterServer(string name, bool havePassword, bool isCommunityServer, GameVersion gameVersion, List<string> modifiers, uint networkVersion, string worldName, bool needServerAccount = true)
    {     {
        bool flag = false;         bool flag = false;
        if (!PlayFabMultiplayerAPI.IsEntityLoggedIn())         if (!PlayFabMultiplayerAPI.IsEntityLoggedIn())
        {         {
            ZLog.LogWarning("Calling ZPlayFabMatchmaking.RegisterServer() without logged in user");             ZLog.LogWarning("Calling ZPlayFabMatchmaking.RegisterServer() without logged in user");
            this.m_pendingRegisterServer = delegate             this.m_pendingRegisterServer = delegate
            {             {
                this.RegisterServer(name, havePassword, isCommunityServer, gameVersion, modifiers, networkVersion, worldName, needServerAccount);                 this.RegisterServer(name, havePassword, isCommunityServer, gameVersion, modifiers, networkVersion, worldName, needServerAccount);
            };             };
            return;             return;
        }         }
        this.m_serverData = new PlayFabMatchmakingServerData         this.m_serverData = new PlayFabMatchmakingServerData
        {         {
            havePassword = havePassword,             havePassword = havePassword,
            isCommunityServer = isCommunityServer,             isCommunityServer = isCommunityServer,
            isDedicatedServer = flag,             isDedicatedServer = flag,
            remotePlayerId = PlayFabManager.instance.Entity.Id,             remotePlayerId = PlayFabManager.instance.Entity.Id,
            serverName = name,             serverName = name,
            gameVersion = gameVersion,             gameVersion = gameVersion,
            modifiers = modifiers,             modifiers = modifiers,
            networkVersion = networkVersion,             networkVersion = networkVersion,
            worldName = worldName             worldName = worldName
        };         };
        this.m_serverData.serverIp = this.GetServerIP();         this.m_serverData.serverIp = this.GetServerIP();
        this.UpdateNumPlayers("New session");         this.UpdateNumPlayers("New session");
        ZLog.Log(string.Format("Register PlayFab server \"{0}\"{1}", name, flag ? (" with IP " + this.m_serverData.serverIp) : ""));         ZLog.Log(string.Format("Register PlayFab server \"{0}\"{1}", name, flag ? (" with IP " + this.m_serverData.serverIp) : ""));
        this.GenerateJoinCode();         this.GenerateJoinCode();
        this.CreateAndJoinNetwork();         this.CreateAndJoinNetwork();
        PlayFabMultiplayerManager playFabMultiplayerManager = PlayFabMultiplayerManager.Get();         PlayFabMultiplayerManager playFabMultiplayerManager = PlayFabMultiplayerManager.Get();
        playFabMultiplayerManager.OnNetworkJoined -= this.OnNetworkJoined;         playFabMultiplayerManager.OnNetworkJoined -= this.OnNetworkJoined;
        playFabMultiplayerManager.OnNetworkJoined += this.OnNetworkJoined;         playFabMultiplayerManager.OnNetworkJoined += this.OnNetworkJoined;
        playFabMultiplayerManager.OnNetworkChanged -= this.OnNetworkChanged;         playFabMultiplayerManager.OnNetworkChanged -= this.OnNetworkChanged;
        playFabMultiplayerManager.OnNetworkChanged += this.OnNetworkChanged;         playFabMultiplayerManager.OnNetworkChanged += this.OnNetworkChanged;
        playFabMultiplayerManager.OnError -= this.OnNetworkError;         playFabMultiplayerManager.OnError -= this.OnNetworkError;
        playFabMultiplayerManager.OnError += this.OnNetworkError;         playFabMultiplayerManager.OnError += this.OnNetworkError;
        playFabMultiplayerManager.OnRemotePlayerJoined -= this.OnRemotePlayerJoined;         playFabMultiplayerManager.OnRemotePlayerJoined -= this.OnRemotePlayerJoined;
        playFabMultiplayerManager.OnRemotePlayerJoined += this.OnRemotePlayerJoined;         playFabMultiplayerManager.OnRemotePlayerJoined += this.OnRemotePlayerJoined;
        playFabMultiplayerManager.OnRemotePlayerLeft -= this.OnRemotePlayerLeft;         playFabMultiplayerManager.OnRemotePlayerLeft -= this.OnRemotePlayerLeft;
        playFabMultiplayerManager.OnRemotePlayerLeft += this.OnRemotePlayerLeft;         playFabMultiplayerManager.OnRemotePlayerLeft += this.OnRemotePlayerLeft;
    }     }
   
    private string GetServerIP()     private string GetServerIP()
    {     {
        if (!this.m_serverData.isDedicatedServer || string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP))         if (!this.m_serverData.isDedicatedServer || string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP))
        {         {
            return "";             return "";
        }         }
        return string.Format("{0}:{1}", ZPlayFabMatchmaking.PublicIP, this.m_serverPort);         return string.Format("{0}:{1}", ZPlayFabMatchmaking.PublicIP, this.m_serverPort);
    }     }
   
    public static void LookupPublicIP()     public static void LookupPublicIP()
    {     {
        if (string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP) && ZPlayFabMatchmaking.m_publicIpLookupThread == null)         if (string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP) && ZPlayFabMatchmaking.m_publicIpLookupThread == null)
        {         {
            ZPlayFabMatchmaking.m_publicIpLookupThread = new Thread(new ParameterizedThreadStart(ZPlayFabMatchmaking.BackgroundLookupPublicIP));             ZPlayFabMatchmaking.m_publicIpLookupThread = new Thread(new ParameterizedThreadStart(ZPlayFabMatchmaking.BackgroundLookupPublicIP));
            ZPlayFabMatchmaking.m_publicIpLookupThread.Name = "PlayfabLooupThread";             ZPlayFabMatchmaking.m_publicIpLookupThread.Name = "PlayfabLooupThread";
            ZPlayFabMatchmaking.m_publicIpLookupThread.Start();             ZPlayFabMatchmaking.m_publicIpLookupThread.Start();
        }         }
    }     }
   
    private static void BackgroundLookupPublicIP(object obj)     private static void BackgroundLookupPublicIP(object obj)
    {     {
        while (string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP))         while (string.IsNullOrEmpty(ZPlayFabMatchmaking.PublicIP))
        {         {
            ZPlayFabMatchmaking.PublicIP = ZNet.GetPublicIP();             ZPlayFabMatchmaking.PublicIP = ZNet.GetPublicIP();
            Thread.Sleep(10);             Thread.Sleep(10);
        }         }
    }     }
   
    private void CreateAndJoinNetwork()     private void CreateAndJoinNetwork()
    {     {
        PlayFabNetworkConfiguration playFabNetworkConfiguration = new PlayFabNetworkConfiguration         PlayFabNetworkConfiguration playFabNetworkConfiguration = new PlayFabNetworkConfiguration
        {         {
            MaxPlayerCount = 10U,             MaxPlayerCount = 10U,
            DirectPeerConnectivityOptions = (PARTY_DIRECT_PEER_CONNECTIVITY_OPTIONS)15U             DirectPeerConnectivityOptions = (PARTY_DIRECT_PEER_CONNECTIVITY_OPTIONS)15U
        };         };
        ZLog.Log(string.Format("Server '{0}' begin PlayFab create and join network for server ", this.m_serverData.serverName));         ZLog.Log(string.Format("Server '{0}' begin PlayFab create and join network for server ", this.m_serverData.serverName));
        PlayFabMultiplayerManager.Get().CreateAndJoinNetwork(playFabNetworkConfiguration);         PlayFabMultiplayerManager.Get().CreateAndJoinNetwork(playFabNetworkConfiguration);
        this.m_isConnectingToNetwork = true;         this.m_isConnectingToNetwork = true;
        this.StartReconnectNetworkTimer(-1);         this.StartReconnectNetworkTimer(-1);
    }     }
   
    public void UnregisterServer()     public void UnregisterServer()
    {     {
        Debug.Log("ZPlayFabMatchmaking::UnregisterServer - unregistering server now. State: " + this.m_state.ToString());         Debug.Log("ZPlayFabMatchmaking::UnregisterServer - unregistering server now. State: " + this.m_state.ToString());
        if (this.m_state == ZPlayFabMatchmaking.State.Active)         if (this.m_state == ZPlayFabMatchmaking.State.Active)
        {         {
            ZPlayFabMatchmakeServerStopped serverStopped = ZPlayFabMatchmaking.ServerStopped;             ZPlayFabMatchmakeServerStopped serverStopped = ZPlayFabMatchmaking.ServerStopped;
            if (serverStopped != null)             if (serverStopped != null)
            {             {
                serverStopped();                 serverStopped();
            }             }
        }         }
        if (this.m_state != ZPlayFabMatchmaking.State.Uninitialized)         if (this.m_state != ZPlayFabMatchmaking.State.Uninitialized)
        {         {
            ZLog.Log(string.Format("Unregister PlayFab server \"{0}\" and leaving network \"{1}\"", this.m_serverData.serverName, this.m_serverData.networkId));             ZLog.Log(string.Format("Unregister PlayFab server \"{0}\" and leaving network \"{1}\"", this.m_serverData.serverName, this.m_serverData.networkId));
            ZPlayFabMatchmaking.DeleteLobby(this.m_serverData.lobbyId);             ZPlayFabMatchmaking.DeleteLobby(this.m_serverData.lobbyId);
            ZPlayFabSocket.DestroyListenSocket();             ZPlayFabSocket.DestroyListenSocket();
            PlayFabMultiplayerManager.Get().LeaveNetwork();             PlayFabMultiplayerManager.Get().LeaveNetwork();
            PlayFabMultiplayerManager.Get().OnNetworkJoined -= this.OnNetworkJoined;             PlayFabMultiplayerManager.Get().OnNetworkJoined -= this.OnNetworkJoined;
            PlayFabMultiplayerManager.Get().OnNetworkChanged -= this.OnNetworkChanged;             PlayFabMultiplayerManager.Get().OnNetworkChanged -= this.OnNetworkChanged;
            PlayFabMultiplayerManager.Get().OnError -= this.OnNetworkError;             PlayFabMultiplayerManager.Get().OnError -= this.OnNetworkError;
            PlayFabMultiplayerManager.Get().OnRemotePlayerJoined -= this.OnRemotePlayerJoined;             PlayFabMultiplayerManager.Get().OnRemotePlayerJoined -= this.OnRemotePlayerJoined;
            PlayFabMultiplayerManager.Get().OnRemotePlayerLeft -= this.OnRemotePlayerLeft;             PlayFabMultiplayerManager.Get().OnRemotePlayerLeft -= this.OnRemotePlayerLeft;
            this.m_serverData = null;             this.m_serverData = null;
            this.m_retries = 0;             this.m_retries = 0;
            this.m_state = ZPlayFabMatchmaking.State.Uninitialized;             this.m_state = ZPlayFabMatchmaking.State.Uninitialized;
            this.StopReconnectNetworkTimer();             this.StopReconnectNetworkTimer();
            return;             return;
        }         }
        ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft = ZPlayFabMatchmaking.LobbyLeft;         ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft = ZPlayFabMatchmaking.LobbyLeft;
        if (lobbyLeft == null)         if (lobbyLeft == null)
        {         {
            return;             return;
        }         }
        lobbyLeft(true);         lobbyLeft(true);
    }     }
   
    internal static void ResetParty()     internal static void ResetParty()
    {     {
        if (ZPlayFabMatchmaking.instance != null && ZPlayFabMatchmaking.instance.IsJoinedToNetwork())         if (ZPlayFabMatchmaking.instance != null && ZPlayFabMatchmaking.instance.IsJoinedToNetwork())
        {         {
            ZPlayFabMatchmaking.instance.OnNetworkError(null, new PlayFabMultiplayerManagerErrorArgs(9999, "Forced ResetParty", PlayFabMultiplayerManagerErrorType.Error));             ZPlayFabMatchmaking.instance.OnNetworkError(null, new PlayFabMultiplayerManagerErrorArgs(9999, "Forced ResetParty", PlayFabMultiplayerManagerErrorType.Error));
            return;             return;
        }         }
        ZLog.Log("No active PlayFab Party to reset");         ZLog.Log("No active PlayFab Party to reset");
    }     }
   
    private void OnNetworkError(object sender, PlayFabMultiplayerManagerErrorArgs args)     private void OnNetworkError(object sender, PlayFabMultiplayerManagerErrorArgs args)
    {     {
        if (this.IsReconnectNetworkTimerActive())         if (this.IsReconnectNetworkTimerActive())
        {         {
            return;             return;
        }         }
        ZLog.LogWarning(string.Format("PlayFab network error in session '{0}' and network {1} with type '{2}' and code '{3}': {4}", new object[]         ZLog.LogWarning(string.Format("PlayFab network error in session '{0}' and network {1} with type '{2}' and code '{3}': {4}", new object[]
        {         {
            this.m_serverData.serverName,             this.m_serverData.serverName,
            this.m_serverData.networkId,             this.m_serverData.networkId,
            args.Type,             args.Type,
            args.Code,             args.Code,
            args.Message             args.Message
        }));         }));
        this.StartReconnectNetworkTimer(args.Code);         this.StartReconnectNetworkTimer(args.Code);
    }     }
   
    private void OnNetworkChanged(object sender, string newNetworkId)     private void OnNetworkChanged(object sender, string newNetworkId)
    {     {
        ZLog.LogWarning(string.Format("PlayFab network session '{0}' and network {1} changed to network {2}", this.m_serverData.serverName, this.m_serverData.networkId, newNetworkId));         ZLog.LogWarning(string.Format("PlayFab network session '{0}' and network {1} changed to network {2}", this.m_serverData.serverName, this.m_serverData.networkId, newNetworkId));
        this.m_serverData.networkId = newNetworkId;         this.m_serverData.networkId = newNetworkId;
        Dictionary<string, string> dictionary = new Dictionary<string, string>();         Dictionary<string, string> dictionary = new Dictionary<string, string>();
        string text = PlayFabAttrKey.NetworkId.ToKeyString();         string text = PlayFabAttrKey.NetworkId.ToKeyString();
        dictionary[text] = this.m_serverData.networkId;         dictionary[text] = this.m_serverData.networkId;
        Dictionary<string, string> dictionary2 = dictionary;         Dictionary<string, string> dictionary2 = dictionary;
        PlayFabMultiplayerAPI.UpdateLobby(new UpdateLobbyRequest         PlayFabMultiplayerAPI.UpdateLobby(new UpdateLobbyRequest
        {         {
            LobbyId = this.m_serverData.lobbyId,             LobbyId = this.m_serverData.lobbyId,
            LobbyData = dictionary2             LobbyData = dictionary2
        }, delegate(LobbyEmptyResult _)         }, delegate(LobbyEmptyResult _)
        {         {
            ZLog.Log(string.Format("Lobby {0} for world '{1}' change to network {2}", this.m_serverData.lobbyId, this.m_serverData.serverName, this.m_serverData.networkId));             ZLog.Log(string.Format("Lobby {0} for world '{1}' change to network {2}", this.m_serverData.lobbyId, this.m_serverData.serverName, this.m_serverData.networkId));
        }, new Action<PlayFabError>(this.OnRefreshFailed), null, null);         }, new Action<PlayFabError>(this.OnRefreshFailed), null, null);
    }     }
   
    private static void DeleteLobby(string lobbyId)     private static void DeleteLobby(string lobbyId)
    {     {
        UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest();         UpdateLobbyRequest updateLobbyRequest = new UpdateLobbyRequest();
        updateLobbyRequest.LobbyId = lobbyId;         updateLobbyRequest.LobbyId = lobbyId;
        Dictionary<string, string> dictionary = new Dictionary<string, string>();         Dictionary<string, string> dictionary = new Dictionary<string, string>();
        dictionary["string_key2"] = false.ToString();         dictionary["string_key2"] = false.ToString();
        updateLobbyRequest.SearchData = dictionary;         updateLobbyRequest.SearchData = dictionary;
        PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, delegate(LobbyEmptyResult _)         PlayFabMultiplayerAPI.UpdateLobby(updateLobbyRequest, delegate(LobbyEmptyResult _)
        {         {
            ZLog.Log("Deactivated PlayFab lobby " + lobbyId);             ZLog.Log("Deactivated PlayFab lobby " + lobbyId);
        }, delegate(PlayFabError error)         }, delegate(PlayFabError error)
        {         {
            ZLog.LogWarning(string.Format("Failed to deactive lobby '{0}': {1}", lobbyId, error.GenerateErrorReport()));             ZLog.LogWarning(string.Format("Failed to deactive lobby '{0}': {1}", lobbyId, error.GenerateErrorReport()));
        }, null, null);         }, null, null);
        ZPlayFabMatchmaking.LeaveLobby(lobbyId);         ZPlayFabMatchmaking.LeaveLobby(lobbyId);
    }     }
   
    public static void LeaveLobby(string lobbyId)     public static void LeaveLobby(string lobbyId)
    {     {
        PlayFabMultiplayerAPI.LeaveLobby(new LeaveLobbyRequest         PlayFabMultiplayerAPI.LeaveLobby(new LeaveLobbyRequest
        {         {
            LobbyId = lobbyId,             LobbyId = lobbyId,
            MemberEntity = ZPlayFabMatchmaking.GetEntityKeyForLocalUser()             MemberEntity = ZPlayFabMatchmaking.GetEntityKeyForLocalUser()
        }, delegate(LobbyEmptyResult _)         }, delegate(LobbyEmptyResult _)
        {         {
            ZLog.Log("Left PlayFab lobby " + lobbyId);             ZLog.Log("Left PlayFab lobby " + lobbyId);
            ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft = ZPlayFabMatchmaking.LobbyLeft;             ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft = ZPlayFabMatchmaking.LobbyLeft;
            if (lobbyLeft == null)             if (lobbyLeft == null)
            {             {
                return;                 return;
            }             }
            lobbyLeft(true);             lobbyLeft(true);
        }, delegate(PlayFabError error)         }, delegate(PlayFabError error)
        {         {
            ZLog.LogError(string.Format("Failed to leave lobby '{0}': {1}", lobbyId, error.GenerateErrorReport()));             ZLog.LogError(string.Format("Failed to leave lobby '{0}': {1}", lobbyId, error.GenerateErrorReport()));
            ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft2 = ZPlayFabMatchmaking.LobbyLeft;             ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft2 = ZPlayFabMatchmaking.LobbyLeft;
            if (lobbyLeft2 == null)             if (lobbyLeft2 == null)
            {             {
                return;                 return;
            }             }
            lobbyLeft2(false);             lobbyLeft2(false);
        }, null, null);         }, null, null);
    }     }
   
    public static void LeaveEmptyLobby()     public static void LeaveEmptyLobby()
    {     {
        ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft = ZPlayFabMatchmaking.LobbyLeft;         ZPlayFabMatchmakeLobbyLeftCallback lobbyLeft = ZPlayFabMatchmaking.LobbyLeft;
        if (lobbyLeft == null)         if (lobbyLeft == null)
        {         {
            return;             return;
        }         }
        lobbyLeft(true);         lobbyLeft(true);
    }     }
   
    public static void ResolveJoinCode(string joinCode, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction)     public static void ResolveJoinCode(string joinCode, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction)
    {     {
        string text = string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]         string text = string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]
        {         {
            "string_key4",             "string_key4",
            joinCode,             joinCode,
            "string_key2",             "string_key2",
            true.ToString()             true.ToString()
        });         });
        ZPlayFabMatchmaking.instance.m_activeSearches.Add(new ZPlayFabLobbySearch(successAction, failedAction, text, null, false));         ZPlayFabMatchmaking.instance.m_activeSearches.Add(new ZPlayFabLobbySearch(successAction, failedAction, text, null, false));
    }     }
   
    public static void CheckHostOnlineStatus(string hostName, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction, bool joinLobby = false)     public static void CheckHostOnlineStatus(string hostName, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction, bool joinLobby = false)
    {     {
        ZPlayFabMatchmaking.FindHostSession(string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]         ZPlayFabMatchmaking.FindHostSession(string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]
        {         {
            "string_key1",             "string_key1",
            hostName,             hostName,
            "string_key2",             "string_key2",
            true.ToString()             true.ToString()
        }), successAction, failedAction, joinLobby);         }), successAction, failedAction, joinLobby);
    }     }
   
    public static void FindHostByIp(string hostIp, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction, bool joinLobby = false)     public static void FindHostByIp(string hostIp, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction, bool joinLobby = false)
    {     {
        ZPlayFabMatchmaking.FindHostSession(string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]         ZPlayFabMatchmaking.FindHostSession(string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]
        {         {
            "string_key10",             "string_key10",
            hostIp,             hostIp,
            "string_key2",             "string_key2",
            true.ToString()             true.ToString()
        }), successAction, failedAction, joinLobby);         }), successAction, failedAction, joinLobby);
    }     }
   
    private static Dictionary<char, int> CreateCharHistogram(string str)     private static Dictionary<char, int> CreateCharHistogram(string str)
    {     {
        Dictionary<char, int> dictionary = new Dictionary<char, int>();         Dictionary<char, int> dictionary = new Dictionary<char, int>();
        foreach (char c in str.ToLowerInvariant())         foreach (char c in str.ToLowerInvariant())
        {         {
            if (dictionary.ContainsKey(c))             if (dictionary.ContainsKey(c))
            {             {
                Dictionary<char, int> dictionary2 = dictionary;                 Dictionary<char, int> dictionary2 = dictionary;
                char c2 = c;                 char c2 = c;
                int num = dictionary2[c2];                 int num = dictionary2[c2];
                dictionary2[c2] = num + 1;                 dictionary2[c2] = num + 1;
            }             }
            else             else
            {             {
                dictionary.Add(c, 1);                 dictionary.Add(c, 1);
            }             }
        }         }
        return dictionary;         return dictionary;
    }     }
   
    private static void AddNameSearchFilter(Dictionary<string, string> searchData, string serverName)     private static void AddNameSearchFilter(Dictionary<string, string> searchData, string serverName)
    {     {
        Dictionary<char, int> dictionary = ZPlayFabMatchmaking.CreateCharHistogram(serverName);         Dictionary<char, int> dictionary = ZPlayFabMatchmaking.CreateCharHistogram(serverName);
        for (char c = 'a'; c <= 'z'; c += '\u0001')         for (char c = 'a'; c <= 'z'; c += '\u0001')
        {         {
            string text;             string text;
            if (ZPlayFabMatchmaking.CharToKeyName(c, out text))             if (ZPlayFabMatchmaking.CharToKeyName(c, out text))
            {             {
                int num;                 int num;
                dictionary.TryGetValue(c, out num);                 dictionary.TryGetValue(c, out num);
                searchData.Add(text, num.ToString());                 searchData.Add(text, num.ToString());
            }             }
        }         }
    }     }
   
    private static string CreateNameSearchFilter(string name)     private static string CreateNameSearchFilter(string name)
    {     {
        Dictionary<char, int> dictionary = ZPlayFabMatchmaking.CreateCharHistogram(name);         Dictionary<char, int> dictionary = ZPlayFabMatchmaking.CreateCharHistogram(name);
        string text = "";         string text = "";
        foreach (char c in name.ToLowerInvariant())         foreach (char c in name.ToLowerInvariant())
        {         {
            string text3;             string text3;
            int num;             int num;
            if (ZPlayFabMatchmaking.CharToKeyName(c, out text3) && dictionary.TryGetValue(c, out num))             if (ZPlayFabMatchmaking.CharToKeyName(c, out text3) && dictionary.TryGetValue(c, out num))
            {             {
                text += string.Format(" and {0} ge {1}", text3, num);                 text += string.Format(" and {0} ge {1}", text3, num);
            }             }
        }         }
        return text;         return text;
    }     }
   
    private static bool CharToKeyName(char ch, out string key)     private static bool CharToKeyName(char ch, out string key)
    {     {
        int num = "eariotnslcudpmhgbfywkvxzjq".IndexOf(ch);         int num = "eariotnslcudpmhgbfywkvxzjq".IndexOf(ch);
        if (num < 0 || num >= 16)         if (num < 0 || num >= 16)
        {         {
            key = null;             key = null;
            return false;             return false;
        }         }
        key = string.Format("number_key{0}", num + 14 + 1);         key = string.Format("number_key{0}", num + 14 + 1);
        return true;         return true;
    }     }
   
    private void CancelPendingSearches()     private void CancelPendingSearches()
    {     {
        foreach (ZPlayFabLobbySearch zplayFabLobbySearch in ZPlayFabMatchmaking.instance.m_activeSearches)         foreach (ZPlayFabLobbySearch zplayFabLobbySearch in ZPlayFabMatchmaking.instance.m_activeSearches)
        {         {
            zplayFabLobbySearch.Cancel();             zplayFabLobbySearch.Cancel();
        }         }
        this.m_pendingSearches.Clear();         this.m_pendingSearches.Clear();
    }     }
   
    private static void FindHostSession(string searchFilter, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction, bool joinLobby)     private static void FindHostSession(string searchFilter, ZPlayFabMatchmakingSuccessCallback successAction, ZPlayFabMatchmakingFailedCallback failedAction, bool joinLobby)
    {     {
        if (joinLobby)         if (joinLobby)
        {         {
            ZPlayFabMatchmaking.instance.CancelPendingSearches();             ZPlayFabMatchmaking.instance.CancelPendingSearches();
            ZPlayFabMatchmaking.instance.m_activeSearches.Add(new ZPlayFabLobbySearch(successAction, failedAction, searchFilter, true));             ZPlayFabMatchmaking.instance.m_activeSearches.Add(new ZPlayFabLobbySearch(successAction, failedAction, searchFilter, true));
            return;             return;
        }         }
        ZPlayFabMatchmaking.instance.m_pendingSearches.Enqueue(new ZPlayFabLobbySearch(successAction, failedAction, searchFilter, false));         ZPlayFabMatchmaking.instance.m_pendingSearches.Enqueue(new ZPlayFabLobbySearch(successAction, failedAction, searchFilter, false));
    }     }
   
    public static void ListServers(string nameFilter, ZPlayFabMatchmakingSuccessCallback serverFoundAction, ZPlayFabMatchmakingFailedCallback listDone, bool listP2P = false)     public static void ListServers(string nameFilter, ZPlayFabMatchmakingSuccessCallback serverFoundAction, ZPlayFabMatchmakingFailedCallback listDone, bool listP2P = false)
    {     {
        ZPlayFabMatchmaking.instance.CancelPendingSearches();         ZPlayFabMatchmaking.instance.CancelPendingSearches();
        string text = (listP2P ? string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]         string text = (listP2P ? string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]
        {         {
            "string_key7",             "string_key7",
            false.ToString(),             false.ToString(),
            "string_key2",             "string_key2",
            true.ToString()             true.ToString()
        }) : string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]         }) : string.Format("{0} eq '{1}' and {2} eq '{3}'", new object[]
        {         {
            "string_key3",             "string_key3",
            true.ToString(),             true.ToString(),
            "string_key2",             "string_key2",
            true.ToString()             true.ToString()
        }));         }));
        if (string.IsNullOrEmpty(nameFilter))         if (string.IsNullOrEmpty(nameFilter))
        {         {
.            text += string.Format(" and {0} eq {1}", "number_key13", 23U);             text += string.Format(" and {0} eq {1}", "number_key13", 27U);
        }         }
        else         else
        {         {
            text += ZPlayFabMatchmaking.CreateNameSearchFilter(nameFilter);             text += ZPlayFabMatchmaking.CreateNameSearchFilter(nameFilter);
        }         }
        if (listP2P)         if (listP2P)
        {         {
            using (HashSet<string>.Enumerator enumerator = ZPlayFabMatchmaking.GetAllFriends().GetEnumerator())             using (HashSet<string>.Enumerator enumerator = ZPlayFabMatchmaking.GetAllFriends().GetEnumerator())
            {             {
                while (enumerator.MoveNext())                 while (enumerator.MoveNext())
                {                 {
                    string text2 = enumerator.Current;                     string text2 = enumerator.Current;
                    string text3 = ZPlayFabMatchmaking.CreateSearchFilter(text, true, text2, PrivilegeManager.CanCrossplay);                     string text3 = ZPlayFabMatchmaking.CreateSearchFilter(text, true, text2, PrivilegeManager.CanCrossplay);
                    ZPlayFabMatchmaking.instance.m_pendingSearches.Enqueue(new ZPlayFabLobbySearch(serverFoundAction, listDone, text3, null, true));                     ZPlayFabMatchmaking.instance.m_pendingSearches.Enqueue(new ZPlayFabLobbySearch(serverFoundAction, listDone, text3, null, true));
                }                 }
                return;                 return;
            }             }
        }         }
        string text4 = ZPlayFabMatchmaking.CreateSearchFilter(text, false, "", PrivilegeManager.CanCrossplay);         string text4 = ZPlayFabMatchmaking.CreateSearchFilter(text, false, "", PrivilegeManager.CanCrossplay);
        ZPlayFabMatchmaking.instance.m_pendingSearches.Enqueue(new ZPlayFabLobbySearch(serverFoundAction, listDone, text4, nameFilter, false));         ZPlayFabMatchmaking.instance.m_pendingSearches.Enqueue(new ZPlayFabLobbySearch(serverFoundAction, listDone, text4, nameFilter, false));
    }     }
   
    private static string CreateSearchFilter(string baseFilter, bool includeFriend, string friend = "", bool isCrossplay = false)     private static string CreateSearchFilter(string baseFilter, bool includeFriend, string friend = "", bool isCrossplay = false)
    {     {
        string text = (isCrossplay ? "None" : PrivilegeManager.GetCurrentPlatform().ToString());         string text = (isCrossplay ? "None" : PrivilegeManager.GetCurrentPlatform().ToString());
        return string.Concat(new string[]         return string.Concat(new string[]
        {         {
            baseFilter,             baseFilter,
            includeFriend ? (" and string_key8 eq '" + friend + "'") : "",             includeFriend ? (" and string_key8 eq '" + friend + "'") : "",
            " and string_key12 eq '",             " and string_key12 eq '",
            text,             text,
            "'"              "'" 
        });         });
    }     }
   
    public static void AddFriend(string xboxUserId)     public static void AddFriend(string xboxUserId)
    {     {
        ZPlayFabMatchmaking.instance.m_friends.Add(xboxUserId);         ZPlayFabMatchmaking.instance.m_friends.Add(xboxUserId);
    }     }
   
    public static bool IsFriendWith(string xboxUserId)     public static bool IsFriendWith(string xboxUserId)
    {     {
        return ZPlayFabMatchmaking.instance.m_friends.Contains(xboxUserId);         return ZPlayFabMatchmaking.instance.m_friends.Contains(xboxUserId);
    }     }
   
    public static HashSet<string> GetAllFriends()     public static HashSet<string> GetAllFriends()
    {     {
        return ZPlayFabMatchmaking.instance.m_friends;         return ZPlayFabMatchmaking.instance.m_friends;
    }     }
   
    public static bool IsJoinCode(string joinString)     public static bool IsJoinCode(string joinString)
    {     {
        int num;         int num;
        return (long)joinString.Length == 6L && int.TryParse(joinString, out num);         return (long)joinString.Length == 6L && int.TryParse(joinString, out num);
    }     }
   
    public static void SetDataPort(int serverPort)     public static void SetDataPort(int serverPort)
    {     {
        if (ZPlayFabMatchmaking.instance != null)         if (ZPlayFabMatchmaking.instance != null)
        {         {
            ZPlayFabMatchmaking.instance.m_serverPort = serverPort;             ZPlayFabMatchmaking.instance.m_serverPort = serverPort;
        }         }
    }     }
   
    public static void OnLogin()     public static void OnLogin()
    {     {
        if (ZPlayFabMatchmaking.instance != null && ZPlayFabMatchmaking.instance.m_pendingRegisterServer != null)         if (ZPlayFabMatchmaking.instance != null && ZPlayFabMatchmaking.instance.m_pendingRegisterServer != null)
        {         {
            ZPlayFabMatchmaking.instance.m_pendingRegisterServer();             ZPlayFabMatchmaking.instance.m_pendingRegisterServer();
            ZPlayFabMatchmaking.instance.m_pendingRegisterServer = null;             ZPlayFabMatchmaking.instance.m_pendingRegisterServer = null;
        }         }
    }     }
   
    internal static void ForwardProgress()     internal static void ForwardProgress()
    {     {
        if (ZPlayFabMatchmaking.instance != null)         if (ZPlayFabMatchmaking.instance != null)
        {         {
            ZPlayFabMatchmaking.instance.StopReconnectNetworkTimer();             ZPlayFabMatchmaking.instance.StopReconnectNetworkTimer();
        }         }
    }     }
   
    private static ZPlayFabMatchmaking m_instance;     private static ZPlayFabMatchmaking m_instance;
   
    private static string m_publicIP = "";     private static string m_publicIP = "";
   
    private static readonly object m_mtx = new object();     private static readonly object m_mtx = new object();
   
    private static Thread m_publicIpLookupThread;     private static Thread m_publicIpLookupThread;
   
    public const uint JoinStringLength = 6U;     public const uint JoinStringLength = 6U;
   
    public const uint MaxPlayers = 10U;     public const uint MaxPlayers = 10U;
   
    internal const int NumSearchPages = 4;     internal const int NumSearchPages = 4;
   
    public const string RemotePlayerIdSearchKey = "string_key1";     public const string RemotePlayerIdSearchKey = "string_key1";
   
    public const string IsActiveSearchKey = "string_key2";     public const string IsActiveSearchKey = "string_key2";
   
    public const string IsCommunityServerSearchKey = "string_key3";     public const string IsCommunityServerSearchKey = "string_key3";
   
    public const string JoinCodeSearchKey = "string_key4";     public const string JoinCodeSearchKey = "string_key4";
   
    public const string ServerNameSearchKey = "string_key5";     public const string ServerNameSearchKey = "string_key5";
   
    public const string GameVersionSearchKey = "string_key6";     public const string GameVersionSearchKey = "string_key6";
   
    public const string IsDedicatedServerSearchKey = "string_key7";     public const string IsDedicatedServerSearchKey = "string_key7";
   
    public const string XboxUserIdSearchKey = "string_key8";     public const string XboxUserIdSearchKey = "string_key8";
   
    public const string CreatedSearchKey = "string_key9";     public const string CreatedSearchKey = "string_key9";
   
    public const string ServerIpSearchKey = "string_key10";     public const string ServerIpSearchKey = "string_key10";
   
    public const string PageSearchKey = "number_key11";     public const string PageSearchKey = "number_key11";
   
    public const string PlatformRestrictionKey = "string_key12";     public const string PlatformRestrictionKey = "string_key12";
   
    public const string NetworkVersionSearchKey = "number_key13";     public const string NetworkVersionSearchKey = "number_key13";
   
    public const string ModifiersSearchKey = "string_key14";     public const string ModifiersSearchKey = "string_key14";
   
    private const int NumStringSearchKeys = 14;     private const int NumStringSearchKeys = 14;
   
    private ZPlayFabMatchmaking.State m_state;     private ZPlayFabMatchmaking.State m_state;
   
    private PlayFabMatchmakingServerData m_serverData;     private PlayFabMatchmakingServerData m_serverData;
   
    private int m_retries;     private int m_retries;
   
    private float m_retryIn = -1f;     private float m_retryIn = -1f;
   
    private const float LostNetworkRetryDuration = 30f;     private const float LostNetworkRetryDuration = 30f;
   
    private float m_lostNetworkRetryIn = -1f;     private float m_lostNetworkRetryIn = -1f;
   
    private bool m_isConnectingToNetwork;     private bool m_isConnectingToNetwork;
   
    private bool m_isResettingNetwork;     private bool m_isResettingNetwork;
   
    private float m_submitBackgroundSearchIn = -1f;     private float m_submitBackgroundSearchIn = -1f;
   
    private int m_serverPort = -1;     private int m_serverPort = -1;
   
    private float m_refreshLobbyTimer;     private float m_refreshLobbyTimer;
   
    private const float RefreshLobbyDurationMin = 540f;     private const float RefreshLobbyDurationMin = 540f;
   
    private const float RefreshLobbyDurationMax = 840f;     private const float RefreshLobbyDurationMax = 840f;
   
    private const float DurationBetwenBackgroundSearches = 2f;     private const float DurationBetwenBackgroundSearches = 2f;
   
    private readonly List<ZPlayFabLobbySearch> m_activeSearches = new List<ZPlayFabLobbySearch>();     private readonly List<ZPlayFabLobbySearch> m_activeSearches = new List<ZPlayFabLobbySearch>();
   
    private readonly Queue<ZPlayFabLobbySearch> m_pendingSearches = new Queue<ZPlayFabLobbySearch>();     private readonly Queue<ZPlayFabLobbySearch> m_pendingSearches = new Queue<ZPlayFabLobbySearch>();
   
    private readonly HashSet<string> m_friends = new HashSet<string>();     private readonly HashSet<string> m_friends = new HashSet<string>();
   
    private Action m_pendingRegisterServer;     private Action m_pendingRegisterServer;
   
    private enum State     private enum State
    {     {
        Uninitialized,         Uninitialized,
        Creating,         Creating,
        RegenerateJoinCode,         RegenerateJoinCode,
        Active         Active
    }     }
} }