示例#1
0
        public Protocol1ArenaEngine()
        {
            ChatServer  = new AsyncTcpServer <PlayerState>();
            ChatHandler = new SessionHandler(this);

            TunnelServer    = new AsyncUdpServer <TunnelState>();
            MyTunnelHandler = new TunnelHandler(this);

            MaxPlayers = 4;
            MaxRooms   = 1;
        }
示例#2
0
 public CnCNetLobby(WindowManager windowManager, CnCNetManager connectionManager,
                    CnCNetGameLobby gameLobby, CnCNetGameLoadingLobby gameLoadingLobby,
                    TopBar topBar, PrivateMessagingWindow pmWindow, TunnelHandler tunnelHandler,
                    GameCollection gameCollection)
     : base(windowManager)
 {
     this.connectionManager = connectionManager;
     this.gameLobby         = gameLobby;
     this.gameLoadingLobby  = gameLoadingLobby;
     this.tunnelHandler     = tunnelHandler;
     this.topBar            = topBar;
     this.pmWindow          = pmWindow;
     this.gameCollection    = gameCollection;
 }
示例#3
0
        public TunnelListBox(WindowManager windowManager, TunnelHandler tunnelHandler) : base(windowManager)
        {
            this.tunnelHandler = tunnelHandler;

            tunnelHandler.TunnelsRefreshed += TunnelHandler_TunnelsRefreshed;
            tunnelHandler.TunnelPinged     += TunnelHandler_TunnelPinged;

            SelectedIndexChanged += TunnelListBox_SelectedIndexChanged;

            Width  = 466;
            Height = 200;
            PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            AddColumn("Name", 230);
            AddColumn("Official", 70);
            AddColumn("Ping", 76);
            AddColumn("Players", 90);
            AllowRightClickUnselect = false;
            AllowKeyboardInput      = true;
        }
        public CnCNetGameLoadingLobby(WindowManager windowManager, TopBar topBar,
                                      CnCNetManager connectionManager, TunnelHandler tunnelHandler,
                                      List <GameMode> gameModes) : base(windowManager)
        {
            this.connectionManager = connectionManager;
            this.tunnelHandler     = tunnelHandler;
            this.gameModes         = gameModes;
            this.topBar            = topBar;

            ctcpCommandHandlers = new CommandHandlerBase[]
            {
                new NoParamCommandHandler(NOT_ALL_PLAYERS_PRESENT_CTCP_COMMAND, HandleNotAllPresentNotification),
                new NoParamCommandHandler(GET_READY_CTCP_COMMAND, HandleGetReadyNotification),
                new StringCommandHandler(FILE_HASH_CTCP_COMMAND, HandleFileHashCommand),
                new StringCommandHandler(INVALID_FILE_HASH_CTCP_COMMAND, HandleCheaterNotification),
                new IntCommandHandler(TUNNEL_PING_CTCP_COMMAND, HandleTunnelPingNotification),
                new StringCommandHandler(OPTIONS_CTCP_COMMAND, HandleOptionsMessage),
                new NoParamCommandHandler(INVALID_SAVED_GAME_INDEX_CTCP_COMMAND, HandleInvalidSaveIndexCommand),
                new StringCommandHandler(START_GAME_CTCP_COMMAND, HandleStartGameCommand),
                new IntCommandHandler(PLAYER_READY_CTCP_COMMAND, HandlePlayerReadyRequest)
            };
        }
示例#5
0
 public GameCreationWindow(WindowManager windowManager, TunnelHandler tunnelHandler)
     : base(windowManager)
 {
     this.tunnelHandler = tunnelHandler;
 }
 public TunnelSelectionWindow(WindowManager windowManager, TunnelHandler tunnelHandler) : base(windowManager)
 {
     this.tunnelHandler = tunnelHandler;
 }
示例#7
0
        private void Finish()
        {
            ProgramConstants.GAME_VERSION = ClientConfiguration.Instance.ModMode ?
                                            "N/A" : CUpdater.GameVersion;

            DiscordHandler discordHandler = null;

            if (!string.IsNullOrEmpty(ClientConfiguration.Instance.DiscordAppId))
            {
                discordHandler = new DiscordHandler(WindowManager);
            }

            var gameCollection = new GameCollection();

            gameCollection.Initialize(GraphicsDevice);

            var lanLobby = new LANLobby(WindowManager, gameCollection, mapLoader.GameModes, mapLoader, discordHandler);

            var cncnetUserData = new CnCNetUserData(WindowManager);
            var cncnetManager  = new CnCNetManager(WindowManager, gameCollection);
            var tunnelHandler  = new TunnelHandler(WindowManager, cncnetManager);


            var topBar = new TopBar(WindowManager, cncnetManager);

            var optionsWindow = new OptionsWindow(WindowManager, gameCollection, topBar);

            var pmWindow = new PrivateMessagingWindow(WindowManager,
                                                      cncnetManager, gameCollection, cncnetUserData);

            privateMessagingPanel = new PrivateMessagingPanel(WindowManager);

            var cncnetGameLobby = new CnCNetGameLobby(WindowManager,
                                                      "MultiplayerGameLobby", topBar, mapLoader.GameModes, cncnetManager, tunnelHandler, gameCollection, cncnetUserData, mapLoader, discordHandler);
            var cncnetGameLoadingLobby = new CnCNetGameLoadingLobby(WindowManager,
                                                                    topBar, cncnetManager, tunnelHandler, mapLoader.GameModes, gameCollection, discordHandler);
            var cncnetLobby = new CnCNetLobby(WindowManager, cncnetManager,
                                              cncnetGameLobby, cncnetGameLoadingLobby, topBar, pmWindow, tunnelHandler,
                                              gameCollection, cncnetUserData);
            var gipw = new GameInProgressWindow(WindowManager);

            var skirmishLobby = new SkirmishLobby(WindowManager, topBar, mapLoader.GameModes, discordHandler);

            topBar.SetSecondarySwitch(cncnetLobby);

            var mainMenu = new MainMenu(WindowManager, skirmishLobby, lanLobby,
                                        topBar, optionsWindow, cncnetLobby, cncnetManager, discordHandler);

            WindowManager.AddAndInitializeControl(mainMenu);

            DarkeningPanel.AddAndInitializeWithControl(WindowManager, skirmishLobby);

            DarkeningPanel.AddAndInitializeWithControl(WindowManager, cncnetGameLoadingLobby);

            DarkeningPanel.AddAndInitializeWithControl(WindowManager, cncnetGameLobby);

            DarkeningPanel.AddAndInitializeWithControl(WindowManager, cncnetLobby);

            DarkeningPanel.AddAndInitializeWithControl(WindowManager, lanLobby);

            DarkeningPanel.AddAndInitializeWithControl(WindowManager, optionsWindow);

            WindowManager.AddAndInitializeControl(privateMessagingPanel);
            privateMessagingPanel.AddChild(pmWindow);

            topBar.SetTertiarySwitch(pmWindow);
            topBar.SetOptionsWindow(optionsWindow);

            WindowManager.AddAndInitializeControl(gipw);
            skirmishLobby.Disable();
            cncnetLobby.Disable();
            cncnetGameLobby.Disable();
            cncnetGameLoadingLobby.Disable();
            lanLobby.Disable();
            pmWindow.Disable();
            optionsWindow.Disable();

            WindowManager.AddAndInitializeControl(topBar);
            topBar.AddPrimarySwitchable(mainMenu);

            mainMenu.PostInit();

            if (UserINISettings.Instance.AutomaticCnCNetLogin &&
                NameValidator.IsNameValid(ProgramConstants.PLAYERNAME) == null)
            {
                cncnetManager.Connect();
            }

            WindowManager.RemoveControl(this);

            Cursor.Visible = visibleSpriteCursor;
        }