Esempio n. 1
0
 public void OpenAll(TreeNode_ThingCategory node, int nestLevel, int openMask)
 {
     node.SetOpen(openMask, true);
     foreach (TreeNode_ThingCategory current in node.ChildCategoryNodes)
     {
         if (!current.catDef.resourceReadoutRoot)
         {
             OpenAll(current, nestLevel + 1, openMask);
         }
     }
 }
Esempio n. 2
0
        public void SaveTree(TreeNode_ThingCategory node, int nestLevel, int openMask)
        {
            if (node.Openable)
            {
                bool open = false;
                if (Scribe.mode == LoadSaveMode.Saving)
                {
                    open = node.IsOpen(openMask);
                }

                //Try to load by old xml tag, just defName
                string xmlTag = node.catDef.defName;
                if (Scribe.mode == LoadSaveMode.LoadingVars)
                {
                    Scribe_Values.Look(ref open, xmlTag);
                }

                if (!open || Scribe.mode == LoadSaveMode.Saving)
                {
                    //From now on let's validate xml, and start with a letter for sure
                    xmlTag = "open_" + Regex.Replace(xmlTag, "[^a-zA-Z0-9:.-_]", "");
                    Scribe_Values.Look(ref open, xmlTag);
                }

                if (Scribe.mode == LoadSaveMode.LoadingVars)
                {
                    node.SetOpen(openMask, open);
                }
            }
            foreach (TreeNode_ThingCategory current in node.ChildCategoryNodes)
            {
                if (!current.catDef.resourceReadoutRoot)
                {
                    SaveTree(current, nestLevel + 1, openMask);
                }
            }
        }