Further fixes

This commit is contained in:
Lohikar 2017-11-17 13:32:53 -06:00
parent f98750212c
commit 2e3b7d9c2e
6 changed files with 39 additions and 15 deletions

View file

@ -22,11 +22,14 @@ namespace AuroraRecordGenerator
[ProtoMember(5, IsRequired = true)]
public SpeciesType Species { get; set; } = SpeciesType.Human;
[ProtoMember(16)]
public SpeciesSubType Subspecies { get; set; } = SpeciesSubType.None;
[ProtoMember(6, IsRequired = true)]
public GenderType Gender { get; set; }
[ProtoMember(7)]
public DateTime BirthDate { get; set; } = DateTime.Parse("1/1/2458");
public DateTime BirthDate { get; set; } = Info.IcDate;
[ProtoMember(8)]
public double? CharHeight { get; set; } = 170;

View file

@ -16,7 +16,6 @@
<x:Type TypeName="local:SpeciesType" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider x:Key="SubspeciesEnum" MethodName="GetSpeciesOptions" ObjectType="{x:Type local:RecordEditor}"/>
</controls:MetroWindow.Resources>
<Grid>
<TabControl Margin="0,10,0,44.96" controls:TabControlHelper.IsUnderlined="True">
@ -260,19 +259,19 @@
</Grid.RowDefinitions>
<!-- Opt-Outs -->
<Grid Grid.Row="0" ToolTip="If the character wishes to not be cloned.">
<CheckBox Content="Do Not Clone" HorizontalAlignment="Left"
<CheckBox x:Name="NoClone" Content="Do Not Clone" HorizontalAlignment="Left"
Margin="10,10,0,0" VerticalAlignment="Top" />
<CheckBox Content="No Prosthetics"
<CheckBox x:Name="NoProsthetic" Content="No Prosthetics"
HorizontalAlignment="Left" Margin="10,33,0,0" VerticalAlignment="Top"
ToolTip="If the character should not be fitted with prosthetics." />
<CheckBox Content="Do Not Borgify" HorizontalAlignment="Left"
<CheckBox x:Name="NoBorg" Content="Do Not Borgify" HorizontalAlignment="Left"
Margin="136,10,0,0" VerticalAlignment="Top"
ToolTip="If the character should not be borged." />
<CheckBox Content="Do Not Resuscitate"
<CheckBox x:Name="NoRevive" Content="Do Not Resuscitate"
HorizontalAlignment="Left" Margin="136,33,0,0" VerticalAlignment="Top"
ToolTip="If the character should not be revived." />
</Grid>
<!-- whee, user-resizable stuff is fun! Not. -->
<!-- user-resizable stuff is fun! Not. -->
<GridSplitter Grid.Row="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch"
VerticalAlignment="Bottom" Margin="0" Height="10" />
<GridSplitter Grid.Row="2" Grid.ColumnSpan="1" HorizontalAlignment="Stretch"

View file

@ -77,7 +77,15 @@ namespace AuroraRecordGenerator
private void GenerateRecord(object sender, RoutedEventArgs e)
{
// THIS IS IT
// Update medical checkboxes.
Data.NoClone = NoClone.IsChecked ?? false;
Data.NoBorg = NoBorg.IsChecked ?? false;
Data.NoProsthetic = NoProsthetic.IsChecked ?? false;
Data.NoRevive = NoRevive.IsChecked ?? false;
// Figure out what subspecies we've got.
var subspecies = SubSpeciesCombo.SelectedItem as string;
Data.Subspecies = subspecies != null ? Utility.SubspeciesNiceNameToEnum(subspecies) : SpeciesSubType.None;
var wnd = new GeneratedResultWindow(Data);
wnd.Show();
}

View file

@ -13,6 +13,10 @@ namespace AuroraRecordGenerator
record.AppendLine(MakeNameLine());
record.AppendLine($"Date of Birth: {_targetRecord.BirthDate.ToString("MMMM")} {_targetRecord.BirthDate.Day.Ordinalize()}, {_targetRecord.BirthDate.Year}");
record.AppendLine($"Species: {_targetRecord.Species.Humanize()}");// might fuck up the names
if (_targetRecord.Subspecies != SpeciesSubType.None)
{
record.AppendLine($"{_targetRecord.Subspecies.GetAttributeOfType<SubspeciesMetaAttribute>()?.FieldName ?? "Subspecies"}: {Utility.SubspeciesNiceName(_targetRecord.Subspecies)}");
}
record.AppendLine(_targetRecord.Species.HasGender()
? $"Gender: {_targetRecord.Gender.Humanize()}"
: "Gender: Not Applicable.");

View file

@ -37,22 +37,22 @@ namespace AuroraRecordGenerator
[ProtoEnum, SubspeciesMeta(SpeciesType.None, "N/A")]
None = 0,
[ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai")]
[ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "M'sai", "Ethnicity")]
MsaiTajara,
[ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan")]
[ProtoEnum, SubspeciesMeta(SpeciesType.Tajara, "Zhan-Khazan", "Ethnicity")]
ZhanTajara,
[ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type A (Worker)")]
[ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type A (Worker)", "Classification")]
VaurcaWorker,
[ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type B (Warrior)")]
[ProtoEnum, SubspeciesMeta(SpeciesType.Vaurca, "Type B (Warrior)", "Classification")]
VaurcaWarrior,
[ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell Frame")]
[ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Shell Frame", "Subtype")]
IpcShell,
[ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Industrial Frame")]
[ProtoEnum, SubspeciesMeta(SpeciesType.IPC, "Industrial Frame", "Subtype")]
IpcG1Industrial
}
@ -84,10 +84,12 @@ namespace AuroraRecordGenerator
{
public SpeciesType AssociatedSpecies {get; private set;}
public string NiceName { get; private set; }
public SubspeciesMetaAttribute(SpeciesType associatedType, string nicename)
public string FieldName { get; private set; }
public SubspeciesMetaAttribute(SpeciesType associatedType, string nicename, string fieldname = "Subspecies")
{
AssociatedSpecies = associatedType;
NiceName = nicename;
FieldName = fieldname;
}
}
}

View file

@ -59,6 +59,14 @@ namespace AuroraRecordGenerator
var attr = species.GetAttributeOfType<SubspeciesMetaAttribute>();
return attr?.NiceName ?? Enum.GetName(typeof(SpeciesSubType), species);
}
public static SpeciesSubType SubspeciesNiceNameToEnum(string nicename)
{
return (from item in Enum.GetValues(typeof(SpeciesSubType)).Cast<SpeciesSubType>()
let attr = item.GetAttributeOfType<SubspeciesMetaAttribute>()
where attr != null && attr.NiceName == nicename
select item).FirstOrDefault();
}
}
// From https://stackoverflow.com/questions/1799370/getting-attributes-of-enums-value