Compare commits
2 Commits
d79ee5a153
...
91bca70168
Author | SHA1 | Date | |
---|---|---|---|
91bca70168 | |||
800ac73331 |
@ -43,6 +43,9 @@ public class CombatZone : Transaction {
|
||||
/// </summary>
|
||||
public int OptionalObjectivesCompleted {
|
||||
get {
|
||||
if (IsGround) {
|
||||
return 0;
|
||||
}
|
||||
return new List<bool?>() { SpecOps, Captain, Correspondent, CapitalShip }
|
||||
.Where(x => x != null && x == true)
|
||||
.Count()
|
||||
@ -50,6 +53,20 @@ public class CombatZone : Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if it is an on foot/ground combat zone
|
||||
/// </summary>
|
||||
public bool IsGround {
|
||||
get { return string.Compare(Type, "On Foot") == 0; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if it is an on foot combat zone
|
||||
/// </summary>
|
||||
public bool IsShip {
|
||||
get { return string.Compare(Type, "Ship") == 0; }
|
||||
}
|
||||
|
||||
public override int CompareTo(Transaction? obj) {
|
||||
if (obj == null || obj.GetType() != typeof(CombatZone)) {
|
||||
return -1;
|
||||
|
@ -19,11 +19,19 @@ class CombatZoneFormat : LogFormatter {
|
||||
}
|
||||
|
||||
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.Key.Grade,
|
||||
log.Key.Type
|
||||
);
|
||||
|
||||
if (optionals > 0) {
|
||||
builder.AppendFormat(" (with {0} optional objectives)", optionals);
|
||||
}
|
||||
builder.Append("\n");
|
||||
}
|
||||
|
||||
return builder.ToString().Trim();
|
||||
|
@ -84,6 +84,11 @@
|
||||
</StackPanel>
|
||||
<Separator Visibility="Hidden" Grid.Column="1" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" />
|
||||
<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"/>
|
||||
<Separator Margin="2,0,2,0" VerticalAlignment="Top"/>
|
||||
<Button Content="Med" x:Name="Med" Click="Med_Click" />
|
||||
|
@ -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>
|
||||
/// Profit from selling, used in the XAML ui for binding
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user