static void AddSpellShortcutsFor(Character player, KnownSpell knownSpell) { List <PlayerActionShortcut> lastShortcuts = null; List <ItemEffect> spellEffects = AllSpellEffects.GetAll(knownSpell.SpellName).OrderBy(x => x.index).ToList(); if (spellEffects.Count == 0) { lastShortcuts = PlayerActionShortcut.FromItemSpellEffect(knownSpell.SpellName, null, player); } else { for (int i = 0; i < spellEffects.Count; i++) { ItemEffect itemEffect = spellEffects[i]; if (i == 0) { lastShortcuts = PlayerActionShortcut.FromItemSpellEffect(knownSpell.SpellName, itemEffect, player); } else { foreach (PlayerActionShortcut playerActionShortcut in lastShortcuts) { playerActionShortcut.Windups.Add(WindupDto.FromItemEffect(itemEffect, playerActionShortcut.Name)); } } } } if (lastShortcuts != null) { AllShortcuts.AddRange(lastShortcuts); } }
static void AddWeaponShortcutsFor(Character player, CarriedWeapon carriedWeapon) { List <PlayerActionShortcut> lastShortcuts = null; List <ItemEffect> weaponEffects = AllWeaponEffects.GetAll(carriedWeapon.Weapon.Name).OrderBy(x => x.index).ToList();; if (weaponEffects.Count == 0) { lastShortcuts = PlayerActionShortcut.FromWeapon(carriedWeapon, null, player); } else { for (int i = 0; i < weaponEffects.Count; i++) { ItemEffect itemEffect = weaponEffects[i]; if (i == 0) { lastShortcuts = PlayerActionShortcut.FromWeapon(carriedWeapon, itemEffect, player); } else { foreach (PlayerActionShortcut playerActionShortcut in lastShortcuts) { playerActionShortcut.Windups.Add(WindupDto.FromItemEffect(itemEffect, PlayerActionShortcut.WeaponWindupPrefix + playerActionShortcut.Name)); } } } } if (lastShortcuts != null) { AllShortcuts.AddRange(lastShortcuts); } }
static void AddFeatureShortcutsFor(Character player, Feature feature) { PlayerActionShortcut shortcut = PlayerActionShortcut.FromFeature(feature, player, ActivationShortcutKind.Activate); AllShortcuts.Add(shortcut); shortcut = PlayerActionShortcut.FromFeature(feature, player, ActivationShortcutKind.Deactivate); if (shortcut != null) { AllShortcuts.Add(shortcut); } }
private void UserSerialPortPreferencesControl_Loaded(object sender, RoutedEventArgs e) { int selectedIndex = 0; ShortcutIdComboBox.Items.Add(new ComboBoxItem() { Content = "Based on device", Tag = "", }); AllShortcuts.Init(); foreach (var item in AllShortcuts.All) { ShortcutIdComboBox.Items.Add(new ComboBoxItem() { Content = item.Name, Tag = item.Id, }); if (item.Id == SerialPortPreferences.ShortcutId) { selectedIndex = ShortcutIdComboBox.Items.Count - 1; // e.g. item[1] has count of 2 ([0] and [1]) } } ShortcutIdComboBox.SelectedIndex = selectedIndex; }
public static List <PlayerActionShortcut> Get(int playerId, string nameStart) { string lowerName = nameStart.ToLower(); return(AllShortcuts.Where(x => x.PlayerId == playerId).Where(x => x.Name.ToLower().StartsWith(lowerName)).ToList()); }
public static List <PlayerActionShortcut> Get(int playerId, TurnPart part) { return(AllShortcuts.Where(x => x.PlayerId == playerId).Where(x => x.Part == part).ToList()); }
static void AddFeatureShortcutsFor(Character player, Feature feature) { PlayerActionShortcut shortcut = PlayerActionShortcut.FromFeature(feature, player); AllShortcuts.Add(shortcut); }