Esempio n. 1
0
        Int32 DrawElement(Elements.Base element, Vector2 location, String overridetext)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            if (overridetext == null)
            {
                throw new ArgumentNullException("overridetext");
            }

            if (element is Elements.Text)
            {
                var fontdata = ModifyPrintData(element.DataMap.FontData);
                var font     = element.Collection.Fonts.GetFont(fontdata.Index);
                if (font == null)
                {
                    return(0);
                }

                font.Print(location + element.DataMap.Offset, fontdata.ColorIndex, fontdata.Justification, overridetext, null);
                return(font.GetTextLength(overridetext));
            }

            return(0);
        }
Esempio n. 2
0
 public void DrawCursorActive(Vector2 location)
 {
     Elements.Base element = m_elements.GetElement("cursor.active");
     if (element != null)
     {
         element.Draw(location);
     }
 }
Esempio n. 3
0
 public void PlaySelectSound()
 {
     Elements.Base element = m_elements.GetElement("cursor.done");
     if (element != null)
     {
         element.PlaySound();
     }
 }
Esempio n. 4
0
 public void PlayCursorMoveSound()
 {
     Elements.Base element = m_elements.GetElement("cursor.move");
     if (element != null)
     {
         element.PlaySound();
     }
 }
Esempio n. 5
0
        protected override Elements.Base GetElement()
        {
            Elements.Base element = Engine.RoundInformation.GetRoundElement(Engine.RoundNumber);

            if (element.DataMap.Type == ElementType.None)
            {
                element = Engine.Elements.GetElement("round.default");
            }

            return(element);
        }
Esempio n. 6
0
        public Audio.Channel PlaySound(String name)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            Elements.Base element = GetElement(name);
            if (element != null)
            {
                return(element.PlaySound());
            }

            return(null);
        }
Esempio n. 7
0
        public void DrawProfile(PlayerProfile profile)
        {
            if (profile == null)
            {
                throw new ArgumentNullException("profile");
            }

            Elements.Base face = m_elements.GetElement("player.face");
            if (face != null)
            {
                profile.SpriteManager.Draw(SpriteId.LargePortrait, face.DataMap.Offset, Vector2.Zero, face.DataMap.Scale, face.DataMap.Flip);
            }

            Elements.Text name = m_elements.GetElement("player.name") as Elements.Text;
            if (name != null)
            {
                SelectScreen.Print(name.DataMap.FontData, name.DataMap.Offset, profile.DisplayName, null);
            }
        }
Esempio n. 8
0
        Rectangle CreateBarScissorRectangle(Elements.Base element, Vector2 location, Single percentage, Point range)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            Drawing.Sprite sprite = element.SpriteManager.GetSprite(element.DataMap.SpriteId);
            if (sprite == null)
            {
                return(new Rectangle());
            }

            Point drawlocation = (Point)Video.Renderer.GetDrawLocation(sprite.Size, (Vector2)location, (Vector2)sprite.Axis, element.DataMap.Scale, element.DataMap.Flip);

            Rectangle rectangle = new Rectangle();

            rectangle.X      = (Int32)element.DataMap.Offset.X + drawlocation.X + 1;
            rectangle.Y      = (Int32)element.DataMap.Offset.Y + drawlocation.Y;
            rectangle.Height = sprite.Size.Y + 1;
            rectangle.Width  = sprite.Size.X + 1;

            Int32 position = (Int32)MathHelper.Lerp(range.X, range.Y, percentage);

            if (position > 0)
            {
                rectangle.Width = position + 2;
            }
            else if (position < 0)
            {
                rectangle.Width = -position + 2;

                rectangle.X += position - range.Y - 1;
            }
            else
            {
                rectangle.Width = 0;
            }

            return(rectangle);
        }