Esempio n. 1
0
 public IEnumerable <SaveListItem> GetSelectedItems()
 {
     foreach (SaveListItem child in savesList.GetChildren())
     {
         if (child.Selectable && child.Selected)
         {
             yield return(child);
         }
     }
 }
Esempio n. 2
0
 public void UpdateGuiEntries()
 {
     foreach (Node child in _cmdHistoryList.GetChildren())
     {
         child.Free();
     }
     
     foreach (string str in _console.GetCmdHistory())
     {
         Label entry = new Label();
         entry.Text = str;
         _cmdHistoryList.AddChild(entry);
     }
 }
Esempio n. 3
0
    public void Start()
    {
        _levelLabel      = GetNode <Label>(_levelPath);
        _levelLabel.Text = (1).ToString();

        _scoreLabel      = GetNode <Label>(_scorePath);
        _scoreLabel.Text = (0).ToString();

        _livesContainer = GetNode <BoxContainer>(_livesContainerPath);
        if (_livesContainer.GetChildren().Count > 0)
        {
            foreach (Node child in _livesContainer.GetChildren())
            {
                child.QueueFree();
            }
        }

        for (int i = 0; i < _maxLives; i++)
        {
            var textureRect = CreateLifeTexture();
            _livesContainer.AddChild(textureRect);
        }
    }
Esempio n. 4
0
    // TODO: sometimes shows more lives than we have when player dies
    public void RemoveLife(int currLives)
    {
        var lives    = _livesContainer.GetChildren();
        int numLives = lives.Count;

        if (lives.Count == 0)
        {
            return;
        }

        for (int i = 0; i < (numLives - currLives); i++)
        {
            var lifeNode = (Node)lives[0];
            lifeNode.QueueFree();
        }
    }