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); } } } }
private void ExecuteCreatePlayerActor() { CreateActorWindowViewModel createActorWindowViewModel = new CreateActorWindowViewModel(); Model.PlayerActor playerActor = createActorWindowViewModel.GetPlayerActor(); if (playerActor != null) { ActorLibrary.AddActor(playerActor); } }
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); } } }
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(); }
public void LoadPlayerActor(Model.PlayerActor playerActor) { ActorName = playerActor.ActorName; InitiativeMod = Methods.GetSignedNumberString(playerActor.InitiativeMod); Weapons = playerActor.Weapons; }