Пример #1
0
        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;
        }
Пример #2
0
        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);
        }
Пример #3
0
        public override void Start()
        {
            float cumulativeHeight = 8;

            UILabel label = AddUIComponent <UILabel>();

            label.textScale        = 0.9f;
            label.width            = width;
            label.text             = "TMPE settings";
            label.relativePosition = new Vector2(8, cumulativeHeight);
            label.SendToBack();
            cumulativeHeight += label.height + 8;

            var checkBox = UIWindow2.CreateCheckBox(this);

            checkBox.name               = "RAB_enterBlockedJunctionMainRoad";
            checkBox.label.text         = "Enter junct. main r.";
            checkBox.tooltip            = "Allow vehicles on the roundabout to enter blocked junctions (TMPE policy)";
            checkBox.isChecked          = SavedEnterBlockedMainRoad;
            checkBox.relativePosition   = new Vector3(8, cumulativeHeight);
            checkBox.eventCheckChanged += (c, state) =>
            {
                SavedEnterBlockedMainRoad.value = state;
            };
            cumulativeHeight += checkBox.height + 8;

            checkBox                    = UIWindow2.CreateCheckBox(this);
            checkBox.name               = "RAB_enterBlockedJunctionYieldingRoad";
            checkBox.label.text         = "Enter junct. yield. r.";
            checkBox.tooltip            = "Allow vehicles entering the roundabout to enter blocked junction (TMPE policy)";
            checkBox.isChecked          = SavedEnterBlockedYieldingRoad;
            checkBox.relativePosition   = new Vector3(8, cumulativeHeight);
            checkBox.eventCheckChanged += (c, state) =>
            {
                SavedEnterBlockedYieldingRoad.value = state;
            };
            cumulativeHeight += checkBox.height + 8;

            checkBox                    = UIWindow2.CreateCheckBox(this);
            checkBox.name               = "RAB_noParking";
            checkBox.label.text         = "No parking";
            checkBox.tooltip            = "Restrict parking on the roundabout (TMPE policy)";
            checkBox.isChecked          = SavedNoParking;
            checkBox.relativePosition   = new Vector3(8, cumulativeHeight);
            checkBox.eventCheckChanged += (c, state) =>
            {
                SavedNoParking.value = state;
            };
            cumulativeHeight += checkBox.height + 8;

            checkBox                    = UIWindow2.CreateCheckBox(this);
            checkBox.name               = "RAB_prioritySigns";
            checkBox.label.text         = "Priority signs";
            checkBox.tooltip            = "Vehicles on the roundabout will have right-of-way";
            checkBox.isChecked          = SavedPrioritySigns;
            checkBox.relativePosition   = new Vector3(8, cumulativeHeight);
            checkBox.eventCheckChanged += (c, state) =>
            {
                SavedPrioritySigns.value = state;
            };
            cumulativeHeight += checkBox.height + 8;

            checkBox                    = UIWindow2.CreateCheckBox(this);
            checkBox.name               = "RAB_noCrossings";
            checkBox.label.text         = "Disable crosswalks";
            checkBox.tooltip            = "Disallow pedestrians to cross to inner ring of the roundabout (Does not change visual appearance)";
            checkBox.isChecked          = SavedNoCrossings;
            checkBox.relativePosition   = new Vector3(8, cumulativeHeight);
            checkBox.eventCheckChanged += (c, state) =>
            {
                SavedNoCrossings.value = state;
            };
            cumulativeHeight += checkBox.height + 8;

            /*label = AddUIComponent<UILabel>();
             * label.text = "Would you like to see more TMPE features (eg. automatic lane connector)? Please visit the workshop page and let me know your usual " +
             *  "roundabout TMPE setup. Please, be as concrete as possible. ( You can include screenshots ;) )\n- Your Strad. PS: I don't promise anything :D";
             * label.wordWrap = true;
             * label.textScale = 0.65f;
             * label.autoSize = false;
             * label.width = width - 16;
             * label.relativePosition = new Vector2(8, cumulativeHeight);
             * label.SendToBack();
             * cumulativeHeight += label.height + 8;*/
        }
Пример #4
0
        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;

            UILabel labelElevation = AddUIComponent <UILabel>();

            labelElevation.textScale        = 0.9f;
            labelElevation.text             = "Elevation:";
            labelElevation.relativePosition = new Vector2(8, cumulativeHeight);
            labelElevation.tooltip          = "Press PgUp/PgDn to adjust";
            labelElevation.SendToBack();

            ElevationField = AddUIComponent <NumericTextField>();
            ElevationField.relativePosition = new Vector2(width - ElevationField.width - 8, cumulativeHeight);
            ElevationField.tooltip          = "Press PgUp/PgDn to adjust";
            ElevationField.MinVal           = -500f;
            ElevationField.MaxVal           = 1000f;
            ElevationField.Increment        = 3;
            ElevationField.DefaultVal       = 0;
            ElevationField.text             = "0";
            cumulativeHeight += ElevationField.height + 8;

            UILabel label = AddUIComponent <UILabel>();

            label.text             = "Roads won't be removed or connected\nUse Fine Road Tool for elevated roads";
            label.wordWrap         = true;
            label.textScale        = 0.9f;
            label.autoSize         = false;
            label.width            = width - 16;
            label.height           = 96;
            label.relativePosition = new Vector2(8, cumulativeHeight);
            label.SendToBack();
            cumulativeHeight += label.height;

            var absoluteElevation = UIWindow2.CreateCheckBox(this);

            absoluteElevation.name               = "RAB_absoluteElevation";
            absoluteElevation.label.text         = "Absolute elevation";
            absoluteElevation.tooltip            = "Elevation will be measured from zero level instead of terrain level";
            absoluteElevation.isChecked          = EllipseTool.Instance.ControlVertices;
            absoluteElevation.relativePosition   = new Vector3(8, cumulativeHeight);
            absoluteElevation.isChecked          = false;
            absoluteElevation.eventCheckChanged += (c, state) =>
            {
                FreeCursorTool.Instance.AbsoluteElevation = state;
            };
            cumulativeHeight += absoluteElevation.height + 8;

            height = cumulativeHeight;
        }
Пример #5
0
 public UIWindow2()
 {
     instance = this;
 }