Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/imchillin/Anamnesis
Browse files Browse the repository at this point in the history
  • Loading branch information
Peebs-miqo committed Nov 1, 2022
2 parents 4f61518 + 8aab2f6 commit 648c1b0
Show file tree
Hide file tree
Showing 8 changed files with 384 additions and 207 deletions.
39 changes: 39 additions & 0 deletions Anamnesis/Actor/Converters/NpcFaceWarningConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// © Anamnesis.
// Licensed under the MIT license.

namespace Anamnesis.Converters;

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using Anamnesis.Memory;

public class NpcFaceWarningConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length != 2)
throw new ArgumentException();

if (values[0] is ActorTypes type && values[1] is byte head)
{
if (type == ActorTypes.BattleNpc || type == ActorTypes.EventNpc)
return Visibility.Collapsed;

if (head > 5)
return Visibility.Visible;

return Visibility.Collapsed;
}
else
{
return Visibility.Collapsed;
}
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotSupportedException("NpcFaceWarningConverter is a OneWay converter.");
}
}
Loading

0 comments on commit 648c1b0

Please sign in to comment.