Ejemplo n.º 1
0
    public override void _Ready()
    {
        style.SetBgColor(grayColor);
        Set("custom_styles/panel", style);

        GetNode <OptionButton>("OptionButton").AddItem("Host", 0);
        GetNode <OptionButton>("OptionButton").AddItem("Client", 1);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Sets the icon to a coloured panel instaed for defult
    /// </summary>
    /// <param name="color"></param>
    public void SetIconColour(Color color)
    {
        StyleBoxFlat box = (icon.Get("custom_styles/panel") as StyleBoxFlat).Duplicate() as StyleBoxFlat;

        box.SetBgColor(color);
        icon.Set("custom_styles/panel", box);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Sets the colours of the control points to that colour,
    /// warning shares the resources and does not make a new one
    /// </summary>
    /// <param name=""></param>
    public void SetColour(List <Control> points, Color colour)
    {
        StyleBoxFlat box = (points[0].Get("custom_styles/panel") as StyleBoxFlat).Duplicate() as StyleBoxFlat;

        box.SetBgColor(colour);

        foreach (Control point in points)
        {
            point.Set("custom_styles/panel", box);
        }
    }
Ejemplo n.º 4
0
    public void UpdateScoreboard(Color color, int score)
    {
        int newScore = 100 + (Math.Max(0, score - 2) * 100);

        this.score += newScore;
        scoreLabel.SetText("Score\n" + this.score);

        StyleBoxFlat style = new StyleBoxFlat();

        style.SetBgColor(color);

        Label newScoreHistory = new Label();

        newScoreHistory.SetAlign(Label.AlignEnum.Center);
        newScoreHistory.SetValign(Label.VAlign.Center);
        newScoreHistory.Text = score.ToString() + " (" + newScore.ToString() + ")";
        newScoreHistory.AddStyleboxOverride("normal", style);

        scoreHistory.AddChild(newScoreHistory);
    }