Пример #1
0
 public PrivateMessagingWindow(WindowManager windowManager,
                               CnCNetManager connectionManager, GameCollection gameCollection, CnCNetUserData cncnetUserData) : base(windowManager)
 {
     this.gameCollection    = gameCollection;
     this.connectionManager = connectionManager;
     this.cncnetUserData    = cncnetUserData;
 }
Пример #2
0
 public TopBar(
     WindowManager windowManager,
     CnCNetManager connectionManager,
     PrivateMessageHandler privateMessageHandler
     ) : base(windowManager)
 {
     downTimeWaitTime           = TimeSpan.FromSeconds(DOWN_TIME_WAIT_SECONDS);
     this.connectionManager     = connectionManager;
     this.privateMessageHandler = privateMessageHandler;
 }
Пример #3
0
        public PrivateMessagingWindow(WindowManager windowManager,
                                      CnCNetManager connectionManager, GameCollection gameCollection, CnCNetUserData cncnetUserData) : base(windowManager)
        {
            this.gameCollection    = gameCollection;
            this.connectionManager = connectionManager;
            this.cncnetUserData    = cncnetUserData;

            connectionManager.UserAdded            += ConnectionManager_UserAdded;
            connectionManager.UserRemoved          += ConnectionManager_UserRemoved;
            connectionManager.UserGameIndexUpdated += ConnectionManager_UserGameIndexUpdated;
        }
        public PrivateMessagingWindow(WindowManager windowManager,
                                      CnCNetManager connectionManager, GameCollection gameCollection) : base(windowManager)
        {
            this.gameCollection    = gameCollection;
            this.connectionManager = connectionManager;

            connectionManager.UserAdded            += ConnectionManager_UserAdded;
            connectionManager.UserRemoved          += ConnectionManager_UserRemoved;
            connectionManager.UserGameIndexUpdated += ConnectionManager_UserGameIndexUpdated;

            WindowManager.GameClosing += WindowManager_GameClosing;
        }
Пример #5
0
 /// <summary>
 /// Creates a new instance of the main menu.
 /// </summary>
 public MainMenu(WindowManager windowManager, SkirmishLobby skirmishLobby,
                 LANLobby lanLobby, TopBar topBar, OptionsWindow optionsWindow,
                 CnCNetLobby cncnetLobby,
                 CnCNetManager connectionManager) : base(windowManager)
 {
     this.skirmishLobby       = skirmishLobby;
     this.lanLobby            = lanLobby;
     this.topBar              = topBar;
     this.connectionManager   = connectionManager;
     this.optionsWindow       = optionsWindow;
     cncnetLobby.UpdateCheck += CncnetLobby_UpdateCheck;
 }
Пример #6
0
        public TunnelHandler(WindowManager wm, CnCNetManager connectionManager) : base(wm.Game)
        {
            this.wm = wm;
            this.connectionManager = connectionManager;

            wm.Game.Components.Add(this);

            Enabled = false;

            connectionManager.Connected      += ConnectionManager_Connected;
            connectionManager.Disconnected   += ConnectionManager_Disconnected;
            connectionManager.ConnectionLost += ConnectionManager_ConnectionLost;
        }
Пример #7
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;
 }
Пример #8
0
 /// <summary>
 /// Creates a new instance of the main menu.
 /// </summary>
 public MainMenu(WindowManager windowManager, SkirmishLobby skirmishLobby,
                 LANLobby lanLobby, TopBar topBar, OptionsWindow optionsWindow,
                 CnCNetLobby cncnetLobby,
                 CnCNetManager connectionManager, DiscordHandler discordHandler) : base(windowManager)
 {
     this.skirmishLobby       = skirmishLobby;
     this.lanLobby            = lanLobby;
     this.topBar              = topBar;
     this.connectionManager   = connectionManager;
     this.optionsWindow       = optionsWindow;
     this.cncnetLobby         = cncnetLobby;
     this.discordHandler      = discordHandler;
     cncnetLobby.UpdateCheck += CncnetLobby_UpdateCheck;
     isMediaPlayerAvailable   = IsMediaPlayerAvailable();
 }
        public GlobalContextMenu(
            WindowManager windowManager,
            CnCNetManager connectionManager,
            CnCNetUserData cncnetUserData,
            PrivateMessagingWindow pmWindow
            ) : base(windowManager)
        {
            this.connectionManager = connectionManager;
            this.cncnetUserData    = cncnetUserData;
            this.pmWindow          = pmWindow;

            Name            = nameof(GlobalContextMenu);
            ClientRectangle = new Rectangle(0, 0, 150, 2);
            Enabled         = false;
            Visible         = false;
        }
        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)
            };
        }
Пример #11
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;
        }
Пример #12
0
 public RecentPlayerTable(WindowManager windowManager, CnCNetManager connectionManager) : base(windowManager)
 {
     this.connectionManager = connectionManager;
 }