Пример #1
0
        public AIDebugger(DwarfGUI gui, GameMaster master)
        {
            MainPanel = new Panel(gui, gui.RootComponent);
            Layout = new GridLayout(gui, MainPanel, 13, 1);

            DwarfSelector = new ComboBox(gui, Layout);
            DwarfSelector.OnSelectionModified += DwarfSelector_OnSelectionModified;
            GoalLabel = new Label(gui, Layout, "Script: null", gui.DefaultFont);
            PlanLabel = new Label(gui, Layout, "Plan: null", gui.DefaultFont);
            AStarPathLabel = new Label(gui, Layout, "Astar Path: null", gui.DefaultFont);
            LastMessages = new Label(gui, Layout, "Messages: ", gui.DefaultFont);
            ScrollView btDisplayHolder = new ScrollView(gui, Layout);
            BTDisplay = new ActDisplay(gui, btDisplayHolder);

            Layout.SetComponentPosition(DwarfSelector, 0, 0, 1, 1);
            Layout.SetComponentPosition(GoalLabel, 0, 1, 1, 1);
            Layout.SetComponentPosition(PlanLabel, 0, 2, 1, 1);
            Layout.SetComponentPosition(AStarPathLabel, 0, 3, 1, 1);
            Layout.SetComponentPosition(LastMessages, 0, 4, 1, 2);
            Layout.SetComponentPosition(btDisplayHolder, 0, 6, 1, 6);
            Visible = false;

            int i = 0;
            foreach(CreatureAI component in master.Faction.Minions)
            {
                DwarfSelector.AddValue("Minion " + i);
                i++;
            }

            Master = master;

            MainPanel.LocalBounds = new Rectangle(100, 120, 500, 600);
        }
Пример #2
0
        public MasterControls(DwarfGUI gui, GUIComponent parent, GameMaster master, Texture2D icons, GraphicsDevice device, SpriteFont font)
            : base(gui, parent)
        {
            Master = master;
            Icons = icons;
            IconSize = 32;
            CurrentMode = master.CurrentToolMode;
            ToolButtons = new Dictionary<GameMaster.ToolMode, Button>();

            GridLayout layout = new GridLayout(GUI, this, 1, 8)
            {
                EdgePadding = 0
            };

            CreateButton(layout, GameMaster.ToolMode.SelectUnits, "Select", "Click and drag to select dwarves.", 5, 0);
            CreateButton(layout, GameMaster.ToolMode.Dig, "Mine", "Click and drag to designate mines.\nRight click to erase.", 0, 0);
            CreateButton(layout, GameMaster.ToolMode.Build, "Build", "Click to open build menu.", 2, 0);
            CreateButton(layout, GameMaster.ToolMode.Magic, "Magic", "Click to open the magic menu.", 6, 1);
            CreateButton(layout, GameMaster.ToolMode.Gather, "Gather", "Click on resources to designate them\nfor gathering. Right click to erase.", 6, 0);
            CreateButton(layout, GameMaster.ToolMode.Chop, "Chop", "Click on trees to designate them\nfor chopping. Right click to erase.", 1, 0);
            CreateButton(layout, GameMaster.ToolMode.Guard, "Guard", "Click and drag to designate guard areas.\nRight click to erase.", 4, 0);
            CreateButton(layout, GameMaster.ToolMode.Attack, "Attack", "Click and drag to attack entities.\nRight click to cancel.", 3, 0);
            //CreateButton(layout, GameMaster.ToolMode.CreateStockpiles, "Stock", "Click and drag to designate stockpiles.\nRight click to erase.", 7, 0);

            int i = 0;
            foreach(Button b in ToolButtons.Values)
            {
                layout.SetComponentPosition(b, i, 0, 1, 1);
                i++;
            }
        }
Пример #3
0
        public GodModeTool(DwarfGUI gui, GameMaster master)
        {
            GUI = gui;
            Player = master;

            SelectorPanel = new Window(GUI, gui.RootComponent)
            {
                LocalBounds = new Rectangle(200, 100, 300, 100)
            };

            Label label = new Label(GUI, SelectorPanel, "Cheat Mode!", GUI.DefaultFont)
            {
                LocalBounds = new Rectangle(10, 10, 250, 32)
            };

            SelectorBox = new ComboBox(GUI, SelectorPanel)
            {
                LocalBounds = new Rectangle(10, 64, 250, 32),
                WidthSizeMode = GUIComponent.SizeMode.Fit
            };

            IsActive = false;
            Chunks = PlayState.ChunkManager;

            foreach(string s in RoomLibrary.GetRoomTypes())
            {
                SelectorBox.AddValue("Build " + s);
            }

            List<string> strings = EntityFactory.EntityFuncs.Keys.ToList();
            strings.Sort();
            foreach (string s in strings)
            {
                SelectorBox.AddValue(s);
            }

            foreach(VoxelType type in VoxelLibrary.PrimitiveMap.Keys.Where(type => type.Name != "empty" && type.Name != "water"))
            {
                SelectorBox.AddValue("Place " + type.Name);
            }

            SelectorBox.AddValue("Delete Block");
            SelectorBox.AddValue("Kill Block");
            SelectorBox.AddValue("Kill Things");
            SelectorBox.AddValue("Fill Water");
            SelectorBox.AddValue("Fill Lava");
            SelectorBox.AddValue("Fire");
            SelectorBox.OnSelectionModified += SelectorBox_OnSelectionModified;

            SelectorPanel.IsVisible = false;
        }
Пример #4
0
        public BuildMenu(DwarfGUI gui, GUIComponent parent, GameMaster faction)
            : base(gui, parent, WindowButtons.CloseButton)
        {
            GridLayout layout = new GridLayout(GUI, this, 1, 1);
            Master = faction;
            Selector = new TabSelector(GUI, layout, 3);
            layout.SetComponentPosition(Selector, 0, 0, 1, 1);

            SetupBuildRoomTab();
            SetupBuildItemTab();
            SetupBuildWallTab();

            Selector.SetTab("Rooms");
            MinWidth = 512;
            MinHeight = 256;
        }
Пример #5
0
 public MagicMenu(DwarfGUI gui, GUIComponent parent, GameMaster master, WindowButtons buttons = WindowButtons.CloseButton)
     : base(gui, parent, buttons)
 {
     Master = master;
     MinWidth = 512;
     MinHeight = 256;
     Selector = new TabSelector(GUI, this, 2)
     {
         WidthSizeMode = SizeMode.Fit,
         HeightSizeMode = SizeMode.Fit,
         LocalBounds = new Rectangle(0, 0, MinWidth, MinHeight)
     };
     SpellTriggered = spell => { };
     CreateSpellsTab();
     CreateResearchTab();
     Selector.SetTab("Known Spells");
 }
Пример #6
0
 public bool HasAction(GameMaster.ToolMode action)
 {
     return Actions != null && Actions.Contains(action);
 }
Пример #7
0
 public MagicTool(GameMaster master)
 {
     Player = master;
 }
Пример #8
0
 public static List<CreatureAI> FilterMinionsWithCapability(List<CreatureAI> minions, GameMaster.ToolMode action)
 {
     return minions.Where(creature => creature.Stats.CurrentClass.HasAction(action)).ToList();
 }
Пример #9
0
 public DwarfSelectorTool(GameMaster master)
 {
     Player = master;
     InputManager.MouseClickedCallback += InputManager_MouseClickedCallback;
 }
Пример #10
0
 public bool SelectedUnitsHaveCapability(GameMaster.ToolMode tool)
 {
     return Master.Faction.SelectedMinions.Any(minion => minion.Stats.CurrentClass.HasAction(tool));
 }
Пример #11
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;
        }
Пример #12
0
 public MagicTool(GameMaster master)
 {
     Player = master;
 }