예제 #1
0
 private void ExecuteEditActor(object actorObj)
 {
     if (actorObj is Model.Actor)
     {
         CreateActorWindowViewModel createActorWindowViewModel = new CreateActorWindowViewModel();
         if (actorObj is Model.PlayerActor)
         {
             createActorWindowViewModel.LoadPlayerActor(actorObj as Model.PlayerActor);
             Model.PlayerActor playerActor = createActorWindowViewModel.GetPlayerActor();
             if (playerActor != null)
             {
                 ActorLibrary.EditActor(actorObj as Model.PlayerActor, playerActor);
                 Encounter.UpdateActor(actorObj as Model.PlayerActor);
             }
         }
         else if (actorObj is Model.Creature)
         {
             createActorWindowViewModel.LoadCreature(actorObj as Model.Creature);
             Model.Creature creature = createActorWindowViewModel.GetCreature();
             if (creature != null)
             {
                 ActorLibrary.EditActor(actorObj as Model.Creature, creature);
             }
         }
     }
 }
예제 #2
0
        private void ExecuteCreatePlayerActor()
        {
            CreateActorWindowViewModel createActorWindowViewModel = new CreateActorWindowViewModel();

            Model.PlayerActor playerActor = createActorWindowViewModel.GetPlayerActor();
            if (playerActor != null)
            {
                ActorLibrary.AddActor(playerActor);
            }
        }
예제 #3
0
 private void ExecuteAddActorToEncounter(object actorObj)
 {
     if (actorObj is Model.Actor)
     {
         if (actorObj is Model.PlayerActor)
         {
             Model.PlayerActor playerActor = actorObj as Model.PlayerActor;
             Encounter.AddActor(playerActor, playerActor.ActorName);
         }
         else
         {
             Model.Actor actor            = actorObj as Model.Actor;
             string      defaultActorName = actor.ActorName + " " + (Encounter.GetNumberOfActorsWithName(actor.ActorName) + 1);
             Encounter.AddActor(actor, defaultActorName);
         }
     }
 }
예제 #4
0
        public Model.PlayerActor GetPlayerActor()
        {
            bool   askForInput = true;
            string feedback    = null;

            Model.PlayerActor playerActor = null;
            while (askForInput)
            {
                View.CreatePlayerActorWindow createActorWindow = new View.CreatePlayerActorWindow(feedback);
                createActorWindow.DataContext = this;
                if (createActorWindow.ShowDialog() == true)
                {
                    try
                    {
                        Model.ActorAttributes attributes = new Model.ActorAttributes
                        {
                            InitiativeMod = Convert.ToInt32(InitiativeMod),
                        };
                        playerActor = new Model.PlayerActor(attributes)
                        {
                            ActorName = ActorName,
                            Weapons   = Weapons,
                        };
                        askForInput = false;
                    }
                    catch (FormatException)
                    {
                        feedback = "Invalid format";
                    }
                }
                else
                {
                    askForInput = false;
                }
            }

            return(playerActor);
        }
 public override void ReadActorXML(XmlNode xmlNode)
 {
     Actor = new Model.PlayerActor(xmlNode);
 }
 public PlayerActorInitiativeViewModel(XmlNode playerXml)
 {
     _actor = new Model.PlayerActor(playerXml);
 }
 public PlayerActorInitiativeViewModel(Model.PlayerActor playerActor)
 {
     _actor = playerActor.Clone();
 }
예제 #8
0
 public void LoadPlayerActor(Model.PlayerActor playerActor)
 {
     ActorName     = playerActor.ActorName;
     InitiativeMod = Methods.GetSignedNumberString(playerActor.InitiativeMod);
     Weapons       = playerActor.Weapons;
 }