add GUI for optional objectives in combat zones

This commit is contained in:
Florian Stinglmayr 2022-11-28 20:06:14 +01:00
parent d79ee5a153
commit 800ac73331
3 changed files with 105 additions and 1 deletions

View File

@ -19,11 +19,19 @@ class CombatZoneFormat : LogFormatter {
} }
foreach (var log in logs) { foreach (var log in logs) {
builder.AppendFormat("Won {0}x {1} {2} Combat Zones\n", int optionals = log.Value
.Sum(x => x.OptionalObjectivesCompleted)
;
builder.AppendFormat("Won {0}x {1} {2} Combat Zones",
log.Value.Count, log.Value.Count,
log.Key.Grade, log.Key.Grade,
log.Key.Type log.Key.Type
); );
if (optionals > 0) {
builder.AppendFormat(" (with {0} optional objectives)", optionals);
}
builder.Append("\n");
} }
return builder.ToString().Trim(); return builder.ToString().Trim();

View File

@ -84,6 +84,11 @@
</StackPanel> </StackPanel>
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" /> <Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
<StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}"> <StackPanel Grid.Column="2" Orientation="Horizontal" HorizontalAlignment="Right" x:Name="CombatZone" Visibility="{Binding IsCombatZone}">
<ToggleButton x:Name="CapitalShip" Margin="2,0,2,0" Content="Capital Ship" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCapitalShip, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="Captain" Margin="2,0,2,0" Content="Captain" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCaptain, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="Correspondent" Margin="2,0,2,0" Content="Correspondent" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasCorrespondent, Mode=TwoWay}" IsThreeState="False"/>
<ToggleButton x:Name="SpecOps" Margin="2,0,2,0" Content="Spec Ops" Visibility="{Binding IsShipCombatZone}" IsChecked="{Binding HasSpecOps, Mode=TwoWay}" IsThreeState="False"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button x:Name="Low" Content="Low" Click="Low_Click"/> <Button x:Name="Low" Content="Low" Click="Low_Click"/>
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/> <Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
<Button Content="Med" x:Name="Med" Click="Med_Click" /> <Button Content="Med" x:Name="Med" Click="Med_Click" />

View File

@ -25,6 +25,97 @@ public class UITransaction {
} }
} }
public Visibility IsShipCombatZone {
get {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return Visibility.Hidden;
}
if (string.Compare(combat.Type, "Ship") == 0) {
return Visibility.Visible;
}
return Visibility.Hidden;
}
}
public bool? HasSpecOps {
get {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return false;
}
return combat.SpecOps ?? false;
}
set {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return;
}
combat.SpecOps = value;
}
}
public bool? HasCapitalShip {
get {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return false;
}
return combat.CapitalShip ?? false;
}
set {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return;
}
combat.CapitalShip = value;
}
}
public bool? HasCaptain {
get {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return false;
}
return combat.Captain ?? false;
}
set {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return;
}
combat.Captain = value;
}
}
public bool? HasCorrespondent {
get {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return false;
}
return combat.Correspondent ?? false;
}
set {
CombatZone? combat = Transaction as CombatZone;
if (combat == null) {
return;
}
combat.Correspondent = value;
}
}
/// <summary> /// <summary>
/// Profit from selling, used in the XAML ui for binding /// Profit from selling, used in the XAML ui for binding
/// </summary> /// </summary>