Ejemplo n.º 1
0
 public PrivateMessagingWindow(WindowManager windowManager,
                               CnCNetManager connectionManager, GameCollection gameCollection, CnCNetUserData cncnetUserData) : base(windowManager)
 {
     this.gameCollection    = gameCollection;
     this.connectionManager = connectionManager;
     this.cncnetUserData    = cncnetUserData;
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
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;
        }