add support for thargoid combat zones

This commit is contained in:
Florian Stinglmayr 2022-12-03 14:47:31 +01:00
parent 67966ca27a
commit 661a4672d9
5 changed files with 43 additions and 96 deletions

View File

@ -1,48 +0,0 @@
<Window x:Class="EliteBGS.CombatZoneDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:EliteBGS"
mc:Ignorable="d"
Title="Add Combat Zone Wins" Height="150" Width="370" Icon="EliteBGS.ico" WindowStartupLocation="CenterOwner">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<GroupBox Header="Add Combat Zone" Grid.Row="0" Grid.Column="0" Width="Auto">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ComboBox x:Name="type" Grid.Column="0" VerticalAlignment="Top" Width="Auto" IsReadOnly="True" Height="23" Margin="5" SelectedIndex="0">
<ComboBoxItem Content="Ship"/>
<ComboBoxItem Content="On Foot"/>
</ComboBox>
<ComboBox x:Name="grade" Grid.Column="1" VerticalAlignment="Top" IsReadOnly="True" Margin="5" Height="23" Width="Auto" SelectedIndex="0">
<ComboBoxItem Content="Low"/>
<ComboBoxItem Content="Medium"/>
<ComboBoxItem Content="High"/>
</ComboBox>
<TextBox x:Name="amount" Grid.Column="2" Height="23" TextWrapping="Wrap" Text="1" VerticalAlignment="Top" Width="Auto" Margin="5" HorizontalContentAlignment="Right"/>
</Grid>
</GroupBox>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button x:Name="Accept" Content="Accept" HorizontalAlignment="Right" Grid.Column="0" Grid.Row="1" VerticalAlignment="Top" Width="75" Margin="5" IsDefault="True" Click="Accept_Click"/>
<Button x:Name="Cancel" Content="Cancel" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="1" VerticalAlignment="Top" Width="75" Margin="5" IsCancel="True" Click="Cancel_Click"/>
</Grid>
</Grid>
</Window>

View File

@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace EliteBGS {
/// <summary>
/// Interaction logic for CombatZoneDialog.xaml
/// </summary>
public partial class CombatZoneDialog : Window {
public CombatZoneDialog() {
InitializeComponent();
}
public string Type => (type.SelectedItem as ComboBoxItem).Content.ToString();
public string Grade => (grade.SelectedItem as ComboBoxItem).Content.ToString();
public int Amount {
get {
try {
return int.Parse(amount.Text);
} catch (Exception) {
return 1;
}
}
}
private void Accept_Click(object sender, RoutedEventArgs e) {
DialogResult = true;
Close();
}
private void Cancel_Click(object sender, RoutedEventArgs e) {
DialogResult = false;
Close();
}
}
}

View File

@ -116,6 +116,7 @@
<StackPanel Orientation="Vertical">
<Button Content="Ground" x:Name="Ground" Click="Ground_Click"/>
<Button Content="Ship" x:Name="Ship" Click="Ship_Click"/>
<Button Content="Thargoid" x:Name="Thargoid" Click="Thargoid_Click"/>
</StackPanel>
</Expander>
</StackPanel>

View File

@ -329,6 +329,16 @@ public partial class MainWindow : Window {
RefreshView();
}
private void Thargoid_Click(object sender, RoutedEventArgs e) {
CombatZone transaction = GetTransaction<CombatZone>(sender);
if (transaction == null) {
return;
}
transaction.Type = CombatZones.ThargoidCombatZone;
RefreshView();
}
private void Profit_LostFocus(object sender, RoutedEventArgs e) {
RefreshView();
}

View File

@ -5,6 +5,7 @@ using Newtonsoft.Json;
using EDPlayerJournal.BGS;
using System.Linq;
using System.Windows;
using EDPlayerJournal;
namespace EliteBGS;
@ -25,6 +26,21 @@ public class UITransaction {
}
}
public Visibility IsGroundCombatZone {
get {
CombatZone combat = Transaction as CombatZone;
if (combat == null) {
return Visibility.Hidden;
}
if (string.Compare(combat.Type, CombatZones.GroundCombatZone) == 0) {
return Visibility.Visible;
}
return Visibility.Hidden;
}
}
public Visibility IsShipCombatZone {
get {
CombatZone combat = Transaction as CombatZone;
@ -32,7 +48,22 @@ public class UITransaction {
return Visibility.Hidden;
}
if (string.Compare(combat.Type, "Ship") == 0) {
if (string.Compare(combat.Type, CombatZones.ShipCombatZone) == 0) {
return Visibility.Visible;
}
return Visibility.Hidden;
}
}
public Visibility IsThargoidCombatZone {
get {
CombatZone combat = Transaction as CombatZone;
if (combat == null) {
return Visibility.Hidden;
}
if (string.Compare(combat.Type, CombatZones.ThargoidCombatZone) == 0) {
return Visibility.Visible;
}