protected void LoadButtons(RichContentManager content)
        {
            int x = Parent.Position.X,
                y = Parent.Position.Y;

            var maxInRow = MaxInRow();
            var inRow = 0;

            foreach (var name in ThingNames)
            {
                var resource = ResourceNameFromId(name);
                var button = content.MakeButton(x, y, resource);

                x += button.Rect.Width;
                inRow++;

                // Start from the beginning for a new row.
                if (inRow >= maxInRow)
                {
                    x = Parent.Position.X;
                    inRow = 0;
                    y += button.Rect.Height;
                }

                ThingButtons.Add(name, button);
            }
        }
 // Default sets all of the buttons, yo.
 public override void LoadContent(RichContentManager content)
 {
     // Load all of the buttons from thing names.
     LoadButtons(content);
     LoadContentExtra(content);
 }
 protected virtual void LoadContentExtra(RichContentManager content)
 {
     // INTENDED TO BE OVERRIDDEN
 }
Esempio n. 4
0
        public void LoadContent(RichContentManager content)
        {
            // Load the background.
            _shapePalletBackground =
                    content.Load<Texture2D>("ShapePallet/shapePalletBackground");

            BoundingBox = new Rectangle(
                    Position.X, Position.Y,
                    _shapePalletBackground.Width,
                    _shapePalletBackground.Height);

            // And the cancel button to the bottom of the palette.
            _cancelButton = content.MakeButton(
                    BoundingBox.Center.X - (120/2),
                    BoundingBox.Bottom,
                    "GUI/cancel");

            // LoadContent for all palette states; do not LoadContent more than once.
            var statesLoaded = new List<PaletteState>();
            foreach (var state in _states.Values.Where( state => !statesLoaded.Contains(state)))
            {
                statesLoaded.Add(state);
                state.LoadContent(content);
            }
        }
 public override void LoadContent(RichContentManager content)
 {
 }
 public abstract void LoadContent(RichContentManager content);