public override void Start() { float cumulativeHeight = 0; UILabel labelRadius = AddUIComponent <UILabel>(); labelRadius.textScale = 0.9f; labelRadius.text = "Main axis:"; labelRadius.relativePosition = new Vector2(8, cumulativeHeight); labelRadius.tooltip = "Press SHIFT +/- to adjust"; labelRadius.SendToBack(); Radius1tf = AddUIComponent <NumericTextField>(); Radius1tf.relativePosition = new Vector2(width - Radius1tf.width - 8, cumulativeHeight); Radius1tf.tooltip = "Press SHIFT +/- to adjust"; Radius1tf.DefaultVal = RADIUS1_DEF; Radius1tf.text = RADIUS1_DEF.ToString(); cumulativeHeight += Radius1tf.height + 8; labelRadius = AddUIComponent <UILabel>(); labelRadius.textScale = 0.9f; labelRadius.text = "Minor axis:"; labelRadius.relativePosition = new Vector2(8, cumulativeHeight); labelRadius.tooltip = "Press CTRL +/- to adjust"; labelRadius.SendToBack(); Radius2tf = AddUIComponent <NumericTextField>(); Radius2tf.relativePosition = new Vector2(204 - Radius1tf.width - 8, cumulativeHeight); Radius2tf.tooltip = "Press CTRL +/- to adjust"; Radius2tf.DefaultVal = RADIUS2_DEF; Radius2tf.text = RADIUS2_DEF.ToString(); cumulativeHeight += Radius2tf.height + 8; var buildButton = UIWindow2.CreateButton(this); buildButton.text = "Build"; buildButton.relativePosition = new Vector2(8, cumulativeHeight); buildButton.playAudioEvents = false; buildButton.eventClick += (c, p) => { EllipseTool.Instance.BuildEllipse(); }; cumulativeHeight += buildButton.height + 8; var controlVertices = UIWindow2.CreateCheckBox(this); controlVertices.name = "RAB_controlVertices"; controlVertices.label.text = "Insert control points"; controlVertices.tooltip = "Control points are inserted on main axes to keep the ellipse in shape. See workshop page"; controlVertices.isChecked = EllipseTool.Instance.ControlVertices; controlVertices.relativePosition = new Vector3(8, cumulativeHeight); controlVertices.eventCheckChanged += (c, state) => { EllipseTool.Instance.ControlVertices = state; }; cumulativeHeight += controlVertices.height + 8; height = cumulativeHeight; }
public override void Start() { float cumulativeHeight = 0; UILabel labelRadius = AddUIComponent <UILabel>(); labelRadius.textScale = 0.9f; labelRadius.text = "Radius:"; labelRadius.relativePosition = new Vector2(8, cumulativeHeight); labelRadius.tooltip = "Press +/- to adjust"; labelRadius.SendToBack(); RadiusField = AddUIComponent <NumericTextField>(); RadiusField.relativePosition = new Vector2(width - RadiusField.width - 8, cumulativeHeight); RadiusField.tooltip = "Press +/- to adjust"; cumulativeHeight += RadiusField.height + 8; UIButton button = UIWindow2.CreateButton(this); button.text = "Free Cursor..."; button.tooltip = "Create roundabouts anywhere (Warning! Roads won't be removed or connected)"; button.relativePosition = new Vector2(8, cumulativeHeight); button.width = width - 16; button.eventClick += (c, p) => { UIWindow2.instance.SwitchTool(FreeCursorTool.Instance); }; cumulativeHeight += button.height + 8; button = UIWindow2.CreateButton(this); button.text = "Elliptic Roundabout..."; button.relativePosition = new Vector2(8, cumulativeHeight); button.width = width - 16; button.eventClick += (c, p) => { UIWindow2.instance.SwitchTool(EllipseTool.Instance); }; cumulativeHeight += button.height + 8; label = AddUIComponent <UILabel>(); label.text = "Tip: Use Fine Road Tool for elevated roads"; label.wordWrap = true; label.textScale = 0.9f; label.autoSize = false; label.width = width - 16; label.height = 48; label.relativePosition = new Vector2(8, cumulativeHeight); label.SendToBack(); cumulativeHeight += label.height; height = cumulativeHeight; UIWindow2.instance.SwitchWindow(this); }