Beispiel #1
0
        private VisNode MarshalTech(Tech tech, Dictionary <int, int> startingLevelsByTier, string imagesPath)
        {
            var result = VisHelpers.CreateNode(tech, CreateRelativePath(imagesPath), "tech");

            result.prerequisites = tech.PrerequisiteIds != null
                ? tech.PrerequisiteIds.ToArray()
                : new[] { BuildRootNodeName(tech.Area) };

            result.group = (tech.Mod == "Stellaris" ? "" : "Mod") + tech.Area;
            result.title = result.title + "<br/><b>Tier: </b>" + tech.TierValue;

            if (tech.Categories != null)
            {
                var catString           = tech.Categories.Count() > 1 ? "Categories" : "Category";
                var categoriesLocalised = tech.Categories.Select(x => localisationApi.GetName(x)).ToArray();

                result.title = result.title + "<br/><b>" + catString + ": </b>" + string.Join(",", categoriesLocalised);

                result.categories = tech.Categories.ToArray();
            }

            result.title = result.title + "<br/><b>Base cost: </b>" + (tech.BaseCost ?? 0);

            // we are assigning levels in the graph, so work out where this tech sits.
            result.level = tech.TierValue == -1 ? 0 : CalculateLevel(tech, startingLevelsByTier);

            if (tech.Flags.Any())
            {
                result.title = result.title + "<br/><b>Attributes: </b>" + string.Join(", ", tech.Flags);
            }

            VisHelpers.SetGestaltAvailability(result, tech);

            // rare purple tech
            if (tech.Flags.Contains(TechFlag.Rare))
            {
                VisHelpers.SetBorder(result, "#8900CE");
            }

            // starter technology
            if (tech.Flags.Contains(TechFlag.Starter))
            {
                VisHelpers.SetBorder(result, "#00CE56");
            }

            // may cause endgame crisis or AI revolution
            if (tech.Flags.Contains(TechFlag.Dangerous))
            {
                VisHelpers.SetBorder(result, "#D30000");
            }

            // tech that requires an acquisition - base weight is 0
            if (tech.Flags.Contains(TechFlag.NonTechDependency))
            {
                VisHelpers.SetBorder(result, "#CE7C00");
            }

            // tech that is repeatable
            if (tech.Flags.Contains(TechFlag.Repeatable))
            {
                VisHelpers.SetBorder(result, "#0078CE");
            }

            return(result);
        }
Beispiel #2
0
 private string CreateRelativePath(string imagesPath)
 {
     return(VisHelpers.CreateRelativePath(imagesPath, outputDirectoryHelper.Root));
 }