Пример #1
0
        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();
        }
Пример #2
0
 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);
 }
Пример #3
0
 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();
 }
Пример #4
0
 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();
        }