예제 #1
0
    public void UpdateBalances(Dictionary <Compound, CompoundBalance> balances)
    {
        childCache.UnMarkAll();

        foreach (var entry in balances)
        {
            var compoundControl = childCache.GetChild(entry.Key);
            var amount          = entry.Value.Balance;
            compoundControl.Amount = amount;

            compoundControl.ValueColour = amount < 0 ?
                                          CompoundAmount.Colour.Red :
                                          CompoundAmount.Colour.White;
        }

        childCache.DeleteUnmarked();
        childCache.ApplyOrder();
    }
예제 #2
0
    /// <summary>
    ///   Updates the shown compounds
    /// </summary>
    /// <param name="compounds">The compounds and amounts to show</param>
    /// <param name="markRed">Compounds that match these will be marked red.</param>
    public void UpdateCompounds(IEnumerable <KeyValuePair <Compound, float> > compounds,
                                IReadOnlyList <Compound>?markRed = null)
    {
        compoundAmountControls.UnMarkAll();

        foreach (var entry in compounds)
        {
            var compoundControl = compoundAmountControls.GetChild(entry.Key);
            compoundControl.Amount = entry.Value;

            if (markRed != null)
            {
                compoundControl.ValueColour = markRed.Contains(entry.Key) ?
                                              CompoundAmount.Colour.Red :
                                              CompoundAmount.Colour.White;
            }
        }

        compoundAmountControls.DeleteUnmarked();
    }
예제 #3
0
    public override void _Process(float delta)
    {
        if (!IsVisibleInTree())
        {
            return;
        }

        if (ProcessesToShow == null)
        {
            createdProcessControls.Clear();
            return;
        }

        // Check that all children are up to date
        createdProcessControls.UnMarkAll();

        foreach (var process in ProcessesToShow)
        {
            createdProcessControls.GetChild(process);
        }

        createdProcessControls.ApplyOrder();
        createdProcessControls.DeleteUnmarked();
    }