public override void ReadXML(XmlNode xmlNode, EncounterViewModel encounterViewModel)
        {
            base.ReadXML(xmlNode);

            if (encounterViewModel != null)
            {
                try
                {
                    foreach (XmlNode childNode in xmlNode.ChildNodes)
                    {
                        if (childNode.Name == "CreatureInitiativeViewModel")
                        {
                            ActorViewModel = new CreatureInitiativeViewModel(childNode, encounterViewModel);
                        }
                    }
                }
                catch (XmlException e)
                {
                    MessageBox.Show(e.ToString());
                }
            }
            else
            {
                throw new ArgumentException("EncounterViewModel is null!");
            }
        }
示例#2
0
        protected virtual void InitWeaponList(EncounterViewModel encounterViewModel)
        {
            encounterViewModel.OnWeaponListChange += OnWeaponListChange;
            _weaponList = encounterViewModel.WeaponList;

            encounterViewModel.OnInitiativeTrackChange += OnInitiativeTrackChange;
            if (encounterViewModel.InitiativeTrack.Count > 0)
            {
                _currentActorName = encounterViewModel.InitiativeTrack.First().ActorViewModel.ActorName;
            }
        }
示例#3
0
 public static ActorInitiativeViewModel GetActorViewModel(Model.Actor actor, EncounterViewModel encounterViewModel)
 {
     if (actor is Model.PlayerActor)
     {
         return(new PlayerActorInitiativeViewModel(actor as Model.PlayerActor));
     }
     else if (actor is Model.Creature)
     {
         return(new CreatureInitiativeViewModel(actor as Model.Creature, encounterViewModel));
     }
     else
     {
         throw new ArgumentException("Unknown type: " + actor.GetType().ToString());
     }
 }
示例#4
0
 public virtual void ReadXML(XmlNode xmlNode, EncounterViewModel encounterViewModel = null)
 {
     try
     {
         foreach (XmlNode childNode in xmlNode.ChildNodes)
         {
             if (childNode.Name == "InitiativeValue")
             {
                 InitiativeValueViewModel = new InitiativeValueViewModel(childNode);
             }
         }
     }
     catch (XmlException e)
     {
         MessageBox.Show(e.ToString());
     }
 }
 public override void ReadXML(XmlNode xmlNode, EncounterViewModel encounterViewModel = null)
 {
     base.ReadXML(xmlNode);
     try
     {
         foreach (XmlNode childNode in xmlNode.ChildNodes)
         {
             if (childNode.Name == "PlayerActorInitiativeViewModel")
             {
                 ActorViewModel = new PlayerActorInitiativeViewModel(childNode);
             }
         }
     }
     catch (XmlException e)
     {
         MessageBox.Show(e.ToString());
     }
 }
示例#6
0
        public MainViewModel()
        {
            _actorLibrary = new Model.ActorLibrary();
            _encounter    = new EncounterViewModel();

            _addActor          = new Command(ExecuteAddActorToEncounter);
            _editActor         = new Command(ExecuteEditActor);
            _loadActorLibrary  = new Command(ExecuteLoadActorLibrary);
            _saveActorLibrary  = new Command(ExecuteSaveActorLibrary);
            _exit              = new Command(ExecuteExit);
            _deleteCard        = new Command(ExecuteDeleteCard);
            _createPlayerActor = new Command(ExecuteCreatePlayerActor);
            _createCreature    = new Command(ExecuteCreateCreature);

            SaveTimer = new System.Threading.Timer(new TimerCallback(DoChangeRefresh), null, Timeout.Infinite, Timeout.Infinite);
            //			CreateTestData();

            _enemyFilter       = "";
            EnemiesCVS         = new CollectionViewSource();
            EnemiesCVS.Source  = ActorLibrary.Enemies;
            EnemiesCVS.Filter += ApplyFilter;
            EnemiesCVS.SortDescriptions.Add(new SortDescription("ActorName", ListSortDirection.Ascending));
            EnemiesCVS.IsLiveSortingRequested = true;
        }
 public static InitiativeCardViewModel GetInitiativeCardViewModel(XmlNode xmlNode, EncounterViewModel encounterViewModel)
 {
     if (xmlNode.Name == "CreatureCard")
     {
         return(new CreatureInitiativeCardViewModel(xmlNode, encounterViewModel));
     }
     else if (xmlNode.Name == "PlayerCard")
     {
         return(new PlayerActorInitiativeCardViewModel(xmlNode));
     }
     else
     {
         throw new ArgumentException("Unrecognised xml node: " + xmlNode.Name);
     }
 }
示例#8
0
 public CreatureInitiativeViewModel(XmlNode xmlNode, EncounterViewModel encounterViewModel)
 {
     ReadXML(xmlNode);
     InitWeaponList(encounterViewModel);
     InitCommands();
 }
示例#9
0
 public CreatureInitiativeViewModel(Model.Creature creature, EncounterViewModel encounterViewModel)
 {
     _actor = creature.Clone();
     InitWeaponList(encounterViewModel);
     InitCommands();
 }
 public CreatureInitiativeCardViewModel(XmlNode xmlNode, EncounterViewModel encounterViewModel)
 {
     ReadXML(xmlNode, encounterViewModel);
     InitCommands();
 }