public static string GetTechTitleById(string id)
        {
            var result = ResearchAndDevelopment.GetTechnologyTitle(id);

            if (!String.IsNullOrEmpty(result))
            {
                return(result);
            }

            PartUpgradeHandler.Upgrade partUpgrade;
            if (PartUpgradeByName.TryGetValue(id, out partUpgrade))
            {
                RDTech upgradeTechnode;
                if (RDTechByName.TryGetValue(partUpgrade.techRequired, out upgradeTechnode))
                {
                    return(upgradeTechnode.title);
                }
            }

            RDTech technode;

            if (RDTechByName.TryGetValue(id, out technode))
            {
                return(technode.title);
            }

            return(id);
        }
Exemplo n.º 2
0
        public static string GetTechTitleById(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                Debug.LogError("[PhotonSail]: GetTechTitleById - id is null");
                return(id);
            }

            var result = ResearchAndDevelopment.GetTechnologyTitle(id);

            if (!string.IsNullOrEmpty(result))
            {
                return(result);
            }

            if (PartUpgradeByName.TryGetValue(id, out var partUpgrade))
            {
                if (partUpgrade != null && !string.IsNullOrEmpty(partUpgrade.techRequired))
                {
                    Debug.LogError("[PhotonSail]: GetTechTitleById - id is null");
                    if (RDTechByName.TryGetValue(partUpgrade.techRequired, out var upgradeTechNode))
                    {
                        return(upgradeTechNode?.title);
                    }
                }
                else if (partUpgrade != null)
                {
                    Debug.LogError("[PhotonSail]: GetTechTitleById - partUpgrade is null");
                }
                else
                {
                    Debug.LogError("[PhotonSail]: GetTechTitleById - partUpgrade.techRequired is null");
                }
            }

            if (RDTechByName.TryGetValue(id, out var techNode))
            {
                return(techNode.title);
            }

            return(id);
        }