Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = Game.Content;

            _background = new PictureBox(content.Load<Texture2D>(@"Backgrounds\Title"), GameRef.ScreenRectangle);
            ControlManager.Add(_background);

            _loadLink = new LinkLabel {Text = "Select game", Position = new Vector2(50, 150)};
            _loadLink.Selected += LoadLinkSelected;
            ControlManager.Add(_loadLink);

            _exitLink = new LinkLabel {Text = "Back"};
            _exitLink.Position = new Vector2(50, 150 + _exitLink.Font.LineSpacing);
            _exitLink.Selected += ExitLinkSelected;
            ControlManager.Add(_exitLink);

            _loadListBox = new ListBox(content.Load<Texture2D>(@"GUI\ListBoxImage"), content.Load<Texture2D>(@"GUI\RightArrowUp"), false) {Position = new Vector2(400, 150)};
            _loadListBox.Selected += LoadListBoxSelected;
            _loadListBox.Leave += LoadListBoxLeave;

            for (int i = 0; i < 20; i++)
                _loadListBox.Items.Add("Game Number: " + i);

            ControlManager.Add(_loadListBox);

            ControlManager.NextControl();
        }
Ejemplo n.º 2
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager content = Game.Content;

            _background = new PictureBox(content.Load<Texture2D>(@"Backgrounds\Title"), GameRef.ScreenRectangle);
            ControlManager.Add(_background);

            var arrowTexture = content.Load<Texture2D>(@"GUI\LeftArrowUp");
            _arrow = new PictureBox(arrowTexture, 0, 0);
            ControlManager.Add(_arrow);

            var leftArrowTexture = content.Load<Texture2D>(@"GUI\RightArrowUp");
            _arrowLeft = new PictureBox(leftArrowTexture, 0, 0);
            ControlManager.Add(_arrowLeft);

            _startGame = new LinkLabel {Text = "The story begins"};
            _startGame.Size = _startGame.Font.MeasureString(_startGame.Text);
            _startGame.Selected += MenuItemSelected;
            ControlManager.Add(_startGame);

            _loadGame = new LinkLabel {Text = "The story continues"};
            _loadGame.Size = _loadGame.Font.MeasureString(_loadGame.Text);
            _loadGame.Selected += MenuItemSelected;
            ControlManager.Add(_loadGame);

            _exitGame = new LinkLabel {Text = "The story ends"};
            _exitGame.Size = _exitGame.Font.MeasureString(_exitGame.Text);
            _exitGame.Selected += MenuItemSelected;
            ControlManager.Add(_exitGame);

            ControlManager.NextControl();

            ControlManager.FocusChanged += ControlManagerFocusChanged;

            var position = new Vector2(350, 500);

            foreach (Control c in ControlManager.Where(c => c is LinkLabel))
            {
                if (c.Size.X > _maxItemWidth)
                    _maxItemWidth = c.Size.X;

                c.Position = position;
                position.Y += c.Size.Y + 5.0f;
            }

            ControlManagerFocusChanged(_startGame, null);
        }
        private void CreateControls()
        {
            Log.Debug("Loading controls...");
            var leftTexture = Game.Content.Load<Texture2D>(@"GUI\LeftArrowUp");
            var rightTexture = Game.Content.Load<Texture2D>(@"GUI\RightArrowUp");
            var stopTexture = Game.Content.Load<Texture2D>(@"GUI\StopBar");

            _background = new PictureBox(Game.Content.Load<Texture2D>(@"Backgrounds\Title"), GameRef.ScreenRectangle);
            ControlManager.Add(_background);

            var label1 = new Label {Text = "Who will search for the Eyes of the Dragon?"};
            label1.AutoSize();
            label1.Position = new Vector2((GameRef.Window.ClientBounds.Width - label1.Size.X) / 2, 150);
            ControlManager.Add(label1);

            _genderSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture);
            _genderSelector.SetItems(Genders, 125);
            _genderSelector.Position = new Vector2(label1.Position.X, 200);
            _genderSelector.SelectionChanged += SelectionChanged;
            ControlManager.Add(_genderSelector);

            _classSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture);
            _classSelector.SetItems(_classes, 125);
            _classSelector.Position = new Vector2(label1.Position.X, 250);
            _classSelector.SelectionChanged += SelectionChanged;
            ControlManager.Add(_classSelector);

            var acceptLabel = new LinkLabel {Text = "Accept this character", Position = new Vector2(label1.Position.X, 300)};
            acceptLabel.Selected += AcceptLabelSelected;
            ControlManager.Add(acceptLabel);

            _characterImage = new PictureBox(_characterImages[0, 0], new Rectangle(500, 200, 96, 96), new Rectangle(0, 0, 32, 32));
            ControlManager.Add(_characterImage);

            ControlManager.NextControl();
            Log.Debug("Loaded controls!");
        }
Ejemplo n.º 4
0
        private void CreateControls(ContentManager content)
        {
            Log.Info("Creating controls...");
            _background = new PictureBox(content.Load<Texture2D>(@"Backgrounds\Title"), GameRef.ScreenRectangle);
            ControlManager.Add(_background);

            var nextControlPosition = new Vector2(300, 150);

            _pointsRemaining = new Label { Text = "Skill Points: " + _unassignedPoints, Position = nextControlPosition };

            nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f;
            ControlManager.Add(_pointsRemaining);

            /*string skillPath = @"Game\Skills\";
            string[] skillFiles = Directory.GetFiles(skillPath, "*.skill");

            var skillData = new List<SkillData>();

            foreach (var file in skillFiles)
            {
                var data = Serializer.Deserialize<SkillData>(file);
                var label = new Label {Text = data.Name, Type = data.Name, Position = nextControlPosition};
                var linkLabel = new LinkLabel {Text = "+", Type = data.Name, TabStop = true, Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y)};
                var countLabel = new Label {Text = "0", Type = data.Name, Position = new Vector2(linkLabel.Position.X + 50, nextControlPosition.Y)};

                nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f;

                linkLabel.Selected += AddSkillLabelSelected;

                ControlManager.Add(label);
                ControlManager.Add(linkLabel);
                ControlManager.Add(countLabel);

                _skillLabels.Add(new SkillLabelSet(label, linkLabel, countLabel));
            }*/

            foreach (var key in DataManager.SkillData.Keys)
            {
                var data = DataManager.SkillData[key];

                var label = new Label
                {
                    Text = data.Name,
                    Type = data.Name,
                    Position = nextControlPosition
                };

                var countLabel = new Label
                {
                    Text = "0",
                    Position = new Vector2(nextControlPosition.X + 300, nextControlPosition.Y)
                };

                var linkLabel = new LinkLabel
                {
                    TabStop = true,
                    Text = "+",
                    Type = data.Name,
                    Position = new Vector2(nextControlPosition.X + 390, nextControlPosition.Y)
                };
                linkLabel.Selected += AddSkillLabelSelected;

                nextControlPosition.Y += ControlManager.Font.LineSpacing + 10f;

                ControlManager.Add(label);
                ControlManager.Add(countLabel);
                ControlManager.Add(linkLabel);

                _skillLabels.Add(new SkillLabelSet(label, linkLabel, countLabel));
            }

            nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f;

            var undoLabel = new LinkLabel {Text = "Undo", Position = nextControlPosition, TabStop = true};
            undoLabel.Selected += UndoLabelSelected;
            nextControlPosition.Y += ControlManager.Font.LineSpacing + 10.0f;
            ControlManager.Add(undoLabel);

            var acceptLabel = new LinkLabel {Text = "Accept", Position = nextControlPosition, TabStop = true};
            acceptLabel.Selected += AcceptLabelSelected;
            ControlManager.Add(acceptLabel);

            ControlManager.NextControl();
            Log.Debug("Controls created!");
        }