private void OnLobbySessionSlotSelected(LobbySessionSlot lobbySessionSlot)
        {
            statusLabel.SetString(connectionStartString);

            UpdateInputState(false);

            var clientConnectionToken = new ClientConnectionToken
            {
                PrefferedClass = (ClassType)PlayerPrefs.GetInt(UnitUtils.PreferredClassPrefName, 0),
                Name           = playerNameInput.text
            };

            photonReference.StartConnection(lobbySessionSlot.UdpSession, clientConnectionToken, OnConnectSuccess, OnConnectFail);

            void OnConnectFail(ClientConnectFailReason failReason)
            {
                statusLabel.SetString(LocalizationReference.Localize(failReason));

                UpdateInputState(true);
            }

            void OnConnectSuccess()
            {
                statusLabel.SetString(connectSuccessString);

                UpdateInputState(true);

                WindowController.HidePanel <LobbyPanel>();
            }
        }
Beispiel #2
0
        private void OnLobbySessionSlotSelected(LobbySessionSlot lobbySessionSlot)
        {
            statusLabel.SetString(connectionStartString);

            UpdateInputState(false);

            photonReference.StartConnection(lobbySessionSlot.UdpSession, new ClientConnectionToken(playerNameInput.text), OnConnectSuccess, OnConnectFail);

            void OnConnectFail(ClientConnectFailReason failReason)
            {
                statusLabel.SetString(LocalizationReference.Localize(failReason));

                UpdateInputState(true);
            }

            void OnConnectSuccess()
            {
                statusLabel.SetString(connectSuccessString);

                UpdateInputState(true);

                WindowController.HidePanel <LobbyPanel>();
            }
        }