Beispiel #1
0
 void addChild(HRCResult child)
 {
     this.childlen.Add(child);
 }
Beispiel #2
0
        public static string[] parseRangeText(string rangeText, int hero_pos, List<bool> isForceAllInList)
        {
            int reduceCount = 0;
            for (int i = 0; i < hero_pos; ++i)
                if (isForceAllInList[i]) ++reduceCount;
            hero_pos -= reduceCount;

            root = new HRCResult(null, null, null, null, null);
            HRCResult now = root;
            int level = -1;

            string[] delimiter = { "\r\n" };
            string[] rangeTextParts = rangeText.Split(delimiter, StringSplitOptions.None);
            foreach (string rangeTextPart in rangeTextParts)
            {
                string[] parts = rangeTextPart.Split(new string[] { "\t" }, StringSplitOptions.RemoveEmptyEntries);
                if (parts.Length < 2) continue;
                if (getTabCount(rangeTextPart) > level)
                {
                    now = new HRCResult(parts[0], parts[1], parts[2], parts[3], now);
                    level++;
                }
                else
                {
                    while (getTabCount(rangeTextPart) < level)
                    {
                        now = now.parent;
                        level--;
                    }
                    if (getTabCount(rangeTextPart) == level)
                    {
                        now = new HRCResult(parts[0], parts[1], parts[2], parts[3], now.parent);
                    }
                }
            }

            List<string> ranges = new List<string>();
            for (int i = 0; i < hero_pos; ++i)
            {
                ranges.Add(root.getChild(i).getChild(hero_pos - i - 1).range);
            }

            if(hero_pos < root.getChildCount())
                ranges.Add(root.getChild(hero_pos).range);

            return ranges.ToArray();
        }
Beispiel #3
0
 public HRCResult(string action, string amount, string name, string range, HRCResult parent)
 {
     this.action = action;
     this.amount = amount;
     this.name = name;
     this.range = range;
     this.parent = parent;
     if (parent != null) parent.addChild(this);
 }
Beispiel #4
0
 public static void clearCalc()
 {
     rangeText = null; root = null;
 }