public Button CreateButton(GUIComponent parent, GameMaster.ToolMode mode, string name, string tooltip, int x, int y) { Button button = new Button(GUI, parent, name, GUI.SmallFont, Button.ButtonMode.ImageButton, new ImageFrame(Icons, IconSize, x, y)) { CanToggle = true, IsToggled = false, KeepAspectRatio = true, DontMakeBigger = true, ToolTip = tooltip, TextColor = Color.White, HoverTextColor = Color.Yellow, DrawFrame = true }; button.OnClicked += () => ButtonClicked(button); ToolButtons[mode] = button; return(button); }
public EmployeeClass(EmployeeClassDef definition) { Name = definition.Name; Levels = definition.Levels; Actions = new List <GameMaster.ToolMode>(); foreach (string s in definition.Actions) { GameMaster.ToolMode value = GameMaster.ToolMode.SelectUnits; if (Enum.TryParse(s, true, out value)) { Actions.Add(value); } } CompositeAnimation.Descriptor descriptor = FileUtils.LoadJsonFromString <CompositeAnimation.Descriptor>(ContentPaths.GetFileAsString(definition.Animations)); Animations = new List <Animation>(); Animations.AddRange(descriptor.GenerateAnimations(Name)); Attacks = definition.Attacks; }
public static List <CreatureAI> FilterMinionsWithCapability(List <CreatureAI> minions, GameMaster.ToolMode action) { return(minions.Where(creature => creature.Stats.CurrentClass.HasAction(action)).ToList()); }
public bool SelectedUnitsHaveCapability(GameMaster.ToolMode tool) { return(Master.Faction.SelectedMinions.Any(minion => minion.Stats.CurrentClass.HasAction(tool))); }
public bool HasAction(GameMaster.ToolMode action) { return(Actions != null && Actions.Contains(action)); }