public AnimatedLabel() { InitializeComponent(); AnimLabel.SetBinding(Label.TextProperty, new Binding(nameof(AnimLabelText), source: this)); AnimLabel.SetBinding(Label.FontSizeProperty, new Binding(nameof(AnimLabelFontSize), source: this)); AnimLabel.SetBinding(Label.FontAttributesProperty, new Binding(nameof(AnimLabelFontAttributes), source: this)); AnimLabel.SetBinding(Label.TextColorProperty, new Binding(nameof(AnimLabelTextColor), source: this)); AnimBackground.SetBinding(BoxView.WidthRequestProperty, new Binding(nameof(AnimBackgroundWidth), source: this)); AnimBackground.SetBinding(BoxView.HeightRequestProperty, new Binding(nameof(AnimBackgroundheight), source: this)); AnimBackground.SetBinding(BoxView.CornerRadiusProperty, new Binding(nameof(AnimBackgroundCornerRadius), source: this)); AnimBackground.SetBinding(BoxView.ColorProperty, new Binding(nameof(AnimBackgroundColor), source: this)); }
public Level1(Size clientSize) { XAxis = 10; YAxis = 5; BrickHeight = (int)(clientSize.Height * 0.3) / YAxis; BrickWidth = clientSize.Width / XAxis; AnimBricks = new AnimBrick(); AnimBackgrounds = new AnimBackground(); AnimBackgrounds.UiHitbox = new Rectangle(0, (int)(clientSize.Height * 0.85), clientSize.Width, (int)(clientSize.Height * 0.15)); UiElements = new UiCollection { Life = new AnimLife(), Portrait = new Portrait(new Rectangle((int)(AnimBackgrounds.UiHitbox.X + (AnimBackgrounds.UiHitbox.Width * 0.05)), (int)(AnimBackgrounds.UiHitbox.Y + (AnimBackgrounds.UiHitbox.Height * 0.15)), (int)(AnimBackgrounds.UiHitbox.Height - ((AnimBackgrounds.UiHitbox.Height * 0.15) * 2)), (int)(AnimBackgrounds.UiHitbox.Height - ((AnimBackgrounds.UiHitbox.Height * 0.15) * 2)))), ScoreHitbox = new Rectangle(), LifeTextHitbox = new Rectangle(), ComboHitbox = new Rectangle() }; DrawFormat = new StringFormat(); //DrawFormat.Alignment = StringAlignment.Center; DrawFormat.LineAlignment = StringAlignment.Center; try{ DrawFont = new Font("Metroid Fusion", 24); } catch (IOException e) { MessageBox.Show("Error al cargar el elemento"); } }