public override void _Ready()
    {
        base._Ready();

        //if (label != null)
        //{
        //	RemoveChild(label);
        //	label.Dispose();
        //}
        //add label as child
        label = new Label();



        label.AddColorOverride("font_color", fontColor);
        label.AddColorOverride("font_color_shadow", fontShadowColor);


        AddChild(label);


        //if window resizes, update our position, only helps if Project --> Display --> Window --> Stretch --> Mode == "disabled", so not doing it by default
        //this.GetTree().Root.Connect("size_changed", this, "updatePosition");

        //set our initial position
        updatePosition();

        //set our update frequency
        this.labelUpdateFrequency = TimeSpan.FromSeconds(1 / labelUpdatesPerSecond);
        this.historyLength        = TimeSpan.FromSeconds(labelUpdateFrequency.TotalSeconds * 10);
        this.labelUpdateStopwatch = System.Diagnostics.Stopwatch.StartNew();

        isInitialized        = true;
        this.ProcessPriority = int.MinValue;
    }
示例#2
0
    public void UpdateEnergyBalance(EnergyBalanceInfo energyBalance)
    {
        if (energyBalance.FinalBalance > 0)
        {
            atpBalanceLabel.Text = ATP_BALANCE_DEFAULT_TEXT;
            atpBalanceLabel.AddColorOverride("font_color", new Color(1.0f, 1.0f, 1.0f, 1.0f));
        }
        else
        {
            atpBalanceLabel.Text = ATP_BALANCE_DEFAULT_TEXT + " - ATP PRODUCTION TOO LOW!";
            atpBalanceLabel.AddColorOverride("font_color", new Color(1.0f, 0.2f, 0.2f, 1.0f));
        }

        float maxValue = Math.Max(energyBalance.TotalConsumption, energyBalance.TotalProduction);

        atpProductionBar.MaxValue = maxValue;
        atpProductionBar.Value    = energyBalance.TotalProduction;

        atpConsumptionBar.MaxValue = maxValue;
        atpConsumptionBar.Value    = energyBalance.TotalConsumption;

        var atpProductionBarProgressLength = (float)(atpProductionBar.RectSize.x * atpProductionBar.Value /
                                                     atpProductionBar.MaxValue);
        var atpConsumptionBarProgressLength = (float)(atpConsumptionBar.RectSize.x * atpConsumptionBar.Value /
                                                      atpConsumptionBar.MaxValue);

        atpProductionLabel.RectSize  = new Vector2(atpProductionBarProgressLength, 18);
        atpConsumptionLabel.RectSize = new Vector2(atpConsumptionBarProgressLength, 18);

        atpProductionLabel.Text  = string.Format(CultureInfo.CurrentCulture, "{0:F1}", energyBalance.TotalProduction);
        atpConsumptionLabel.Text = string.Format(CultureInfo.CurrentCulture, "{0:F1}", energyBalance.TotalConsumption);
    }
示例#3
0
 private void SetStatColor(int _newStat, int _oldStat, Label _statText)
 {
     if (_newStat > _oldStat)
     {
         _statText.AddColorOverride("font_color", Color.ColorN("Green"));
     }
     else if (_newStat < _oldStat)
     {
         _statText.AddColorOverride("font_color", Color.ColorN("Red"));
     }
 }
 public void SetHitIndicator(bool isHitting)
 {
     if (isHitting)
     {
         surname.AddColorOverride("font_color", HIT_INDICATOR_COLOR);
     }
     else
     {
         surname.AddColorOverride("font_color", SURNAME_STANDARD_COLOR);
     }
 }
示例#5
0
        public void AddScoreEntry(string name, int score)
        {
            string         url     = $"http://dreamlo.com/lb/Pv6PwoSKi0e2o9TOfiZb-QuaU0x_d4VE2kmz0kXoVsqg/add/{Uri.EscapeDataString(name)}/{score}";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader reader = new StreamReader(stream ?? new MemoryStream()))
                    {
                        if (reader.ReadToEnd() == "OK")
                        {
                            Label scoreStatus = GetNode <Label>("ScoreStatus");
                            scoreStatus.Text = "Score upload Success!";
                            scoreStatus.AddColorOverride("font_color", Color.ColorN("Green"));
                        }
                        else
                        {
                            Label scoreStatus = GetNode <Label>("ScoreStatus");
                            scoreStatus.Text = "Score upload fail!";
                            scoreStatus.AddColorOverride("font_color", Color.ColorN("Red"));
                        }
                    }
                }
            }
        }
示例#6
0
    /// <summary>
    /// Display the header for Leaderboard
    /// </summary>
    private void AddHeader()
    {
        dFont          = new DynamicFont();
        dFont.FontData = ResourceLoader.Load("res://Fonts/Candy Beans.otf") as DynamicFontData;
        dFont.Size     = 26;

        Label rank = new Label();

        rank.AddFontOverride("font", dFont);
        rank.Text = "Rank                               ";
        rank.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(rank);

        Label lbl = new Label();

        lbl.AddFontOverride("font", dFont);
        lbl.Text = "Name                                    ";
        lbl.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl);

        Label lbl2 = new Label();

        lbl2.AddFontOverride("font", dFont);
        lbl2.Text = "Score";
        lbl2.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl2);
    }
示例#7
0
 public override void _Ready()
 {
     _label      = GetNode <Position2D>("Position2D").GetNode <Label>("Label");
     _label.Text = Text;
     _label.AddColorOverride("font_color", Color);
     _animationPlayer = GetNode <AnimationPlayer>("AnimationPlayer");
 }
        public override void SetInstructions(List <string> instructions)
        {
            DeleteInstructions();

            foreach (var item in instructions)
            {
                var label = new Label();
                label.AddFontOverride("font", _instructionsFont);
                label.AddColorOverride("font_color", _instructionsColor);
                label.Autowrap    = true;
                label.RectSize    = _instructionsBackground.RectSize;
                label.RectMinSize = new Vector2(_instructionsBackground.RectSize.x - 10, 0);
                label.Text        = item;
                _instructionsContainer.AddChild(label);
            }

            var confirmLabel = new Label();

            confirmLabel.AddFontOverride("font", _instructionsFont);
            confirmLabel.AddColorOverride("font_color", _instructionsColor);
            confirmLabel.Autowrap    = true;
            confirmLabel.RectSize    = _instructionsBackground.RectSize;
            confirmLabel.RectMinSize = new Vector2(_instructionsBackground.RectSize.x - 10, 0);
            confirmLabel.Text        = ResourceStrings.Nongamified.CompleteSequenceNongamified;
            _instructionsContainer.AddChild(confirmLabel);
        }
示例#9
0
    /// <summary>
    /// Display the column titles for completed Assignments
    /// </summary>
    private void DisplayCompletedHeader()
    {
        //Student Name
        Label lbl = new Label();

        lbl.AddFontOverride("font", dFont);
        lbl.Text = "Assignment" + "       ";
        lbl.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl);

        Label lbl3 = new Label();

        lbl3.AddFontOverride("font", dFont);
        lbl3.Text = "Teacher" + "      ";
        lbl3.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl3);

        Label date = new Label();

        date.AddFontOverride("font", dFont);
        date.Text = "DueDate" + "      ";
        date.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(date);

        Label lbl2 = new Label();

        lbl2.AddFontOverride("font", dFont);
        lbl2.Text = "Score";
        lbl2.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl2);
    }
示例#10
0
    /// <summary>
    /// Handles the countdown logic
    /// </summary>
    /// <param name="delta"></param>
    public override void _Process(float delta)
    {
        if (s <= 0)
        {
            //GetTree().ChangeScene("res://Presentation/World/World.tscn");
            charSprite.Play("Die");
            HideBtns();
            lose.Play("Lose");
            timerLabel.Visible = false;
        }
        if (ms <= 0)
        {
            s -= 1;
            ms = 9;
        }
        timerLabel.Text = String.Format("{0}:{1}", s, ms);

        if (s <= 10)
        {
            //RED
            float r = 0.73f;
            float g = 0.03f;
            float b = 0.11f;
            timerLabel.AddColorOverride("font_color", new Color(r, g, b));
        }
    }
示例#11
0
    /// <summary>
    /// Display column titles for the Student's CreatedLevels
    /// </summary>
    private void DisplayHeader()
    {
        //Student Name
        Label lbl = new Label();

        lbl.AddFontOverride("font", dFont);
        lbl.Text = "Game Name" + "       ";
        lbl.AddColorOverride("font_color", new Color(0, 0, 0));

        gridContainer.AddChild(lbl);

        Label lbl3 = new Label();

        lbl3.AddFontOverride("font", dFont);
        lbl3.Text = "           ";
        lbl3.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl3);

        Label lbl4 = new Label();

        lbl4.AddFontOverride("font", dFont);
        lbl4.Text = "   ";
        lbl4.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl4);

        Label lbl5 = new Label();

        lbl5.AddFontOverride("font", dFont);
        lbl5.Text = "   ";
        lbl5.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(lbl5);
    }
示例#12
0
    /// <summary>
    /// Displayed Assignments completed by Student
    /// </summary>
    private void DisplayCompletedAssignments()
    {
        List <AssignmentScore> completedAssignments = assignmentScoreBL.GetStudentCompletedAssignment(Global.StudentId);

        foreach (AssignmentScore as2 in completedAssignments)
        {
            Label name = new Label();
            name.AddFontOverride("font", dFont2);
            name.Text = as2.PublishedAssignment.Assignment.AssignmentName;
            name.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(name);

            Label teacher = new Label();
            teacher.AddFontOverride("font", dFont2);
            teacher.Text = as2.PublishedAssignment.Assignment.Teacher.TeacherName;
            teacher.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(teacher);

            Label date = new Label();
            date.AddFontOverride("font", dFont2);
            date.Text = as2.PublishedAssignment.DueDate.ToString() + "     ";
            date.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(date);

            Label score = new Label();
            score.AddFontOverride("font", dFont2);
            score.Text = as2.Score.ToString();
            score.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(score);
        }
    }
示例#13
0
        public override void _Ready()
        {
            _overlayWrapper     = GetNode <MarginContainer>("MarginContainer");
            _gameStatusLabel    = _overlayWrapper.GetNode <Label>("GameStatusContainer/GameStatusLabel");
            _nicknameValue      = _overlayWrapper.GetNode <LineEdit>("VBoxContainer/NicknameLabel");
            _gameCodeValue      = _overlayWrapper.GetNode <LineEdit>("VBoxContainer/GameCodeValue");
            _codeErrorLabel     = _overlayWrapper.GetNode <Label>("VBoxContainer/CodeErrorLabel");
            _enterNicknameLabel = _overlayWrapper.GetNode <Label>("VBoxContainer/EnterNicknameLabel");
            _enterCodeLabel     = _overlayWrapper.GetNode <Label>("VBoxContainer/EnterCodeLabel");
            _startButton        = _overlayWrapper.GetNode <Button>("VBoxContainer/StartButton");

            _gameStatusLabel.Visible = false;
            _codeErrorLabel.Visible  = false;

            var font = (DynamicFont)GD.Load($"{Constants.ResourcesPath}Fonts/Montserrat/montserrat_regular.tres");

            font.Size = 25;

            _enterNicknameLabel.AddFontOverride("font", font);
            _enterCodeLabel.AddFontOverride("font", font);
            _codeErrorLabel.AddFontOverride("font", font);
            _nicknameValue.AddFontOverride("font", font);
            _gameCodeValue.AddFontOverride("font", font);
            _startButton.AddFontOverride("font", font);

            var boldFont = (DynamicFont)GD.Load($"{Constants.ResourcesPath}Fonts/Montserrat/montserrat_bold.tres");

            boldFont.Size = 55;

            _gameStatusLabel.AddFontOverride("font", boldFont);
            _gameStatusLabel.AddColorOverride("font_color", new Color("#bf5034"));

            _startButton.Connect("pressed", this, nameof(StartButtonPressed));
        }
示例#14
0
        public void OnTextChanged(string NewCommand)
        {
            if (string.IsNullOrEmpty(NewCommand) || string.IsNullOrWhiteSpace(NewCommand))
            {
                return;
            }

            int Count = Autofill.GetChildCount();

            for (int i = 0; i < Count; ++i)
            {
                Autofill.GetChild(i).QueueFree();
            }

            List <Command> Commands = Sys.Ref.Shared.GetNode <InterpreterSys>().AutofillCommand(NewCommand);

            foreach (var Command in Commands)
            {
                Node NewEntry = AutofillEntry.Instance();

                Label Alias = NewEntry.GetNode <Label>("Alias");

                System.Drawing.Color AliasColor = System.Drawing.Color.FromName(Command.AliasColor);

                Alias.AddColorOverride("font_color", new Color()
                {
                    r8 = AliasColor.R,
                    g8 = AliasColor.G,
                    b8 = AliasColor.B,
                    a8 = AliasColor.A
                });

                Alias.Text = Command.Alias;

                if (Command.Arguments == null)
                {
                    Alias.Text += "()";
                }
                else
                {
                    Alias.Text += '(' + Command.Arguments + ')';
                }

                Label Description = NewEntry.GetNode <Label>("Description");

                System.Drawing.Color DescriptionColor = System.Drawing.Color.FromName(Command.DescriptionColor);

                Description.AddColorOverride("font_color", new Color()
                {
                    r8 = DescriptionColor.R,
                    g8 = DescriptionColor.G,
                    b8 = DescriptionColor.B,
                    a8 = DescriptionColor.A
                });

                Description.Text = Command.Description;

                Autofill.AddChild(NewEntry);
            }
        }
示例#15
0
    /// <summary>
    /// Display the game list
    /// </summary>
    private void DisplayGameList()
    {
        ClearGrid();
        DisplayHeader();
        gridContainer.Columns = 3;
        Theme theme = ResourceLoader.Load("res://Assets/GUI/BtnUI4.tres") as Theme;

        foreach (CustomLevel cl in customLevelList)
        {
            Label lbl3 = new Label();
            lbl3.AddFontOverride("font", dFont2);
            lbl3.Text = cl.CustomLevelName + "      ";
            lbl3.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(lbl3);

            Label lbl2 = new Label();
            lbl2.AddFontOverride("font", dFont2);
            lbl2.Text = cl.Student.StudentName;
            lbl2.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(lbl2);

            Button btn = new Button();
            btn.RectMinSize = new Vector2(80, 30);
            btn.Text        = "Play";
            string[] arr = new string[1] {
                btn.Name
            };
            Godot.Collections.Array ar = new Godot.Collections.Array();
            ar.Add(btn);
            btn.Name = cl.CustomLevelId.ToString();
            btn.Connect("pressed", this, "PlayLevel", ar);
            btn.Theme = theme;
            gridContainer.AddChild(btn);
        }
    }
示例#16
0
        /// <summary>
        /// Initializes the control.
        /// </summary>
        /// <param name="teammate">Teammate model to initialize the control from.</param>
        /// <param name="addIcon">Texture of the add icon.</param>
        /// <param name="removeIcon">Texture of the remove icon.</param>
        public void Init(Teammate teammate, Texture addIcon, Texture removeIcon)
        {
            Teammate = teammate;
            var actionIcon  = teammate.IsAddedToTeam ? removeIcon : addIcon;
            var usedTexture = teammate.IsAddedToTeam ? teammate.SmallTexture : teammate.BigTexture;

            _verticalContainer = GetNode <VBoxContainer>("VerticalContainer");
            _teammateButton    = _verticalContainer.GetNode <TextureButton>("TeammateButton");
            _actionIcon        = _teammateButton.GetNode <TextureRect>("ActionIcon");
            _teammateName      = _verticalContainer.GetNode <Label>("CenterContainer/TeammateName");

            _teammateButton.TextureNormal = usedTexture;

            var teammateButtonSize = _teammateButton.TextureNormal.GetSize();

            this.RectMinSize = _teammateButton.TextureNormal.GetSize();

            _teammateName.Text  = teammate.Name;
            _actionIcon.Texture = teammate.IsAddedToTeam ? actionIcon : actionIcon;

            var actionIconSize = _actionIcon.Texture.GetSize();

            _actionIcon.SetPosition(new Vector2(teammateButtonSize.x - actionIconSize.x, teammateButtonSize.y - actionIconSize.y));

            _teammateButton.Connect("pressed", this, nameof(OnClick));

            _verticalContainer.Set("custom_constants/separation", VerticalContainerSeparation);
            _teammateName.AddFontOverride("font", Font);

            if (LabelColor.HasValue)
            {
                _teammateName.AddColorOverride("font_color", LabelColor.Value);
            }
        }
示例#17
0
    public void FillDataPipe(IEnumerable <IEnumerable <int> > data)
    {
        int numPipe = 0;

        foreach (IEnumerable <int> pipe in data)
        {
            HBoxContainer actualHBoxContainer = new HBoxContainer();
            var           actualLabelPipe     = new Label();
            numPipe++;
            actualLabelPipe.Text = $" * tube n°{numPipe}";
            actualLabelPipe.AddFontOverride("font", ResourceLoader.Load <Font>("res://fonts/fontsmall.tres"));
            actualLabelPipe.AddColorOverride("font_color", Colors.Black);
            vBoxContainer.AddChild(actualLabelPipe);

            vBoxContainer.AddChild(actualHBoxContainer);
            var          hSeparator = new HSeparator();
            StyleBoxLine sbl        = new StyleBoxLine()
            {
                Color = new Color("ad4c4c"), Thickness = 5
            };
            hSeparator.AddStyleboxOverride("separator", sbl);
            vBoxContainer.AddChild(hSeparator);

            foreach (int length in pipe)
            {
                actualHBoxContainer.AddChild(CreateLabelPipeDraw(length));
            }
        }
        RectSize = new Vector2(RectSize.x, (numPipe) * 68);
    }
示例#18
0
    // Called when the node enters the scene tree for the first time.
    public override void _Ready()
    {
        Label text = (Label)GetNode("Label");

        text.Text = texte;
        text.AddColorOverride("font_color", cl);
        Connect("pressed", this, nameof(cliquer));
    }
示例#19
0
 void initializeTitle()
 {
     if (ownScore > opponentScore)
     {
         title.Text = WIN_TEXT;
         title.AddColorOverride("font_color", WIN_COLOR);
     }
     else if (ownScore == opponentScore)
     {
         title.Text = DRAW_TEXT;
         title.AddColorOverride("font_color", DRAW_COLOR);
     }
     else
     {
         title.Text = LOSE_TEXT;
         title.AddColorOverride("font_color", LOSE_COLOR);
     }
 }
示例#20
0
 public void KilledEnemies(int amount)
 {
     killCount += amount;
     if (killCount >= 100)
     {
         killCountLabel.AddColorOverride("font_color", new Color(255, 185, 0));
     }
     killCountLabel.Text = $"kills : {killCount}";
 }
示例#21
0
    void increaseScore(Label label)
    {
        int previousScore = int.Parse(label.Text);

        label.Text = (previousScore + 1).ToString();

        label.AddColorOverride("font_color", SCORE_HIGHLIGHT_COLOR);
        System.Threading.Thread thread = new System.Threading.Thread(() => handleScoreLabelColor(label));
        thread.Start();
    }
    private void _AddNoScoresInfo()
    {
        var label = new Label()
        {
            Text = "No scores!"
        };

        label.AddColorOverride("font_color", new Color(0, 0, 0, 0.5f));
        AddChild(label);
    }
示例#23
0
 void handleOwnTeam()
 {
     if (Team.TeamAlias == GameData.CurrentTeam.TeamAlias)
     {
         alias.AddColorOverride("font_color", OWN_TEAM_HIGHLIGHT_COLOR);
         difference.AddColorOverride("font_color", OWN_TEAM_HIGHLIGHT_COLOR);
         goalsMinus.AddColorOverride("font_color", OWN_TEAM_HIGHLIGHT_COLOR);
         goalsPlus.AddColorOverride("font_color", OWN_TEAM_HIGHLIGHT_COLOR);
         points.AddColorOverride("font_color", OWN_TEAM_HIGHLIGHT_COLOR);
     }
 }
示例#24
0
    /// <summary>
    /// Display the Levels
    /// </summary>
    private void DisplayLevels()
    {
        Theme theme = ResourceLoader.Load("res://Assets/GUI/BtnUI4.tres") as Theme;

        customLevelList = customLevelBL.GetStudentCustomLevel(Global.StudentId);
        foreach (CustomLevel customLevel in customLevelList)
        {
            Label name = new Label();
            name.AddFontOverride("font", dFont2);
            name.Text = customLevel.CustomLevelName + "      ";
            name.AddColorOverride("font_color", new Color(0, 0, 0));
            gridContainer.AddChild(name);

            Button playBtn = new Button();
            playBtn.RectMinSize = new Vector2(80, 30);
            playBtn.Text        = "Play";
            string[] playArr = new string[1] {
                playBtn.Name
            };
            Godot.Collections.Array playAr = new Godot.Collections.Array();
            playAr.Add(playBtn);
            playBtn.Name = customLevel.CustomLevelId.ToString();
            playBtn.Connect("pressed", this, "PlayLevel", playAr);
            playBtn.Theme = theme;
            gridContainer.AddChild(playBtn);

            Button btn = new Button();
            btn.RectMinSize = new Vector2(80, 30);
            btn.Text        = "Edit";
            string[] arr = new string[1] {
                btn.Name
            };
            Godot.Collections.Array ar = new Godot.Collections.Array();
            ar.Add(btn);
            btn.Name = customLevel.CustomLevelName.ToString();
            btn.Connect("pressed", this, "EditLevel", ar);
            btn.Theme = theme;
            gridContainer.AddChild(btn);

            Button btn2 = new Button();
            btn2.RectMinSize = new Vector2(80, 30);
            btn2.Text        = "Delete";
            string[] arr2 = new string[1] {
                btn2.Name
            };
            Godot.Collections.Array ar2 = new Godot.Collections.Array();
            ar2.Add(btn2);
            btn2.Name = customLevel.CustomLevelName.ToString() + " ";
            btn2.Connect("pressed", this, "DeleteLevel", ar2);
            btn2.Theme = theme;
            gridContainer.AddChild(btn2);
        }
    }
示例#25
0
        private void Load(Node node, Vector2 position, string text, Color color, Color?outline)
        {
            float duration = 0.6f;

            label      = GetNode <Label>("Label");
            label.Text = text;
            label.AddColorOverride("font_color", color);
            if (outline.HasValue)
            {
                label.AddColorOverride("font_outline_modulate", outline.Value);
            }
            node.AddChild(this);
            Position = position;
            Tween tween = new Tween();

            AddChild(tween);
            tween.InterpolateProperty(this, "modulate:a", 1f, 0f, duration, Tween.TransitionType.Cubic, Tween.EaseType.In);
            tween.InterpolateProperty(this, "position:y", position.y, position.y - 16, duration, Tween.TransitionType.Sine, Tween.EaseType.Out);
            tween.Connect("tween_all_completed", this, nameof(on_TweenAllCompleted));
            tween.Start();
        }
示例#26
0
    public void UpdateState(string newState)
    {
        SwitchData data;

        if (states.TryGetValue(newState, out data))
        {
            Label label = GetNode <Label>("Texture/Label");
            label.Text = data.text;
            label.AddColorOverride("font_color", data.textColor);
            GetNode <ColorRect>("Texture/Outline").Color = data.buttonColor;
        }
    }
示例#27
0
    private void UpdateSignLabel(int updateLabelId, int oldValue, int newValue)
    {
        Label l = labelMap[updateLabelId];

        if (oldValue > -1 && oldValue != newValue)
        {
            bool increase = newValue > oldValue;
            l.Text = increase ? "+" : "-";
            l.AddColorOverride("font_color", increase ? increaseColor : decreaseColor);
            l.Visible = true;
            updateTimer.Start();
        }
    }
示例#28
0
    /// <summary>
    /// Display the Credits
    /// </summary>
    private void DisplayCredits()
    {
        Godot.File file = new Godot.File();
        file.Open("res://Credits/credits.txt", Godot.File.ModeFlags.Read);
        string content = file.GetAsText();

        file.Close();
        Label name = new Label();

        name.AddFontOverride("font", dFont);
        name.Text = content;
        name.AddColorOverride("font_color", new Color(0, 0, 0));
        gridContainer.AddChild(name);
    }
示例#29
0
    public override void _Input(InputEvent ev)
    {
        if (ev is InputEventKey keyEv)
        {
            var input = _lineEdit.Text;

            if (input == _letter.Text)
            {
                _letter.AddColorOverride("font_color", new Color(1, 0.5f, 0.31f, 1));
            }

            _lineEdit.Clear();
        }
    }
示例#30
0
        private void AddEntry(string Text, ConsoleColors TextColor)
        {
            if (ConsoleHistory.GetChildCount() >= ConsoleMaxLines)
            {
                ConsoleHistory.GetChild(0).QueueFree();
            }

            Node  ConsoleEntryNode  = ConsoleEntry.Instance();
            Label ConsoleEntryLabel = (Label)ConsoleEntryNode;

            switch (TextColor)
            {
            default:
            case ConsoleColors.Message:
                ConsoleEntryLabel.AddColorOverride("font_color", new Color(1.0f, 1.0f, 1.0f));
                break;

            case ConsoleColors.Warning:
                ConsoleEntryLabel.AddColorOverride("font_color", new Color(0.988f, 0.91f, 0.012f));
                break;

            case ConsoleColors.Error:
                ConsoleEntryLabel.AddColorOverride("font_color", new Color(0.988f, 0.012f, 0.012f));
                break;
            }

            ConsoleEntryLabel.Text = Text;

            if (Sys.Ref.Shared.Contains <RCONSys>())
            {
                Sys.Ref.Shared.GetNode <RCONSys>().Send(Text, TextColor);
            }

            ConsoleHistory.AddChild(ConsoleEntryLabel);

            CallDeferred(nameof(SetScrollbar));
        }