Пример #1
0
        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);
        }
Пример #2
0
        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;
        }
Пример #3
0
 public static List <CreatureAI> FilterMinionsWithCapability(List <CreatureAI> minions, GameMaster.ToolMode action)
 {
     return(minions.Where(creature => creature.Stats.CurrentClass.HasAction(action)).ToList());
 }
Пример #4
0
 public bool SelectedUnitsHaveCapability(GameMaster.ToolMode tool)
 {
     return(Master.Faction.SelectedMinions.Any(minion => minion.Stats.CurrentClass.HasAction(tool)));
 }
Пример #5
0
 public bool HasAction(GameMaster.ToolMode action)
 {
     return(Actions != null && Actions.Contains(action));
 }