Пример #1
0
        public void RunCurrentselected()
        {
            switch (currentIndex)
            {
            case 0:
            {
                // Create new lobby
                DisableKeyboard = !DisableKeyboard;
                loader          = new Loader <List <LobbyInfo> >("Creating lobby",
                                                                 () => {
                        ClientProtocol.CreateLobby();
                        return(null);
                    },
                                                                 (success) => ParentState._context.TransitionTo(new LobbyState(Game))
                                                                 );
            }
            break;

            case 1:
            {
                // Join existing lobby
                loader = new Loader <List <LobbyInfo> >("Loading lobbies",
                                                        () => ClientProtocol.GetLobbies(),
                                                        (lobbies) => {
                        if (lobbies.Count != 0)
                        {
                            DisableKeyboard = !DisableKeyboard;
                            ParentState._context.TransitionTo(new SelectLobbyState(Game));
                        }
                        else
                        {
                            var info     = clientInformation.GetComponent <Text>();
                            info.Message = "No existing lobbies";
                            loader       = null;
                        }
                    }
                                                        );
            }
            break;

            default:
                break;
            }
        }