More fixes

This commit is contained in:
Lohikar 2017-11-17 12:57:33 -06:00
parent 25fc65cdd8
commit f98750212c
4 changed files with 9 additions and 15 deletions

View file

@ -109,7 +109,7 @@
<TextBlock Grid.Column="2" HorizontalAlignment="Left" Margin="5,57,0,0" TextWrapping="Wrap" Text="Citizenship" VerticalAlignment="Top" /> <TextBlock Grid.Column="2" HorizontalAlignment="Left" Margin="5,57,0,0" TextWrapping="Wrap" Text="Citizenship" VerticalAlignment="Top" />
<ComboBox Grid.Column="0" x:Name="SubSpeciesCombo" Margin="10,120,5,0" <ComboBox Grid.Column="0" x:Name="SubSpeciesCombo" Margin="10,120,5,0"
VerticalAlignment="Top" VerticalAlignment="Top"
ToolTip="Your character's species. Required." ToolTip="Your character's ethnic group or subtype."
SelectionChanged="SpeciesSelectChanged" Height="26" SelectionChanged="SpeciesSelectChanged" Height="26"
/> />
<TextBlock Grid.Column="0" Margin="10,104,10,0" TextWrapping="Wrap" <TextBlock Grid.Column="0" Margin="10,104,10,0" TextWrapping="Wrap"

View file

@ -150,15 +150,9 @@ namespace AuroraRecordGenerator
private static IEnumerable<string> GetSpeciesOptions() => Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>().Select(Utility.SubspeciesNiceName); private static IEnumerable<string> GetSpeciesOptions() => Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>().Select(Utility.SubspeciesNiceName);
private static IEnumerable<string> GetSpeciesOptions(SpeciesType limitTo) private static IEnumerable<string> GetSpeciesOptions(SpeciesType limitTo) => from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
{
var targetAttr = limitTo.GetAttributeOfType<SubspeciesMetaAttribute>()?.AssociatedSpecies;
if (targetAttr == null)
return GetSpeciesOptions();
return from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>() let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
where attr != null && attr.AssociatedSpecies == targetAttr where attr != null && (attr.AssociatedSpecies == limitTo || attr.AssociatedSpecies == SpeciesType.None)
select Utility.SubspeciesNiceName(item); select Utility.SubspeciesNiceName(item);
} }
} }
}

View file

@ -16,7 +16,7 @@ namespace AuroraRecordGenerator
record.AppendLine(_targetRecord.Species.HasGender() record.AppendLine(_targetRecord.Species.HasGender()
? $"Gender: {_targetRecord.Gender.Humanize()}" ? $"Gender: {_targetRecord.Gender.Humanize()}"
: "Gender: Not Applicable."); : "Gender: Not Applicable.");
record.AppendLine($"Citizenship: {_targetRecord.Citizenship.IfEmpty("None.")}"); record.AppendLine($"Citizenship: {_targetRecord.Citizenship.IfEmpty("Not Specified.")}");
record.AppendLine($"Clearance Level: {_targetRecord.Clearance.IfEmpty("Not Specified")}"); record.AppendLine($"Clearance Level: {_targetRecord.Clearance.IfEmpty("Not Specified")}");
record.AppendLine($"Employed As: {_targetRecord.EmployedAs.IfEmpty("Assistant")}"); record.AppendLine($"Employed As: {_targetRecord.EmployedAs.IfEmpty("Assistant")}");
if (_targetRecord.CharHeight != null) if (_targetRecord.CharHeight != null)
@ -27,8 +27,8 @@ namespace AuroraRecordGenerator
// identifying features // identifying features
var trimmedFeatures = _targetRecord.DistinguishingFeatures.Trim(); var trimmedFeatures = _targetRecord.DistinguishingFeatures.Trim();
if (trimmedFeatures.Length > 0) record.Append("Distinguishing Features: ");
record.AppendLine($"Distinguishing Features: {trimmedFeatures}"); record.AppendLine(trimmedFeatures.Length > 0 ? trimmedFeatures : "None noted.");
record.AppendLine(); record.AppendLine();

View file

@ -34,7 +34,7 @@ namespace AuroraRecordGenerator
[ProtoContract] [ProtoContract]
public enum SpeciesSubType public enum SpeciesSubType
{ {
[ProtoEnum] [ProtoEnum, SubspeciesMeta(SpeciesType.None, "N/A")]
None = 0, None = 0,
[ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai")] [ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai")]