Exemple #1
0
        private void BuildComponents()
        {
            // default textures
            defaultFrame        = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), BackgroundColour);
            defaultFontGraphics = new FontGraphics(Text, Width, 20, PositionProfileFactory.BuildCenteredRelative(),
                                                   FontFlow.Shrink, TextColour, Textures.ButtonFont);
            defaultFrame.Components.Add(defaultFontGraphics);
            defaultFrame.Initialise(this.GetBounds());

            // hover textures
            hoverFrame        = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), HoverBackgroundColour);
            hoverFontGraphics = new FontGraphics(Text, Width, 20, PositionProfileFactory.BuildCenteredRelative(),
                                                 FontFlow.Shrink, HoverTextColour, Textures.ButtonFont);
            hoverFrame.Components.Add(hoverFontGraphics);
            hoverFrame.Initialise(this.GetBounds());

            //focus textures
            focusFrame        = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), FocusBackgroundColour);
            focusFontGraphics = new FontGraphics(Text, Width, 20, PositionProfileFactory.BuildCenteredRelative(),
                                                 FontFlow.Shrink, FocusTextColour, Textures.ButtonFont);
            focusFrame.Components.Add(focusFontGraphics);
            focusFrame.Initialise(this.GetBounds());

            this.frame = this.Focus ? this.focusFrame : this.defaultFrame;
        }
Exemple #2
0
        /// <summary>
        /// Buikds the constituant components.
        /// </summary>
        private void BuildComponents()
        {
            Frame currentHealthframe = new Frame(ZeroAdjustedWidth(Unit.CurrentHealth, Unit.MaxHealth), Height, PositionProfileFactory.CenteredLeftRelative(), DrawLayer, Color.SpringGreen);

            frame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), DrawLayer, Color.Red);
            frame.Components.Add(currentHealthframe);
        }
Exemple #3
0
        private void BuildComponents()
        {
            defaultFrame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), BackgroundColour);
            defaultFrame.Initialise(this.GetBounds());

            hoverFrame = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), HoverBackgroundColour);
            hoverFrame.Initialise(this.GetBounds());

            this.frame = this.defaultFrame;

            foreach (BaseComplexComponent component in Components)
            {
                component.Initialise(this.GetBounds(), this.Id, this.Priority, this.Visible);
            }
        }
Exemple #4
0
        private void BuildComponents()
        {
            frame        = new Frame(Width, Height, PositionProfileFactory.BuildCenteredRelative(), BackgroundColour);
            fontGraphics = new FontGraphics(Text, Width, Gutter, PositionProfileFactory.BuildTopLeftRelative(),
                                            FontFlow.Wrap, TextColour, Textures.TooltipFont);

            frame.Components.Add(fontGraphics);
            frame.Initialise(this.GetBounds());

            //TO-DO Fix this f*****g shit

            /*
             * Now that the dimensions are assigned for the fontGraphics,
             * assign the known height to Tooltip and rebuild the frame
             * using it.
             */
            int adjustedHeight = fontGraphics.Height + (Gutter * 2);

            this.Height  = adjustedHeight;
            frame.Height = adjustedHeight;
            frame.Initialise(this.GetBounds());
        }
Exemple #5
0
        /// <summary>
        /// Builds the constituant components.
        /// </summary>
        private void BuildComponents()
        {
            frame = new Frame(Width, Height, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Center, 0, 0), DrawLayer, Color.Black);

            FontGraphics nameFontGraphics = new FontGraphics(unit.Name, Width, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Top, 0, 10), DrawLayer, TextFormat.Shrink, Color.White, Resources.Textures.Debug);

            frame.Components.Add(nameFontGraphics);

            //Health bar
            Color healthColour = unit.CurrentHealth == 0 ? Color.Transparent : Color.Green;

            FontGraphics healthFontGraphics = new FontGraphics(string.Format(ResourceText, unit.CurrentHealth, unit.MaxHealth), Width, PositionProfileFactory.BuildCenteredRelative(), DrawLayer, TextFormat.Shrink, Color.White, Resources.Textures.Debug);
            Frame        healthFrame        = new Frame(Width, 50, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Top, 0, 50), DrawLayer, Color.Black);
            Frame        health             = new Frame(ZeroAdjustedWidth(unit.CurrentHealth, unit.MaxHealth), 50, new RelativePositionProfile(HorizontalAlign.Left, VerticalAlign.Center, 0, 0), DrawLayer, healthColour);

            healthFrame.Components.Add(health);
            healthFrame.Components.Add(healthFontGraphics);
            frame.Components.Add(healthFrame);

            //Energy bar
            Color energyColour = unit.CurrentEnergy == 0 ? Color.Transparent : Color.RoyalBlue;

            FontGraphics energyFontGraphics = new FontGraphics(string.Format(ResourceText, unit.CurrentEnergy, unit.MaxEnergy), Width, PositionProfileFactory.BuildCenteredRelative(), DrawLayer, TextFormat.Shrink, Color.White, Resources.Textures.Debug);
            Frame        energyFrame        = new Frame(Width, 50, new RelativePositionProfile(HorizontalAlign.Center, VerticalAlign.Top, 0, 100), DrawLayer, Color.Black);
            Frame        energy             = new Frame(ZeroAdjustedWidth(unit.CurrentEnergy, unit.MaxEnergy), 50, new RelativePositionProfile(HorizontalAlign.Left, VerticalAlign.Center, 0, 0), DrawLayer, energyColour);

            energyFrame.Components.Add(energy);
            energyFrame.Components.Add(energyFontGraphics);
            frame.Components.Add(energyFrame);
        }
Exemple #6
0
 private void BuildComponents()
 {
     this.image = new ImageGraphics(this.Texture, PositionProfileFactory.BuildCenteredRelative());
     this.image.Initialise(this.GetBounds());
 }