コード例 #1
0
        private void CreateTimeUI(IUIBuilder builder)
        {
            _timeGroup = new UIGroup(builder);

            TimeSliderGroup = _timeGroup.CreateHorizontalGroup(510, 125, new Vector2(10, 0), 2, idx => _timeGroup.CreateSliderEx(), true);
            TimeSpanSlider  = new JSONStorableFloat($"Device:{_name}:TimeSpan", 1, v =>
            {
                TimeSpanSlider.valNoCallback = Mathf.Round(v);
                TimeScrubberSlider.max       = Mathf.Round(v);
                _editor.SetDrawScale(_storable, new Vector2(v, 1), _offset, true);
            }, 1, 300, true, true);

            TimeScrubberSlider = new JSONStorableFloat($"Device:{_name}:TimeScrubberPosition", 0, 0, TimeSpanSlider.val, true, true);

            var timeSpanSlider = TimeSliderGroup.items[0].GetComponent <UIDynamicSlider>();

            timeSpanSlider.Configure("Time Span", TimeSpanSlider.min, TimeSpanSlider.max, TimeSpanSlider.defaultVal, valFormat: "F0", showQuickButtons: false);
            timeSpanSlider.defaultButtonEnabled = false;
            timeSpanSlider.slider.wholeNumbers  = true;
            TimeSpanSlider.slider = timeSpanSlider.slider;

            var timeScrubberSlider = TimeSliderGroup.items[1].GetComponent <UIDynamicSlider>();

            timeScrubberSlider.Configure("Scrubber", TimeScrubberSlider.min, TimeScrubberSlider.max, TimeScrubberSlider.defaultVal, valFormat: "F2", showQuickButtons: false);
            TimeScrubberSlider.slider = timeScrubberSlider.slider;

            TimeToggleGroup   = _timeGroup.CreateHorizontalGroup(510, 50, new Vector2(10, 0), 2, idx => _timeGroup.CreateToggleEx(), true);
            TineRunningToggle = new JSONStorableBool($"Device:{_name}:TimeRunning", false);
            TimeLoopingToggle = new JSONStorableBool($"Device:{_name}:TimeLooping", true);

            var timeRunningToggle = TimeToggleGroup.items[0].GetComponent <UIDynamicToggle>();

            timeRunningToggle.label  = "Running";
            TineRunningToggle.toggle = timeRunningToggle.toggle;

            var timelLoopingToggle = TimeToggleGroup.items[1].GetComponent <UIDynamicToggle>();

            timelLoopingToggle.label = "Looping";
            TimeLoopingToggle.toggle = timelLoopingToggle.toggle;

            _timeGroup.SetVisible(false);
        }
コード例 #2
0
        private void CreateA2AxisUI(IUIBuilder builder)
        {
            var group   = new UIGroup(builder);
            var visible = false;

            A2AxisTitle = builder.CreateButton("Lube | A2", () =>
            {
                group.SetVisible(visible = !visible);
                OutputA2CurveEditorSettings.SetVisible(visible);
            }, new Color(0.4f, 0.4f, 0.4f), Color.white, true);
            OutputA2CurveEditor = group.CreateCurveEditor(300, true);
            OutputA2Curve       = group.CreateCurve("Device:A2:OutputCurve", OutputA2CurveEditor, new List <Keyframe> {
                new Keyframe(0, 0, 0, 1), new Keyframe(1, 1, 1, 0)
            });
            OutputA2CurveEditor.SetDrawScale(OutputA2Curve, Vector2.one, Vector2.zero, true);

            OutputA2CurveEditorSettings = new DeviceCurveEditorSettings("A2:OutputCurveSettings", OutputA2CurveEditor, OutputA2Curve);
            OutputA2CurveEditorSettings.CreateUI(group);

            EnableOverrideA2Toggle = group.CreateToggle("Device:A2:EnableOverride", "Enable Override", true, true);
            OverrideA2Slider       = group.CreateSlider("Device:A2:Override", "Override Value (%)", 0f, 0f, 1f, true, true, true, "P0");

            group.SetVisible(false);
        }