public AllianceXmlPassive( [JsonProperty(PropertyName = "tech", Required = Required.Always)] string tech, [JsonProperty(PropertyName = "techstatus", Required = Required.Always)] TechStatusEnum techStatus, [JsonProperty(PropertyName = "persistentcitytechstatus", Required = Required.Always)] TechStatusEnum persistentCityTechStatus, [Range(0, 99)][JsonProperty(PropertyName = "level", Required = Required.Always)] int level) { Tech = tech; TechStatus = techStatus; PersistentCityTechStatus = persistentCityTechStatus; Level = level; }
public static bool AddOrUpdate(this AiCharacterXmlTechs techs, string techId, TechStatusEnum techStatus) { if (string.IsNullOrWhiteSpace(techId)) { throw new ArgumentNullException(nameof(techId)); } if (techStatus == TechStatusEnum.Invalid) { throw new ArgumentNullException(nameof(techStatus)); } var tech = techs.Get(techId); if (tech != null) { tech.Status = techStatus; tech.PersistentCityStatus = techStatus; return(true); } var newTech = new AiCharacterXmlTechsTech { TechId = techId, Status = techStatus, PersistentCityStatus = techStatus }; techs.Add(newTech); return(true); }