Example #1
0
        public override void Start()
        {
            okButton             = TerrainUI.MakeButton(this, "Generate Terrain", 10, 210, 135);
            okButton.eventClick += okButton_eventClick;

            flatButton             = TerrainUI.MakeButton(this, "Flatten", 155, 210, 70);
            flatButton.eventClick += flattenButton_eventClick;

            int y  = 8;
            int sh = 40;

            smoothSlider = TerrainUI.MakeSlider(this, "SmoothSlider", "Smoothness", y, 9.0f, 0.0f, 10.0f, 1.0f, value => { smoothness = value; }); y += sh;
            scaleSlider  = TerrainUI.MakeSlider(this, "ScaleSlider", "Scale", y, scale, 0.0f, 1.0f, 0.05f, value => { scale = value; }); y += sh;
            offsetSlider = TerrainUI.MakeSlider(this, "OffsetSlider", "Offset", y, offset, -1.0f, 1.0f, 0.05f, value => { offset = value; }); y += sh;
            blurSlider   = TerrainUI.MakeSlider(this, "BlurSlider", "Blur", y, blur, 0.0f, 2.0f, 1.00f, value => { blur = value; }); y += sh;
        }
Example #2
0
        public override void Start()
        {
            this.backgroundSprite = "MenuPanel";
            this.width            = 240;   //240
            this.height           = 330;   //290

            title.text             = "Terrain Generator";
            title.relativePosition = new Vector3(15, 15);
            title.textScale        = 0.9f;
            title.size             = new Vector2(200, 30);

            dragHandle.width            = this.width;
            dragHandle.height           = 50;
            dragHandle.target           = this;
            dragHandle.relativePosition = Vector3.zero;

            closeButton.relativePosition = new Vector2(this.width - 34, 6);
            closeButton.normalBgSprite   = "buttonclose";
            closeButton.hoveredBgSprite  = "buttonclosehover";
            closeButton.focusedBgSprite  = "buttonclosepressed";
            closeButton.pressedBgSprite  = "buttonclosepressed";
            closeButton.color            = new Color(1, 1, 1, .15f);
            closeButton.hoveredColor     = new Color(1, 1, 1, .75f);
            closeButton.eventClick      += closeButton_eventClick;

            tabContainer.relativePosition = new Vector3(0, 84);
            tabContainer.width            = this.width;
            tabContainer.backgroundSprite = "GenericPanel";
            tabContainer.color            = new Color(.4f, .4f, .4f, 1.0f);

            tabStrip.width              = this.width - 20;
            tabStrip.height             = 18;
            tabStrip.relativePosition   = new Vector3(10, 50);
            tabStrip.startSelectedIndex = 1;
            tabStrip.selectedIndex      = -1;

            tabs = new List <UIButton>();
            tabs.Add(TerrainUI.MakeTab(tabStrip, "Init", 34, initPanel, baseTabButton_eventClick));
            tabs.Add(TerrainUI.MakeTab(tabStrip, "Terrain", 54, terrainPanel, baseTabButton_eventClick));
            tabs.Add(TerrainUI.MakeTab(tabStrip, "Resources", 74, resPanel, baseTabButton_eventClick));
            tabs.Add(TerrainUI.MakeTab(tabStrip, "Trees", 54, treePanel, baseTabButton_eventClick));

            //terrainPanel.Hide ();
            resPanel.Hide();
            treePanel.Hide();
            initPanel.Hide();
        }
Example #3
0
        public UITerrainInitConfig(UIPanel panel, string txt, float y, UITerrainSetValue valFunc)
        {
            UILabel label = panel.AddUIComponent <UILabel>();

            label.name             = txt + "Label";
            label.text             = txt;
            label.relativePosition = new Vector3(10.0f, y);
            label.textScale        = 0.8f;

            hi     = TerrainUI.MakeCheckBox(panel, "", y, hi_eventClick, "Set to max height.", 120);
            zero   = TerrainUI.MakeCheckBox(panel, "", y, zero_eventClick, "Set to medium height.", 145);
            lo     = TerrainUI.MakeCheckBox(panel, "", y, lo_eventClick, "Set to lowest height.", 170);
            random = TerrainUI.MakeCheckBox(panel, "", y, random_eventClick, "Set to random height.", 195);
            none();
            random.isChecked = true;
            setValue         = valFunc;
            setValue(SquareDiamond.InitMode.INIT_RANDOM);
        }
Example #4
0
        public override void Start()
        {
            float y  = 8.0f;
            int   sh = 40;

            smoothSlider = TerrainUI.MakeSlider(this, "SmoothSlider", "Smoothness", y, smoothness, 0.0f, 9.0f, 1.0f, value => { smoothness = value; });
            y           += sh;
            scaleSlider  = TerrainUI.MakeSlider(this, "ScaleSlider", "Scale", y, scale, 0.0f, 1.0f, 0.05f, value => { scale = value; });
            y           += sh;
            forestSlider = TerrainUI.MakeSlider(this, "ForestSlider", "Forest Level", y, forest, 0.0f, 1.0f, 0.05f, value => { forest = value; }, "Small values create thin lines around areas. Larger values generate big forest areas.");
            y           += sh;
            oreSlider    = TerrainUI.MakeSlider(this, "OreSlider", "Ore Level", y, ore, 0.0f, 1.0f, 0.05f, value => { ore = value; });

            y = 180;
            deltreesCheckbox = TerrainUI.MakeCheckBox(this, "Delete trees before generating.", y, deltree_eventClick);

            okButton             = TerrainUI.MakeButton(this, "Generate Resources", 10, 210, 160);
            okButton.eventClick += okButton_eventClick;
        }
Example #5
0
        public override void Start()
        {
            float y = 0.0f;

            treeCol = GameObject.FindObjectOfType <TreeCollection>();
            string[] items = new string[treeCol.m_prefabs.Length + 1];
            items[0] = "Use Random Trees";
            for (int n = 0; n < treeCol.m_prefabs.Length; n++)
            {
                items[n + 1] = treeCol.m_prefabs[n].name;
            }

            TerrainUI.MakeDropDown(this, y, "Tree Type", items, listbox_eventClick);
            y += 50;

            followCheckbox = TerrainUI.MakeCheckBox(this, "Follow Resources", y, followcb_eventClick, "Use forest resources to place trees. If unchecked trees are placed randomly.");
            y += 30;

            insideCheckbox = TerrainUI.MakeCheckBox(this, "Only inside game area.", y, insidecb_eventClick, "Do not place trees outside the center 25 tiles.");
            y += 30;

            TerrainUI.MakeSlider(this, "DensitySlider", "Max Density", y, density, 1.0f, 64.0f, 1.0f, value => { density = value; });
            y += 45;

            UILabel txt = AddUIComponent <UILabel>();

            txt.text             = "Please Note: It can take a couple\nof minutes for the trees\nto show on the map.";
            txt.name             = "TreePlacementInfoText";
            txt.relativePosition = new Vector3(15.0f, y);
            txt.textScale        = 0.8f;
            txt.textColor        = new Color(.7f, .7f, .7f, 1f);
            txt.size             = new Vector2(200, 86);
            txt.autoSize         = false;
            txt.autoHeight       = false;

            okButton             = TerrainUI.MakeButton(this, "Create Trees", 10, 210, 110);
            okButton.eventClick += okButton_eventClick;

            delallButton             = TerrainUI.MakeButton(this, "Delete All", 140, 210, 90);
            delallButton.eventClick += delallButton_eventClick;
        }
Example #6
0
        public override void Start()
        {
            float y  = 0.0f;
            float sh = 28.0f;

            UILabel lab1 = this.AddUIComponent <UILabel>();

            lab1.relativePosition = new Vector3(105, y);
            lab1.text             = "Mntn";
            lab1.textScale        = 0.6f;

            UILabel lab2 = this.AddUIComponent <UILabel>();

            lab2.relativePosition = new Vector3(135, y);
            lab2.text             = "Land";
            lab2.textScale        = 0.6f;

            UILabel lab3 = this.AddUIComponent <UILabel>();

            lab3.relativePosition = new Vector3(165, y);
            lab3.text             = "Sea";
            lab3.textScale        = 0.6f;

            UILabel lab4 = this.AddUIComponent <UILabel>();

            lab4.relativePosition = new Vector3(185, y);
            lab4.text             = "Random";
            lab4.textScale        = 0.6f;

            y += sh;

            new UITerrainInitConfig(this, "Corners", y, value => { TerraGen.tg.InitNorthWest = value; }); y += sh;
            new UITerrainInitConfig(this, "Top", y, value => { TerraGen.tg.InitNorth = value; }); y         += sh;
            new UITerrainInitConfig(this, "Side", y, value => { TerraGen.tg.InitWest = value; }); y         += sh;
            new UITerrainInitConfig(this, "Center", y, value => { TerraGen.tg.InitCenter = value; }); y     += sh;

            useforResources           = TerrainUI.MakeCheckBox(this, "Use for resources too.", y, useforResources_eventClick, "Use this settings for resources too. Otherwise resources are always randomized.");
            useforResources.isChecked = false;
        }