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); }
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; }
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; }
public static UICustomCheckbox MakeCheckBox(UIPanel panel, string txt, float y, ColossalFramework.UI.MouseEventHandler eventClick, string tooltip = "", float x = 15.0f) { UILabel label = panel.AddUIComponent <UILabel>(); label.name = txt + "Label"; label.text = txt; label.relativePosition = new Vector3(35.0f, y); label.textScale = 0.8f; UICustomCheckbox cb = panel.AddUIComponent <UICustomCheckbox>(); cb.relativePosition = new Vector3(x, y); cb.size = new Vector2(12, 12); cb.eventClick += eventClick; cb.Show(); cb.color = new Color32(185, 221, 254, 255); cb.enabled = true; cb.isChecked = true; cb.tooltip = tooltip; return(cb); }
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; }