Ejemplo n.º 1
0
        public TileTypeTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input           = input;
            this.ui              = ui;
            this.tileTypes       = new Dictionary <CheckBox, TileType>();
            this.highlight       = new StaticSizeHighlighter(input, ui, camera, 3, Color.Green);
            this.checkBoxes      = new ExclusiveCheckBoxes();
            this.mouseButtonDown = false;
            this.enabled         = false;
            InitUI(ui, out uiElem, out sizeSlider);

            foreach (var tileType in input.Level.Package.TileTypes)
            {
                var checkBox = ui.SelectionBar.CreateCheckBox();
                checkBox.SetStyle("SelectionBarCheckBox");
                checkBox.Toggled      += OnTileTypeToggled;
                checkBox.Texture       = input.Level.Package.TileIconTexture;
                checkBox.ImageRect     = tileType.IconRectangle;
                checkBox.HoverOffset   = new IntVector2(tileType.IconRectangle.Width(), 0);
                checkBox.CheckedOffset = new IntVector2(2 * tileType.IconRectangle.Width(), 0);

                tileTypes.Add(checkBox, tileType);
                checkBoxes.AddCheckBox(checkBox);
            }
        }
Ejemplo n.º 2
0
        public TerrainManipulatorTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input        = input;
            this.ui           = ui;
            this.checkBoxes   = new ExclusiveCheckBoxes();
            this.camera       = camera;
            this.manipulators = new Dictionary <UIElement, TerrainManipulator>();
            this.enabled      = false;

            var selectorCheckBox = ui.SelectionBar.CreateCheckBox();

            selectorCheckBox.Name = "Selector";
            selectorCheckBox.SetStyle("VertexHeightToolSelectingBox");

            VertexSelector selector = new VertexSelector(Map, input);

            checkBoxes.AddCheckBox(selectorCheckBox);
            manipulators.Add(selectorCheckBox, selector);

            var moverCheckBox = ui.SelectionBar.CreateCheckBox();

            moverCheckBox.Name = "Mover";
            moverCheckBox.SetStyle("VertexHeightToolMovingBox");

            checkBoxes.AddCheckBox(moverCheckBox);
            manipulators.Add(moverCheckBox, new VertexMover(this, selector, input, Map));


            var tileHeightCheckBox = ui.SelectionBar.CreateCheckBox();

            tileHeightCheckBox.Name = "TileHeight";
            tileHeightCheckBox.SetStyle("TileHeightToolTileHeightBox");

            checkBoxes.AddCheckBox(tileHeightCheckBox);
            manipulators.Add(tileHeightCheckBox, new TileHeightManipulator(input, ui, camera, Map));

            var terrainSmoothingCheckBox = ui.SelectionBar.CreateCheckBox();

            terrainSmoothingCheckBox.Name = "TerrainSmoothing";
            terrainSmoothingCheckBox.SetStyle("TerrainSmoothingToolCheckBox");

            checkBoxes.AddCheckBox(terrainSmoothingCheckBox);
            manipulators.Add(terrainSmoothingCheckBox, new TerrainSmoothingManipulator(input, ui, camera, Map));

            checkBoxes.SelectedChanged += OnToggled;
        }
Ejemplo n.º 3
0
        public SpawnerTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input      = input;
            this.ui         = ui;
            this.spawners   = new Dictionary <CheckBox, Spawner>();
            this.checkBoxes = new ExclusiveCheckBoxes();
            this.enabled    = false;

            checkBoxes.SelectedChanged += OnSelectedChanged;

            foreach (var spawner in ActiveSpawners)
            {
                SpawnableUnitTypePlugin typePlugin = (SpawnableUnitTypePlugin)Level.Package.GetUnitType(spawner).Plugin;
                InitCheckbox(typePlugin.GetSpawner(input, ui, camera), input.Level.Package);
            }

            InitCheckbox(new Deleter(input, ui, camera), input.Level.Package);
            InitUI(ui, out uiElem, out unitName);
        }
Ejemplo n.º 4
0
        public BuilderTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input      = input;
            this.ui         = ui;
            this.builders   = new Dictionary <CheckBox, Builder>();
            this.checkBoxes = new ExclusiveCheckBoxes();
            this.enabled    = false;

            checkBoxes.SelectedChanged += OnSelectedChanged;

            IEnumerable <string> activeBuilders = Level.EditorMode ? EditBuilders : PlayBuilders;

            foreach (var builder in activeBuilders)
            {
                BaseBuildingTypePlugin typePlugin = (BaseBuildingTypePlugin)Level.Package.GetBuildingType(builder).Plugin;
                InitCheckbox(typePlugin.GetBuilder(input, ui, camera), input.Level.Package);
            }

            InitCheckbox(new Destroyer(input, ui, camera), input.Level.Package);
            InitUI(ui, out uiElem);
        }
Ejemplo n.º 5
0
        public BuildingBuilderTool(GameController input, GameUI ui, CameraMover camera, IntRect iconRectangle)
            : base(input, iconRectangle)
        {
            this.input         = input;
            this.ui            = ui;
            this.buildingTypes = new Dictionary <CheckBox, BuildingType>();
            this.checkBoxes    = new ExclusiveCheckBoxes();
            this.enabled       = false;

            foreach (var buildingType in input.Level.Package.BuildingTypes)
            {
                var checkBox = ui.SelectionBar.CreateCheckBox();
                checkBox.SetStyle("SelectionBarCheckBox");
                checkBox.Toggled      += OnBuildingTypeToggled;
                checkBox.Texture       = input.Level.Package.BuildingIconTexture;
                checkBox.ImageRect     = buildingType.IconRectangle;
                checkBox.HoverOffset   = new IntVector2(buildingType.IconRectangle.Width(), 0);
                checkBox.CheckedOffset = new IntVector2(2 * buildingType.IconRectangle.Width(), 0);

                buildingTypes.Add(checkBox, buildingType);
                checkBoxes.AddCheckBox(checkBox);
            }
        }