public void Show(string name, ICell <bool> selected = null, Action <IDisposable> connectionSink = null)
    {
        text.text = name;
        if (selected == null)
        {
            selected = StaticCell <bool> .Default();
        }
        if (connectionSink == null)
        {
            connectionSink = _ => { }
        }
        ;

        connectionSink(selected.Bind(sel => text.color = sel ? selectedTextColor : normalTextColor));
        connectionSink(selected.Bind(sel => bg.color   = sel ? selectedColor : normalColor));
    }
}
Beispiel #2
0
        static ICell <int> FinalStat(Unit unit, Equipment eq, UnitBuffType buffType)
        {
            // selected unit can be null.
            if (unit == null)
            {
                return(StaticCell <int> .Default());
            }

            var stat = StatForBuffType(unit, buffType);

            // If equipment does not buff this stat return just stat.
            if (eq == null || eq.type != buffType)
            {
                return(stat);
            }
            // If equipment stat match this kind of stat merge those.
            return(stat.Merge(eq.buff, (s, buff) => s + buff));
        }