Exemple #1
0
        public override void Initialize()
        {
            EnableStartLocationSelection = true;

#if !WINDOWSGL
            disposeTextures = !UserINISettings.Instance.PreloadMapPreviews;
#endif
            startingLocationIndicators = new PlayerLocationIndicator[MAX_STARTING_LOCATIONS];

            Color nameBackgroundColor = AssetLoader.GetRGBAColorFromString(
                ClientConfiguration.Instance.MapPreviewNameBackgroundColor);

            Color nameBorderColor = AssetLoader.GetRGBAColorFromString(
                ClientConfiguration.Instance.MapPreviewNameBorderColor);

            contextMenu     = new XNAContextMenu(WindowManager);
            contextMenu.Tag = -1;

            double angularVelocity         = gameOptionsIni.GetDoubleValue("General", "StartingLocationAngularVelocity", 0.015);
            double reservedAngularVelocity = gameOptionsIni.GetDoubleValue("General", "ReservedStartingLocationAngularVelocity", -0.0075);

            Color hoverRemapColor = AssetLoader.GetRGBAColorFromString(ClientConfiguration.Instance.MapPreviewStartingLocationHoverRemapColor);

            // Init starting location indicators
            for (int i = 0; i < MAX_STARTING_LOCATIONS; i++)
            {
                PlayerLocationIndicator indicator = new PlayerLocationIndicator(WindowManager, mpColors,
                                                                                nameBackgroundColor, nameBorderColor, contextMenu);
                indicator.FontIndex               = FontIndex;
                indicator.Visible                 = false;
                indicator.Enabled                 = false;
                indicator.AngularVelocity         = angularVelocity;
                indicator.HoverRemapColor         = hoverRemapColor;
                indicator.ReversedAngularVelocity = reservedAngularVelocity;
                indicator.WaypointTexture         = AssetLoader.LoadTexture(string.Format("slocindicator{0}.png", i + 1));
                indicator.Tag         = i;
                indicator.LeftClick  += Indicator_LeftClick;
                indicator.RightClick += Indicator_RightClick;

                startingLocationIndicators[i] = indicator;

                AddChild(indicator);
            }

            contextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2);
            AddChild(contextMenu);
            contextMenu.Disable();

            briefingBox = new CoopBriefingBox(WindowManager);
            AddChild(briefingBox);
            briefingBox.Disable();

            sndClickSound = new EnhancedSoundEffect("button.wav");

            sndDropdownSound = new EnhancedSoundEffect("dropdown.wav");

            base.Initialize();

            ClientRectangleUpdated += (s, e) => UpdateMap();
        }
        public override void Initialize()
        {
            EnableStartLocationSelection = true;

            BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);

#if !WINDOWSGL
            disposeTextures = !UserINISettings.Instance.PreloadMapPreviews;
#endif

            contextMenu                 = new XNAContextMenu(WindowManager);
            contextMenu.Tag             = -1;
            contextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2);
            AddChild(contextMenu);
            contextMenu.Disable();

            sndClickSound = new EnhancedSoundEffect("button.wav");

            sndDropdownSound = new EnhancedSoundEffect("dropdown.wav");

            base.Initialize();
        }
Exemple #3
0
 public PlayerLocationIndicator(WindowManager windowManager, List <MultiplayerColor> mpColors,
                                Color nameBackgroundColor, Color nameBorderColor, XNAContextMenu contextMenu) : base(windowManager)
 {
     this.mpColors            = mpColors;
     this.nameBackgroundColor = nameBackgroundColor;
     this.nameBorderColor     = nameBorderColor;
     this.contextMenu         = contextMenu;
     HoverRemapColor          = Color.White;
 }
Exemple #4
0
        public override void Initialize()
        {
            Name              = "PrivateMessagingWindow";
            ClientRectangle   = new Rectangle(0, 0, 600, 600);
            BackgroundTexture = AssetLoader.LoadTextureUncached("privatemessagebg.png");

            unknownGameIcon = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.unknownicon);
            adminGameIcon   = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.cncneticon);

            personalMessageColor  = AssetLoader.GetColorFromString(ClientConfiguration.Instance.SentPMColor);
            otherUserMessageColor = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor);

            lblPrivateMessaging           = new XNALabel(WindowManager);
            lblPrivateMessaging.Name      = "lblPrivateMessaging";
            lblPrivateMessaging.FontIndex = 1;
            lblPrivateMessaging.Text      = "PRIVATE MESSAGING";

            AddChild(lblPrivateMessaging);
            lblPrivateMessaging.CenterOnParent();
            lblPrivateMessaging.ClientRectangle = new Rectangle(
                lblPrivateMessaging.X, 12,
                lblPrivateMessaging.Width,
                lblPrivateMessaging.Height);

            tabControl                 = new XNAClientTabControl(WindowManager);
            tabControl.Name            = "tabControl";
            tabControl.ClientRectangle = new Rectangle(60, 50, 0, 0);
            tabControl.ClickSound      = new EnhancedSoundEffect("button.wav");
            tabControl.FontIndex       = 1;
            tabControl.AddTab("Messages", 160);
            tabControl.AddTab("Friend List", 160);
            tabControl.AddTab("All Players", 160);
            tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;

            lblPlayers                 = new XNALabel(WindowManager);
            lblPlayers.Name            = "lblPlayers";
            lblPlayers.ClientRectangle = new Rectangle(12, tabControl.Bottom + 24, 0, 0);
            lblPlayers.FontIndex       = 1;
            lblPlayers.Text            = "PLAYERS:";

            lbUserList                 = new XNAListBox(WindowManager);
            lbUserList.Name            = "lbUserList";
            lbUserList.ClientRectangle = new Rectangle(lblPlayers.X,
                                                       lblPlayers.Bottom + 6,
                                                       150, Height - lblPlayers.Bottom - 18);
            lbUserList.RightClick             += LbUserList_RightClick;
            lbUserList.SelectedIndexChanged   += LbUserList_SelectedIndexChanged;
            lbUserList.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbUserList.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            lblMessages                 = new XNALabel(WindowManager);
            lblMessages.Name            = "lblMessages";
            lblMessages.ClientRectangle = new Rectangle(lbUserList.Right + 12,
                                                        lblPlayers.Y, 0, 0);
            lblMessages.FontIndex = 1;
            lblMessages.Text      = "MESSAGES:";

            lbMessages                 = new ChatListBox(WindowManager);
            lbMessages.Name            = "lbMessages";
            lbMessages.ClientRectangle = new Rectangle(lblMessages.X,
                                                       lbUserList.Y,
                                                       Width - lblMessages.X - 12,
                                                       lbUserList.Height - 25);
            lbMessages.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbMessages.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            tbMessageInput                 = new XNATextBox(WindowManager);
            tbMessageInput.Name            = "tbMessageInput";
            tbMessageInput.ClientRectangle = new Rectangle(lbMessages.X,
                                                           lbMessages.Bottom + 6, lbMessages.Width, 19);
            tbMessageInput.EnterPressed     += TbMessageInput_EnterPressed;
            tbMessageInput.MaximumTextLength = 200;
            tbMessageInput.Enabled           = false;

            playerContextMenu                 = new XNAContextMenu(WindowManager);
            playerContextMenu.Name            = "playerContextMenu";
            playerContextMenu.ClientRectangle = new Rectangle(0, 0, 150, 2);
            playerContextMenu.Enabled         = false;
            playerContextMenu.Visible         = false;
            playerContextMenu.AddItem("Add Friend", PlayerContextMenu_ToggleFriend);

            notificationBox            = new PrivateMessageNotificationBox(WindowManager);
            notificationBox.Enabled    = false;
            notificationBox.Visible    = false;
            notificationBox.LeftClick += NotificationBox_LeftClick;

            AddChild(tabControl);
            AddChild(lblPlayers);
            AddChild(lbUserList);
            AddChild(lblMessages);
            AddChild(lbMessages);
            AddChild(tbMessageInput);
            AddChild(playerContextMenu);
            WindowManager.AddAndInitializeControl(notificationBox);

            base.Initialize();

            CenterOnParent();

            tabControl.SelectedTab = 0;

            connectionManager.PrivateMessageReceived += ConnectionManager_PrivateMessageReceived;

            sndMessageSound = new EnhancedSoundEffect("message.wav");

            sndPrivateMessageSound = new EnhancedSoundEffect("pm.wav");

            sndMessageSound.Enabled = UserINISettings.Instance.MessageSound;

            GameProcessLogic.GameProcessExited += SharedUILogic_GameProcessExited;
        }