private void Init() { DisplayName = TextManager.Get("Submarine.Name." + Name, true); if (string.IsNullOrEmpty(DisplayName)) { DisplayName = Name; } Description = TextManager.Get("Submarine.Description." + Name, true); if (string.IsNullOrEmpty(Description)) { Description = SubmarineElement.GetAttributeString("description", ""); } GameVersion = new Version(SubmarineElement.GetAttributeString("gameversion", "0.0.0.0")); if (Enum.TryParse(SubmarineElement.GetAttributeString("tags", ""), out SubmarineTag tags)) { Tags = tags; } Dimensions = SubmarineElement.GetAttributeVector2("dimensions", Vector2.Zero); RecommendedCrewSizeMin = SubmarineElement.GetAttributeInt("recommendedcrewsizemin", 0); RecommendedCrewSizeMax = SubmarineElement.GetAttributeInt("recommendedcrewsizemax", 0); RecommendedCrewExperience = SubmarineElement.GetAttributeString("recommendedcrewexperience", "Unknown"); //backwards compatibility (use text tags instead of the actual text) if (RecommendedCrewExperience == "Beginner") { RecommendedCrewExperience = "CrewExperienceLow"; } else if (RecommendedCrewExperience == "Intermediate") { RecommendedCrewExperience = "CrewExperienceMid"; } else if (RecommendedCrewExperience == "Experienced") { RecommendedCrewExperience = "CrewExperienceHigh"; } RequiredContentPackages.Clear(); string[] contentPackageNames = SubmarineElement.GetAttributeStringArray("requiredcontentpackages", new string[0]); foreach (string contentPackageName in contentPackageNames) { RequiredContentPackages.Add(contentPackageName); } InitProjectSpecific(); }
private void Init() { DisplayName = TextManager.Get("Submarine.Name." + Name, true); if (string.IsNullOrEmpty(DisplayName)) { DisplayName = Name; } Description = TextManager.Get("Submarine.Description." + Name, true); if (string.IsNullOrEmpty(Description)) { Description = SubmarineElement.GetAttributeString("description", ""); } EqualityCheckVal = SubmarineElement.GetAttributeInt("checkval", 0); Price = SubmarineElement.GetAttributeInt("price", 1000); InitialSuppliesSpawned = SubmarineElement.GetAttributeBool("initialsuppliesspawned", false); GameVersion = new Version(SubmarineElement.GetAttributeString("gameversion", "0.0.0.0")); if (Enum.TryParse(SubmarineElement.GetAttributeString("tags", ""), out SubmarineTag tags)) { Tags = tags; } Dimensions = SubmarineElement.GetAttributeVector2("dimensions", Vector2.Zero); RecommendedCrewSizeMin = SubmarineElement.GetAttributeInt("recommendedcrewsizemin", 0); RecommendedCrewSizeMax = SubmarineElement.GetAttributeInt("recommendedcrewsizemax", 0); RecommendedCrewExperience = SubmarineElement.GetAttributeString("recommendedcrewexperience", "Unknown"); if (SubmarineElement?.Attribute("type") != null) { if (Enum.TryParse(SubmarineElement.GetAttributeString("type", ""), out SubmarineType type)) { Type = type; if (Type == SubmarineType.OutpostModule) { OutpostModuleInfo = new OutpostModuleInfo(this, SubmarineElement); } } } if (Type == SubmarineType.Player) { if (SubmarineElement?.Attribute("class") != null) { if (Enum.TryParse(SubmarineElement.GetAttributeString("class", "Undefined"), out SubmarineClass submarineClass)) { SubmarineClass = submarineClass; } } } else { SubmarineClass = SubmarineClass.Undefined; } //backwards compatibility (use text tags instead of the actual text) if (RecommendedCrewExperience == "Beginner") { RecommendedCrewExperience = "CrewExperienceLow"; } else if (RecommendedCrewExperience == "Intermediate") { RecommendedCrewExperience = "CrewExperienceMid"; } else if (RecommendedCrewExperience == "Experienced") { RecommendedCrewExperience = "CrewExperienceHigh"; } RequiredContentPackages.Clear(); string[] contentPackageNames = SubmarineElement.GetAttributeStringArray("requiredcontentpackages", new string[0]); foreach (string contentPackageName in contentPackageNames) { RequiredContentPackages.Add(contentPackageName); } InitProjectSpecific(); }