コード例 #1
0
ファイル: TileTypeTool.cs プロジェクト: MK4H/MHUrho
        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);
            }
        }
コード例 #2
0
ファイル: TerrainManipulatorTool.cs プロジェクト: MK4H/MHUrho
        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;
        }
コード例 #3
0
ファイル: SpawnerTool.cs プロジェクト: MK4H/MHUrho
        void InitCheckbox(Spawner spawner, GamePack package)
        {
            var checkBox = ui.SelectionBar.CreateCheckBox();

            checkBox.SetStyle("SelectionBarCheckBox");
            checkBox.Texture       = package.BuildingIconTexture;
            checkBox.ImageRect     = spawner.UnitType.IconRectangle;
            checkBox.HoverOffset   = new IntVector2(spawner.UnitType.IconRectangle.Width(), 0);
            checkBox.CheckedOffset = new IntVector2(2 * spawner.UnitType.IconRectangle.Width(), 0);
            checkBoxes.AddCheckBox(checkBox);
            spawners.Add(checkBox, spawner);
        }
コード例 #4
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);
            }
        }