コード例 #1
0
        public void Initialize()
        {
            float width  = guiComponent.graphics.camera.screenWidth / guiComponent.graphics.camera.scale;
            float height = guiComponent.graphics.camera.screenHeight / guiComponent.graphics.camera.scale;

            Vector2 iconSize = new Vector2(20, 20);
            int     margin   = 0;

            size     = new Vector2(width, .25f * height);
            location = new Vector2(0, .75f * height);

            row       = new TableContainer(guiComponent, 6, 3, 3);
            row.align = ListContainer.Align.CENTER;
            Button temp = new Button(guiComponent, "");

            temp.margin      = margin;
            temp.normTexture = guiComponent.guiTextures[38];
            temp.clicTexture = guiComponent.guiTextures[49];
            temp.forcedSize  = iconSize;

            //Create all the buttons for selecting Tools
            //New Map Tool
            temp.normTexture = guiComponent.guiTextures[38];
            temp.forcedSize  = iconSize;

            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).newTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            //Save Tool
            temp             = new Button(guiComponent, "");
            temp.margin      = margin;
            temp.normTexture = guiComponent.guiTextures[30];
            temp.clicTexture = guiComponent.guiTextures[41];
            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).saveTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            //Load Tool
            temp             = new Button(guiComponent, "");
            temp.normTexture = guiComponent.guiTextures[36];
            temp.clicTexture = guiComponent.guiTextures[47];
            temp.margin      = margin;
            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).loadTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            //Pencil Tool
            temp             = new Button(guiComponent, "");
            temp.margin      = margin;
            temp.normTexture = guiComponent.guiTextures[31];
            temp.clicTexture = guiComponent.guiTextures[42];
            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).pencilTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            temp             = new Button(guiComponent, "");
            temp.margin      = margin;
            temp.normTexture = guiComponent.guiTextures[32];
            temp.clicTexture = guiComponent.guiTextures[43];


            temp.forcedSize = iconSize;

            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).flagTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            temp             = new Button(guiComponent, "");
            temp.normTexture = guiComponent.guiTextures[33];
            temp.clicTexture = guiComponent.guiTextures[44];
            temp.margin      = margin;
            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).eraseTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);
            temp             = new Button(guiComponent, "");
            temp.normTexture = guiComponent.guiTextures[34];
            temp.clicTexture = guiComponent.guiTextures[45];
            temp.margin      = margin;
            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).fillTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);
            temp             = new Button(guiComponent, "");
            temp.normTexture = guiComponent.guiTextures[35];
            temp.clicTexture = guiComponent.guiTextures[46];
            temp.margin      = margin;
            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).actorTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);


            temp             = new Button(guiComponent, "");
            temp.normTexture = guiComponent.guiTextures[40];
            temp.clicTexture = guiComponent.guiTextures[48];
            temp.margin      = margin;

            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).optionTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            temp             = new Button(guiComponent, "");
            temp.normTexture = guiComponent.guiTextures[50];
            temp.clicTexture = guiComponent.guiTextures[51];
            temp.margin      = margin;

            temp.forcedSize  = iconSize;
            temp.clickEvent += (loc) =>
            {
                (guiComponent.tileEngine as Editor).activeTool.active = false;

                (guiComponent.tileEngine as Editor).activeTool        = (guiComponent.tileEngine as Editor).stampTool;
                (guiComponent.tileEngine as Editor).activeTool.active = true;
                guiComponent.current.pack();
            };
            row.Add(temp);

            row.Add(null);
            row.Add(null);
            row.Add(null);

            Add(row);
            Add(new ToolOptionsGUI(guiComponent as EditorGUI));
        }