public MainWindowViewModel(IEnumerable <ISpell> spells = null, ICharacterInformation character = null, ISpellTemplate template = null) { SelectedFont = AvailableFonts[0]; ShowGrid = true; _characterInformation = character; Spells = spells; _template = template; if (Spells != null && Spells.Any() && CharacterInformation != null) { SelectedSpell = Spells.FirstOrDefault(); } }
public IBlock Apply(ISpell spell, ICharacterInformation info) { var root = new Block("RootBlock"); root.Children.Add(RenderEigenschaften(info)); root.Children.Add(RenderSpellName(spell.Name)); root.Children.Add(RenderProbe(spell, info)); root.Children.Add(RenderZfW(spell.ZfW)); root.Children.Add(RenderZauberdauer(spell)); root.Children.Add(RenderReichweite(spell)); return(root); }
public MainWindow() { InitializeComponent(); ICharacterImporter cimport = new CharacterImporter(); ICharacterInformation ci = cimport.Import("character.json"); ISpellsImporter simport = new SpellsImporter(); IEnumerable <ISpell> spells = simport.Import("spells.json"); var vm = new MainWindowViewModel(spells, ci, new SpellTemplate()); DataContext = vm; //Preview.Render(vm.Renderable); }
private IRenderable RenderProbe(ISpell spell, ICharacterInformation info) { IBlock b = new Block("ProbeBlock"); string probe = string.Format("{0}/{1}/{2}", spell.Probe1.ToString(), spell.Probe2.ToString(), spell.Probe3.ToString()); b.Children.Add(new Text(7, AvailableColumns - 4, 4, 1, probe, TextStyle.Label)); string probenWerte = string.Format("{0}/{1}/{2}{3}{4}", info.GetEigenschaft(spell.Probe1), info.GetEigenschaft(spell.Probe2), info.GetEigenschaft(spell.Probe3), spell.ZfW > 0 ? "+" : "-", spell.ZfW); b.Children.Add(new Text(8, AvailableColumns - 4, 4, 1, probenWerte, TextStyle.Default)); return(b); }
private Block RenderEigenschaften(ICharacterInformation character) { var block = new Block("EigenschaftenBlock"); int columnOffset = 0; int width = 3; foreach (Eigenschaft e in Enum.GetValues(typeof(Eigenschaft))) { var eigenschaftsBlock = new Block(string.Format("Eigenschaft{0}Block", e.ToString())); var label = new Text(54, 6 + columnOffset, width, 1, e.ToString(), TextStyle.Label); var text = new Text(55, 6 + columnOffset, width, 1, character.GetEigenschaft(e).ToString(), TextStyle.Default); eigenschaftsBlock.Children.Add(label); eigenschaftsBlock.Children.Add(text); block.Children.Add(eigenschaftsBlock); columnOffset += width; } return(block); }
public void TestImport() { string path = TestContext.CurrentContext.TestDirectory + "/TestFiles/character.json"; ICharacterImporter sut = new CharacterImporter(); ICharacterInformation info = sut.Import(path); Assert.NotNull(info); Assert.AreEqual("Husein", info.Name); Assert.AreEqual(14, info.Mut); Assert.AreEqual(13, info.Klugheit); Assert.AreEqual(12, info.Charisma); Assert.AreEqual(11, info.Intuition); Assert.AreEqual(10, info.Konstitution); Assert.AreEqual(9, info.Körperkraft); Assert.AreEqual(8, info.Gewandheit); Assert.AreEqual(15, info.Fingerfertigkeit); Assert.AreEqual(52, info.Astralenergie); Assert.AreEqual(9, info.Magieresistenz); Assert.AreEqual(4, info.Selbstbeherrschung); }
public void SetCharacterInformation(ICharacterInformation information) { this.Information = information; }