示例#1
0
        public void Load(TextAsset tree_file)
        {
            ResourceTreeLoader <ResourceTreeNode> resourceTreeLoader = new ResourceTreeLoader <ResourceTreeNode>(tree_file);

            foreach (ResourceTreeNode item in resourceTreeLoader)
            {
                string a = item.Id.Substring(0, 1);
                if (string.Equals(a, "_"))
                {
                    new TechTreeTitle(item.Id, this, Strings.Get("STRINGS.RESEARCH.TREES.TITLE" + item.Id.ToUpper()), item);
                }
            }
        }
示例#2
0
        public void Load(TextAsset tree_file)
        {
            ResourceTreeLoader <ResourceTreeNode> resourceTreeLoader = new ResourceTreeLoader <ResourceTreeNode>(tree_file);

            foreach (ResourceTreeNode item in resourceTreeLoader)
            {
                string a = item.Id.Substring(0, 1);
                if (!string.Equals(a, "_"))
                {
                    Tech tech = TryGet(item.Id);
                    if (tech == null)
                    {
                        tech = new Tech(item.Id, this, Strings.Get("STRINGS.RESEARCH.TECHS." + item.Id.ToUpper() + ".NAME"), Strings.Get("STRINGS.RESEARCH.TECHS." + item.Id.ToUpper() + ".DESC"), item);
                    }
                    foreach (ResourceTreeNode reference in item.references)
                    {
                        Tech tech2 = TryGet(reference.Id);
                        if (tech2 == null)
                        {
                            tech2 = new Tech(reference.Id, this, Strings.Get("STRINGS.RESEARCH.TECHS." + reference.Id.ToUpper() + ".NAME"), Strings.Get("STRINGS.RESEARCH.TECHS." + reference.Id.ToUpper() + ".DESC"), reference);
                        }
                        tech2.requiredTech.Add(tech);
                        tech.unlockedTech.Add(tech2);
                    }
                }
            }
            tierCount = 0;
            foreach (Tech resource in resources)
            {
                resource.tier = GetTier(resource);
                List <Tuple <string, float> > list = TECH_TIERS[resource.tier];
                foreach (Tuple <string, float> item2 in list)
                {
                    resource.costsByResearchTypeID.Add(item2.first, item2.second);
                }
                tierCount = Math.Max(resource.tier + 1, tierCount);
            }
        }