Exemple #1
0
        public GameInitDelegate([ObjectCreator.Param] Widget widget)
        {
            Info = (widget as GameInitInfoWidget);

            Game.ConnectionStateChanged += orderManager =>
            {
                Widget.CloseWindow();
                switch( orderManager.Connection.ConnectionState )
                {
                    case ConnectionState.PreConnecting:
                        Widget.OpenWindow("MAINMENU_BG");
                        break;
                    case ConnectionState.Connecting:
                        Widget.OpenWindow( "CONNECTING_BG",
                            new Dictionary<string, object> { { "host", orderManager.Host }, { "port", orderManager.Port } } );
                        break;
                    case ConnectionState.NotConnected:
                        Widget.OpenWindow( "CONNECTION_FAILED_BG",
                            new Dictionary<string, object> { { "orderManager", orderManager } } );
                        break;
                    case ConnectionState.Connected:
                        var lobby = Game.OpenWindow(orderManager.world, "SERVER_LOBBY");
                        lobby.GetWidget<ChatDisplayWidget>("CHAT_DISPLAY").ClearChat();
                        lobby.GetWidget("CHANGEMAP_BUTTON").Visible = true;
                        lobby.GetWidget("LOCKTEAMS_CHECKBOX").Visible = true;
                        lobby.GetWidget("ALLOWCHEATS_CHECKBOX").Visible = true;
                        lobby.GetWidget("DISCONNECT_BUTTON").Visible = true;
                        break;
                }
            };

            if (FileSystem.Exists(Info.TestFile))
                ContinueLoading(widget);
            else
            {
                MainMenuButtonsDelegate.DisplayModSelector();
                ShowInstallMethodDialog();
            }
        }
Exemple #2
0
 public GameInitDelegate([ObjectCreator.Param] Widget widget)
 {
     Info = (widget as GameInitInfoWidget);
 }