forked from HearthSim/Hearthstone-Deck-Tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEntityControl.xaml.cs
46 lines (40 loc) · 1.21 KB
/
EntityControl.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using HearthDb.Enums;
using Hearthstone_Deck_Tracker.Hearthstone.Entities;
using Hearthstone_Deck_Tracker.Utility;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
namespace Hearthstone_Deck_Tracker.Controls
{
public partial class EntityControl : UserControl
{
public EntityControl(Entity entity)
{
InitializeComponent();
DataContext = entity;
Card = (Hearthstone.Card)entity.Card.Clone();
Card.BaconCard = true;
}
public Entity Entity => (Entity)DataContext;
public Dictionary<GameTag, string> RelevantTags = new Dictionary<GameTag, string>()
{
[GameTag.TAUNT] = LocUtil.Get("GameTag_Taunt"),
[GameTag.DIVINE_SHIELD] = LocUtil.Get("GameTag_DivineShield"),
[GameTag.POISONOUS] = LocUtil.Get("GameTag_Poisonous"),
[GameTag.WINDFURY] = LocUtil.Get("GameTag_Windfury"),
[GameTag.DEATHRATTLE] = LocUtil.Get("GameTag_Deathrattle")
};
public string Effects
{
get
{
if(Entity == null)
return null;
var tags = RelevantTags.Keys.Where(x => Entity.HasTag(x)).Select(x => RelevantTags[x]);
return string.Join(", ", tags);
}
}
public int Health => Entity?.GetTag(GameTag.HEALTH) ?? 0;
public Hearthstone.Card Card { get; }
}
}