public void AlignFacingWith(ManagedCharacter character) { Vector3 leaderFacingVector = character.Position.FacingVector; Vector3 distantPointInSameDirection = character.Position.Vector + leaderFacingVector * 500; (this.Position as Position).Face(distantPointInSameDirection); }
private void ShowActivateGangWidgetPopup(List <ManagedCharacter> gangMembers) { ManagedCharacter gangLeader = gangMembers.FirstOrDefault(gm => gm.IsGangLeader); OpenActivateCharacterWidgetPopup(gangLeader); this.eventAggregator.PublishOnUIThread(new ShowActivateGangWidgetEvent(gangMembers)); }
protected CharacterActionImpl(ManagedCharacter owner, string name, KeyBindCommandGenerator generator, string shortcut) { Name = name; Owner = owner; Generator = generator; KeyboardShortcut = shortcut; }
private void ShowActivateCharacterWidgetPopup(ManagedCharacter character, string optionGroupName, string optionName) { if (character != null && character.IsActive) { OpenActivateCharacterWidgetPopup(character); this.eventAggregator.PublishOnUIThread(new ShowActivateCharacterWidgetEvent(character, optionGroupName, optionName)); } else if ((character != null && !character.IsActive) && popupService.IsOpen("ActiveCharacterWidgetView")) { this.CloseActiveCharacterWidgetPopup(character); } }
public void CopyIdentitiesTo(ManagedCharacter targetCharacter) { foreach (var id in this.Identities.Where(i => i.Name != this.Name)) { Identity identity = id.Clone() as Identity; identity.Name = targetCharacter.GetNewValidIdentityName(identity.Name); if (identity.AnimationOnLoad != null) { identity.AnimationOnLoad.Owner = targetCharacter; } targetCharacter.Identities.InsertAction(identity); } }
private void OpenActivateCharacterWidgetPopup(ManagedCharacter activatedCharacter) { if (!popupService.IsOpen("ActiveCharacterWidgetView")) { System.Windows.Style style = ControlUtilities.GetCustomWindowStyle(); double minwidth = 80; style.Setters.Add(new Setter(Window.MinWidthProperty, minwidth)); var desktopWorkingArea = System.Windows.SystemParameters.WorkArea; double left = desktopWorkingArea.Right - 500; double top = desktopWorkingArea.Bottom - 80 * activatedCharacter.CharacterActionGroups.Count; object savedPos = popupService.GetPosition("ActiveCharacterWidgetView", activatedCharacter.Name); if (savedPos != null) { double[] posArray = (double[])savedPos; left = posArray[0]; top = posArray[1]; } style.Setters.Add(new Setter(Window.LeftProperty, left)); style.Setters.Add(new Setter(Window.TopProperty, top)); popupService.ShowDialog("ActiveCharacterWidgetView", ActiveCharacterWidgetViewModel, "", false, null, new SolidColorBrush(Colors.Transparent), style, WindowStartupLocation.Manual); ActivateWindow(ActiveWindow.ACTIVE_CHARACTER); } }
private void CloseActiveCharacterWidgetPopup(ManagedCharacter character) { popupService.SavePosition("ActiveCharacterWidgetView", character != null ? character.Name : null); popupService.CloseDialog("ActiveCharacterWidgetView"); ActivateAnotherWindowAfterCollapsingCurrentOne(ActiveWindow.ACTIVE_CHARACTER); }
private void LoadActivatedCharacter(ManagedCharacter activatedCharacter, string actionGroupName, string actionName) { this.UnloadPreviousActivatedCharacter(); this.ActiveCharacter = activatedCharacter; if (activatedCharacter != null) { (activatedCharacter as AnimatedAbility.AnimatedCharacter)?.LoadDefaultAbilities(); if(this.CharacterActionGroups != null) { foreach (var actionGroupVM in this.CharacterActionGroups) actionGroupVM.UnregisterKeyEventHandlers(); } this.CharacterActionGroups = new ObservableCollection<CharacterActionGroupViewModel>(); foreach (CharacterActionGroup group in activatedCharacter.CharacterActionGroups) { bool loadedOptionExists = group.Name == actionGroupName; bool showActionsInGroup = false; //if (character.OptionGroupExpansionStates.ContainsKey(group.Name)) // showOptionsInGroup = character.OptionGroupExpansionStates[group.Name]; switch (group.Type) { case CharacterActionType.Ability: var abilityActionGroupViewModel = IoC.Get<CharacterActionGroupViewModelImpl<AnimatedAbility.AnimatedAbility>>(); abilityActionGroupViewModel.ActionGroup = group; abilityActionGroupViewModel.ShowActions = showActionsInGroup; abilityActionGroupViewModel.IsReadOnly = true; abilityActionGroupViewModel.LoadedActionName = loadedOptionExists ? actionName : ""; this.CharacterActionGroups.Add(abilityActionGroupViewModel); break; case CharacterActionType.Identity: var identityActionGroupViewModel = IoC.Get<CharacterActionGroupViewModelImpl<Identity>>(); identityActionGroupViewModel.ActionGroup = group; identityActionGroupViewModel.ShowActions = showActionsInGroup; identityActionGroupViewModel.IsReadOnly = true; identityActionGroupViewModel.LoadedActionName = loadedOptionExists ? actionName : ""; this.CharacterActionGroups.Add(identityActionGroupViewModel); break; case CharacterActionType.Movement: var movementActionGroupViewModel = IoC.Get<CharacterActionGroupViewModelImpl<CharacterMovement>>(); movementActionGroupViewModel.ActionGroup = group; movementActionGroupViewModel.ShowActions = showActionsInGroup; movementActionGroupViewModel.IsReadOnly = true; movementActionGroupViewModel.LoadedActionName = loadedOptionExists ? actionName : ""; this.CharacterActionGroups.Add(movementActionGroupViewModel); break; case CharacterActionType.Mixed: var mixedActionGroupViewModel = IoC.Get<CharacterActionGroupViewModelImpl<CharacterAction>>(); mixedActionGroupViewModel.ActionGroup = group; mixedActionGroupViewModel.ShowActions = showActionsInGroup; mixedActionGroupViewModel.IsReadOnly = true; mixedActionGroupViewModel.LoadedActionName = loadedOptionExists ? actionName : ""; this.CharacterActionGroups.Add(mixedActionGroupViewModel); break; } } this.ActiveCharacter = activatedCharacter; } }
public void Handle(ShowActivateGangWidgetEvent message) { ManagedCharacter gangLeader = message.ActivatedGangMembers.FirstOrDefault(gm => gm.IsGangLeader); LoadActivatedCharacter(gangLeader, null, null); }
public IdentityImpl(ManagedCharacter owner, string name, string surface, SurfaceType type, KeyBindCommandGenerator generator, string shortcut) : base(owner, name, generator, shortcut) { Type = type; Surface = surface; }
public DeactivateGangEvent(ManagedCharacter deactivatedGangLeader) { this.DeactivatedGangLeader = deactivatedGangLeader; }
public DeActivateCharacterEvent(ManagedCharacter character) { this.DeActivatedCharacter = character; }
public ActivateCharacterEvent(ManagedCharacter character, string selectedActionGroupName, string selectedActionName) { this.ActivatedCharacter = character; this.SelectedActionGroupName = selectedActionGroupName; this.SelectedActionName = selectedActionName; }
public ObservableCollection <CharacterActionGroup> GetStandardCharacterActionGroup(ManagedCharacter character) { var actionGroup = new ObservableCollection <CharacterActionGroup>(); var identitiesGroup = new CharacterActionListImpl <Identity>(CharacterActionType.Identity, character.Generator, character); identitiesGroup.Name = "Identities"; //Identity newId = identitiesGroup.AddNew(new IdentityImpl()) as Identity; IdentityImpl newId = new IdentityImpl(); newId.Owner = null; newId.Name = "Identity"; newId.Type = SurfaceType.Costume; newId.Surface = "Identity"; newId.Generator = character.Generator; identitiesGroup.AddNew(newId); identitiesGroup.Active = newId; actionGroup.Add(identitiesGroup); var abilitiesGroup = new CharacterActionListImpl <AnimatedAbility.AnimatedAbility>(CharacterActionType.Ability, character.Generator, character); abilitiesGroup.Name = "Powers"; actionGroup.Add(abilitiesGroup); var movementsGroup = new CharacterActionListImpl <CharacterMovement>(CharacterActionType.Movement, character.Generator, character); movementsGroup.Name = "Movements"; actionGroup.Add(movementsGroup); return(actionGroup); }