コード例 #1
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 = UIUtil.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                    = UIUtil.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                    = UIUtil.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                    = UIUtil.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                    = UIUtil.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;*/
        }
コード例 #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;

            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 = UIUtil.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;
        }