예제 #1
0
		public EOPartyPanel(XNAPanel parent)
			: base(null, null, parent)
		{
			_setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

			m_removeTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 43);
			m_buttons = new List<XNAButton>();
			
			//will tint this different colors for health bar and fill a rectangle
			m_healthBar = new Texture2D[4];
			m_healthBar[HP_OUTLINE] = Game.Content.Load<Texture2D>("Party\\hp-outline");
			m_healthBar[HP_RED] = Game.Content.Load<Texture2D>("Party\\hp-red");
			m_healthBar[HP_YELLOW] = Game.Content.Load<Texture2D>("Party\\hp-yellow");
			m_healthBar[HP_GREEN] = Game.Content.Load<Texture2D>("Party\\hp-green");

			m_numMembers = new XNALabel(new Rectangle(455, 2, 27, 14), Constants.FontSize08pt5)
			{
				AutoSize = false,
				ForeColor = Constants.LightGrayText,
				TextAlign = LabelAlignment.MiddleRight
			};
			m_numMembers.SetParent(this);

			m_scrollBar = new ScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
			{
				LinesToRender = 7,
				Visible = true
			};
			m_scrollBar.SetParent(this);
			World.IgnoreDialogs(m_scrollBar);
		}
        private XNAPanel CreateColumnHeader(string headerText)
        {
            XNALabel xnaLabel = new XNALabel(WindowManager);

            xnaLabel.FontIndex = HeaderFontIndex;
            xnaLabel.X         = 3;
            xnaLabel.Y         = 2;
            xnaLabel.Text      = headerText;
            XNAPanel header = new XNAPanel(WindowManager);

            header.Height = xnaLabel.Height + 3;
            var width = Width / 3;

            if (DrawListBoxBorders)
            {
                header.Width = width + 1;
            }
            else
            {
                header.Width = width;
            }
            header.AddChild(xnaLabel);

            return(header);
        }
예제 #3
0
        public EOPartyPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            m_removeTexture = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 43);
            m_buttons = new List<XNAButton>();

            //will tint this different colors for health bar and fill a rectangle
            m_healthBar = new Texture2D[4];
            m_healthBar[HP_OUTLINE] = Game.Content.Load<Texture2D>("Party\\hp-outline");
            m_healthBar[HP_RED] = Game.Content.Load<Texture2D>("Party\\hp-red");
            m_healthBar[HP_YELLOW] = Game.Content.Load<Texture2D>("Party\\hp-yellow");
            m_healthBar[HP_GREEN] = Game.Content.Load<Texture2D>("Party\\hp-green");

            m_numMembers = new XNALabel(new Rectangle(455, 2, 27, 14), "Microsoft Sans Serif", 8.5f)
            {
                AutoSize = false,
                ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8),
                TextAlign = System.Drawing.ContentAlignment.MiddleRight
            };
            m_numMembers.SetParent(this);

            m_scrollBar = new EOScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), EOScrollBar.ScrollColors.LightOnMed)
            {
                LinesToRender = 7,
                Visible = true
            };
            m_scrollBar.SetParent(this);
            World.IgnoreDialogs(m_scrollBar);
        }
예제 #4
0
        public EOPartyPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            m_removeTexture = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 43);
            m_buttons       = new List <XNAButton>();

            //will tint this different colors for health bar and fill a rectangle
            m_healthBar             = new Texture2D[4];
            m_healthBar[HP_OUTLINE] = Game.Content.Load <Texture2D>("Party\\hp-outline");
            m_healthBar[HP_RED]     = Game.Content.Load <Texture2D>("Party\\hp-red");
            m_healthBar[HP_YELLOW]  = Game.Content.Load <Texture2D>("Party\\hp-yellow");
            m_healthBar[HP_GREEN]   = Game.Content.Load <Texture2D>("Party\\hp-green");

            m_numMembers = new XNALabel(new Rectangle(455, 2, 27, 14), "Microsoft Sans Serif", 8.5f)
            {
                AutoSize  = false,
                ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8),
                TextAlign = System.Drawing.ContentAlignment.MiddleRight
            };
            m_numMembers.SetParent(this);

            m_scrollBar = new EOScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), EOScrollBar.ScrollColors.LightOnMed)
            {
                LinesToRender = 7,
                Visible       = true
            };
            m_scrollBar.SetParent(this);
            World.IgnoreDialogs(m_scrollBar);
        }
예제 #5
0
        public OldEOPartyPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            m_removeTexture = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 43);
            m_buttons       = new List <XNAButton>();

            //will tint this different colors for health bar and fill a rectangle
            m_healthBar             = new Texture2D[4];
            m_healthBar[HP_OUTLINE] = Game.Content.Load <Texture2D>("Party\\hp-outline");
            m_healthBar[HP_RED]     = Game.Content.Load <Texture2D>("Party\\hp-red");
            m_healthBar[HP_YELLOW]  = Game.Content.Load <Texture2D>("Party\\hp-yellow");
            m_healthBar[HP_GREEN]   = Game.Content.Load <Texture2D>("Party\\hp-green");

            m_numMembers = new XNALabel(new Rectangle(455, 2, 27, 14), Constants.FontSize08pt5)
            {
                AutoSize  = false,
                ForeColor = ColorConstants.LightGrayText,
                TextAlign = LabelAlignment.MiddleRight
            };
            m_numMembers.SetParent(this);

            m_scrollBar = new OldScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
            {
                LinesToRender = 7,
                Visible       = true
            };
            m_scrollBar.SetParent(this);
            OldWorld.IgnoreDialogs(m_scrollBar);
        }
        public override void Initialize()
        {
            Name = "PrivateMessageNotificationBox";
            BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 196), 1, 1);
            ClientRectangle         = new Rectangle(WindowManager.RenderResolutionX - 300, -100, 300, 100);
            PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            XNALabel lblHeader = new XNALabel(WindowManager);

            lblHeader.Name      = "lblHeader";
            lblHeader.FontIndex = 1;
            lblHeader.Text      = "PRIVATE MESSAGE";
            AddChild(lblHeader);
            lblHeader.CenterOnParent();
            lblHeader.ClientRectangle = new Rectangle(lblHeader.X,
                                                      6, lblHeader.Width, lblHeader.Height);

            XNAPanel linePanel = new XNAPanel(WindowManager);

            linePanel.Name            = "linePanel";
            linePanel.ClientRectangle = new Rectangle(0, Height - 20, Width, 1);

            XNALabel lblHint = new XNALabel(WindowManager);

            lblHint.Name       = "lblHint";
            lblHint.RemapColor = UISettings.ActiveSettings.SubtleTextColor;
            lblHint.Text       = "Press F4 to respond";

            AddChild(lblHint);
            lblHint.CenterOnParent();
            lblHint.ClientRectangle = new Rectangle(lblHint.X,
                                                    linePanel.Y + 3,
                                                    lblHint.Width, lblHint.Height);

            gameIconPanel                   = new XNAPanel(WindowManager);
            gameIconPanel.Name              = "gameIconPanel";
            gameIconPanel.ClientRectangle   = new Rectangle(12, 30, 16, 16);
            gameIconPanel.DrawBorders       = false;
            gameIconPanel.BackgroundTexture = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.dtaicon);

            lblSender                 = new XNALabel(WindowManager);
            lblSender.Name            = "lblSender";
            lblSender.FontIndex       = 1;
            lblSender.ClientRectangle = new Rectangle(gameIconPanel.Right + 3,
                                                      gameIconPanel.Y, 0, 0);
            lblSender.Text = "Rampastring:";

            lblMessage                 = new XNALabel(WindowManager);
            lblMessage.Name            = "lblMessage";
            lblMessage.ClientRectangle = new Rectangle(12, lblSender.Bottom + 6, 0, 0);
            lblMessage.RemapColor      = AssetLoader.GetColorFromString(ClientConfiguration.Instance.ReceivedPMColor);
            lblMessage.Text            = "This is a test message.";

            AddChild(gameIconPanel);
            AddChild(linePanel);
            AddChild(lblSender);
            AddChild(lblMessage);

            base.Initialize();
        }
예제 #7
0
        public override void Initialize()
        {
            Name              = "CheaterScreen";
            ClientRectangle   = new Rectangle(0, 0, 334, 453);
            BackgroundTexture = AssetLoader.LoadTexture("cheaterbg.png");

            var lblCheater = new XNALabel(WindowManager);

            lblCheater.Name            = "lblCheater";
            lblCheater.ClientRectangle = new Rectangle(0, 0, 0, 0);
            lblCheater.FontIndex       = 1;
            lblCheater.Text            = "CHEATER!";

            var lblDescription = new XNALabel(WindowManager);

            lblDescription.Name            = "lblDescription";
            lblDescription.ClientRectangle = new Rectangle(12, 40, 0, 0);
            lblDescription.Text            = "Modified game files have been detected. They could affect" + Environment.NewLine +
                                             "the game experience." +
                                             Environment.NewLine + Environment.NewLine +
                                             "Do you really lack the skill for winning the mission without" + Environment.NewLine + "cheating?";

            var imagePanel = new XNAPanel(WindowManager);

            imagePanel.Name            = "imagePanel";
            imagePanel.DrawMode        = PanelBackgroundImageDrawMode.STRETCHED;
            imagePanel.ClientRectangle = new Rectangle(lblDescription.X,
                                                       lblDescription.Bottom + 12, Width - 24,
                                                       Height - (lblDescription.Bottom + 59));
            imagePanel.BackgroundTexture = AssetLoader.LoadTextureUncached("cheater.png");

            var btnCancel = new XNAClientButton(WindowManager);

            btnCancel.Name            = "btnCancel";
            btnCancel.ClientRectangle = new Rectangle(Width - 104,
                                                      Height - 35, 92, 23);
            btnCancel.Text       = "Cancel";
            btnCancel.LeftClick += BtnCancel_LeftClick;

            var btnYes = new XNAClientButton(WindowManager);

            btnYes.Name            = "btnYes";
            btnYes.ClientRectangle = new Rectangle(12, btnCancel.Y,
                                                   btnCancel.Width, btnCancel.Height);
            btnYes.Text       = "Yes";
            btnYes.LeftClick += BtnYes_LeftClick;

            AddChild(lblCheater);
            AddChild(lblDescription);
            AddChild(imagePanel);
            AddChild(btnCancel);
            AddChild(btnYes);

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

            base.Initialize();
        }
예제 #8
0
        public override void Initialize()
        {
            Name = nameof(ChoiceNotificationBox);
            BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 196), 1, 1);
            ClientRectangle         = new Rectangle(0, -boxHeight, 300, boxHeight);
            PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            lblHeader             = new XNALabel(WindowManager);
            lblHeader.Name        = nameof(lblHeader);
            lblHeader.FontIndex   = 1;
            lblHeader.AnchorPoint = new Vector2(ClientRectangle.Width / 2, 12);
            lblHeader.TextAnchor  = LabelTextAnchorInfo.CENTER;
            lblHeader.Text        = "MAKE A CHOICE";
            AddChild(lblHeader);

            gameIconPanel                   = new XNAPanel(WindowManager);
            gameIconPanel.Name              = nameof(gameIconPanel);
            gameIconPanel.ClientRectangle   = new Rectangle(12, lblHeader.Bottom + 6, 16, 16);
            gameIconPanel.DrawBorders       = false;
            gameIconPanel.BackgroundTexture = AssetLoader.TextureFromImage(ClientCore.Properties.Resources.dtaicon);
            AddChild(gameIconPanel);

            lblSender                 = new XNALabel(WindowManager);
            lblSender.Name            = nameof(lblSender);
            lblSender.FontIndex       = 1;
            lblSender.ClientRectangle = new Rectangle(gameIconPanel.Right + 3, lblHeader.Bottom + 6, 0, 0);
            lblSender.Text            = "fonger";
            AddChild(lblSender);

            lblChoiceText                 = new XNALabel(WindowManager);
            lblChoiceText.Name            = nameof(lblChoiceText);
            lblChoiceText.FontIndex       = 1;
            lblChoiceText.ClientRectangle = new Rectangle(12, lblSender.Bottom + 6, 0, 0);
            lblChoiceText.Text            = "What do you want to do?";
            AddChild(lblChoiceText);

            affirmativeButton = new XNAClientButton(WindowManager);
            affirmativeButton.ClientRectangle = new Rectangle(ClientRectangle.Left + 8, lblChoiceText.Bottom + 6, 75, 23);
            affirmativeButton.Name            = nameof(affirmativeButton);
            affirmativeButton.Text            = "Yes";
            affirmativeButton.LeftClick      += AffirmativeButton_LeftClick;
            AddChild(affirmativeButton);

            negativeButton = new XNAClientButton(WindowManager);
            negativeButton.ClientRectangle = new Rectangle(ClientRectangle.Width - (75 + 8), lblChoiceText.Bottom + 6, 75, 23);
            negativeButton.Name            = nameof(negativeButton);
            negativeButton.Text            = "No";
            negativeButton.LeftClick      += NegativeButton_LeftClick;
            AddChild(negativeButton);

            base.Initialize();
        }
        public override void Initialize()
        {
            Name = nameof(MissionCompletionNotification);
            BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 196), 2, 2);
            PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;

            rankTextures = new Texture2D[]
            {
                AssetLoader.LoadTexture("rankEasy.png"),
                AssetLoader.LoadTexture("rankEasy.png"),
                AssetLoader.LoadTexture("rankNormal.png"),
                AssetLoader.LoadTexture("rankHard.png")
            };

            Width  = 300;
            Height = 60;
            Y      = 200;

            starIconPanel                         = new XNAPanel(WindowManager);
            starIconPanel.Name                    = nameof(starIconPanel);
            starIconPanel.Width                   = 60;
            starIconPanel.X                       = UIDesignConstants.EMPTY_SPACE_SIDES;
            starIconPanel.Y                       = UIDesignConstants.EMPTY_SPACE_TOP;
            starIconPanel.Height                  = Height - starIconPanel.Y - UIDesignConstants.EMPTY_SPACE_BOTTOM;
            starIconPanel.Width                   = starIconPanel.Height;
            starIconPanel.DrawBorders             = false;
            starIconPanel.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            starIconPanel.Disable();
            AddChild(starIconPanel);

            lblMissionName             = new XNALabel(WindowManager);
            lblMissionName.Name        = nameof(lblMissionName);
            lblMissionName.FontIndex   = UIDesignConstants.BOLD_FONT_INDEX;
            lblMissionName.TextAnchor  = LabelTextAnchorInfo.HORIZONTAL_CENTER;
            lblMissionName.AnchorPoint = new Vector2(Width / 2f, UIDesignConstants.EMPTY_SPACE_TOP);
            lblMissionName.Text        = "MISSION NAME";
            AddChild(lblMissionName);

            lblDescription             = new XNALabel(WindowManager);
            lblDescription.Name        = nameof(lblDescription);
            lblDescription.FontIndex   = UIDesignConstants.BOLD_FONT_INDEX;
            lblDescription.TextAnchor  = LabelTextAnchorInfo.HORIZONTAL_CENTER;
            lblDescription.AnchorPoint = new Vector2(Width / 2f, lblMissionName.Bottom + UIDesignConstants.EMPTY_SPACE_TOP * 2);
            lblDescription.Text        = "Completed on Difficulty";
            AddChild(lblDescription);

            base.Initialize();
        }
예제 #10
0
        private IXNAPanel GetCreateAccountLabels()
        {
            var labelsPanel = new XNAPanel();

            for (int srcYIndex = 0; srcYIndex < 6; ++srcYIndex)
            {
                var texturePictureBox = new XNAPictureBox
                {
                    Texture         = _labelsTexture,
                    SourceRectangle = new Rectangle(0, srcYIndex * (srcYIndex < 2 ? 14 : 15), 149, 15),
                    DrawPosition    = new Vector2(358, (srcYIndex < 3 ? 50 : 241) + srcYIndex % 3 * 51)
                };
                texturePictureBox.SetParentControl(labelsPanel);
            }
            return(labelsPanel);
        }
        private IXNAPanel GetCreateAccountLabels()
        {
            var labelsPanel = new XNAPanel();

            for (int srcYIndex = 0; srcYIndex < 6; ++srcYIndex)
            {
                var lblpos            = new Vector2(358, (srcYIndex < 3 ? 50 : 241) + srcYIndex % 3 * 51);
                var labelTexture      = new SpriteSheet(_labelsTexture, new Rectangle(0, srcYIndex * (srcYIndex < 2 ? 14 : 15), 149, 15));
                var texturePictureBox = new DisposablePictureBox(labelTexture.GetSourceTexture())
                {
                    DrawPosition = lblpos
                };
                texturePictureBox.SetParentControl(labelsPanel);
            }
            return(labelsPanel);
        }
예제 #12
0
        public override void Initialize()
        {
            Name = "MessageBox";
            BackgroundTexture = AssetLoader.LoadTexture("msgboxform.png");

            XNALabel lblCaption = new XNALabel(WindowManager);

            lblCaption.Text            = caption;
            lblCaption.ClientRectangle = new Rectangle(12, 9, 0, 0);
            lblCaption.FontIndex       = 1;

            XNAPanel line = new XNAPanel(WindowManager);

            line.ClientRectangle = new Rectangle(6, 29, 0, 1);

            XNALabel lblDescription = new XNALabel(WindowManager);

            lblDescription.Text            = description;
            lblDescription.ClientRectangle = new Rectangle(12, 39, 0, 0);

            AddChild(lblCaption);
            AddChild(line);
            AddChild(lblDescription);

            Vector2 textDimensions = Renderer.GetTextDimensions(lblDescription.Text, lblDescription.FontIndex);

            ClientRectangle      = new Rectangle(0, 0, (int)textDimensions.X + 24, (int)textDimensions.Y + 81);
            line.ClientRectangle = new Rectangle(6, 29, Width - 12, 1);

            if (messageBoxButtons == XNAMessageBoxButtons.OK)
            {
                AddOKButton();
            }
            else if (messageBoxButtons == XNAMessageBoxButtons.YesNo)
            {
                AddYesNoButtons();
            }
            else // messageBoxButtons == DXMessageBoxButtons.OKCancel
            {
                AddOKCancelButtons();
            }

            base.Initialize();

            WindowManager.CenterControlOnScreen(this);
        }
예제 #13
0
        public EOOnlineList(XNAPanel parent)
            : base(null, null, parent)
        {
            m_onlineList = new List <ClientOnlineEntry>();
            //this enables scrolling with mouse wheel and mouseover for parent
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            m_totalNumPlayers = new XNALabel(new Rectangle(455, 2, 27, 14), "Microsoft Sans Serif", 8.5f)
            {
                AutoSize  = false,
                ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8),
                TextAlign = System.Drawing.ContentAlignment.MiddleRight
            };
            m_totalNumPlayers.SetParent(this);

            m_scrollBar = new EOScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), EOScrollBar.ScrollColors.LightOnMed)
            {
                LinesToRender = 7,
                Visible       = true
            };
            m_scrollBar.SetParent(this);
            m_scrollBar.IgnoreDialog(typeof(EOPaperdollDialog));
            m_scrollBar.IgnoreDialog(typeof(EOChestDialog));

            m_filterClick = new Rectangle(2 + DrawAreaWithOffset.X, 2 + DrawAreaWithOffset.Y, 14, 14);

            Texture2D weirdOffsets = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, true);

            for (int i = 0; i < m_filterTextures.Length; ++i)
            {
                Rectangle offsetsSource = new Rectangle(i % 2 == 0 ? 0 : 12, i >= 2 ? 246 : 233, 12, 13);

                m_filterTextures[i] = new Texture2D(EOGame.Instance.GraphicsDevice, 12, 13);
                Color[] dat = new Color[12 * 13];
                weirdOffsets.GetData(0, offsetsSource, dat, 0, dat.Length);
                m_filterTextures[i].SetData(dat);
            }
        }
예제 #14
0
        //parent x,y - 102,330
        public EOSettingsPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            w = World.Instance;
            m_leftSide = new XNALabel[5];
            m_rightSide = new XNALabel[5];

            for (int i = 0; i < m_leftSide.Length; ++i)
            {
                m_leftSide[i] = new XNALabel(new Rectangle(117, 25 + (18*i), 100, 15), "Microsoft Sans Serif", 8.5f)
                {
                    ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8)
                };
                m_leftSide[i].SetParent(this);
                m_rightSide[i] = new XNALabel(new Rectangle(356, 25 + (18*i), 100, 15), "Microsoft Sans Serif", 8.5f)
                {
                    ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8)
                };
                m_rightSide[i].SetParent(this);
            }

            _setTextForLanguage();

            m_buttons = new XNAButton[10];
            for (int i = 0; i < m_buttons.Length; ++i)
            {
                m_buttons[i] = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, true),
                    new Vector2(i < 5 ? 215 : 454, 25 + (18*(i%5))),
                    new Rectangle(0, 0, 19, 15),
                    new Rectangle(19, 0, 19, 15));

                m_buttons[i].SetParent(this);
                m_buttons[i].OnClick += _settingChange;
                m_buttons[i].OnMouseOver += (o, e) => EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_SETTINGS_CLICK_TO_CHANGE);
            }
        }
예제 #15
0
        private KeyLayout m_keyboard = KeyLayout.English;         //this is not stored or loaded

        //parent x,y - 102,330
        public EOSettingsPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            w           = World.Instance;
            m_leftSide  = new XNALabel[5];
            m_rightSide = new XNALabel[5];

            for (int i = 0; i < m_leftSide.Length; ++i)
            {
                m_leftSide[i] = new XNALabel(new Rectangle(117, 25 + (18 * i), 100, 15), "Microsoft Sans Serif", 8.5f)
                {
                    ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8)
                };
                m_leftSide[i].SetParent(this);
                m_rightSide[i] = new XNALabel(new Rectangle(356, 25 + (18 * i), 100, 15), "Microsoft Sans Serif", 8.5f)
                {
                    ForeColor = System.Drawing.Color.FromArgb(0xff, 0xc8, 0xc8, 0xc8)
                };
                m_rightSide[i].SetParent(this);
            }

            _setTextForLanguage();

            m_buttons = new XNAButton[10];
            for (int i = 0; i < m_buttons.Length; ++i)
            {
                m_buttons[i] = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, true),
                                             new Vector2(i < 5 ? 215 : 454, 25 + (18 * (i % 5))),
                                             new Rectangle(0, 0, 19, 15),
                                             new Rectangle(19, 0, 19, 15));

                m_buttons[i].SetParent(this);
                m_buttons[i].OnClick     += _settingChange;
                m_buttons[i].OnMouseOver += (o, e) => EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_SETTINGS_CLICK_TO_CHANGE);
            }
        }
예제 #16
0
        private KeyLayout m_keyboard = KeyLayout.English; //this is not stored or loaded

        //parent x,y - 102,330
        public OldEOSettingsPanel(XNAPanel parent)
            : base(null, null, parent)
        {
            _setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

            w           = OldWorld.Instance;
            m_leftSide  = new XNALabel[5];
            m_rightSide = new XNALabel[5];

            for (int i = 0; i < m_leftSide.Length; ++i)
            {
                m_leftSide[i] = new XNALabel(new Rectangle(117, 25 + (18 * i), 100, 15), Constants.FontSize08pt5)
                {
                    ForeColor = ColorConstants.LightGrayText
                };
                m_leftSide[i].SetParent(this);
                m_rightSide[i] = new XNALabel(new Rectangle(356, 25 + (18 * i), 100, 15), Constants.FontSize08pt5)
                {
                    ForeColor = ColorConstants.LightGrayText
                };
                m_rightSide[i].SetParent(this);
            }

            _setTextForLanguage();

            m_buttons = new XNAButton[10];
            for (int i = 0; i < m_buttons.Length; ++i)
            {
                m_buttons[i] = new XNAButton(((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true),
                                             new Vector2(i < 5 ? 215 : 454, 25 + (18 * (i % 5))),
                                             new Rectangle(0, 0, 19, 15),
                                             new Rectangle(19, 0, 19, 15));

                m_buttons[i].SetParent(this);
                m_buttons[i].OnClick     += _settingChange;
                m_buttons[i].OnMouseOver += (o, e) => EOGame.Instance.Hud.SetStatusLabel(EOResourceID.STATUS_LABEL_TYPE_BUTTON, EOResourceID.STATUS_LABEL_SETTINGS_CLICK_TO_CHANGE);
            }
        }
예제 #17
0
		public EOOnlineList(XNAPanel parent)
			: base(null, null, parent)
		{
			m_onlineList = new List<ClientOnlineEntry>();
			//this enables scrolling with mouse wheel and mouseover for parent
			_setSize(parent.BackgroundImage.Width, parent.BackgroundImage.Height);

			m_totalNumPlayers = new XNALabel(new Rectangle(455, 2, 27, 14), Constants.FontSize08pt5)
			{
				AutoSize = false,
				ForeColor = Constants.LightGrayText,
				TextAlign = LabelAlignment.MiddleRight
			};
			m_totalNumPlayers.SetParent(this);

			m_scrollBar = new ScrollBar(this, new Vector2(467, 20), new Vector2(16, 97), ScrollBarColors.LightOnMed)
			{
				LinesToRender = 7,
				Visible = true
			};
			m_scrollBar.SetParent(this);
			World.IgnoreDialogs(m_scrollBar);

			m_filterClick = new Rectangle(2 + DrawAreaWithOffset.X, 2 + DrawAreaWithOffset.Y, 14, 14);

			Texture2D weirdOffsets = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true);
			for (int i = 0; i < m_filterTextures.Length; ++i)
			{
				Rectangle offsetsSource = new Rectangle(i % 2 == 0 ? 0 : 12, i >= 2 ? 246 : 233, 12, 13);

				m_filterTextures[i] = new Texture2D(EOGame.Instance.GraphicsDevice, 12, 13);
				Color[] dat = new Color[12*13];
				weirdOffsets.GetData(0, offsetsSource, dat, 0, dat.Length);
				m_filterTextures[i].SetData(dat);
			}
		}
예제 #18
0
		public ActiveSpells(XNAPanel parent, PacketAPI api)
			: base(null, null, parent)
		{
			_api = api;

			_childItems = new List<ISpellIcon>(SPELL_NUM_ROWS * SPELL_ROW_LENGTH);
			RemoveAllSpells();

			var localSpellSlotMap = new Dictionary<int, int>();
			_spellsKey = _tryGetCharacterRegKey();
			if (_spellsKey != null)
			{
				const string spellFmt = "item{0}";
				for (int i = 0; i < SPELL_ROW_LENGTH*4; ++i)
				{
					int id;
					try
					{
						id = Convert.ToInt32(_spellsKey.GetValue(String.Format(spellFmt, i)));
					}
					catch { continue; }
					localSpellSlotMap.Add(i, id);
				}
			}

			var localSpells = World.Instance.MainPlayer.ActiveCharacter.Spells;
			// ReSharper disable once LoopCanBeConvertedToQuery
			foreach (var spell in localSpells)
			{
				SpellRecord rec = World.Instance.ESF.GetSpellRecordByID(spell.id);
				int slot = localSpellSlotMap.ContainsValue(spell.id)
					? localSpellSlotMap.First(_pair => _pair.Value == spell.id).Key
					: _getNextOpenSlot();

				if (slot < 0 || !_addNewSpellToSlot(slot, rec, spell.level))
				{
					EOMessageBox.Show("You have too many spells! They don't all fit.", "Warning", XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
					break;
				}

				if (slot >= SPELL_ROW_LENGTH*(SPELL_NUM_ROWS/2))
					_childItems.Last().Visible = false;
			}

			_setSize(parent.DrawArea.Width, parent.DrawArea.Height);

			_functionKeyGraphics = ((EOGame) Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58, true);
			_functionKeyRow1SourceRect = new Rectangle(148, 51, 18, 13);
			_functionKeyRow2SourceRect = new Rectangle(148 + 18*8, 51, 18, 13);

			_selectedSpellName = new XNALabel(new Rectangle(9, 50, 81, 13), Constants.FontSize08pt5)
			{
				Visible = false,
				Text = "",
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleCenter,
				ForeColor = Constants.LightGrayText
			};
			_selectedSpellName.SetParent(this);

			_selectedSpellLevel = new XNALabel(new Rectangle(32, 78, 42, 15), Constants.FontSize08pt5)
			{
				Visible = true,
				Text = "0",
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			_selectedSpellLevel.SetParent(this);

			var skillPoints = World.Instance.MainPlayer.ActiveCharacter.Stats.SkillPoints;
			_totalSkillPoints = new XNALabel(new Rectangle(32, 96, 42, 15), Constants.FontSize08pt5)
			{
				Visible = true,
				Text = skillPoints.ToString(),
				AutoSize = false,
				TextAlign = LabelAlignment.MiddleLeft,
				ForeColor = Constants.LightGrayText
			};
			_totalSkillPoints.SetParent(this);

			var buttonSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true);

			_levelUpButton1 = new XNAButton(buttonSheet, new Vector2(71, 77), new Rectangle(215, 386, 19, 15), new Rectangle(234, 386, 19, 15))
			{
				FlashSpeed = 500,
				Visible = false
			};
			_levelUpButton1.OnClick += LevelUp_Click;
			_levelUpButton1.SetParent(this);
			_levelUpButton2 = new XNAButton(buttonSheet, new Vector2(71, 95), new Rectangle(215, 386, 19, 15), new Rectangle(234, 386, 19, 15))
			{
				FlashSpeed = 500,
				Visible = false
			};
			_levelUpButton2.OnClick += LevelUp_Click;
			_levelUpButton2.SetParent(this);

			_scroll = new ScrollBar(this, new Vector2(467, 2), new Vector2(16, 115), ScrollBarColors.LightOnMed) { LinesToRender = 2 };
			_scroll.UpdateDimensions(4);

			foreach (var child in children.Where(x => !(x is EmptySpellIcon)))
				World.IgnoreDialogs(child);
		}
        private void InitGameListPanel()
        {
            const int gameListPanelHeight = 185;
            XNAPanel  gameListPanel       = new XNAPanel(WindowManager);

            gameListPanel.DrawBorders     = false;
            gameListPanel.Name            = nameof(gameListPanel);
            gameListPanel.ClientRectangle = new Rectangle(0, Bottom - gameListPanelHeight, Width, gameListPanelHeight);

            AddChild(gameListPanel);

            var lblFollowedGames = new XNALabel(WindowManager);

            lblFollowedGames.Name            = nameof(lblFollowedGames);
            lblFollowedGames.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblFollowedGames.Text            = "Show game rooms from the following games:";

            gameListPanel.AddChild(lblFollowedGames);

            int chkCount          = 0;
            int chkCountPerColumn = 4;
            int nextColumnXOffset = 0;
            int columnXOffset     = 0;

            foreach (CnCNetGame game in gameCollection.GameList)
            {
                if (!game.Supported || string.IsNullOrEmpty(game.GameBroadcastChannel))
                {
                    continue;
                }

                if (chkCount == chkCountPerColumn)
                {
                    chkCount          = 0;
                    columnXOffset    += nextColumnXOffset + 6;
                    nextColumnXOffset = 0;
                }

                var panel = new XNAPanel(WindowManager);
                panel.Name            = "panel" + game.InternalName;
                panel.ClientRectangle = new Rectangle(lblFollowedGames.X + columnXOffset,
                                                      lblFollowedGames.Bottom + 12 + chkCount * 22, 16, 16);
                panel.DrawBorders       = false;
                panel.BackgroundTexture = game.Texture;

                var chkBox = new XNAClientCheckBox(WindowManager);
                chkBox.Name            = game.InternalName.ToUpper();
                chkBox.ClientRectangle = new Rectangle(
                    panel.Right + 6,
                    panel.Y, 0, 0);
                chkBox.Text = game.UIName;

                chkCount++;

                gameListPanel.AddChild(panel);
                gameListPanel.AddChild(chkBox);
                followedGameChks.Add(chkBox);

                if (chkBox.Right > nextColumnXOffset)
                {
                    nextColumnXOffset = chkBox.Right;
                }
            }
        }
예제 #20
0
        public override void Initialize()
        {
            Name              = "GameLoadingLobby";
            ClientRectangle   = new Rectangle(0, 0, 590, 510);
            BackgroundTexture = AssetLoader.LoadTexture("loadmpsavebg.png");

            lblDescription                 = new XNALabel(WindowManager);
            lblDescription.Name            = "lblDescription";
            lblDescription.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblDescription.Text            = "Wait for all players to join and get ready, then click Load Game to load the saved multiplayer game.";

            panelPlayers = new XNAPanel(WindowManager);
            panelPlayers.ClientRectangle   = new Rectangle(12, 32, 373, 125);
            panelPlayers.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            panelPlayers.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;

            AddChild(lblDescription);
            AddChild(panelPlayers);

            lblPlayerNames = new XNALabel[8];
            for (int i = 0; i < 4; i++)
            {
                XNALabel lblPlayerName = new XNALabel(WindowManager);
                lblPlayerName.Name            = "lblPlayerName" + i;
                lblPlayerName.ClientRectangle = new Rectangle(9, 9 + 30 * i, 0, 0);
                lblPlayerName.Text            = "Player " + i;
                panelPlayers.AddChild(lblPlayerName);
                lblPlayerNames[i] = lblPlayerName;
            }

            for (int i = 4; i < 8; i++)
            {
                XNALabel lblPlayerName = new XNALabel(WindowManager);
                lblPlayerName.Name            = "lblPlayerName" + i;
                lblPlayerName.ClientRectangle = new Rectangle(190, 9 + 30 * (i - 4), 0, 0);
                lblPlayerName.Text            = "Player " + i;
                panelPlayers.AddChild(lblPlayerName);
                lblPlayerNames[i] = lblPlayerName;
            }

            lblMapName                 = new XNALabel(WindowManager);
            lblMapName.Name            = "lblMapName";
            lblMapName.FontIndex       = 1;
            lblMapName.ClientRectangle = new Rectangle(panelPlayers.Right + 12,
                                                       panelPlayers.Y, 0, 0);
            lblMapName.Text = "MAP:";

            lblMapNameValue                 = new XNALabel(WindowManager);
            lblMapNameValue.Name            = "lblMapNameValue";
            lblMapNameValue.ClientRectangle = new Rectangle(lblMapName.X,
                                                            lblMapName.Y + 18, 0, 0);
            lblMapNameValue.Text = "Map name";

            lblGameMode                 = new XNALabel(WindowManager);
            lblGameMode.Name            = "lblGameMode";
            lblGameMode.ClientRectangle = new Rectangle(lblMapName.X,
                                                        panelPlayers.Y + 40, 0, 0);
            lblGameMode.FontIndex = 1;
            lblGameMode.Text      = "GAME MODE:";

            lblGameModeValue                 = new XNALabel(WindowManager);
            lblGameModeValue.Name            = "lblGameModeValue";
            lblGameModeValue.ClientRectangle = new Rectangle(lblGameMode.X,
                                                             lblGameMode.Y + 18, 0, 0);
            lblGameModeValue.Text = "Game mode";

            lblSavedGameTime                 = new XNALabel(WindowManager);
            lblSavedGameTime.Name            = "lblSavedGameTime";
            lblSavedGameTime.ClientRectangle = new Rectangle(lblMapName.X,
                                                             panelPlayers.Bottom - 40, 0, 0);
            lblSavedGameTime.FontIndex = 1;
            lblSavedGameTime.Text      = "SAVED GAME:";

            ddSavedGame                 = new XNAClientDropDown(WindowManager);
            ddSavedGame.Name            = "ddSavedGame";
            ddSavedGame.ClientRectangle = new Rectangle(lblSavedGameTime.X,
                                                        panelPlayers.Bottom - 21,
                                                        Width - lblSavedGameTime.X - 12, 21);
            ddSavedGame.SelectedIndexChanged += DdSavedGame_SelectedIndexChanged;

            lbChatMessages      = new ChatListBox(WindowManager);
            lbChatMessages.Name = "lbChatMessages";
            lbChatMessages.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbChatMessages.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbChatMessages.ClientRectangle   = new Rectangle(12, panelPlayers.Bottom + 12,
                                                             Width - 24,
                                                             Height - panelPlayers.Bottom - 12 - 29 - 34);

            tbChatInput                 = new XNATextBox(WindowManager);
            tbChatInput.Name            = "tbChatInput";
            tbChatInput.ClientRectangle = new Rectangle(lbChatMessages.X,
                                                        lbChatMessages.Bottom + 3, lbChatMessages.Width, 19);
            tbChatInput.MaximumTextLength = 200;
            tbChatInput.EnterPressed     += TbChatInput_EnterPressed;

            btnLoadGame                 = new XNAClientButton(WindowManager);
            btnLoadGame.Name            = "btnLoadGame";
            btnLoadGame.ClientRectangle = new Rectangle(lbChatMessages.X,
                                                        tbChatInput.Bottom + 6, 133, 23);
            btnLoadGame.Text       = "Load Game";
            btnLoadGame.LeftClick += BtnLoadGame_LeftClick;

            btnLeaveGame                 = new XNAClientButton(WindowManager);
            btnLeaveGame.Name            = "btnLeaveGame";
            btnLeaveGame.ClientRectangle = new Rectangle(Width - 145,
                                                         btnLoadGame.Y, 133, 23);
            btnLeaveGame.Text       = "Leave Game";
            btnLeaveGame.LeftClick += BtnLeaveGame_LeftClick;

            AddChild(lblMapName);
            AddChild(lblMapNameValue);
            AddChild(lblGameMode);
            AddChild(lblGameModeValue);
            AddChild(lblSavedGameTime);
            AddChild(lbChatMessages);
            AddChild(tbChatInput);
            AddChild(btnLoadGame);
            AddChild(btnLeaveGame);
            AddChild(ddSavedGame);

            base.Initialize();

            sndGetReady     = new EnhancedSoundEffect("getready.wav");
            sndJoinSound    = new EnhancedSoundEffect("joingame.wav");
            sndLeaveSound   = new EnhancedSoundEffect("leavegame.wav");
            sndMessageSound = new EnhancedSoundEffect("message.wav");

            MPColors = MultiplayerColor.LoadColors();

            WindowManager.CenterControlOnScreen(this);

            if (SavedGameManager.AreSavedGamesAvailable())
            {
                fsw = new FileSystemWatcher(ProgramConstants.GamePath + "Saved Games", "*.NET");
                fsw.EnableRaisingEvents = false;
                fsw.Created            += fsw_Created;
                fsw.Changed            += fsw_Created;
            }
        }
예제 #21
0
        public EOInventory(XNAPanel parent, PacketAPI api)
            : base(null, null, parent)
        {
            m_api = api;

            //load info from registry
            Dictionary<int, int> localItemSlotMap = new Dictionary<int, int>();
            m_inventoryKey = _tryGetCharacterRegKey();
            if (m_inventoryKey != null)
            {
                const string itemFmt = "item{0}";
                for (int i = 0; i < INVENTORY_ROW_LENGTH * 4; ++i)
                {
                    int id;
                    try
                    {
                        id = Convert.ToInt32(m_inventoryKey.GetValue(string.Format(itemFmt, i)));
                    }
                    catch { continue; }
                    localItemSlotMap.Add(i, id);
                }
            }

            //add the inventory items that were retrieved from the server
            List<InventoryItem> localInv = World.Instance.MainPlayer.ActiveCharacter.Inventory;
            if (localInv.Find(_item => _item.id == 1).id != 1)
                localInv.Insert(0, new InventoryItem {amount = 0, id = 1}); //add 0 gold if there isn't any gold

            bool dialogShown = false;
            foreach (InventoryItem item in localInv)
            {
                ItemRecord rec = World.Instance.EIF.GetItemRecordByID(item.id);
                int slot = localItemSlotMap.ContainsValue(item.id)
                    ? localItemSlotMap.First(_pair => _pair.Value == item.id).Key
                    : _getNextOpenSlot(rec.Size);
                if (!dialogShown && !_addItemToSlot(slot, rec, item.amount))
                {
                    dialogShown = true;
                    EODialog.Show("Something doesn't fit in the inventory. Rearrange items or get rid of them.", "Warning", XNADialogButtons.Ok, EODialogStyle.SmallDialogSmallHeader);
                }
            }

            //coordinates for parent of EOInventory: 102, 330 (pnlInventory in InGameHud)
            //extra in photoshop right now: 8, 31

            //current weight label (member variable, needs to have text updated when item amounts change)
            m_lblWeight = new XNALabel(new Rectangle(385, 37, 88, 18), "Microsoft Sans MS", 8f)
            {
                ForeColor = System.Drawing.Color.FromArgb(255, 0xc8, 0xc8, 0xc8),
                TextAlign = ContentAlignment.MiddleCenter,
                Visible = true,
                AutoSize = false
            };
            m_lblWeight.SetParent(this);
            UpdateWeightLabel();

            Texture2D thatWeirdSheet = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27); //oh my gawd the offsets on this bish

            //(local variables, added to child controls)
            //'paperdoll' button
            m_btnPaperdoll = new XNAButton(thatWeirdSheet, new Vector2(385, 9), /*new Rectangle(39, 385, 88, 19)*/null, new Rectangle(126, 385, 88, 19));
            m_btnPaperdoll.SetParent(this);
            m_btnPaperdoll.OnClick += (s, e) => m_api.RequestPaperdoll((short)World.Instance.MainPlayer.ActiveCharacter.ID);
            //'drop' button
            //491, 398 -> 389, 68
            //0,15,38,37
            //0,52,38,37
            m_btnDrop = new XNAButton(thatWeirdSheet, new Vector2(389, 68), new Rectangle(0, 15, 38, 37), new Rectangle(0, 52, 38, 37));
            m_btnDrop.SetParent(this);
            World.IgnoreDialogs(m_btnDrop);
            //'junk' button - 4 + 38 on the x away from drop
            m_btnJunk = new XNAButton(thatWeirdSheet, new Vector2(431, 68), new Rectangle(0, 89, 38, 37), new Rectangle(0, 126, 38, 37));
            m_btnJunk.SetParent(this);
            World.IgnoreDialogs(m_btnJunk);
        }
예제 #22
0
		public EOCharacterStats(XNAPanel parent) 
			: base(null, null, parent)
		{
			c = World.Instance.MainPlayer.ActiveCharacter;
		}
예제 #23
0
 public EOCharacterStats(XNAPanel parent)
     : base(null, null, parent)
 {
     c = World.Instance.MainPlayer.ActiveCharacter;
 }
예제 #24
0
        public OldEOInventory(XNAPanel parent, PacketAPI api)
            : base(null, null, parent)
        {
            m_api = api;

            //load info from registry
            Dictionary <int, int> localItemSlotMap = new Dictionary <int, int>();

            m_inventoryKey = _tryGetCharacterRegKey();
            if (m_inventoryKey != null)
            {
                const string itemFmt = "item{0}";
                for (int i = 0; i < INVENTORY_ROW_LENGTH * 4; ++i)
                {
                    int id;
                    try
                    {
                        id = Convert.ToInt32(m_inventoryKey.GetValue(string.Format(itemFmt, i)));
                    }
                    catch { continue; }
                    localItemSlotMap.Add(i, id);
                }
            }

            //add the inventory items that were retrieved from the server
            List <InventoryItem> localInv = OldWorld.Instance.MainPlayer.ActiveCharacter.Inventory;

            if (localInv.Find(_item => _item.ItemID == 1).ItemID != 1)
            {
                localInv.Insert(0, new InventoryItem(amount: 0, itemID: 1)); //add 0 gold if there isn't any gold
            }
            bool dialogShown = false;

            foreach (var item in localInv)
            {
                var rec  = OldWorld.Instance.EIF[item.ItemID];
                int slot = localItemSlotMap.ContainsValue(item.ItemID)
                    ? localItemSlotMap.First(_pair => _pair.Value == item.ItemID).Key
                    : _getNextOpenSlot(rec.Size);

                List <Tuple <int, int> > points;
                if (!_fitsInSlot(slot, rec.Size, out points))
                {
                    slot = _getNextOpenSlot(rec.Size);
                }

                if (!_addItemToSlot(slot, rec, item.Amount) && !dialogShown)
                {
                    dialogShown = true;
                    EOMessageBox.Show("Something doesn't fit in the inventory. Rearrange items or get rid of them.", "Warning", EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                }
            }

            //coordinates for parent of EOInventory: 102, 330 (pnlInventory in InGameHud)
            //extra in photoshop right now: 8, 31

            //current weight label (member variable, needs to have text updated when item amounts change)
            m_lblWeight = new XNALabel(new Rectangle(385, 37, 88, 18), Constants.FontSize08pt5)
            {
                ForeColor = ColorConstants.LightGrayText,
                TextAlign = LabelAlignment.MiddleCenter,
                Visible   = true,
                AutoSize  = false
            };
            m_lblWeight.SetParent(this);
            UpdateWeightLabel();

            Texture2D thatWeirdSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27); //oh my gawd the offsets on this bish

            //(local variables, added to child controls)
            //'paperdoll' button
            m_btnPaperdoll = new XNAButton(thatWeirdSheet, new Vector2(385, 9), /*new Rectangle(39, 385, 88, 19)*/ null, new Rectangle(126, 385, 88, 19));
            m_btnPaperdoll.SetParent(this);
            m_btnPaperdoll.OnClick += (s, e) => m_api.RequestPaperdoll((short)OldWorld.Instance.MainPlayer.ActiveCharacter.ID);
            //'drop' button
            //491, 398 -> 389, 68
            //0,15,38,37
            //0,52,38,37
            m_btnDrop = new XNAButton(thatWeirdSheet, new Vector2(389, 68), new Rectangle(0, 15, 38, 37), new Rectangle(0, 52, 38, 37));
            m_btnDrop.SetParent(this);
            OldWorld.IgnoreDialogs(m_btnDrop);
            //'junk' button - 4 + 38 on the x away from drop
            m_btnJunk = new XNAButton(thatWeirdSheet, new Vector2(431, 68), new Rectangle(0, 89, 38, 37), new Rectangle(0, 126, 38, 37));
            m_btnJunk.SetParent(this);
            OldWorld.IgnoreDialogs(m_btnJunk);
        }
        public override void Initialize()
        {
            base.Initialize();

            Name = "CnCNetOptionsPanel";

            chkPingUnofficialTunnels                 = new XNAClientCheckBox(WindowManager);
            chkPingUnofficialTunnels.Name            = "chkPingUnofficialTunnels";
            chkPingUnofficialTunnels.ClientRectangle = new Rectangle(12, 12, 0, 0);
            chkPingUnofficialTunnels.Text            = "Ping unofficial CnCNet tunnels";

            AddChild(chkPingUnofficialTunnels);

            chkWriteInstallPathToRegistry                 = new XNAClientCheckBox(WindowManager);
            chkWriteInstallPathToRegistry.Name            = "chkWriteInstallPathToRegistry";
            chkWriteInstallPathToRegistry.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkPingUnofficialTunnels.Bottom + 12, 0, 0);
            chkWriteInstallPathToRegistry.Text = "Write game installation path to Windows" + Environment.NewLine +
                                                 "Registry (makes it possible to join" + Environment.NewLine +
                                                 "other games' game rooms on CnCNet)";

            AddChild(chkWriteInstallPathToRegistry);

            chkPlaySoundOnGameHosted                 = new XNAClientCheckBox(WindowManager);
            chkPlaySoundOnGameHosted.Name            = "chkPlaySoundOnGameHosted";
            chkPlaySoundOnGameHosted.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkWriteInstallPathToRegistry.Bottom + 12, 0, 0);
            chkPlaySoundOnGameHosted.Text = "Play sound when a game is hosted";

            AddChild(chkPlaySoundOnGameHosted);

            chkNotifyOnUserListChange                 = new XNAClientCheckBox(WindowManager);
            chkNotifyOnUserListChange.Name            = "chkNotifyOnUserListChange";
            chkNotifyOnUserListChange.ClientRectangle = new Rectangle(
                chkPingUnofficialTunnels.X,
                chkPlaySoundOnGameHosted.Bottom + 12, 0, 0);
            chkNotifyOnUserListChange.Text = "Show player join / quit messages" + Environment.NewLine +
                                             "on CnCNet lobby";

            AddChild(chkNotifyOnUserListChange);

            chkSkipLoginWindow                 = new XNAClientCheckBox(WindowManager);
            chkSkipLoginWindow.Name            = "chkSkipLoginWindow";
            chkSkipLoginWindow.ClientRectangle = new Rectangle(
                276,
                12, 0, 0);
            chkSkipLoginWindow.Text            = "Skip login dialog";
            chkSkipLoginWindow.CheckedChanged += ChkSkipLoginWindow_CheckedChanged;

            AddChild(chkSkipLoginWindow);

            chkPersistentMode                 = new XNAClientCheckBox(WindowManager);
            chkPersistentMode.Name            = "chkPersistentMode";
            chkPersistentMode.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkSkipLoginWindow.Bottom + 12, 0, 0);
            chkPersistentMode.Text            = "Stay connected outside of the CnCNet lobby";
            chkPersistentMode.CheckedChanged += ChkPersistentMode_CheckedChanged;

            AddChild(chkPersistentMode);

            chkConnectOnStartup                 = new XNAClientCheckBox(WindowManager);
            chkConnectOnStartup.Name            = "chkConnectOnStartup";
            chkConnectOnStartup.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkPersistentMode.Bottom + 12, 0, 0);
            chkConnectOnStartup.Text          = "Connect automatically on client startup";
            chkConnectOnStartup.AllowChecking = false;

            AddChild(chkConnectOnStartup);

            chkDiscordIntegration                 = new XNAClientCheckBox(WindowManager);
            chkDiscordIntegration.Name            = "chkDiscordIntegration";
            chkDiscordIntegration.ClientRectangle = new Rectangle(
                chkSkipLoginWindow.X,
                chkConnectOnStartup.Bottom + 12, 0, 0);
            chkDiscordIntegration.Text = "Show detailed game info in Discord status";

            if (String.IsNullOrEmpty(ClientConfiguration.Instance.DiscordAppId))
            {
                chkDiscordIntegration.AllowChecking = false;
                chkDiscordIntegration.Checked       = false;
            }
            else
            {
                chkDiscordIntegration.AllowChecking = true;
            }

            AddChild(chkDiscordIntegration);

            var lblFollowedGames = new XNALabel(WindowManager);

            lblFollowedGames.Name            = "lblFollowedGames";
            lblFollowedGames.ClientRectangle = new Rectangle(
                chkNotifyOnUserListChange.X,
                chkNotifyOnUserListChange.Bottom + 24, 0, 0);
            lblFollowedGames.Text = "Show game rooms from the following games:";

            AddChild(lblFollowedGames);

            int chkCount          = 0;
            int chkCountPerColumn = 5;
            int nextColumnXOffset = 0;
            int columnXOffset     = 0;

            foreach (CnCNetGame game in gameCollection.GameList)
            {
                if (!game.Supported || string.IsNullOrEmpty(game.GameBroadcastChannel))
                {
                    continue;
                }

                if (chkCount == chkCountPerColumn)
                {
                    chkCount          = 0;
                    columnXOffset    += nextColumnXOffset + 6;
                    nextColumnXOffset = 0;
                }

                var panel = new XNAPanel(WindowManager);
                panel.Name            = "panel" + game.InternalName;
                panel.ClientRectangle = new Rectangle(chkPingUnofficialTunnels.X + columnXOffset,
                                                      lblFollowedGames.Bottom + 12 + chkCount * 22, 16, 16);
                panel.DrawBorders       = false;
                panel.BackgroundTexture = game.Texture;

                var chkBox = new XNAClientCheckBox(WindowManager);
                chkBox.Name            = game.InternalName.ToUpper();
                chkBox.ClientRectangle = new Rectangle(
                    panel.Right + 6,
                    panel.Y, 0, 0);
                chkBox.Text = game.UIName;

                chkCount++;

                AddChild(panel);
                AddChild(chkBox);
                followedGameChks.Add(chkBox);

                if (chkBox.Right > nextColumnXOffset)
                {
                    nextColumnXOffset = chkBox.Right;
                }
            }
        }
예제 #26
0
        public HUD(Game g, PacketAPI api)
            : base(g)
        {
            if(!api.Initialized)
                throw new ArgumentException("Need to initialize connection before the in-game stuff will work");
            m_packetAPI = api;

            DrawOrder = 5;

            mainFrame = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 1, true);
            topLeft = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 21, true);
            sidebar = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 22, true);
            topBar = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 23, true);
            filler = new Texture2D(g.GraphicsDevice, 1, 1);
            filler.SetData(new[] {Color.FromNonPremultiplied(8, 8, 8, 255)});

            Texture2D mainButtonTexture = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 25);
            mainBtn = new XNAButton[NUM_BTN];

            //set up panels
            Texture2D invBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 44);
            pnlInventory = new XNAPanel(new Rectangle(102, 330, invBG.Width, invBG.Height))
            {
                BackgroundImage = invBG,
                Visible = false
            };

            Texture2D spellsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 62);
            pnlActiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height))
            {
                BackgroundImage = spellsBG,
                Visible = false
            };

            pnlPassiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height))
            {
                BackgroundImage = spellsBG,
                Visible = false
            };

            Texture2D chatBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 28);
            pnlChat = new XNAPanel(new Rectangle(102, 330, chatBG.Width, chatBG.Height))
            {
                BackgroundImage = chatBG,
                Visible = false
            };

            Texture2D statsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 34);
            pnlStats = new XNAPanel(new Rectangle(102, 330, statsBG.Width, statsBG.Height))
            {
                BackgroundImage = statsBG,
                Visible = false
            };

            Texture2D onlineBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 36);
            pnlOnline = new XNAPanel(new Rectangle(102, 330, onlineBG.Width, onlineBG.Height))
            {
                BackgroundImage = onlineBG,
                Visible = false
            };

            Texture2D partyBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 42);
            pnlParty = new XNAPanel(new Rectangle(102, 330, partyBG.Width, partyBG.Height))
            {
                BackgroundImage = partyBG,
                Visible = false
            };

            Texture2D settingsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 47);
            pnlSettings = new XNAPanel(new Rectangle(102, 330, settingsBG.Width, settingsBG.Height))
            {
                BackgroundImage = settingsBG,
                Visible = false
            };

            Texture2D helpBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 63);
            pnlHelp = new XNAPanel(new Rectangle(102, 330, helpBG.Width, helpBG.Height))
            {
                BackgroundImage = helpBG,
                Visible = false
            };

            Texture2D newsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 48);
            pnlNews = new XNAPanel(new Rectangle(102, 330, newsBG.Width, newsBG.Height)) {BackgroundImage = newsBG};

            //for easy update of all panels via foreach
            List<XNAPanel> pnlCollection = new List<XNAPanel>(10)
            {
                pnlInventory,
                pnlActiveSpells,
                pnlPassiveSpells,
                pnlChat,
                pnlStats,
                pnlOnline,
                pnlParty,
                pnlSettings,
                pnlHelp,
                pnlNews
            };
            //pnlCollection.Add(pnlMacro); //if this ever happens...

            pnlCollection.ForEach(_pnl => World.IgnoreDialogs(_pnl));

            for (int i = 0; i < NUM_BTN; ++i)
            {
                Texture2D _out = new Texture2D(g.GraphicsDevice, mainButtonTexture.Width / 2, mainButtonTexture.Height / NUM_BTN);
                Texture2D _ovr = new Texture2D(g.GraphicsDevice, mainButtonTexture.Width / 2, mainButtonTexture.Height / NUM_BTN);

                Rectangle _outRec = new Rectangle(0, i * _out.Height, _out.Width, _out.Height);
                Rectangle _ovrRec = new Rectangle(_ovr.Width, i * _ovr.Height, _ovr.Width, _ovr.Height);

                Color[] _outBuf = new Color[_outRec.Width * _outRec.Height];
                Color[] _ovrBuf = new Color[_ovrRec.Width * _ovrRec.Height];

                mainButtonTexture.GetData(0, _outRec, _outBuf, 0, _outBuf.Length);
                _out.SetData(_outBuf);

                mainButtonTexture.GetData(0, _ovrRec, _ovrBuf, 0, _ovrBuf.Length);
                _ovr.SetData(_ovrBuf);

                //0-5: left side, starting at 59, 327 with increments of 20
                //6-10: right side, starting at 587, 347
                Vector2 btnLoc = new Vector2(i < 6 ? 62 : 590, (i < 6 ? 330 : 350) + ((i < 6 ? i : i - 6) * 20));

                mainBtn[i] = new XNAButton(new [] { _out, _ovr }, btnLoc);
                World.IgnoreDialogs(mainBtn[i]);
            }

            //left button onclick events
            mainBtn[0].OnClick += (s,e) => _doStateChange(InGameStates.Inventory);
            mainBtn[1].OnClick += (s,e) => World.Instance.ActiveMapRenderer.ToggleMapView();
            mainBtn[2].OnClick += (s,e) => _doStateChange(InGameStates.Active);
            mainBtn[3].OnClick += (s, e) => _doStateChange(InGameStates.Passive);
            mainBtn[4].OnClick += (s, e) => _doStateChange(InGameStates.Chat);
            mainBtn[5].OnClick += (s, e) => _doStateChange(InGameStates.Stats);

            //right button onclick events
            mainBtn[6].OnClick += (s, e) => _doStateChange(InGameStates.Online);
            mainBtn[7].OnClick += (s, e) => _doStateChange(InGameStates.Party);
            //mainBtn[8].OnClick += OnViewMacro; //not implemented in EO client
            mainBtn[9].OnClick += (s, e) => _doStateChange(InGameStates.Settings);
            mainBtn[10].OnClick += (s, e) => _doStateChange(InGameStates.Help);

            SpriteBatch = new SpriteBatch(g.GraphicsDevice);

            state = InGameStates.News;

            chatRenderer = new EOChatRenderer();
            chatRenderer.SetParent(pnlChat);
            chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER),
                World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_1),
                ChatType.Note, ChatColor.Server);
            chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER),
                World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_2),
                ChatType.Note, ChatColor.Server);

            newsTab = new ChatTab(pnlNews);

            chatTextBox = new ChatTextBox(new Rectangle(124, 308, 440, 19), g.Content.Load<Texture2D>("cursor"), "Microsoft Sans Serif", 8.0f)
            {
                Selected = true,
                Visible = true,
                MaxChars = 140
            };
            World.IgnoreDialogs(chatTextBox);
            chatTextBox.OnEnterPressed += _doTalk;
            chatTextBox.OnClicked += (s, e) =>
            {
                //make sure clicking on the textarea selects it (this is an annoying problem in the original client)
                if (((EOGame)g).Dispatcher.Subscriber != null)
                    ((XNATextBox) (g as EOGame).Dispatcher.Subscriber).Selected = false;

                (g as EOGame).Dispatcher.Subscriber = chatTextBox;
                chatTextBox.Selected = true;
            };
            chatTextBox.OnTextChanged += (s, e) =>
            {
                if (chatTextBox.Text.Length <= 0)
                {
                    if (modeTextureLoaded && modeTexture != null)
                    {
                        modeTextureLoaded = false;
                        modeTexture.Dispose();
                        modeTexture = null;

                        currentChatMode = ChatMode.NoText;
                    }
                    return;
                }

                if (chatTextBox.Text.Length == 1 && chatTextBox.Text[0] == '~' &&
                    World.Instance.MainPlayer.ActiveCharacter.CurrentMap == World.Instance.JailMap)
                {
                    chatTextBox.Text = "";
                    SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING, DATCONST2.JAIL_WARNING_CANNOT_USE_GLOBAL);
                    return;
                }

                switch (chatTextBox.Text[0])
                {
                    case '!': currentChatMode = ChatMode.Private; break;
                    case '@': //should show global if admin, otherwise, public/normal chat
                        if (World.Instance.MainPlayer.ActiveCharacter.AdminLevel == AdminLevel.Player)
                            goto default;
                        currentChatMode = ChatMode.Global;
                        break;
                    case '~': currentChatMode = ChatMode.Global; break;
                    case '+':
                    {
                        if (World.Instance.MainPlayer.ActiveCharacter.AdminLevel == AdminLevel.Player)
                            goto default;
                        currentChatMode = ChatMode.Admin;
                    }
                        break;
                    case '\'': currentChatMode = ChatMode.Group; break;
                    case '&':
                    {
                        if (World.Instance.MainPlayer.ActiveCharacter.GuildName == "")
                            goto default;
                        currentChatMode = ChatMode.Guild;
                    }
                        break;
                    default: currentChatMode = ChatMode.Public; break;
                }
            };

            ((EOGame)g).Dispatcher.Subscriber = chatTextBox;

            m_muteTimer = new Timer(s =>
            {
                chatTextBox.IgnoreAllInput = false;
                currentChatMode = ChatMode.NoText;
                m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite);
            }, null, Timeout.Infinite, Timeout.Infinite);

            statusLabel = new XNALabel(new Rectangle(97, 455, 1, 1), "Microsoft Sans Serif", 7f);
            clockLabel = new XNALabel(new Rectangle(558, 455, 1, 1), "Microsoft Sans Serif", 7f);

            StatusBars[0] = new HudElementHP();
            StatusBars[1] = new HudElementTP();
            StatusBars[2] = new HudElementSP();
            StatusBars[3] = new HudElementTNL();

            m_whoIsOnline = new EOOnlineList(pnlOnline);
            m_party = new EOPartyPanel(pnlParty);

            m_friendList = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true),
                new Vector2(592, 312),
                new Rectangle(0, 260, 17, 15),
                new Rectangle(0, 276, 17, 15))
            {
                Visible = true,
                Enabled = true
            };
            m_friendList.OnClick += (o, e) => EOFriendIgnoreListDialog.Show(m_packetAPI, false);
            m_friendList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_FRIEND_LIST);

            m_ignoreList = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true),
                new Vector2(609, 312),
                new Rectangle(17, 260, 17, 15),
                new Rectangle(17, 276, 17, 15))
            {
                Visible = true,
                Enabled = true
            };
            m_ignoreList.OnClick += (o, e) => EOFriendIgnoreListDialog.Show(m_packetAPI, true);
            m_ignoreList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_IGNORE_LIST);

            m_expInfo = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 58),
                new Vector2(55, 0),
                new Rectangle(331, 30, 22, 14),
                new Rectangle(331, 30, 22, 14));
            m_expInfo.OnClick += (o, e) => EOSessionExpDialog.Show();
            m_questInfo = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 58),
                new Vector2(77, 0),
                new Rectangle(353, 30, 22, 14),
                new Rectangle(353, 30, 22, 14));

            //no need to make this a member variable
            //it does not have any resources to dispose and it is automatically disposed by the framework
            // ReSharper disable once UnusedVariable
            EOSettingsPanel settings = new EOSettingsPanel(pnlSettings);
        }
        public override void Initialize()
        {
            ReadGameCommands();

            Name              = "HotkeyConfigurationWindow";
            ClientRectangle   = new Rectangle(0, 0, 600, 450);
            BackgroundTexture = AssetLoader.LoadTextureUncached("hotkeyconfigbg.png");

            var lblCategory = new XNALabel(WindowManager);

            lblCategory.Name            = "lblCategory";
            lblCategory.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblCategory.Text            = "Category:";

            ddCategory                 = new XNAClientDropDown(WindowManager);
            ddCategory.Name            = "ddCategory";
            ddCategory.ClientRectangle = new Rectangle(lblCategory.Right + 12,
                                                       lblCategory.Y - 1, 250, ddCategory.Height);

            HashSet <string> categories = new HashSet <string>();

            foreach (var command in gameCommands)
            {
                if (!categories.Contains(command.Category))
                {
                    categories.Add(command.Category);
                }
            }

            foreach (string category in categories)
            {
                ddCategory.AddItem(category);
            }

            lbHotkeys                 = new XNAMultiColumnListBox(WindowManager);
            lbHotkeys.Name            = "lbHotkeys";
            lbHotkeys.ClientRectangle = new Rectangle(12, ddCategory.Bottom + 12,
                                                      ddCategory.Right - 12, Height - ddCategory.Bottom - 59);
            lbHotkeys.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
            lbHotkeys.BackgroundTexture       = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbHotkeys.AddColumn("Command", 150);
            lbHotkeys.AddColumn("Shortcut", lbHotkeys.Width - 150);

            hotkeyInfoPanel                 = new XNAPanel(WindowManager);
            hotkeyInfoPanel.Name            = "HotkeyInfoPanel";
            hotkeyInfoPanel.ClientRectangle = new Rectangle(lbHotkeys.Right + 12,
                                                            ddCategory.Y, Width - lbHotkeys.Right - 24, lbHotkeys.Height + ddCategory.Height + 12);

            lblCommandCaption                 = new XNALabel(WindowManager);
            lblCommandCaption.Name            = "lblCommandCaption";
            lblCommandCaption.FontIndex       = 1;
            lblCommandCaption.ClientRectangle = new Rectangle(12, 12, 0, 0);
            lblCommandCaption.Text            = "Command name";

            lblDescription                 = new XNALabel(WindowManager);
            lblDescription.Name            = "lblDescription";
            lblDescription.ClientRectangle = new Rectangle(12, lblCommandCaption.Bottom + 12, 0, 0);
            lblDescription.Text            = "Command description";

            var lblCurrentHotkey = new XNALabel(WindowManager);

            lblCurrentHotkey.Name            = "lblCurrentHotkey";
            lblCurrentHotkey.ClientRectangle = new Rectangle(lblDescription.X,
                                                             lblDescription.Bottom + 48, 0, 0);
            lblCurrentHotkey.FontIndex = 1;
            lblCurrentHotkey.Text      = "Currently assigned hotkey:";

            lblCurrentHotkeyValue                 = new XNALabel(WindowManager);
            lblCurrentHotkeyValue.Name            = "lblCurrentHotkeyValue";
            lblCurrentHotkeyValue.ClientRectangle = new Rectangle(lblDescription.X,
                                                                  lblCurrentHotkey.Bottom + 6, 0, 0);
            lblCurrentHotkeyValue.Text = "Current hotkey value";

            var lblNewHotkey = new XNALabel(WindowManager);

            lblNewHotkey.Name            = "lblNewHotkey";
            lblNewHotkey.ClientRectangle = new Rectangle(lblDescription.X,
                                                         lblCurrentHotkeyValue.Bottom + 48, 0, 0);
            lblNewHotkey.FontIndex = 1;
            lblNewHotkey.Text      = "New hotkey:";

            lblNewHotkeyValue                 = new XNALabel(WindowManager);
            lblNewHotkeyValue.Name            = "lblNewHotkeyValue";
            lblNewHotkeyValue.ClientRectangle = new Rectangle(lblDescription.X,
                                                              lblNewHotkey.Bottom + 6, 0, 0);
            lblNewHotkeyValue.Text = HOTKEY_TIP_TEXT;

            lblCurrentlyAssignedTo                 = new XNALabel(WindowManager);
            lblCurrentlyAssignedTo.Name            = "lblCurrentlyAssignedTo";
            lblCurrentlyAssignedTo.ClientRectangle = new Rectangle(lblDescription.X,
                                                                   lblNewHotkeyValue.Bottom + 12, 0, 0);
            lblCurrentlyAssignedTo.Text = "Currently assigned to:\nKey";

            var btnAssign = new XNAClientButton(WindowManager);

            btnAssign.Name            = "btnAssign";
            btnAssign.ClientRectangle = new Rectangle(lblDescription.X,
                                                      lblCurrentlyAssignedTo.Bottom + 24, 121, 23);
            btnAssign.Text       = "Assign Hotkey";
            btnAssign.LeftClick += BtnAssign_LeftClick;

            btnResetKey                 = new XNAClientButton(WindowManager);
            btnResetKey.Name            = "btnResetKey";
            btnResetKey.ClientRectangle = new Rectangle(btnAssign.X, btnAssign.Bottom + 12, btnAssign.Width, 23);
            btnResetKey.Text            = "Reset to Default";
            btnResetKey.LeftClick      += BtnReset_LeftClick;

            var lblDefaultHotkey = new XNALabel(WindowManager);

            lblDefaultHotkey.Name            = "lblOriginalHotkey";
            lblDefaultHotkey.ClientRectangle = new Rectangle(lblCurrentHotkey.X, btnResetKey.Bottom + 12, 0, 0);
            lblDefaultHotkey.Text            = "Default hotkey:";

            lblDefaultHotkeyValue                 = new XNALabel(WindowManager);
            lblDefaultHotkeyValue.Name            = "lblDefaultHotkeyValue";
            lblDefaultHotkeyValue.ClientRectangle = new Rectangle(lblDefaultHotkey.Right + 12, lblDefaultHotkey.Y, 0, 0);

            var btnSave = new XNAClientButton(WindowManager);

            btnSave.Name            = "btnSave";
            btnSave.ClientRectangle = new Rectangle(12, lbHotkeys.Bottom + 12, 92, 23);
            btnSave.Text            = "Save";
            btnSave.LeftClick      += BtnSave_LeftClick;

            var btnResetAllKeys = new XNAClientButton(WindowManager);

            btnResetAllKeys.Name            = "btnResetAllToDefaults";
            btnResetAllKeys.ClientRectangle = new Rectangle(0, btnSave.Y, 121, 23);
            btnResetAllKeys.Text            = "Reset All Keys";
            btnResetAllKeys.LeftClick      += BtnResetToDefaults_LeftClick;
            AddChild(btnResetAllKeys);
            btnResetAllKeys.CenterOnParentHorizontally();

            var btnCancel = new XNAClientButton(WindowManager);

            btnCancel.Name            = "btnExit";
            btnCancel.ClientRectangle = new Rectangle(Width - 104, btnSave.Y, 92, 23);
            btnCancel.Text            = "Cancel";
            btnCancel.LeftClick      += BtnCancel_LeftClick;

            AddChild(lbHotkeys);
            AddChild(lblCategory);
            AddChild(ddCategory);
            AddChild(hotkeyInfoPanel);
            AddChild(btnSave);
            AddChild(btnCancel);
            hotkeyInfoPanel.AddChild(lblCommandCaption);
            hotkeyInfoPanel.AddChild(lblDescription);
            hotkeyInfoPanel.AddChild(lblCurrentHotkey);
            hotkeyInfoPanel.AddChild(lblCurrentHotkeyValue);
            hotkeyInfoPanel.AddChild(lblNewHotkey);
            hotkeyInfoPanel.AddChild(lblNewHotkeyValue);
            hotkeyInfoPanel.AddChild(lblCurrentlyAssignedTo);
            hotkeyInfoPanel.AddChild(lblDefaultHotkey);
            hotkeyInfoPanel.AddChild(lblDefaultHotkeyValue);
            hotkeyInfoPanel.AddChild(btnAssign);
            hotkeyInfoPanel.AddChild(btnResetKey);

            if (categories.Count > 0)
            {
                hotkeyInfoPanel.Disable();
                lbHotkeys.SelectedIndexChanged += LbHotkeys_SelectedIndexChanged;

                ddCategory.SelectedIndexChanged += DdCategory_SelectedIndexChanged;
                ddCategory.SelectedIndex         = 0;
            }
            else
            {
                Logger.Log("No keyboard game commands exist!");
            }

            GameProcessLogic.GameProcessExited += GameProcessLogic_GameProcessExited;

            base.Initialize();

            CenterOnParent();

            Keyboard.OnKeyPressed += Keyboard_OnKeyPressed;
            EnabledChanged        += HotkeyConfigurationWindow_EnabledChanged;
        }
예제 #28
0
        public HUD(Game g, PacketAPI api)
            : base(g)
        {
            if (!api.Initialized)
            {
                throw new ArgumentException("Need to initialize connection before the in-game stuff will work");
            }
            m_packetAPI = api;

            DrawOrder = 5;

            mainFrame = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 1, true);
            topLeft   = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 21, true);
            sidebar   = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 22, true);
            topBar    = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 23, true);
            filler    = new Texture2D(g.GraphicsDevice, 1, 1);
            filler.SetData(new[] { Color.FromNonPremultiplied(8, 8, 8, 255) });

            Texture2D mainButtonTexture = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 25);

            mainBtn = new XNAButton[NUM_BTN];

            //set up panels
            Texture2D invBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 44);

            pnlInventory = new XNAPanel(new Rectangle(102, 330, invBG.Width, invBG.Height))
            {
                BackgroundImage = invBG,
                Visible         = false
            };

            Texture2D spellsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 62);

            pnlActiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height))
            {
                BackgroundImage = spellsBG,
                Visible         = false
            };

            pnlPassiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height))
            {
                BackgroundImage = spellsBG,
                Visible         = false
            };

            Texture2D chatBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 28);

            pnlChat = new XNAPanel(new Rectangle(102, 330, chatBG.Width, chatBG.Height))
            {
                BackgroundImage = chatBG,
                Visible         = false
            };

            Texture2D statsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 34);

            pnlStats = new XNAPanel(new Rectangle(102, 330, statsBG.Width, statsBG.Height))
            {
                BackgroundImage = statsBG,
                Visible         = false
            };

            Texture2D onlineBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 36);

            pnlOnline = new XNAPanel(new Rectangle(102, 330, onlineBG.Width, onlineBG.Height))
            {
                BackgroundImage = onlineBG,
                Visible         = false
            };

            Texture2D partyBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 42);

            pnlParty = new XNAPanel(new Rectangle(102, 330, partyBG.Width, partyBG.Height))
            {
                BackgroundImage = partyBG,
                Visible         = false
            };

            Texture2D settingsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 47);

            pnlSettings = new XNAPanel(new Rectangle(102, 330, settingsBG.Width, settingsBG.Height))
            {
                BackgroundImage = settingsBG,
                Visible         = false
            };

            Texture2D helpBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 63);

            pnlHelp = new XNAPanel(new Rectangle(102, 330, helpBG.Width, helpBG.Height))
            {
                BackgroundImage = helpBG,
                Visible         = false
            };

            Texture2D newsBG = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 48);

            pnlNews = new XNAPanel(new Rectangle(102, 330, newsBG.Width, newsBG.Height))
            {
                BackgroundImage = newsBG
            };

            //for easy update of all panels via foreach
            List <XNAPanel> pnlCollection = new List <XNAPanel>(10)
            {
                pnlInventory,
                pnlActiveSpells,
                pnlPassiveSpells,
                pnlChat,
                pnlStats,
                pnlOnline,
                pnlParty,
                pnlSettings,
                pnlHelp,
                pnlNews
            };

            //pnlCollection.Add(pnlMacro); //if this ever happens...

            pnlCollection.ForEach(_pnl => World.IgnoreDialogs(_pnl));

            for (int i = 0; i < NUM_BTN; ++i)
            {
                Texture2D _out = new Texture2D(g.GraphicsDevice, mainButtonTexture.Width / 2, mainButtonTexture.Height / NUM_BTN);
                Texture2D _ovr = new Texture2D(g.GraphicsDevice, mainButtonTexture.Width / 2, mainButtonTexture.Height / NUM_BTN);

                Rectangle _outRec = new Rectangle(0, i * _out.Height, _out.Width, _out.Height);
                Rectangle _ovrRec = new Rectangle(_ovr.Width, i * _ovr.Height, _ovr.Width, _ovr.Height);

                Color[] _outBuf = new Color[_outRec.Width * _outRec.Height];
                Color[] _ovrBuf = new Color[_ovrRec.Width * _ovrRec.Height];

                mainButtonTexture.GetData(0, _outRec, _outBuf, 0, _outBuf.Length);
                _out.SetData(_outBuf);

                mainButtonTexture.GetData(0, _ovrRec, _ovrBuf, 0, _ovrBuf.Length);
                _ovr.SetData(_ovrBuf);

                //0-5: left side, starting at 59, 327 with increments of 20
                //6-10: right side, starting at 587, 347
                Vector2 btnLoc = new Vector2(i < 6 ? 62 : 590, (i < 6 ? 330 : 350) + ((i < 6 ? i : i - 6) * 20));

                mainBtn[i] = new XNAButton(new [] { _out, _ovr }, btnLoc);
                World.IgnoreDialogs(mainBtn[i]);
            }

            //left button onclick events
            mainBtn[0].OnClick += (s, e) => _doStateChange(InGameStates.Inventory);
            mainBtn[1].OnClick += (s, e) => World.Instance.ActiveMapRenderer.ToggleMapView();
            mainBtn[2].OnClick += (s, e) => _doStateChange(InGameStates.Active);
            mainBtn[3].OnClick += (s, e) => _doStateChange(InGameStates.Passive);
            mainBtn[4].OnClick += (s, e) => _doStateChange(InGameStates.Chat);
            mainBtn[5].OnClick += (s, e) => _doStateChange(InGameStates.Stats);

            //right button onclick events
            mainBtn[6].OnClick += (s, e) => _doStateChange(InGameStates.Online);
            mainBtn[7].OnClick += (s, e) => _doStateChange(InGameStates.Party);
            //mainBtn[8].OnClick += OnViewMacro; //not implemented in EO client
            mainBtn[9].OnClick  += (s, e) => _doStateChange(InGameStates.Settings);
            mainBtn[10].OnClick += (s, e) => _doStateChange(InGameStates.Help);

            SpriteBatch = new SpriteBatch(g.GraphicsDevice);

            state = InGameStates.News;

            chatRenderer = new EOChatRenderer();
            chatRenderer.SetParent(pnlChat);
            chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER),
                                      World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_1),
                                      ChatType.Note, ChatColor.Server);
            chatRenderer.AddTextToTab(ChatTabs.Global, World.GetString(DATCONST2.STRING_SERVER),
                                      World.GetString(DATCONST2.GLOBAL_CHAT_SERVER_MESSAGE_2),
                                      ChatType.Note, ChatColor.Server);

            newsTab = new ChatTab(pnlNews);

            chatTextBox = new ChatTextBox(new Rectangle(124, 308, 440, 19), g.Content.Load <Texture2D>("cursor"), "Microsoft Sans Serif", 8.0f)
            {
                Selected = true,
                Visible  = true,
                MaxChars = 140
            };
            World.IgnoreDialogs(chatTextBox);
            chatTextBox.OnEnterPressed += _doTalk;
            chatTextBox.OnClicked      += (s, e) =>
            {
                //make sure clicking on the textarea selects it (this is an annoying problem in the original client)
                if (((EOGame)g).Dispatcher.Subscriber != null)
                {
                    ((XNATextBox)(g as EOGame).Dispatcher.Subscriber).Selected = false;
                }

                (g as EOGame).Dispatcher.Subscriber = chatTextBox;
                chatTextBox.Selected = true;
            };
            chatTextBox.OnTextChanged += (s, e) =>
            {
                if (chatTextBox.Text.Length <= 0)
                {
                    if (modeTextureLoaded && modeTexture != null)
                    {
                        modeTextureLoaded = false;
                        modeTexture.Dispose();
                        modeTexture = null;

                        currentChatMode = ChatMode.NoText;
                    }
                    return;
                }

                if (chatTextBox.Text.Length == 1 && chatTextBox.Text[0] == '~' &&
                    World.Instance.MainPlayer.ActiveCharacter.CurrentMap == World.Instance.JailMap)
                {
                    chatTextBox.Text = "";
                    SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING, DATCONST2.JAIL_WARNING_CANNOT_USE_GLOBAL);
                    return;
                }

                switch (chatTextBox.Text[0])
                {
                case '!': currentChatMode = ChatMode.Private; break;

                case '@':                         //should show global if admin, otherwise, public/normal chat
                    if (World.Instance.MainPlayer.ActiveCharacter.AdminLevel == AdminLevel.Player)
                    {
                        goto default;
                    }
                    currentChatMode = ChatMode.Global;
                    break;

                case '~': currentChatMode = ChatMode.Global; break;

                case '+':
                {
                    if (World.Instance.MainPlayer.ActiveCharacter.AdminLevel == AdminLevel.Player)
                    {
                        goto default;
                    }
                    currentChatMode = ChatMode.Admin;
                }
                break;

                case '\'': currentChatMode = ChatMode.Group; break;

                case '&':
                {
                    if (World.Instance.MainPlayer.ActiveCharacter.GuildName == "")
                    {
                        goto default;
                    }
                    currentChatMode = ChatMode.Guild;
                }
                break;

                default: currentChatMode = ChatMode.Public; break;
                }
            };

            ((EOGame)g).Dispatcher.Subscriber = chatTextBox;

            m_muteTimer = new Timer(s =>
            {
                chatTextBox.IgnoreAllInput = false;
                currentChatMode            = ChatMode.NoText;
                m_muteTimer.Change(Timeout.Infinite, Timeout.Infinite);
            }, null, Timeout.Infinite, Timeout.Infinite);

            statusLabel = new XNALabel(new Rectangle(97, 455, 1, 1), "Microsoft Sans Serif", 7f);
            clockLabel  = new XNALabel(new Rectangle(558, 455, 1, 1), "Microsoft Sans Serif", 7f);

            StatusBars[0] = new HudElementHP();
            StatusBars[1] = new HudElementTP();
            StatusBars[2] = new HudElementSP();
            StatusBars[3] = new HudElementTNL();

            m_whoIsOnline = new EOOnlineList(pnlOnline);
            m_party       = new EOPartyPanel(pnlParty);

            m_friendList = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true),
                                         new Vector2(592, 312),
                                         new Rectangle(0, 260, 17, 15),
                                         new Rectangle(0, 276, 17, 15))
            {
                Visible = true,
                Enabled = true
            };
            m_friendList.OnClick     += (o, e) => EOFriendIgnoreListDialog.Show(m_packetAPI, false);
            m_friendList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_FRIEND_LIST);

            m_ignoreList = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27, false, true),
                                         new Vector2(609, 312),
                                         new Rectangle(17, 260, 17, 15),
                                         new Rectangle(17, 276, 17, 15))
            {
                Visible = true,
                Enabled = true
            };
            m_ignoreList.OnClick     += (o, e) => EOFriendIgnoreListDialog.Show(m_packetAPI, true);
            m_ignoreList.OnMouseOver += (o, e) => SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_BUTTON, DATCONST2.STATUS_LABEL_IGNORE_LIST);

            m_expInfo = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 58),
                                      new Vector2(55, 0),
                                      new Rectangle(331, 30, 22, 14),
                                      new Rectangle(331, 30, 22, 14));
            m_expInfo.OnClick += (o, e) => EOSessionExpDialog.Show();
            m_questInfo        = new XNAButton(GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 58),
                                               new Vector2(77, 0),
                                               new Rectangle(353, 30, 22, 14),
                                               new Rectangle(353, 30, 22, 14));

            //no need to make this a member variable
            //it does not have any resources to dispose and it is automatically disposed by the framework
// ReSharper disable once UnusedVariable
            EOSettingsPanel settings = new EOSettingsPanel(pnlSettings);
        }
예제 #29
0
        public EOInventory(XNAPanel parent, PacketAPI api)
            : base(null, null, parent)
        {
            m_api = api;

            //load info from registry
            Dictionary <int, int> localItemSlotMap = new Dictionary <int, int>();

            m_inventoryKey = _tryGetCharacterRegKey();
            if (m_inventoryKey != null)
            {
                const string itemFmt = "item{0}";
                for (int i = 0; i < INVENTORY_ROW_LENGTH * 4; ++i)
                {
                    int id;
                    try
                    {
                        id = Convert.ToInt32(m_inventoryKey.GetValue(string.Format(itemFmt, i)));
                    }
                    catch { continue; }
                    localItemSlotMap.Add(i, id);
                }
            }

            //add the inventory items that were retrieved from the server
            List <InventoryItem> localInv = World.Instance.MainPlayer.ActiveCharacter.Inventory;

            if (localInv.Find(_item => _item.id == 1).id != 1)
            {
                localInv.Insert(0, new InventoryItem {
                    amount = 0, id = 1
                });                                                                         //add 0 gold if there isn't any gold
            }
            bool dialogShown = false;

            foreach (InventoryItem item in localInv)
            {
                ItemRecord rec  = World.Instance.EIF.GetItemRecordByID(item.id);
                int        slot = localItemSlotMap.ContainsValue(item.id)
                                        ? localItemSlotMap.First(_pair => _pair.Value == item.id).Key
                                        : GetNextOpenSlot(rec.Size);
                if (!dialogShown && !AddItemToSlot(slot, rec, item.amount))
                {
                    dialogShown = true;
                    EODialog.Show("Something doesn't fit in the inventory. Rearrange items or get rid of them.", "Warning", XNADialogButtons.Ok, EODialogStyle.SmallDialogSmallHeader);
                }
            }

            //coordinates for parent of EOInventory: 102, 330 (pnlInventory in InGameHud)
            //extra in photoshop right now: 8, 31

            //current weight label (member variable, needs to have text updated when item amounts change)
            m_lblWeight = new XNALabel(new Rectangle(385, 37, 88, 18), "Microsoft Sans MS", 8f)
            {
                ForeColor = System.Drawing.Color.FromArgb(255, 0xc8, 0xc8, 0xc8),
                TextAlign = ContentAlignment.MiddleCenter,
                Visible   = true,
                AutoSize  = false
            };
            m_lblWeight.SetParent(this);
            UpdateWeightLabel();

            Texture2D thatWeirdSheet = GFXLoader.TextureFromResource(GFXTypes.PostLoginUI, 27);             //oh my gawd the offsets on this bish

            //(local variables, added to child controls)
            //'paperdoll' button
            m_btnPaperdoll = new XNAButton(thatWeirdSheet, new Vector2(385, 9), /*new Rectangle(39, 385, 88, 19)*/ null, new Rectangle(126, 385, 88, 19));
            m_btnPaperdoll.SetParent(this);
            m_btnPaperdoll.OnClick += (s, e) => m_api.RequestPaperdoll((short)World.Instance.MainPlayer.ActiveCharacter.ID);
            //'drop' button
            //491, 398 -> 389, 68
            //0,15,38,37
            //0,52,38,37
            m_btnDrop = new XNAButton(thatWeirdSheet, new Vector2(389, 68), new Rectangle(0, 15, 38, 37), new Rectangle(0, 52, 38, 37));
            m_btnDrop.SetParent(this);
            m_btnDrop.IgnoreDialog(typeof(EOPaperdollDialog));
            m_btnDrop.IgnoreDialog(typeof(EOChestDialog));
            //'junk' button - 4 + 38 on the x away from drop
            m_btnJunk = new XNAButton(thatWeirdSheet, new Vector2(431, 68), new Rectangle(0, 89, 38, 37), new Rectangle(0, 126, 38, 37));
            m_btnJunk.SetParent(this);
            m_btnJunk.IgnoreDialog(typeof(EOPaperdollDialog));
            m_btnJunk.IgnoreDialog(typeof(EOChestDialog));
        }
예제 #30
0
		private void CreatePanels()
		{
			Texture2D invBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 44);
			pnlInventory = new XNAPanel(new Rectangle(102, 330, invBG.Width, invBG.Height))
			{
				BackgroundImage = invBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D spellsBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 62);
			pnlActiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height))
			{
				BackgroundImage = spellsBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			pnlPassiveSpells = new XNAPanel(new Rectangle(102, 330, spellsBG.Width, spellsBG.Height))
			{
				BackgroundImage = spellsBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D chatBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 28);
			pnlChat = new XNAPanel(new Rectangle(102, 330, chatBG.Width, chatBG.Height))
			{
				BackgroundImage = chatBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D statsBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 34);
			pnlStats = new XNAPanel(new Rectangle(102, 330, statsBG.Width, statsBG.Height))
			{
				BackgroundImage = statsBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D onlineBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 36);
			pnlOnline = new XNAPanel(new Rectangle(102, 330, onlineBG.Width, onlineBG.Height))
			{
				BackgroundImage = onlineBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D partyBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 42);
			pnlParty = new XNAPanel(new Rectangle(102, 330, partyBG.Width, partyBG.Height))
			{
				BackgroundImage = partyBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D settingsBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 47);
			pnlSettings = new XNAPanel(new Rectangle(102, 330, settingsBG.Width, settingsBG.Height))
			{
				BackgroundImage = settingsBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D helpBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 63);
			pnlHelp = new XNAPanel(new Rectangle(102, 330, helpBG.Width, helpBG.Height))
			{
				BackgroundImage = helpBG,
				Visible = false,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			Texture2D newsBG = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 48);
			pnlNews = new XNAPanel(new Rectangle(102, 330, newsBG.Width, newsBG.Height))
			{
				BackgroundImage = newsBG,
				DrawOrder = HUD_CONTROL_DRAW_ORDER
			};

			//for easy update of all panels via foreach
			List<XNAPanel> pnlCollection = new List<XNAPanel>(10)
			{
				pnlInventory,
				pnlActiveSpells,
				pnlPassiveSpells,
				pnlChat,
				pnlStats,
				pnlOnline,
				pnlParty,
				pnlSettings,
				pnlHelp,
				pnlNews
			};
			//pnlCollection.Add(pnlMacro); //if this ever happens...

			pnlCollection.ForEach(World.IgnoreDialogs);
		}
        public override void Initialize()
        {
            sm = StatisticsManager.Instance;

            string strLblEconomy    = "ECONOMY";
            string strLblAvgEconomy = "Average economy:";

            if (ClientConfiguration.Instance.UseBuiltStatistic)
            {
                strLblEconomy    = "BUILT";
                strLblAvgEconomy = "Avg. number of objects built:";
            }

            Name = "StatisticsWindow";
            BackgroundTexture = AssetLoader.LoadTexture("scoreviewerbg.png");
            ClientRectangle   = new Rectangle(0, 0, 700, 521);

            tabControl                 = new XNAClientTabControl(WindowManager);
            tabControl.Name            = "tabControl";
            tabControl.ClientRectangle = new Rectangle(12, 10, 0, 0);
            tabControl.SoundOnClick    = AssetLoader.LoadSound("button.wav");
            tabControl.FontIndex       = 1;
            tabControl.AddTab("Game Statistics", 133);
            tabControl.AddTab("Total Statistics", 133);
            tabControl.SelectedIndexChanged += TabControl_SelectedIndexChanged;

            XNALabel lblFilter = new XNALabel(WindowManager);

            lblFilter.Name            = "lblFilter";
            lblFilter.FontIndex       = 1;
            lblFilter.Text            = "FILTER:";
            lblFilter.ClientRectangle = new Rectangle(527, 12, 0, 0);

            cmbGameClassFilter = new XNAClientDropDown(WindowManager);
            cmbGameClassFilter.ClientRectangle = new Rectangle(585, 11, 105, 21);
            cmbGameClassFilter.Name            = "cmbGameClassFilter";
            cmbGameClassFilter.AddItem("All games");
            cmbGameClassFilter.AddItem("Online games");
            cmbGameClassFilter.AddItem("Online PvP");
            cmbGameClassFilter.AddItem("Online Co-Op");
            cmbGameClassFilter.AddItem("Skirmish");
            cmbGameClassFilter.SelectedIndex         = 0;
            cmbGameClassFilter.SelectedIndexChanged += CmbGameClassFilter_SelectedIndexChanged;

            XNALabel lblGameMode = new XNALabel(WindowManager);

            lblGameMode.Name            = "lblGameMode";
            lblGameMode.FontIndex       = 1;
            lblGameMode.Text            = "GAME MODE:";
            lblGameMode.ClientRectangle = new Rectangle(294, 12, 0, 0);

            cmbGameModeFilter                       = new XNAClientDropDown(WindowManager);
            cmbGameModeFilter.Name                  = "cmbGameModeFilter";
            cmbGameModeFilter.ClientRectangle       = new Rectangle(381, 11, 114, 21);
            cmbGameModeFilter.SelectedIndexChanged += CmbGameModeFilter_SelectedIndexChanged;

            var btnReturnToMenu = new XNAClientButton(WindowManager);

            btnReturnToMenu.Name            = "btnReturnToMenu";
            btnReturnToMenu.ClientRectangle = new Rectangle(270, 486, 160, 23);
            btnReturnToMenu.Text            = "Return to Main Menu";
            btnReturnToMenu.LeftClick      += BtnReturnToMenu_LeftClick;

            var btnClearStatistics = new XNAClientButton(WindowManager);

            btnClearStatistics.Name            = "btnClearStatistics";
            btnClearStatistics.ClientRectangle = new Rectangle(12, 486, 160, 23);
            btnClearStatistics.Text            = "Clear Statistics";
            btnClearStatistics.LeftClick      += BtnClearStatistics_LeftClick;
            btnClearStatistics.Visible         = false;

            chkIncludeSpectatedGames = new XNAClientCheckBox(WindowManager);

            AddChild(chkIncludeSpectatedGames);
            chkIncludeSpectatedGames.Name            = "chkIncludeSpectatedGames";
            chkIncludeSpectatedGames.Text            = "Include spectated games";
            chkIncludeSpectatedGames.Checked         = true;
            chkIncludeSpectatedGames.ClientRectangle = new Rectangle(
                Width - chkIncludeSpectatedGames.Width - 12,
                cmbGameModeFilter.Bottom + 3,
                chkIncludeSpectatedGames.Width,
                chkIncludeSpectatedGames.Height);
            chkIncludeSpectatedGames.CheckedChanged += ChkIncludeSpectatedGames_CheckedChanged;

            #region Match statistics

            panelGameStatistics      = new XNAPanel(WindowManager);
            panelGameStatistics.Name = "panelGameStatistics";
            panelGameStatistics.BackgroundTexture = AssetLoader.LoadTexture("scoreviewerpanelbg.png");
            panelGameStatistics.ClientRectangle   = new Rectangle(10, 55, 680, 425);

            AddChild(panelGameStatistics);

            XNALabel lblMatches = new XNALabel(WindowManager);
            lblMatches.Text            = "GAMES:";
            lblMatches.FontIndex       = 1;
            lblMatches.ClientRectangle = new Rectangle(4, 2, 0, 0);

            lbGameList      = new XNAMultiColumnListBox(WindowManager);
            lbGameList.Name = "lbGameList";
            lbGameList.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbGameList.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbGameList.AddColumn("DATE / TIME", 130);
            lbGameList.AddColumn("MAP", 200);
            lbGameList.AddColumn("GAME MODE", 130);
            lbGameList.AddColumn("FPS", 50);
            lbGameList.AddColumn("DURATION", 76);
            lbGameList.AddColumn("COMPLETED", 90);
            lbGameList.ClientRectangle       = new Rectangle(2, 25, 676, 250);
            lbGameList.SelectedIndexChanged += LbGameList_SelectedIndexChanged;
            lbGameList.AllowKeyboardInput    = true;

            lbGameStatistics      = new XNAMultiColumnListBox(WindowManager);
            lbGameStatistics.Name = "lbGameStatistics";
            lbGameStatistics.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
            lbGameStatistics.DrawMode          = PanelBackgroundImageDrawMode.STRETCHED;
            lbGameStatistics.AddColumn("NAME", 130);
            lbGameStatistics.AddColumn("KILLS", 78);
            lbGameStatistics.AddColumn("LOSSES", 78);
            lbGameStatistics.AddColumn(strLblEconomy, 80);
            lbGameStatistics.AddColumn("SCORE", 100);
            lbGameStatistics.AddColumn("WON", 50);
            lbGameStatistics.AddColumn("SIDE", 100);
            lbGameStatistics.AddColumn("TEAM", 60);
            lbGameStatistics.ClientRectangle = new Rectangle(2, 280, 676, 143);

            panelGameStatistics.AddChild(lblMatches);
            panelGameStatistics.AddChild(lbGameList);
            panelGameStatistics.AddChild(lbGameStatistics);

            #endregion

            #region Total statistics

            panelTotalStatistics      = new XNAPanel(WindowManager);
            panelTotalStatistics.Name = "panelTotalStatistics";
            panelTotalStatistics.BackgroundTexture = AssetLoader.LoadTexture("scoreviewerpanelbg.png");
            panelTotalStatistics.ClientRectangle   = new Rectangle(10, 55, 680, 425);

            AddChild(panelTotalStatistics);
            panelTotalStatistics.Visible = false;
            panelTotalStatistics.Enabled = false;

            int locationY = TOTAL_STATS_FIRST_ITEM_Y;

            AddTotalStatisticsLabel("lblGamesStarted", "Games started:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblGamesStartedValue                 = new XNALabel(WindowManager);
            lblGamesStartedValue.Name            = "lblGamesStartedValue";
            lblGamesStartedValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblGamesStartedValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblGamesFinished", "Games finished:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblGamesFinishedValue                 = new XNALabel(WindowManager);
            lblGamesFinishedValue.Name            = "lblGamesFinishedValue";
            lblGamesFinishedValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblGamesFinishedValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblWins", "Wins:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblWinsValue                 = new XNALabel(WindowManager);
            lblWinsValue.Name            = "lblWinsValue";
            lblWinsValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblWinsValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblLosses", "Losses:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblLossesValue                 = new XNALabel(WindowManager);
            lblLossesValue.Name            = "lblLossesValue";
            lblLossesValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblLossesValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblWinLossRatio", "Win / Loss ratio:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblWinLossRatioValue                 = new XNALabel(WindowManager);
            lblWinLossRatioValue.Name            = "lblWinLossRatioValue";
            lblWinLossRatioValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblWinLossRatioValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageGameLength", "Average game length:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblAverageGameLengthValue                 = new XNALabel(WindowManager);
            lblAverageGameLengthValue.Name            = "lblAverageGameLengthValue";
            lblAverageGameLengthValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblAverageGameLengthValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblTotalTimePlayed", "Total time played:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblTotalTimePlayedValue                 = new XNALabel(WindowManager);
            lblTotalTimePlayedValue.Name            = "lblTotalTimePlayedValue";
            lblTotalTimePlayedValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblTotalTimePlayedValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageEnemyCount", "Average number of enemies:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblAverageEnemyCountValue                 = new XNALabel(WindowManager);
            lblAverageEnemyCountValue.Name            = "lblAverageEnemyCountValue";
            lblAverageEnemyCountValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblAverageEnemyCountValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageAllyCount", "Average number of allies:", new Point(TOTAL_STATS_LOCATION_X1, locationY));

            lblAverageAllyCountValue                 = new XNALabel(WindowManager);
            lblAverageAllyCountValue.Name            = "lblAverageAllyCountValue";
            lblAverageAllyCountValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X1, locationY, 0, 0);
            lblAverageAllyCountValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            // SECOND COLUMN

            locationY = TOTAL_STATS_FIRST_ITEM_Y;

            AddTotalStatisticsLabel("lblTotalKills", "Total kills:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblTotalKillsValue                 = new XNALabel(WindowManager);
            lblTotalKillsValue.Name            = "lblTotalKillsValue";
            lblTotalKillsValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblTotalKillsValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblKillsPerGame", "Kills / game:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblKillsPerGameValue                 = new XNALabel(WindowManager);
            lblKillsPerGameValue.Name            = "lblKillsPerGameValue";
            lblKillsPerGameValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblKillsPerGameValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblTotalLosses", "Total losses:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblTotalLossesValue                 = new XNALabel(WindowManager);
            lblTotalLossesValue.Name            = "lblTotalLossesValue";
            lblTotalLossesValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblTotalLossesValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblLossesPerGame", "Losses / game:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblLossesPerGameValue                 = new XNALabel(WindowManager);
            lblLossesPerGameValue.Name            = "lblLossesPerGameValue";
            lblLossesPerGameValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblLossesPerGameValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblKillLossRatio", "Kill / loss ratio:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblKillLossRatioValue                 = new XNALabel(WindowManager);
            lblKillLossRatioValue.Name            = "lblKillLossRatioValue";
            lblKillLossRatioValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblKillLossRatioValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblTotalScore", "Total score:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblTotalScoreValue                 = new XNALabel(WindowManager);
            lblTotalScoreValue.Name            = "lblTotalScoreValue";
            lblTotalScoreValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblTotalScoreValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageEconomy", strLblAvgEconomy, new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblAverageEconomyValue                 = new XNALabel(WindowManager);
            lblAverageEconomyValue.Name            = "lblAverageEconomyValue";
            lblAverageEconomyValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblAverageEconomyValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblFavouriteSide", "Favourite side:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblFavouriteSideValue                 = new XNALabel(WindowManager);
            lblFavouriteSideValue.Name            = "lblFavouriteSideValue";
            lblFavouriteSideValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblFavouriteSideValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            AddTotalStatisticsLabel("lblAverageAILevel", "Average AI level:", new Point(TOTAL_STATS_LOCATION_X2, locationY));

            lblAverageAILevelValue                 = new XNALabel(WindowManager);
            lblAverageAILevelValue.Name            = "lblAverageAILevelValue";
            lblAverageAILevelValue.ClientRectangle = new Rectangle(TOTAL_STATS_VALUE_LOCATION_X2, locationY, 0, 0);
            lblAverageAILevelValue.RemapColor      = UISettings.AltColor;
            locationY += TOTAL_STATS_Y_INCREASE;

            panelTotalStatistics.AddChild(lblGamesStartedValue);
            panelTotalStatistics.AddChild(lblGamesFinishedValue);
            panelTotalStatistics.AddChild(lblWinsValue);
            panelTotalStatistics.AddChild(lblLossesValue);
            panelTotalStatistics.AddChild(lblWinLossRatioValue);
            panelTotalStatistics.AddChild(lblAverageGameLengthValue);
            panelTotalStatistics.AddChild(lblTotalTimePlayedValue);
            panelTotalStatistics.AddChild(lblAverageEnemyCountValue);
            panelTotalStatistics.AddChild(lblAverageAllyCountValue);

            panelTotalStatistics.AddChild(lblTotalKillsValue);
            panelTotalStatistics.AddChild(lblKillsPerGameValue);
            panelTotalStatistics.AddChild(lblTotalLossesValue);
            panelTotalStatistics.AddChild(lblLossesPerGameValue);
            panelTotalStatistics.AddChild(lblKillLossRatioValue);
            panelTotalStatistics.AddChild(lblTotalScoreValue);
            panelTotalStatistics.AddChild(lblAverageEconomyValue);
            panelTotalStatistics.AddChild(lblFavouriteSideValue);
            panelTotalStatistics.AddChild(lblAverageAILevelValue);

            #endregion

            AddChild(tabControl);
            AddChild(lblFilter);
            AddChild(cmbGameClassFilter);
            AddChild(lblGameMode);
            AddChild(cmbGameModeFilter);
            AddChild(btnReturnToMenu);
            AddChild(btnClearStatistics);

            base.Initialize();

            CenterOnParent();

            sides = ClientConfiguration.Instance.GetSides().Split(',');

            sideTextures = new Texture2D[sides.Length + 1];
            for (int i = 0; i < sides.Length; i++)
            {
                sideTextures[i] = AssetLoader.LoadTexture(sides[i] + "icon.png");
            }

            sideTextures[sides.Length] = AssetLoader.LoadTexture("spectatoricon.png");

            mpColors = MultiplayerColor.LoadColors();

            ReadStatistics();
            ListGameModes();
            ListGames();

            StatisticsManager.Instance.GameAdded += Instance_GameAdded;
        }
예제 #32
0
        public OldActiveSpells(XNAPanel parent, PacketAPI api)
            : base(null, null, parent)
        {
            _api = api;

            _childItems = new List <ISpellIcon>(SPELL_NUM_ROWS * SPELL_ROW_LENGTH);
            RemoveAllSpells();

            var localSpellSlotMap = new Dictionary <int, int>();

            _spellsKey = _tryGetCharacterRegKey();
            if (_spellsKey != null)
            {
                const string spellFmt = "item{0}";
                for (int i = 0; i < SPELL_ROW_LENGTH * 4; ++i)
                {
                    int id;
                    try
                    {
                        id = Convert.ToInt32(_spellsKey.GetValue(String.Format(spellFmt, i)));
                    }
                    catch { continue; }
                    localSpellSlotMap.Add(i, id);
                }
            }

            var localSpells = OldWorld.Instance.MainPlayer.ActiveCharacter.Spells;

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (var spell in localSpells)
            {
                var rec  = OldWorld.Instance.ESF[spell.ID];
                int slot = localSpellSlotMap.ContainsValue(spell.ID)
                    ? localSpellSlotMap.First(_pair => _pair.Value == spell.ID).Key
                    : _getNextOpenSlot();

                if (slot < 0 || !_addNewSpellToSlot(slot, rec, spell.Level))
                {
                    EOMessageBox.Show("You have too many spells! They don't all fit.", "Warning", EODialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
                    break;
                }

                if (slot >= SPELL_ROW_LENGTH * (SPELL_NUM_ROWS / 2))
                {
                    _childItems.Last().Visible = false;
                }
            }

            _setSize(parent.DrawArea.Width, parent.DrawArea.Height);

            _functionKeyGraphics       = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 58, true);
            _functionKeyRow1SourceRect = new Rectangle(148, 51, 18, 13);
            _functionKeyRow2SourceRect = new Rectangle(148 + 18 * 8, 51, 18, 13);

            _selectedSpellName = new XNALabel(new Rectangle(9, 50, 81, 13), Constants.FontSize08pt5)
            {
                Visible   = false,
                Text      = "",
                AutoSize  = false,
                TextAlign = LabelAlignment.MiddleCenter,
                ForeColor = ColorConstants.LightGrayText
            };
            _selectedSpellName.SetParent(this);

            _selectedSpellLevel = new XNALabel(new Rectangle(32, 78, 42, 15), Constants.FontSize08pt5)
            {
                Visible   = true,
                Text      = "0",
                AutoSize  = false,
                TextAlign = LabelAlignment.MiddleLeft,
                ForeColor = ColorConstants.LightGrayText
            };
            _selectedSpellLevel.SetParent(this);

            var skillPoints = OldWorld.Instance.MainPlayer.ActiveCharacter.Stats.SkillPoints;

            _totalSkillPoints = new XNALabel(new Rectangle(32, 96, 42, 15), Constants.FontSize08pt5)
            {
                Visible   = true,
                Text      = skillPoints.ToString(),
                AutoSize  = false,
                TextAlign = LabelAlignment.MiddleLeft,
                ForeColor = ColorConstants.LightGrayText
            };
            _totalSkillPoints.SetParent(this);

            var buttonSheet = ((EOGame)Game).GFXManager.TextureFromResource(GFXTypes.PostLoginUI, 27, true);

            _levelUpButton1 = new XNAButton(buttonSheet, new Vector2(71, 77), new Rectangle(215, 386, 19, 15), new Rectangle(234, 386, 19, 15))
            {
                FlashSpeed = 500,
                Visible    = false
            };
            _levelUpButton1.OnClick += LevelUp_Click;
            _levelUpButton1.SetParent(this);
            _levelUpButton2 = new XNAButton(buttonSheet, new Vector2(71, 95), new Rectangle(215, 386, 19, 15), new Rectangle(234, 386, 19, 15))
            {
                FlashSpeed = 500,
                Visible    = false
            };
            _levelUpButton2.OnClick += LevelUp_Click;
            _levelUpButton2.SetParent(this);

            _scroll = new OldScrollBar(this, new Vector2(467, 2), new Vector2(16, 115), ScrollBarColors.LightOnMed)
            {
                LinesToRender = 2
            };
            _scroll.UpdateDimensions(4);

            foreach (var child in children.Where(x => !(x is EmptySpellIcon)))
            {
                OldWorld.IgnoreDialogs(child);
            }
        }