Skip to content

Commit

Permalink
0.76:
Browse files Browse the repository at this point in the history
- Added Savingthrow Types
- Added Ranged Damage Types
- Added Ammunitions
- Added VFX columns from damagehitvisual to Damage Types
- Fixed dispaly of DamageType groups in UI
- Fixed Itemproperty Table and CostTable Grids not displaying data correctly and not saving changed correctly
  • Loading branch information
Cjreek committed Aug 26, 2024
1 parent e2c3b2f commit d27bd73
Show file tree
Hide file tree
Showing 48 changed files with 2,156 additions and 38 deletions.
9 changes: 9 additions & 0 deletions eos-edit/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@
<DataTemplate DataType="{x:Type dialogVM:DamageTypeGroupSearchViewModel}">
<dialogViews:ModelSearchView/>
</DataTemplate>
<DataTemplate DataType="{x:Type dialogVM:RangedDamageTypeSearchViewModel}">
<dialogViews:ModelSearchView/>
</DataTemplate>
<DataTemplate DataType="{x:Type dialogVM:SavingthrowTypeSearchViewModel}">
<dialogViews:ModelSearchView/>
</DataTemplate>
<DataTemplate DataType="{x:Type dialogVM:AmmunitionSearchViewModel}">
<dialogViews:ModelSearchView/>
</DataTemplate>
<DataTemplate DataType="{x:Type dialogVM:CustomObjectInstanceSearchViewModel}">
<dialogViews:ModelSearchView/>
</DataTemplate>
Expand Down
19 changes: 17 additions & 2 deletions eos-edit/Assets/CustomDataTemplateResources.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
<DataTemplate x:Key="tlkTemplate">
<uc:TLKTextbox TLKStrings="{Binding Value}" TLKLanguage="{Binding Source={x:Static config:EosConfig.RuntimeConfig}, Path=CurrentLanguage}" Gender="{Binding Source={x:Static config:EosConfig.RuntimeConfig}, Path=CurrentGender}"/>
</DataTemplate>

<DataTemplate x:Key="tlkMultilineTemplate">
<uc:TLKTextbox TLKStrings="{Binding Value}" MinHeight="75" TLKLanguage="{Binding Source={x:Static config:EosConfig.RuntimeConfig}, Path=CurrentLanguage}" Gender="{Binding Source={x:Static config:EosConfig.RuntimeConfig}, Path=CurrentGender}" AcceptsReturn="True"/>
</DataTemplate>

<DataTemplate x:Key="raceTemplate">
<uc:RaceComboBox SelectedValue="{Binding Value}" IsNullable="True"/>
</DataTemplate>
Expand Down Expand Up @@ -113,6 +116,12 @@
<DataTemplate x:Key="damageTypeGroupTemplate">
<uc:DamageTypeGroupComboBox SelectedValue="{Binding Value}" IsNullable="True"/>
</DataTemplate>
<DataTemplate x:Key="savingthrowTypeTemplate">
<uc:SavingthrowTypeComboBox SelectedValue="{Binding Value}" IsNullable="True"/>
</DataTemplate>
<DataTemplate x:Key="ammunitionTemplate">
<uc:AmmunitionComboBox SelectedValue="{Binding Value}" IsNullable="True"/>
</DataTemplate>

<DataTemplate x:Key="customObjectTemplate">
<uc:CustomObjectComboBox CustomObjectTemplate="{Binding Property.DataType.CustomType}" SelectedValue="{Binding Value}" IsNullable="True"/>
Expand Down Expand Up @@ -154,6 +163,7 @@
BoolTemplate="{StaticResource boolTemplate}"
StringTemplate="{StaticResource strTemplate}"
TlkTemplate="{StaticResource tlkTemplate}"
TlkMultilineTemplate="{StaticResource tlkMultilineTemplate}"
RaceTemplate="{StaticResource raceTemplate}"
ClassTemplate="{StaticResource classTemplate}"
SkillTemplate="{StaticResource skillTemplate}"
Expand All @@ -171,8 +181,10 @@
DiseaseTemplate="{StaticResource diseaseTemplate}"
PoisonTemplate="{StaticResource poisonTemplate}"
TrapTemplate="{StaticResource trapTemplate}"
SavingthrowTypeTemplate="{StaticResource savingthrowTypeTemplate}"
DamageTypeTemplate="{StaticResource damageTypeTemplate}"
DamageTypeGroupTemplate="{StaticResource damageTypeGroupTemplate}"
AmmunitionTemplate="{StaticResource ammunitionTemplate}"
BaseItemTemplate="{StaticResource baseItemTemplate}"
ProgrammedEffectTemplate="{StaticResource progFXTemplate}"
AppearanceSoundsetTemplate="{StaticResource appearanceSoundsetTemplate}"
Expand Down Expand Up @@ -213,7 +225,7 @@
</DataTemplate>
</Grid.DataTemplates>

<ComboBox x:Name="cbDataType" Grid.Column="0" Items="{Binding Source={x:Static repo:MasterRepository.DataTypes}}" DisplayMemberBinding="{Binding Label}" SelectedItem="{Binding Value.DataType}" Margin="2,0,0,3"/>
<ComboBox x:Name="cbDataType" Grid.Column="0" ItemsSource="{Binding Source={x:Static repo:MasterRepository.DataTypes}}" DisplayMemberBinding="{Binding Label}" SelectedItem="{Binding Value.DataType}" Margin="2,0,0,3"/>
<ContentPresenter x:Name="presenter" Grid.Column="1" Content="{Binding Value}" ContentTemplate="{Binding ElementName=cbDataType, Path=SelectedItem, Converter={StaticResource variantValueTemplateSelector}, ConverterParameter={StaticResource variantTemplateSelector}}"/>
</Grid>
</DataTemplate>
Expand All @@ -226,6 +238,7 @@
BoolTemplate="{StaticResource boolTemplate}"
StringTemplate="{StaticResource strTemplate}"
TlkTemplate="{StaticResource tlkTemplate}"
TlkMultilineTemplate="{StaticResource tlkMultilineTemplate}"
VariantTemplate="{StaticResource variantTemplate}"
RaceTemplate="{StaticResource raceTemplate}"
ClassTemplate="{StaticResource classTemplate}"
Expand All @@ -244,8 +257,10 @@
DiseaseTemplate="{StaticResource diseaseTemplate}"
PoisonTemplate="{StaticResource poisonTemplate}"
TrapTemplate="{StaticResource trapTemplate}"
SavingthrowTypeTemplate="{StaticResource savingthrowTypeTemplate}"
DamageTypeTemplate="{StaticResource damageTypeTemplate}"
DamageTypeGroupTemplate="{StaticResource damageTypeGroupTemplate}"
AmmunitionTemplate="{StaticResource ammunitionTemplate}"
BaseItemTemplate="{StaticResource baseItemTemplate}"
ProgrammedEffectTemplate="{StaticResource progFXTemplate}"
AppearanceSoundsetTemplate="{StaticResource appearanceSoundsetTemplate}"
Expand Down
12 changes: 12 additions & 0 deletions eos-edit/Assets/StyleResources.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,18 @@
<Setter Property="Margin" Value="2,0,0,3"/>
</Style>

<Style Selector="uc|SavingthrowTypeComboBox">
<Setter Property="Margin" Value="2,0,0,3"/>
</Style>

<Style Selector="uc|RangedDamageTypeComboBox">
<Setter Property="Margin" Value="2,0,0,3"/>
</Style>

<Style Selector="uc|AmmunitionComboBox">
<Setter Property="Margin" Value="2,0,0,3"/>
</Style>

<Style Selector="uc|DataTypeComboBox">
<Setter Property="Margin" Value="2,0,0,3"/>
</Style>
Expand Down
11 changes: 10 additions & 1 deletion eos-edit/Extensions/InstancePropertyValueTemplateSelector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class InstancePropertyValueTemplateSelector : IDataTemplate
public DataTemplate? BoolTemplate { get; set; }
public DataTemplate? StringTemplate { get; set; }
public DataTemplate? TlkTemplate { get; set; }
public DataTemplate? TlkMultilineTemplate { get; set; }
public DataTemplate? VariantTemplate { get; set; }
public DataTemplate? RaceTemplate { get; set; }
public DataTemplate? ClassTemplate { get; set; }
Expand All @@ -42,6 +43,8 @@ public class InstancePropertyValueTemplateSelector : IDataTemplate
public DataTemplate? DiseaseTemplate { get; set; }
public DataTemplate? PoisonTemplate { get; set; }
public DataTemplate? TrapTemplate { get; set; }
public DataTemplate? SavingthrowTypeTemplate { get; set; }
public DataTemplate? AmmunitionTemplate { get; set; }
public DataTemplate? BaseItemTemplate { get; set; }
public DataTemplate? ItemPropertyTemplate { get; set; }
public DataTemplate? AppearanceSoundsetTemplate { get; set; }
Expand Down Expand Up @@ -90,7 +93,9 @@ public bool Match(object? data)
if (dataTypeDef.Type == typeof(string))
return StringTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(TLKStringSet))
return TlkTemplate ?? ErrorTemplate;
return TlkTemplate ?? TlkMultilineTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(TLKStringSetMultiLine))
return TlkMultilineTemplate ?? TlkTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(VariantValue))
return VariantTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(Race))
Expand Down Expand Up @@ -147,6 +152,10 @@ public bool Match(object? data)
return DamageTypeTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(DamageTypeGroup))
return DamageTypeGroupTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(SavingthrowType))
return SavingthrowTypeTemplate ?? ErrorTemplate;
if (dataTypeDef.Type == typeof(Ammunition))
return AmmunitionTemplate ?? ErrorTemplate;

if (dataTypeDef.CustomType is CustomObject customObject)
return CustomObjectTemplate ?? ErrorTemplate;
Expand Down
39 changes: 39 additions & 0 deletions eos-edit/Usercontrols/AmmunitionComboBox.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<UserControl xmlns="https://github.com/avaloniaui"
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="using:Eos.Usercontrols"
xmlns:repo="using:Eos.Repositories"
xmlns:nwn="using:Eos.Nwn"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Eos.Usercontrols.AmmunitionComboBox"
x:Name="ucAmmunitionComboBox">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="/Assets/ConverterResources.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:AmmunitionComboBox}}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<Button x:Name="cbAmmunitions" Grid.Column="0" Click="btSearch_Click" HorizontalContentAlignment="Stretch" MinHeight="22">
<Button.Content>
<TextBlock Text="{Binding ElementName=ucAmmunitionComboBox, Path=SelectedValue.Name, Mode=OneWay}" Margin="3,0,0,0"/>
</Button.Content>
</Button>

<Button x:Name="btClear" Grid.Column="1" Content="🞪" Click="btClear_Click" Margin="2,0,0,0"
Height="{Binding ElementName=cbAmmunitions, Path=Bounds.Height}" Width="{Binding ElementName=cbAmmunitions, Path=Bounds.Height}"
IsVisible="{Binding ElementName=ucAmmunitionComboBox, Path=IsNullable}"/>
<!--<local:ResetIsEnabled >-->
<Button x:Name="btGoto" Grid.Column="2" Margin="2,0,0,0" Content="👁" Click="btGoto_Click" Height="{Binding ElementName=cbAmmunitions, Path=Bounds.Height}" Width="{Binding ElementName=cbAmmunitions, Path=Bounds.Height}"/>
<!--</local:ResetIsEnabled>-->
</Grid>
</UserControl>
53 changes: 53 additions & 0 deletions eos-edit/Usercontrols/AmmunitionComboBox.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Eos.Models;
using Eos.Repositories;
using Eos.Services;
using Eos.ViewModels.Base;
using Eos.ViewModels.Dialogs;
using System.Threading.Tasks;

namespace Eos.Usercontrols
{
public partial class AmmunitionComboBox : UserControl
{
public AmmunitionComboBox()
{
InitializeComponent();
}

public static readonly StyledProperty<Ammunition?> SelectedValueProperty = AvaloniaProperty.Register<AmmunitionComboBox, Ammunition?>("SelectedValue", null, false, Avalonia.Data.BindingMode.TwoWay);
public static readonly StyledProperty<bool> IsNullableProperty = AvaloniaProperty.Register<AmmunitionComboBox, bool>("IsNullable", true);

public Ammunition? SelectedValue
{
get { return GetValue(SelectedValueProperty); }
set { SetValue(SelectedValueProperty, value); }
}

public bool IsNullable
{
get { return GetValue(IsNullableProperty); }
set { SetValue(IsNullableProperty, value); }
}

private void btClear_Click(object sender, RoutedEventArgs e)
{
SetValue(SelectedValueProperty, null);
}

private void btSearch_Click(object sender, RoutedEventArgs e)
{
var viewModel = new AmmunitionSearchViewModel(MasterRepository.Ammunitions);
WindowService.OpenDialog(viewModel);
if (viewModel.ResultModel != null)
SetValue(SelectedValueProperty, viewModel.ResultModel);
}

private void btGoto_Click(object sender, RoutedEventArgs e)
{
MessageDispatcher.Send(MessageType.OpenDetail, SelectedValue, true);
}
}
}
39 changes: 39 additions & 0 deletions eos-edit/Usercontrols/RangedDamageTypeComboBox.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<UserControl xmlns="https://github.com/avaloniaui"
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="using:Eos.Usercontrols"
xmlns:repo="using:Eos.Repositories"
xmlns:nwn="using:Eos.Nwn"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Eos.Usercontrols.RangedDamageTypeComboBox"
x:Name="ucRangedDamageTypeComboBox">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceInclude Source="/Assets/ConverterResources.axaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:RangedDamageTypeComboBox}}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<Button x:Name="cbRangedDamageTypes" Grid.Column="0" Click="btSearch_Click" HorizontalContentAlignment="Stretch" MinHeight="22">
<Button.Content>
<TextBlock Text="{Binding ElementName=ucRangedDamageTypeComboBox, Path=SelectedValue.Name, Mode=OneWay}" Margin="3,0,0,0"/>
</Button.Content>
</Button>

<Button x:Name="btClear" Grid.Column="1" Content="🞪" Click="btClear_Click" Margin="2,0,0,0"
Height="{Binding ElementName=cbRangedDamageTypes, Path=Bounds.Height}" Width="{Binding ElementName=cbRangedDamageTypes, Path=Bounds.Height}"
IsVisible="{Binding ElementName=ucRangedDamageTypeComboBox, Path=IsNullable}"/>
<!--<local:ResetIsEnabled >-->
<Button x:Name="btGoto" Grid.Column="2" Margin="2,0,0,0" Content="👁" Click="btGoto_Click" Height="{Binding ElementName=cbRangedDamageTypes, Path=Bounds.Height}" Width="{Binding ElementName=cbRangedDamageTypes, Path=Bounds.Height}"/>
<!--</local:ResetIsEnabled>-->
</Grid>
</UserControl>
53 changes: 53 additions & 0 deletions eos-edit/Usercontrols/RangedDamageTypeComboBox.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Eos.Models;
using Eos.Repositories;
using Eos.Services;
using Eos.ViewModels.Base;
using Eos.ViewModels.Dialogs;
using System.Threading.Tasks;

namespace Eos.Usercontrols
{
public partial class RangedDamageTypeComboBox : UserControl
{
public RangedDamageTypeComboBox()
{
InitializeComponent();
}

public static readonly StyledProperty<RangedDamageType?> SelectedValueProperty = AvaloniaProperty.Register<RangedDamageTypeComboBox, RangedDamageType?>("SelectedValue", null, false, Avalonia.Data.BindingMode.TwoWay);
public static readonly StyledProperty<bool> IsNullableProperty = AvaloniaProperty.Register<RangedDamageTypeComboBox, bool>("IsNullable", true);

public RangedDamageType? SelectedValue
{
get { return GetValue(SelectedValueProperty); }
set { SetValue(SelectedValueProperty, value); }
}

public bool IsNullable
{
get { return GetValue(IsNullableProperty); }
set { SetValue(IsNullableProperty, value); }
}

private void btClear_Click(object sender, RoutedEventArgs e)
{
SetValue(SelectedValueProperty, null);
}

private void btSearch_Click(object sender, RoutedEventArgs e)
{
var viewModel = new RangedDamageTypeSearchViewModel(MasterRepository.RangedDamageTypes);
WindowService.OpenDialog(viewModel);
if (viewModel.ResultModel != null)
SetValue(SelectedValueProperty, viewModel.ResultModel);
}

private void btGoto_Click(object sender, RoutedEventArgs e)
{
MessageDispatcher.Send(MessageType.OpenDetail, SelectedValue, true);
}
}
}
Loading

0 comments on commit d27bd73

Please sign in to comment.