예제 #1
0
 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();
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
 public void SetCharacterInformation(ICharacterInformation information)
 {
     this.Information = information;
 }
예제 #8
0
 public void SetCharacterInformation(ICharacterInformation information)
 {
     this.Information = information;
 }