Esempio n. 1
0
        private void OnRestartButtonPressed()
        {
            if (LeaderBoardService.CanAdd(GlobalState.State.Scores))
            {
                LeaderBoardService.UpdateLeaders(_playerName.Text, GlobalState.State.Scores);
            }

            GetTree().ChangeScene("res://objects/World/World.tscn");
        }
Esempio n. 2
0
        private void OnMainMenuButtonPressed()
        {
            if (LeaderBoardService.CanAdd(GlobalState.State.Scores))
            {
                LeaderBoardService.UpdateLeaders(_playerName.Text, GlobalState.State.Scores);
            }

            GetTree().ChangeScene("res://ui/MainScreen.tscn");
        }
Esempio n. 3
0
        public override void _Ready()
        {
            (FindNode("Scores", true) as Label).Text = $"Scores: {GlobalState.State.Scores}";
            _playerName = (FindNode("PlayerNameEditor", true) as LineEdit);

            if (!LeaderBoardService.CanAdd(GlobalState.State.Scores))
            {
                _playerName.Visible = false;
            }
        }
Esempio n. 4
0
        public override void _Ready()
        {
            var board = FindNode("Leaders", true) as VBoxContainer;

            foreach (var leader in LeaderBoardService.GetLeaders())
            {
                var label = new Label
                {
                    Text = $"{leader.Name} ({leader.Score})"
                };

                board.AddChild(label);
            }
        }