Add DisableDropSound block type
This commit is contained in:
parent
738415f10a
commit
2c4096ff2c
|
@ -0,0 +1,23 @@
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
|
|
||||||
|
namespace Filtration.ObjectModel.BlockItemTypes
|
||||||
|
{
|
||||||
|
public sealed class DisableDropSoundBlockItem : BooleanBlockItem, IAudioVisualBlockItem
|
||||||
|
{
|
||||||
|
public DisableDropSoundBlockItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DisableDropSoundBlockItem(bool booleanValue) : base(booleanValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string PrefixText => "DisableDropSound";
|
||||||
|
public override string DisplayHeading => "Disable Drop Sound";
|
||||||
|
public override Color SummaryBackgroundColor => Colors.Transparent;
|
||||||
|
public override Color SummaryTextColor => Colors.Transparent;
|
||||||
|
public override int SortOrder => 27;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -61,6 +61,7 @@
|
||||||
<Compile Include="BlockItemTypes\BaseTypeBlockItem.cs" />
|
<Compile Include="BlockItemTypes\BaseTypeBlockItem.cs" />
|
||||||
<Compile Include="BlockItemTypes\BorderColorBlockItem.cs" />
|
<Compile Include="BlockItemTypes\BorderColorBlockItem.cs" />
|
||||||
<Compile Include="BlockItemTypes\ClassBlockItem.cs" />
|
<Compile Include="BlockItemTypes\ClassBlockItem.cs" />
|
||||||
|
<Compile Include="BlockItemTypes\DisableDropSoundBlockItem.cs" />
|
||||||
<Compile Include="BlockItemTypes\ElderMapBlockItem.cs" />
|
<Compile Include="BlockItemTypes\ElderMapBlockItem.cs" />
|
||||||
<Compile Include="BlockItemTypes\GemLevelBlockItem.cs" />
|
<Compile Include="BlockItemTypes\GemLevelBlockItem.cs" />
|
||||||
<Compile Include="BlockItemTypes\HasExplicitModBlockItem.cs" />
|
<Compile Include="BlockItemTypes\HasExplicitModBlockItem.cs" />
|
||||||
|
|
|
@ -874,7 +874,24 @@ namespace Filtration.Parser.Tests.Services
|
||||||
Assert.AreEqual("7", blockItem.Value);
|
Assert.AreEqual("7", blockItem.Value);
|
||||||
Assert.AreEqual(95, blockItem.SecondValue);
|
Assert.AreEqual(95, blockItem.SecondValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TranslateStringToItemFilterBlock_DisableDropSound_ReturnsCorrectObject()
|
||||||
|
{
|
||||||
|
// Arrange
|
||||||
|
var inputString = "Show" + Environment.NewLine +
|
||||||
|
" DisableDropSound True";
|
||||||
|
|
||||||
|
// Act
|
||||||
|
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
|
||||||
|
Assert.AreEqual(1, result.BlockItems.Count(b => b is DisableDropSoundBlockItem));
|
||||||
|
var blockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||||
|
Assert.IsTrue(blockItem.BooleanValue);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TranslateStringToItemFilterBlock_Everything_ReturnsCorrectObject()
|
public void TranslateStringToItemFilterBlock_Everything_ReturnsCorrectObject()
|
||||||
{
|
{
|
||||||
|
@ -907,7 +924,8 @@ namespace Filtration.Parser.Tests.Services
|
||||||
" SetBackgroundColor 255 100 5" + Environment.NewLine +
|
" SetBackgroundColor 255 100 5" + Environment.NewLine +
|
||||||
" SetBorderColor 0 0 0" + Environment.NewLine +
|
" SetBorderColor 0 0 0" + Environment.NewLine +
|
||||||
" SetFontSize 50" + Environment.NewLine +
|
" SetFontSize 50" + Environment.NewLine +
|
||||||
" PlayAlertSound 3" + Environment.NewLine;
|
" PlayAlertSound 3" + Environment.NewLine +
|
||||||
|
" DisableDropSound False" + Environment.NewLine;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
var result = _testUtility.Translator.TranslateStringToItemFilterBlock(inputString, _testUtility.MockItemFilterScript);
|
||||||
|
@ -1009,6 +1027,9 @@ namespace Filtration.Parser.Tests.Services
|
||||||
var soundblockItem = result.BlockItems.OfType<SoundBlockItem>().First();
|
var soundblockItem = result.BlockItems.OfType<SoundBlockItem>().First();
|
||||||
Assert.AreEqual("3", soundblockItem.Value);
|
Assert.AreEqual("3", soundblockItem.Value);
|
||||||
Assert.AreEqual(79, soundblockItem.SecondValue);
|
Assert.AreEqual(79, soundblockItem.SecondValue);
|
||||||
|
|
||||||
|
var disableDropSoundBlockItem = result.BlockItems.OfType<DisableDropSoundBlockItem>().First();
|
||||||
|
Assert.IsFalse(disableDropSoundBlockItem.BooleanValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -1861,7 +1882,8 @@ namespace Filtration.Parser.Tests.Services
|
||||||
" SetBackgroundColor 0 0 0" + Environment.NewLine +
|
" SetBackgroundColor 0 0 0" + Environment.NewLine +
|
||||||
" SetBorderColor 255 1 254" + Environment.NewLine +
|
" SetBorderColor 255 1 254" + Environment.NewLine +
|
||||||
" SetFontSize 50" + Environment.NewLine +
|
" SetFontSize 50" + Environment.NewLine +
|
||||||
" PlayAlertSound 6 90";
|
" PlayAlertSound 6 90" + Environment.NewLine +
|
||||||
|
" DisableDropSound True";
|
||||||
|
|
||||||
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
|
_testUtility.TestBlock.BlockItems.Add(new ActionBlockItem(BlockAction.Show));
|
||||||
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
|
_testUtility.TestBlock.BlockItems.Add(new IdentifiedBlockItem(true));
|
||||||
|
@ -1904,6 +1926,7 @@ namespace Filtration.Parser.Tests.Services
|
||||||
_testUtility.TestBlock.BlockItems.Add(new ShaperItemBlockItem(false));
|
_testUtility.TestBlock.BlockItems.Add(new ShaperItemBlockItem(false));
|
||||||
_testUtility.TestBlock.BlockItems.Add(new ShapedMapBlockItem(true));
|
_testUtility.TestBlock.BlockItems.Add(new ShapedMapBlockItem(true));
|
||||||
_testUtility.TestBlock.BlockItems.Add(new ElderMapBlockItem(true));
|
_testUtility.TestBlock.BlockItems.Add(new ElderMapBlockItem(true));
|
||||||
|
_testUtility.TestBlock.BlockItems.Add(new DisableDropSoundBlockItem(true));
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
var result = _testUtility.Translator.TranslateItemFilterBlockToString(_testUtility.TestBlock);
|
||||||
|
|
|
@ -286,6 +286,14 @@ namespace Filtration.Parser.Services
|
||||||
AddBooleanItemToBlockItems<ElderMapBlockItem>(block, trimmedLine);
|
AddBooleanItemToBlockItems<ElderMapBlockItem>(block, trimmedLine);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "DisableDropSound":
|
||||||
|
{
|
||||||
|
// Only ever use the last DisableDropSound item encountered as multiples aren't valid.
|
||||||
|
RemoveExistingBlockItemsOfType<DisableDropSoundBlockItem>(block);
|
||||||
|
|
||||||
|
AddBooleanItemToBlockItems<DisableDropSoundBlockItem>(block, trimmedLine);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,8 @@ namespace Filtration.ViewModels
|
||||||
typeof (BorderColorBlockItem),
|
typeof (BorderColorBlockItem),
|
||||||
typeof (FontSizeBlockItem),
|
typeof (FontSizeBlockItem),
|
||||||
typeof (SoundBlockItem),
|
typeof (SoundBlockItem),
|
||||||
typeof (PositionalSoundBlockItem)
|
typeof (PositionalSoundBlockItem),
|
||||||
|
typeof (DisableDropSoundBlockItem)
|
||||||
};
|
};
|
||||||
|
|
||||||
public bool BlockEnabled
|
public bool BlockEnabled
|
||||||
|
|
Loading…
Reference in New Issue