/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------------------------------------------- void Play() { if (LobbyClient.IsConnected) { string gameType = (m_GameType == E_MPGameType.ZoneControl) ? "zc" : "dm"; bool voiceChat = GetPreferVoiceChat(); m_LastJoinRequestId = m_NextJoinRequestId; m_NextJoinRequestId += 1; bool result; if (m_OtherPlayers == null) { result = LobbyClient.FindServerForOnePlayer(m_LastJoinRequestId, gameType, voiceChat); } else { result = LobbyClient.FindServerForGang(m_LastJoinRequestId, gameType, voiceChat, m_OtherPlayers); } if (!result) { if (LobbyClient.GameVersionNoLongerSupported) { Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109056], TextDatabase.instance[02040007], OnMessageBoxEvent); } else { Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109057], TextDatabase.instance[02040007], OnMessageBoxEvent); } return; } m_IsLookingForServer = true; GuiScreenLobby lobby = Owner as GuiScreenLobby; if (lobby != null) { lobby.RegisterRequest(m_LastJoinRequestId); } Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109058], TextDatabase.instance[02040009], OnMessageBoxEvent); } else { LobbyClient.ToLobbyConnectionResult += OnLobbyConnectionResult; m_IsConnectingToLobby = true; LobbyClient.ConnectToLobby(CloudUser.instance.region); Popup.Show(TextDatabase.instance[0109061], TextDatabase.instance[0109059], TextDatabase.instance[02040009], OnMessageBoxEvent); } }
bool GetPreferVoiceChat() { #if UNITY_STANDALONE_WIN string[] arguments = System.Environment.GetCommandLineArgs(); if (arguments != null) { foreach (string str in arguments) { if (str.StartsWith("-voice=")) { string[] param = str.Split('='); return(System.Convert.ToInt32(param[1]) == 1); } } } #endif GuiScreenLobby lobby = Owner as GuiScreenLobby; return(lobby ? lobby.PreferVoiceChat : false); }