예제 #1
0
        public static string DisplayHolder(RealFuels.PartEntryCostHolder h, bool recurse = false)
        {
            if (h is null)
            {
                return("null");
            }
            if (h.cost == 0 && h.children.Count == 1)
            {
                return(DisplayHolder(GetHolder(h.children.First()), recurse));
            }
            string s = string.Empty;

            foreach (string child in h.children)
            {
                if (GetHolder(child) is RealFuels.PartEntryCostHolder childHolder)
                {
                    s += $" | {CostString(childHolder)}";
                }
            }
            // Append the recursive scan after building the top level, instead of during.
            if (recurse)
            {
                foreach (string child in h.children)
                {
                    if (GetHolder(child) is RealFuels.PartEntryCostHolder childHolder)
                    {
                        s += $"[{DisplayHolder(childHolder, recurse)}]";
                    }
                }
            }

            return($"{CostString(h, h.cost)}{s}");
        }
예제 #2
0
 private static string CostString(RealFuels.PartEntryCostHolder h, int cost=-1)
 {
     if (cost == -1) cost = GetCost(h);
     bool unlocked = IsUnlocked(h.name);
     string sCost = !unlocked ? $": {cost}" : null;
     return $"{Color(unlocked)}{h.name}{sCost}{Uncolor(unlocked)}";
 }
예제 #3
0
 public static int GetCost(RealFuels.PartEntryCostHolder h, bool clearTracker = true)
 {
     if (clearTracker)
     {
         RealFuels.EntryCostDatabase.ClearTracker();
     }
     return(h.GetCost());
 }