コード例 #1
0
        public FlagToolGUI(EditorGUI theInterface)
            : base(theInterface)
        {
            string[] x;
            x    = new string[3];
            x[0] = "On";
            x[1] = "Off";
            x[2] = "Ignore";
            string[] y;
            y    = new string[3];
            y[0] = "On";
            y[1] = "Off";
            y[2] = "Ignore";

            tagBox         = new TextArea(theInterface);
            tagBox.text    = "x";
            actionBox      = new TextArea(theInterface);
            actionBox.text = "x";

            tagLabel    = new Label(theInterface, "Tag: ");
            actionLabel = new Label(theInterface, "Action: ");

            solid     = new GUI.RadioButtonContainer(theInterface, x, 2);
            opacity   = new GUI.RadioButtonContainer(theInterface, y, 2);
            textBoxes = new ListContainer(theInterface, Orientation.VERTICAL);
            labels    = new ListContainer(theInterface, Orientation.VERTICAL);

            solid.forcedLocation   = Vector2.Zero;
            opacity.forcedLocation = new Vector2(100, 0);

            Add(solid);
            Add(opacity);

            textBoxes.Add(actionBox);
            textBoxes.Add(tagBox);
            Add(textBoxes);
            textBoxes.forcedLocation = new Vector2(200, 0);

            labels.Add(actionLabel);
            labels.Add(tagLabel);
            Add(labels);
            labels.forcedLocation = new Vector2(275, 0);

            tagBox.bgColor    = Color.White;
            actionBox.bgColor = Color.White;

            this.forcedSize = new Vector2(300, 200);

            solid.forcedSize     = new Vector2(100, 200);
            opacity.forcedSize   = new Vector2(100, 200);
            tagBox.forcedSize    = new Vector2(50, 20);
            actionBox.forcedSize = new Vector2(50, 20);
        }
コード例 #2
0
        public Label coords;  // Coordinates of the current tile

        public OptionToolGUI(EditorGUI theInterface)
            : base(theInterface)
        {
            orientation           = Orientation.VERTICAL;
            holdThis              = new ListContainer[2];
            holdThis[0]           = new ListContainer(theInterface);
            holdThis[1]           = new ListContainer(theInterface);
            coords                = new Label(theInterface);
            coords.forcedLocation = new Vector2(200, 0);

            solid = new GUI.CheckBoxContainer(theInterface, "Solidity Marker", true);
            solid.children[0].clickEvent += (lol) => { (theInterface.tileEngine as Editor).solid = !(theInterface.tileEngine as Editor).solid; };
            opaque = new GUI.CheckBoxContainer(theInterface, "Opaque Marker", true);
            opaque.children[0].clickEvent += (lol) => { (theInterface.tileEngine as Editor).opaque = !(theInterface.tileEngine as Editor).opaque; };
            grid = new GUI.CheckBoxContainer(theInterface, "Grid", true);
            grid.children[0].clickEvent += (lol) => { (theInterface.tileEngine as Editor).grid = !(theInterface.tileEngine as Editor).grid; };

            Add(solid);
            Add(opaque);
            Add(grid);
            Add(coords);
        }
コード例 #3
0
        public NewToolGUI(EditorGUI theInterface)
            : base(theInterface)
        {
            orientation        = Orientation.VERTICAL;
            holdThis           = new ListContainer[2];
            holdThis[0]        = new ListContainer(theInterface);
            holdThis[1]        = new ListContainer(theInterface);
            newMap             = new Button(theInterface, " New ");
            newMap.margin      = 2;
            newMap.clickEvent += (lol) =>
            {
                guiComponent.tileEngine.world.file.free();
                guiComponent.tileEngine.world.file = new MapFile(new FileStream("../../../../../Game/GameContent/Maps/" + name.text + ".map", FileMode.Create));
                ((guiComponent.tileEngine as Editor).saveTool.gui as SaveToolGUI).name.text = name.text;
                guiComponent.tileEngine.world.file.tiles           = new MapFile.TileData[1, int.Parse(width.text), int.Parse(height.text)];
                guiComponent.tileEngine.world.file.tileSetNames    = new string[1];
                guiComponent.tileEngine.world.file.tileSetNames[0] = "Tiles";
                guiComponent.tileEngine.world.file.soundSetName    = "000_Lucy";

                guiComponent.tileEngine.world.file.worldObjects = new List <MapFile.WorldObjectData>();
                for (int i = 0; i < int.Parse(width.text); i++)
                {
                    for (int j = 0; j < int.Parse(height.text); j++)
                    {
                        guiComponent.tileEngine.world.file.tiles[0, i, j] = new MapFile.TileData();
                        guiComponent.tileEngine.world.file.tiles[0, i, j].tileSetIndex = 0;
                        guiComponent.tileEngine.world.file.tiles[0, i, j].tileIndex    = 16;
                    }
                }
                guiComponent.tileEngine.world.file.name = name.text;
                guiComponent.tileEngine.world.initTiles();
                guiComponent.tileEngine.world.initActors();
                guiComponent.tileEngine.world.sortActors();
                guiComponent.tileEngine.world.addActor(guiComponent.tileEngine.world.actorFactory.createActor(-1, new Vector2(16, 16)));
                (guiComponent.tileEngine.world as EditorWorld).player = guiComponent.tileEngine.world.actors.First.Value as Acting.EmptyActor;
            };
            name            = new TextArea(theInterface);
            name.bgColor    = Color.AntiqueWhite;
            name.forcedSize = new Vector2(120, 15);

            width            = new TextArea(theInterface);
            width.bgColor    = Color.AntiqueWhite;
            width.forcedSize = new Vector2(40, 15);
            width.marginL    = 2;

            height            = new TextArea(theInterface);
            height.bgColor    = Color.AntiqueWhite;
            height.forcedSize = new Vector2(40, 15);
            height.marginL    = 2;

            wLabel         = new Label(theInterface, "Width");
            wLabel.marginL = 2;
            hLabel         = new Label(theInterface, "Height");
            hLabel.marginL = 2;


            holdThis[0].Add(name);
            holdThis[0].Add(newMap);
            holdThis[1].Add(width);
            holdThis[1].Add(wLabel);
            holdThis[1].Add(height);
            holdThis[1].Add(hLabel);

            Add(holdThis[0]);
            Add(holdThis[1]);
        }