public GlobalTechInfo(int techID, TechCategory category, int plymouthCost, int edenCost, int maxScientists, LabType labType, string techName, string description, string teaser, string improveDescription, IList <int> requiredTechIDs, IList <UnitPropertyInfo> unitProperties) { TechID = techID; Category = category; PlymouthCost = plymouthCost; EdenCost = edenCost; MaxScientists = maxScientists; LabType = labType; TechName = techName; Description = description; Teaser = teaser; ImproveDescription = improveDescription; RequiredTechIDs = new ReadOnlyCollection <int>(requiredTechIDs); UnitProperties = new ReadOnlyCollection <UnitPropertyInfo>(unitProperties); }
private static GlobalTechInfo ParseTechValues(List <List <string> > techValues) { // Process tech header string techName = techValues[0][1]; int techId; if (!int.TryParse(techValues[0][2], out techId)) { Debug.LogError("Tech '" + techName + "' has an invalid tech Id!"); } TechCategory category = TechCategory.Basic; string description = ""; string teaser = ""; string improveDesc = ""; int edenCost = 0; int plymouthCost = 0; int maxScientists = 0; LabType labType = LabType.Standard; List <int> requiredTechIDs = new List <int>(); List <UnitPropertyInfo> unitProperties = new List <UnitPropertyInfo>(); // Process tech values for (int i = 0; i < techValues.Count; ++i) { if (techValues[i].Count < 2) { Debug.LogError("TechID " + techId + ": Not enough values specified for type: " + techValues[i][0]); continue; } int value; int.TryParse(techValues[i][1], out value); switch (techValues[i][0]) { case "CATEGORY": category = (TechCategory)value; break; case "DESCRIPTION": description = techValues[i][1]; break; case "TEASER": teaser = techValues[i][1]; break; case "IMPROVE_DESC": improveDesc = techValues[i][1]; break; case "REQUIRES": requiredTechIDs.Add(value); break; case "COST": edenCost = plymouthCost = value; break; case "EDEN_COST": edenCost = value; break; case "PLYMOUTH_COST": plymouthCost = value; break; case "MAX_SCIENTISTS": maxScientists = value; break; case "LAB": labType = (LabType)value; break; case "UNIT_PROP": if (techValues[i].Count < 4) { Debug.LogError("TechID " + techId + ": Not enough values specified for type: " + techValues[i][0]); continue; } map_id mapId = SheetReader.GetMapIdFromCodeName(techValues[i][1]); if (mapId == map_id.None) { Debug.LogError("TechID " + techId + ": Bad unit specifier: " + techValues[i][1]); break; } UnitProperty property = GetUnitProperty(techValues[i][2]); if (property == UnitProperty.None) { Debug.LogError("TechID " + techId + ": Bad property specifier: " + techValues[i][2]); break; } int.TryParse(techValues[i][3], out value); unitProperties.Add(new UnitPropertyInfo(mapId, property, value)); break; } } return(new GlobalTechInfo(techId, category, plymouthCost, edenCost, maxScientists, labType, techName, description, teaser, improveDesc, requiredTechIDs, unitProperties)); }