public PlayerAvatarElement(float x, float y, string playerUsername, int avatarIndex, LabelStyle labelStyle, Action onClick = null, float spriteSize = 128f) : base(Mathf.Ceiling(spriteSize), Mathf.Ceiling(spriteSize) * 2) { bounds = new Rectangle(x, y, spriteSize, spriteSize * 2f); this.playerUsername = playerUsername; this.onClick += onClick; this.labelStyle = labelStyle; var playerAvatarPath = "data/sprites/avatars/"; if (avatarIndex < 5) { playerAvatarPath += $"female_{avatarIndex + 1}_"; } else { playerAvatarPath += $"male_{avatarIndex - 4}_"; } if (Math.Abs(spriteSize - 128f) < 0.00001f) { playerAvatarPath += "128.png"; } else { playerAvatarPath += "64.png"; } playerAvatar = new game.Sprite(playerAvatarPath, true, false); SetXY(x, y); Draw(); }
public Label(float x, float y, float width, float height, string labelText, LabelStyle labelStyle) : base(Mathf.Ceiling(width), Mathf.Ceiling(height), false) { bounds = new Rectangle(x, y, width, height); LabelText = labelText; this.labelStyle = labelStyle; Draw(); SetXY(x, y); }
public RectangleElement(float x, float y, float width, float height, Color fillColor, Color strokeColor, float strokeWeight) : base(Mathf.Ceiling(width), Mathf.Ceiling(height), false) { bounds = new Rectangle(x, y, width, height); this.FillColor = fillColor; this.strokeColor = strokeColor; this.strokeWeight = strokeWeight; SetXY(x, y); Draw(); }
public Minigame1Element(float x, float y, float width, float height, LabelStyle questionStyle, LabelStyle remainingVotesStyle, LabelStyle playerNameStyle, LabelStyle resultStyle, LabelStyle alertStyle, ButtonStyle buttonStyle) { bounds = new Rectangle(x, y, width, height); this.questionStyle = questionStyle; this.remainingVotesStyle = remainingVotesStyle; this.playerNameStyle = playerNameStyle; this.resultStyle = resultStyle; this.alertStyle = alertStyle; this.buttonStyle = buttonStyle; rootElement = new Pivot(); AddChild(rootElement); SetXY(x, y); }
public Button(float x, float y, float width, float height, string buttonText, ButtonStyle buttonStyle, Action onClick = null, Action onMouseEnter = null, Action onMouseLeave = null, Action onMousePress = null, Action onMouseRelease = null) : base(Mathf.Ceiling(width), Mathf.Ceiling(height), false) { bounds = new Rectangle(x, y, width, height); ButtonText = buttonText; this.buttonStyle = buttonStyle; OnClick += onClick; OnMouseEnter += onMouseEnter; OnMouseLeave += onMouseLeave; OnMousePress += onMousePress; OnMouseRelease += onMouseRelease; SetXY(x, y); Draw(); }