Exemple #1
0
    public Dictionary <string, (Action, bool)> GetActionsForCategory(DecisionTree.Category category)
    {
        var decisions = category.Decisions;
        var result    = new Dictionary <string, (Action, bool)>();

        foreach (var decision in decisions)
        {
            if (_state.IsDecisionAvailable(decision))
            {
                var suffix = "";
                var money  = decision.Changes.Find(t => t.Trait == Trait.Money)?.Value;
                if (decision.Id == DecisionId.Work)
                {
                    money = _state.GetPayment(_state.WorkPlace);
                }
                if (money.HasValue)
                {
                    suffix += $" ({money.Value}$)";
                }
                result.Add(decision.Name + suffix, (() => ApplyDecision(decision), _state.IsDecisionActive(decision)));
            }
        }
        result.Add("Back", (TryResetDecideWindow, true));
        return(result);
    }
Exemple #2
0
 void TryResetDecideWindow()
 {
     _selectedCategory = null;
     if (Decide.isActiveAndEnabled)
     {
         Decide.Hide.Invoke();
     }
 }
Exemple #3
0
    Dictionary <string, (Action, bool)> GetCategories()
    {
        var categiries = DecisionTree.Categories;
        var result     = new Dictionary <string, (Action, bool)>();

        foreach (var cat in categiries)
        {
            result.Add(cat.Name, (() => _selectedCategory = cat, true));
        }
        return(result);
    }