コード例 #1
0
        public static string ConvertToString(ItemSkillTree skilltree)
        {
            string save = "";

            for (int i = 0; i < skilltree.GetSize; i++)
            {
                if (i > 0)
                {
                    save += ";";
                }
                save += ItemNodeAtlas.GetID(skilltree.GetNode(i).GetType().Name) + "|";
                for (int j = 0; j < skilltree.GetNode(i).GetNeighboor.Count; j++)
                {
                    save += skilltree.GetNode(i).GetNeighboor[j];
                    if (j < skilltree.GetNode(i).GetNeighboor.Count - 1)
                    {
                        save += ':';
                    }
                }

                save += "|" + skilltree.GetNode(i).GetState + "|" + skilltree.GetNode(i).GetLevel + "|" + skilltree.GetNode(i).GetMaxLevel + "|" + skilltree.GetNode(i).GetRequiredPoints + "|" + skilltree.GetNode(i).GetPos.X + ":" + skilltree.GetNode(i).GetPos.Y + "|";

                save += skilltree.GetNode(i).GetSaveValue();
            }

            return(save);
        }
コード例 #2
0
 //;ID,Neighboor1:2,state,level,maxlevel,required,posx:posy,specificvalue1:2:3:5:7;
 virtual public void Init(ItemSkillTree IST, int ID, int maxlevel, int required, Vector2 pos)
 {
     m_ID_Neightboor   = new List <int>();
     m_SkillTreeParent = IST;
     m_ID             = ID;
     m_Level          = 0;
     m_LockState      = MININT;
     m_MaxLevel       = maxlevel;
     m_RequiredPoints = required;
     m_position       = pos;
 }
コード例 #3
0
        public static ItemSkillTree ConvertToTree(string save, ItemUpdate source)
        {
            string[]      nodeListSave;
            string[]      nodeDetails;
            ItemSkillTree tree = new ItemSkillTree();

            nodeListSave      = save.Split(';');
            tree.m_ItemSource = source;
            string[] a;
            ItemNode bufferNode;

            foreach (string nodeSave in nodeListSave)
            {
                bufferNode  = null;
                nodeDetails = nodeSave.Split(',');
                if (nodeDetails.Length != 8)
                {
                    AnotherRpgMod.Instance.Logger.Warn("Item tree corrupted, reseting tree");
                    tree = new ItemSkillTree();
                    tree.Init(source);
                    return(tree);
                }

                bufferNode = (ItemNode)ItemNodeAtlas.GetCorrectNode(int.Parse(nodeDetails[0]));

                a = nodeDetails[6].Split(':');
                bufferNode.Init(tree, tree.GetSize, int.Parse(nodeDetails[4]), int.Parse(nodeDetails[5]), new Vector2(int.Parse(a[0]), int.Parse(a[1])));

                //Ignore it if there is no neighboor
                if (nodeDetails[1] != "")
                {
                    a = nodeDetails[1].Split(':');
                    foreach (string neightboor in a)
                    {
                        bufferNode.AddNeightboor(int.Parse(neightboor));
                    }
                }
                bufferNode.ForceLockNode(int.Parse(nodeDetails[2]));
                bufferNode.SetLevel = int.Parse(nodeDetails[3]);
                if (nodeDetails[7] != "")
                {
                    bufferNode.LoadValue(nodeDetails[7]);
                }
                tree.AddNode(bufferNode);
            }

            return(tree);
        }
コード例 #4
0
 public ItemNode()
 {
     m_ID_Neightboor   = new List <int>();
     m_SkillTreeParent = new ItemSkillTree();
 }
コード例 #5
0
        public static ItemSkillTree ConvertToTree(string save, ItemUpdate source, int evoPoint, int AscPoint)
        {
            string[]      nodeListSave;
            string[]      nodeDetails;
            ItemSkillTree tree = new ItemSkillTree();

            nodeListSave      = save.Split(';');
            tree.m_ItemSource = source;
            string[] a;
            ItemNode bufferNode;

            foreach (string nodeSave in nodeListSave)
            {
                bufferNode  = null;
                nodeDetails = nodeSave.Split('|');
                if (nodeDetails.Length != 8)
                {
                    AnotherRpgMod.Instance.Logger.Error(source.ItemName);
                    AnotherRpgMod.Instance.Logger.Error("Item tree corrupted, reseting tree");
                    AnotherRpgMod.Instance.Logger.Error(nodeSave);
                    tree = new ItemSkillTree();
                    tree.MaxEvolutionPoints = evoPoint;
                    tree.MaxAscendPoints    = AscPoint;
                    tree.Init(source);
                    tree.Reset(true);
                    tree.EvolutionPoints = tree.MaxEvolutionPoints;
                    tree.AscendPoints    = tree.MaxAscendPoints;

                    if (tree.AscendPoints > 0)
                    {
                        tree.ExtendTree(Mathf.Clamp(Mathf.CeilInt(Mathf.Pow(source.baseCap / 3f, 0.95)), 5, 99) * tree.AscendPoints);
                    }
                    return(tree);
                }

                bufferNode = (ItemNode)ItemNodeAtlas.GetCorrectNode(int.Parse(nodeDetails[0]));

                a = nodeDetails[6].Split(':');
                bufferNode.Init(tree, tree.GetSize, int.Parse(nodeDetails[4]), int.Parse(nodeDetails[5]), new Vector2(int.Parse(a[0]), int.Parse(a[1])));

                //Ignore it if there is no neighboor
                if (nodeDetails[1] != "")
                {
                    a = nodeDetails[1].Split(':');
                    foreach (string neightboor in a)
                    {
                        bufferNode.AddNeightboor(int.Parse(neightboor));
                    }
                }
                bufferNode.ForceLockNode(int.Parse(nodeDetails[2]));
                bufferNode.SetLevel = int.Parse(nodeDetails[3]);


                if (nodeDetails[7] != "")
                {
                    bufferNode.LoadValue(nodeDetails[7]);
                }
                tree.AddNode(bufferNode);
            }

            return(tree);
        }