Add temporary block type for new type
This commit is contained in:
parent
780081263c
commit
c0e9c534de
|
@ -0,0 +1,35 @@
|
|||
using System.Windows.Media;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemBaseTypes
|
||||
{
|
||||
public abstract class StringBlockItem : BlockItemBase, IAudioVisualBlockItem
|
||||
{
|
||||
private string _value;
|
||||
|
||||
protected StringBlockItem()
|
||||
{
|
||||
}
|
||||
|
||||
protected StringBlockItem(string value)
|
||||
{
|
||||
Value = value;
|
||||
}
|
||||
|
||||
public override string OutputText => PrefixText + " " + Value;
|
||||
|
||||
public override string SummaryText => string.Empty;
|
||||
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||
public override Color SummaryTextColor => Colors.Transparent;
|
||||
|
||||
public string Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
_value = value;
|
||||
IsDirty = true;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
|
||||
namespace Filtration.ObjectModel.BlockItemTypes
|
||||
{
|
||||
public class IconBlockItem : StringBlockItem
|
||||
{
|
||||
public IconBlockItem()
|
||||
{
|
||||
Value = "Icon1";
|
||||
}
|
||||
|
||||
public IconBlockItem(string value) : base(value)
|
||||
{
|
||||
}
|
||||
|
||||
public override string PrefixText => "Icon";
|
||||
public override int MaximumAllowed => 1;
|
||||
public override string DisplayHeading => "Drop Icon";
|
||||
public override int SortOrder => 28;
|
||||
}
|
||||
}
|
|
@ -53,6 +53,7 @@
|
|||
<Compile Include="BlockItemBaseTypes\BooleanBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\ColorBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\DualIntegerBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\StringBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\StringIntBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\IntegerBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\NumericFilterPredicateBlockItem.cs" />
|
||||
|
@ -65,6 +66,7 @@
|
|||
<Compile Include="BlockItemTypes\ElderMapBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\GemLevelBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\HasExplicitModBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\IconBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ShapedMapBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ShaperItemBlockItem.cs" />
|
||||
<Compile Include="BlockItemTypes\ElderItemBlockItem.cs" />
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace Filtration.ObjectModel
|
|||
Color DisplayTextColor { get; }
|
||||
Color DisplayBorderColor { get; }
|
||||
double DisplayFontSize { get; }
|
||||
string DisplayIcon { get; }
|
||||
bool HasBlockItemOfType<T>();
|
||||
bool HasBlockGroupInParentHierarchy(ItemFilterBlockGroup targetBlockGroup, ItemFilterBlockGroup startingBlockGroup);
|
||||
}
|
||||
|
@ -260,5 +261,14 @@ namespace Filtration.ObjectModel
|
|||
return fontSizeBlockItem?.Value ?? 34;
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
var displayIcon = BlockItems.OfType<IconBlockItem>().FirstOrDefault();
|
||||
return (displayIcon != null) ? displayIcon.Value : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -892,6 +892,23 @@ namespace Filtration.Parser.Tests.Services
|
|||
Assert.IsTrue(blockItem.BooleanValue);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_DropIcon_ReturnsCorrectObject()
|
||||
{
|
||||
// Arrange
|
||||
var inputString = "Show" + Environment.NewLine +
|
||||
" Icon Icon1";
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
||||
// Assert
|
||||
|
||||
Assert.AreEqual(1, result.BlockItems.Count(b => b is IconBlockItem));
|
||||
var blockItem = result.BlockItems.OfType<IconBlockItem>().First();
|
||||
Assert.AreEqual("Icon1", blockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateStringToItemFilterBlock_Everything_ReturnsCorrectObject()
|
||||
{
|
||||
|
@ -925,7 +942,8 @@ namespace Filtration.Parser.Tests.Services
|
|||
" SetBorderColor 0 0 0" + Environment.NewLine +
|
||||
" SetFontSize 50" + Environment.NewLine +
|
||||
" PlayAlertSound 3" + Environment.NewLine +
|
||||
" DisableDropSound False" + Environment.NewLine;
|
||||
" DisableDropSound False" + Environment.NewLine +
|
||||
" Icon Icon2" + Environment.NewLine;
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||
|
@ -1030,6 +1048,9 @@ namespace Filtration.Parser.Tests.Services
|
|||
|
||||
var disableDropSoundBlockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||
Assert.IsFalse(disableDropSoundBlockItem.BooleanValue);
|
||||
|
||||
var iconBlockItem = result.BlockItems.OfType<IconBlockItem>().First();
|
||||
Assert.AreEqual("Icon2", iconBlockItem.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1856,6 +1877,22 @@ namespace Filtration.Parser.Tests.Services
|
|||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_DropIcon_ReturnsCorrectString()
|
||||
{
|
||||
// Arrange
|
||||
var expectedResult = "Show" + Environment.NewLine +
|
||||
" Icon Icon3";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new IconBlockItem("Icon3"));
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TranslateItemFilterBlockToString_Everything_ReturnsCorrectString()
|
||||
{
|
||||
|
@ -1887,7 +1924,8 @@ namespace Filtration.Parser.Tests.Services
|
|||
" SetBorderColor 255 1 254" + Environment.NewLine +
|
||||
" SetFontSize 50" + Environment.NewLine +
|
||||
" PlayAlertSound 6 90" + Environment.NewLine +
|
||||
" DisableDropSound True";
|
||||
" DisableDropSound True" + Environment.NewLine +
|
||||
" Icon Icon4";
|
||||
|
||||
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
|
||||
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
|
||||
|
@ -1931,6 +1969,7 @@ namespace Filtration.Parser.Tests.Services
|
|||
_testUtility.TestBlock.BlockItems.Add(new ShapedMapBlockItem(true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new ElderMapBlockItem(true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new DisableDropSoundBlockItem(true));
|
||||
_testUtility.TestBlock.BlockItems.Add(new IconBlockItem("Icon4"));
|
||||
|
||||
// Act
|
||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||
|
|
|
@ -297,6 +297,23 @@ namespace Filtration.Parser.Services
|
|||
AddBooleanItemToBlockItems<DisableDropSoundBlockItem>(block, trimmedLine);
|
||||
break;
|
||||
}
|
||||
case "Icon":
|
||||
{
|
||||
// Only ever use the last PlayAlertSound item encountered as multiples aren't valid.
|
||||
RemoveExistingBlockItemsOfType<IconBlockItem>(block);
|
||||
|
||||
var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)");
|
||||
|
||||
if (match.Success)
|
||||
{
|
||||
var blockItemValue = new IconBlockItem
|
||||
{
|
||||
Value = match.Groups[1].Value,
|
||||
};
|
||||
block.BlockItems.Add(blockItemValue);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Filtration.Converters
|
||||
{
|
||||
internal class DropIconConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
var iconString = (string)value;
|
||||
switch(iconString)
|
||||
{
|
||||
case "Icon1":
|
||||
return "/Filtration;component/Resources/DropIcons/Icon1.png";
|
||||
case "Icon2":
|
||||
return "/Filtration;component/Resources/DropIcons/Icon2.png";
|
||||
case "Icon3":
|
||||
return "/Filtration;component/Resources/DropIcons/Icon3.png";
|
||||
case "Icon4":
|
||||
return "/Filtration;component/Resources/DropIcons/Icon4.png";
|
||||
case "Icon5":
|
||||
return "/Filtration;component/Resources/DropIcons/Icon5.png";
|
||||
case "Icon6":
|
||||
return "/Filtration;component/Resources/DropIcons/Icon6.png";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -167,6 +167,7 @@
|
|||
<Compile Include="Converters\BooleanToBlockActionInverseConverter.cs" />
|
||||
<Compile Include="Converters\BooleanToBlockActionConverter.cs" />
|
||||
<Compile Include="Converters\BlockItemToRemoveEnabledVisibilityConverter.cs" />
|
||||
<Compile Include="Converters\DropIconConverter.cs" />
|
||||
<Compile Include="Converters\HashSignRemovalConverter.cs" />
|
||||
<Compile Include="Converters\ItemRarityConverter.cs" />
|
||||
<Compile Include="Converters\TreeViewMarginConverter.cs" />
|
||||
|
@ -190,6 +191,9 @@
|
|||
<Compile Include="UserControls\EditableListBoxControl.xaml.cs">
|
||||
<DependentUpon>EditableListBoxControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\ImageComboBoxControl.xaml.cs">
|
||||
<DependentUpon>ImageComboBoxControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserControls\ItemPreviewControl.xaml.cs">
|
||||
<DependentUpon>ItemPreviewControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -230,6 +234,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\ImageComboBoxControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UserControls\ThemeComponentSelectionControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -538,6 +546,12 @@
|
|||
</None>
|
||||
<Resource Include="Resources\Icons\redo_icon.png" />
|
||||
<Resource Include="Resources\Icons\undo_icon.png" />
|
||||
<Resource Include="Resources\DropIcons\Icon1.png" />
|
||||
<Resource Include="Resources\DropIcons\Icon2.png" />
|
||||
<Resource Include="Resources\DropIcons\Icon3.png" />
|
||||
<Resource Include="Resources\DropIcons\Icon4.png" />
|
||||
<Resource Include="Resources\DropIcons\Icon5.png" />
|
||||
<Resource Include="Resources\DropIcons\Icon6.png" />
|
||||
<Content Include="Resources\ItemBaseTypes.txt" />
|
||||
<Content Include="Resources\ItemClasses.txt" />
|
||||
</ItemGroup>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
|
@ -131,6 +131,13 @@
|
|||
<xctk:ShortUpDown Value="{Binding Path=SecondValue}" Minimum="1" Maximum="300" HorizontalAlignment="Right" ToolTip="Volume"/>
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<!-- Drop Icon Template -->
|
||||
<DataTemplate DataType="{x:Type blockItemTypes:IconBlockItem}">
|
||||
<WrapPanel HorizontalAlignment="Left">
|
||||
<userControls:ImageComboBoxControl/>
|
||||
</WrapPanel>
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
|
|
|
@ -88,6 +88,10 @@ namespace Filtration.UserControls
|
|||
"ShFusing", "ShRegal", "ShVaal"
|
||||
};
|
||||
|
||||
public List<string> IconsAvailable => new List<string> {
|
||||
"Icon1", "Icon2", "Icon3", "Icon4", "Icon5", "Icon6"
|
||||
};
|
||||
|
||||
private void OnSetBlockColorCommmand()
|
||||
{
|
||||
var blockItem = BlockItem as ColorBlockItem;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Filtration.UserControls"
|
||||
xmlns:Converters="clr-namespace:Filtration.Converters" x:Class="Filtration.UserControls.ImageComboBoxControl"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<Converters:DropIconConverter x:Key="DropIconConverter"/>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<ComboBox ItemsSource="{Binding DataContext.IconsAvailable, ElementName=BlockItemContentControl}" SelectedValue="{Binding Value}" Style="{StaticResource MetroComboBox}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image MaxWidth="20" MaxHeight="20" Source="{Binding Converter={StaticResource DropIconConverter}, Mode=OneWay}" />
|
||||
<Label Content="{Binding}" VerticalAlignment="Stretch"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</UserControl>
|
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
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.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Filtration.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ImageComboBoxControl.xaml
|
||||
/// </summary>
|
||||
public partial class ImageComboBoxControl : UserControl
|
||||
{
|
||||
public ImageComboBoxControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -174,7 +174,8 @@ namespace Filtration.ViewModels
|
|||
typeof (FontSizeBlockItem),
|
||||
typeof (SoundBlockItem),
|
||||
typeof (PositionalSoundBlockItem),
|
||||
typeof (DisableDropSoundBlockItem)
|
||||
typeof (DisableDropSoundBlockItem),
|
||||
typeof (IconBlockItem)
|
||||
};
|
||||
|
||||
public bool BlockEnabled
|
||||
|
@ -214,6 +215,7 @@ namespace Filtration.ViewModels
|
|||
public Color DisplayBackgroundColor => Block.DisplayBackgroundColor;
|
||||
public Color DisplayBorderColor => Block.DisplayBorderColor;
|
||||
public double DisplayFontSize => Block.DisplayFontSize/1.8;
|
||||
public string DisplayIcon => Block.DisplayIcon;
|
||||
|
||||
public bool HasSound => Block.HasBlockItemOfType<SoundBlockItem>();
|
||||
public bool HasPositionalSound => Block.HasBlockItemOfType<PositionalSoundBlockItem>();
|
||||
|
@ -437,6 +439,7 @@ namespace Filtration.ViewModels
|
|||
RaisePropertyChanged(nameof(DisplayBackgroundColor));
|
||||
RaisePropertyChanged(nameof(DisplayBorderColor));
|
||||
RaisePropertyChanged(nameof(DisplayFontSize));
|
||||
RaisePropertyChanged(nameof(DisplayIcon));
|
||||
RaisePropertyChanged(nameof(HasSound));
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
<ResourceDictionary>
|
||||
<views:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
<converters:BlockGroupAdvancedFillColorConverter x:Key="BlockGroupAdvancedFillColorConverter" />
|
||||
<converters:DropIconConverter x:Key="DropIconConverter"/>
|
||||
<Style TargetType="{x:Type ContentPresenter}" x:Key="BlockItemFadeInStyle">
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
|
@ -94,6 +95,7 @@
|
|||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- BlockItems Summary Panel -->
|
||||
<StackPanel Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">
|
||||
|
@ -129,6 +131,7 @@
|
|||
|
||||
<!-- Item Preview Box -->
|
||||
<WrapPanel Grid.Row="0" Grid.Column="2" VerticalAlignment="Center">
|
||||
<Image Source="{Binding DisplayIcon, Converter={StaticResource DropIconConverter}, Mode=OneWay}" Width="30" Height="30" />
|
||||
<Button Command="{Binding PlaySoundCommand}"
|
||||
Width="25"
|
||||
Height="25"
|
||||
|
|
Loading…
Reference in New Issue