示例#1
0
文件: buildtab.cs 项目: zyphrus/dire
        public BuildTab(string GroupName, group Group)
            : base(GroupName)
        {
            this.group = Group;

            init();
        }
示例#2
0
文件: buildtab.cs 项目: zyphrus/dire
        public BuildTab(string GroupName)
            : base(GroupName)
        {
            this.group = new group();
            this.group.items = new List<Item>();
            this.group.GroupTitle = GroupName;

            init();
        }
示例#3
0
文件: buildtab.cs 项目: zyphrus/dire
 public BuildTab( group Group)
     : base(Group.GroupTitle)
 {
     init();
     this.group = Group;
     for (int i = 0; i < group.items.Count; i++  )
     {
         this.AddItem(group.items[i]);
     }
 }
示例#4
0
文件: build.cs 项目: zyphrus/dire
        public static build LoadBuild(string path)
        {
            string[] lines = File.ReadAllLines(path);
            Hero Lhero = null;
            string Lauthor = "", Ltitle = "";
            List<group> Litems = new List<group>();
            group tempGroup = new group();
            bool isItems = false; //is reading Items

            foreach (string s in lines)
            {
                if (isItems)
                {
                    if (s.TrimStart().StartsWith("\"item"))
                    {
                        //Item found
                        tempGroup.items.Add(ItemFetcher.ResloveDotaNameToItem(s.Split('\"')[s.Split('\"').Length - 2].Remove(0, 5)));

                    }
                    else if (s.TrimStart().StartsWith("\"") && s.EndsWith("\""))
                    {

                        if (tempGroup.GroupTitle != null || tempGroup.items != null)
                        {

                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Starting_Items")
                            {
                                tempGroup.GroupTitle = "Starting Items";
                            }
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Early_Game")
                            {
                                tempGroup.GroupTitle = "Early Game";
                            }
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Core_Items")
                            {
                                tempGroup.GroupTitle = "Core Items";
                            }
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Luxury")
                            {
                                tempGroup.GroupTitle = "Luxury";
                            }

                            Litems.Add(new group(tempGroup.items, tempGroup.GroupTitle));
                        }
                        //Name of item Group
                        tempGroup = new group(); //init Group
                        tempGroup.items = new List<Item>(); //init Items
                        tempGroup.GroupTitle = s.TrimStart().Split('\"')[1];

                    }
                    else
                    {
                        if (s == "}" && tempGroup.GroupTitle != null) //EOF
                        {
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Starting_Items")
                            {
                                tempGroup.GroupTitle = "Starting Items";
                            }
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Early_Game")
                            {
                                tempGroup.GroupTitle = "Early Game";
                            }
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Core_Items")
                            {
                                tempGroup.GroupTitle = "Core Items";
                            }
                            if (tempGroup.GroupTitle == "#DOTA_Item_Build_Luxury")
                            {
                                tempGroup.GroupTitle = "Luxury";
                            }
                            Litems.Add(new group(tempGroup.items, tempGroup.GroupTitle));
                            break;
                        }
                        continue;
                    }
                }
                else
                {

                    if (s.TrimStart().StartsWith("\"author"))
                    {
                        Lauthor = s.Split('\"')[s.Split('\"').Length - 2];
                        continue;
                    }

                    if (s.TrimStart().StartsWith("\"Title"))
                    {
                        string t = s.Split('\"')[s.Split('\"').Length - 2];
                        Ltitle = s.Split('\"')[s.Split('\"').Length - 2];
                        continue;
                    }

                    if (s.TrimStart().StartsWith("\"hero"))
                    {
                        Lhero = HeroFetcher.ResloveDotaNameToHero(s.Split('\"')[s.Split('\"').Length - 2].Remove(0, 14));
                        continue;
                    }

                    if (s.TrimStart().StartsWith("\"Items"))
                    {
                        isItems = true;
                        continue;
                    }
                }

            }

            return new build(Lhero, Lauthor, Ltitle, Litems);
        }
示例#5
0
文件: build.cs 项目: zyphrus/dire
        private void write_group(StreamWriter fs, group g)
        {
            //Noraml Text to DOTA Titles
            if (g.GroupTitle == "Starting Items")
            {
                g.GroupTitle = "#DOTA_Item_Build_Starting_Items";
            }
            if (g.GroupTitle == "Early Game")
            {
                g.GroupTitle = "#DOTA_Item_Build_Early_Game";
            }
            if (g.GroupTitle == "Core Items")
            {
                g.GroupTitle = "#DOTA_Item_Build_Core_Items";
            }
            if (g.GroupTitle == "Luxury")
            {
                g.GroupTitle = "#DOTA_Item_Build_Luxury";
            }

            fs.WriteLine(TabIndex() + "\"" + g.GroupTitle + "\"");

            write_start_regoin(fs);

            foreach (Item i in g.items) {
                fs.WriteLine(TabIndex() + "\"item\" \t\"item_" + i.DotaName + "\"");
            }

            write_end_regoin(fs);
        }