private void StartDrag()
        {
            _isDragging = true;

            if (DragStarted != null)
            {
                DragStarted.Invoke();
            }

            if (_animSizeCoroutine != null)
            {
                StopCoroutine(_animSizeCoroutine);
            }
            _animSizeCoroutine = StartCoroutine(AnimButtonSize());

            if (_animPositionCoroutine != null)
            {
                StopCoroutine(_animPositionCoroutine);
            }
            _animPositionCoroutine = StartCoroutine(AnimButtonPosition());
        }
Beispiel #2
0
 IEnumerator <object> SelectTask()
 {
     while (true)
     {
         if (Widget.Input.WasMousePressed() && HitTest(Widget.Input.MousePosition))
         {
             DragStarted?.Invoke();
             while (Widget.Input.IsMousePressed())
             {
                 var c = color.Value;
                 PositionToHueSaturation(Widget.Input.MousePosition - Widget.GlobalCenter, out c.H, out c.S);
                 color.Value = c;
                 Window.Current.Invalidate();
                 Changed?.Invoke();
                 yield return(null);
             }
             DragEnded?.Invoke();
         }
         yield return(null);
     }
 }
Beispiel #3
0
        public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
        {
            var touchPoint = uitouch.LocationInView(this);

            if (_lowerTouchEdgeInsets.InsetRect(_lowerHandle.Frame).Contains(touchPoint) && !LowerHandleHidden)
            {
                _lowerHandle.Highlighted = true;
                _lowerTouchOffset        = (float)touchPoint.X - (float)_lowerHandle.Center.X;
            }

            if (_upperTouchEdgeInsets.InsetRect(_upperHandle.Frame).Contains(touchPoint) && !UpperHandleHidden)
            {
                _upperHandle.Highlighted = true;
                _upperTouchOffset        = (float)touchPoint.X - (float)_upperHandle.Center.X;
            }

            _stepValueInternal = StepValueContinuously ? StepValue : 0.0f;

            DragStarted?.Invoke(this, EventArgs.Empty);

            return(true);
        }
Beispiel #4
0
        public void Update()
        {
            if (!IsPushed || _isResolved)
            {
                return;
            }

            if (Mathf.Abs((_initialPointerPosition - Input.mousePosition).magnitude) > _dragDelta)
            {
                _isResolved = true;
                DragStarted?.Invoke();
            }
            else
            {
                _pressTimer += Time.unscaledDeltaTime;

                if (_pressTimer >= Constants.PointerOnClickDelay)
                {
                    _isResolved = true;
                    DragStarted?.Invoke();
                }
            }
        }
Beispiel #5
0
 /// <summary>
 ///     This is called when the user has started touching this widget.
 /// </summary>
 private void OnStartTrackingTouch()
 {
     _isDragging = true;
     DragStarted?.Invoke(this, EventArgs.Empty);
 }
        public EditorLevelObjectsUI()
        {
            Local  local  = Localization.read("/Editor/EditorLevelObjects.dat");
            Bundle bundle = Bundles.getBundle("/Bundles/Textures/Edit/Icons/EditorLevelObjects/EditorLevelObjects.unity3d");

            EditorLevelObjectsUI.container = new Sleek();
            EditorLevelObjectsUI.container.positionOffset_X = 10;
            EditorLevelObjectsUI.container.positionOffset_Y = 10;
            EditorLevelObjectsUI.container.positionScale_X  = 1f;
            EditorLevelObjectsUI.container.sizeOffset_X     = -20;
            EditorLevelObjectsUI.container.sizeOffset_Y     = -20;
            EditorLevelObjectsUI.container.sizeScale_X      = 1f;
            EditorLevelObjectsUI.container.sizeScale_Y      = 1f;
            EditorUI.window.add(EditorLevelObjectsUI.container);
            EditorLevelObjectsUI.active      = false;
            EditorLevelObjectsUI.assets      = new List <Asset>();
            EditorLevelObjectsUI.selectedBox = new SleekBox();
            EditorLevelObjectsUI.selectedBox.positionOffset_X = -230;
            EditorLevelObjectsUI.selectedBox.positionOffset_Y = 80;
            EditorLevelObjectsUI.selectedBox.positionScale_X  = 1f;
            EditorLevelObjectsUI.selectedBox.sizeOffset_X     = 230;
            EditorLevelObjectsUI.selectedBox.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.selectedBox.addLabel(local.format("SelectionBoxLabelText"), ESleekSide.LEFT);
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.selectedBox);
            EditorLevelObjectsUI.searchField = new SleekField();
            EditorLevelObjectsUI.searchField.positionOffset_X = -230;
            EditorLevelObjectsUI.searchField.positionOffset_Y = 120;
            EditorLevelObjectsUI.searchField.positionScale_X  = 1f;
            EditorLevelObjectsUI.searchField.sizeOffset_X     = 160;
            EditorLevelObjectsUI.searchField.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.searchField.hint             = local.format("Search_Field_Hint");
            EditorLevelObjectsUI.searchField.control          = "Search";
            SleekField sleekField = EditorLevelObjectsUI.searchField;

            if (EditorLevelObjectsUI.< > f__mg$cache1 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache1 = new Entered(EditorLevelObjectsUI.onEnteredSearchField);
            }
            sleekField.onEntered = EditorLevelObjectsUI.< > f__mg$cache1;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.searchField);
            EditorLevelObjectsUI.searchButton = new SleekButton();
            EditorLevelObjectsUI.searchButton.positionOffset_X = -60;
            EditorLevelObjectsUI.searchButton.positionOffset_Y = 120;
            EditorLevelObjectsUI.searchButton.positionScale_X  = 1f;
            EditorLevelObjectsUI.searchButton.sizeOffset_X     = 60;
            EditorLevelObjectsUI.searchButton.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.searchButton.text             = local.format("Search");
            EditorLevelObjectsUI.searchButton.tooltip          = local.format("Search_Tooltip");
            SleekButton sleekButton = EditorLevelObjectsUI.searchButton;

            if (EditorLevelObjectsUI.< > f__mg$cache2 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache2 = new ClickedButton(EditorLevelObjectsUI.onClickedSearchButton);
            }
            sleekButton.onClickedButton = EditorLevelObjectsUI.< > f__mg$cache2;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.searchButton);
            EditorLevelObjectsUI.largeToggle = new SleekToggle();
            EditorLevelObjectsUI.largeToggle.positionOffset_X = -230;
            EditorLevelObjectsUI.largeToggle.positionOffset_Y = 160;
            EditorLevelObjectsUI.largeToggle.positionScale_X  = 1f;
            EditorLevelObjectsUI.largeToggle.sizeOffset_X     = 40;
            EditorLevelObjectsUI.largeToggle.sizeOffset_Y     = 40;
            EditorLevelObjectsUI.largeToggle.addLabel(local.format("LargeLabel"), ESleekSide.RIGHT);
            EditorLevelObjectsUI.largeToggle.state = true;
            SleekToggle sleekToggle = EditorLevelObjectsUI.largeToggle;

            if (EditorLevelObjectsUI.< > f__mg$cache3 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache3 = new Toggled(EditorLevelObjectsUI.onToggledLargeToggle);
            }
            sleekToggle.onToggled = EditorLevelObjectsUI.< > f__mg$cache3;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.largeToggle);
            EditorLevelObjectsUI.mediumToggle = new SleekToggle();
            EditorLevelObjectsUI.mediumToggle.positionOffset_X = -230;
            EditorLevelObjectsUI.mediumToggle.positionOffset_Y = 210;
            EditorLevelObjectsUI.mediumToggle.positionScale_X  = 1f;
            EditorLevelObjectsUI.mediumToggle.sizeOffset_X     = 40;
            EditorLevelObjectsUI.mediumToggle.sizeOffset_Y     = 40;
            EditorLevelObjectsUI.mediumToggle.addLabel(local.format("MediumLabel"), ESleekSide.RIGHT);
            EditorLevelObjectsUI.mediumToggle.state = true;
            SleekToggle sleekToggle2 = EditorLevelObjectsUI.mediumToggle;

            if (EditorLevelObjectsUI.< > f__mg$cache4 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache4 = new Toggled(EditorLevelObjectsUI.onToggledMediumToggle);
            }
            sleekToggle2.onToggled = EditorLevelObjectsUI.< > f__mg$cache4;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.mediumToggle);
            EditorLevelObjectsUI.smallToggle = new SleekToggle();
            EditorLevelObjectsUI.smallToggle.positionOffset_X = -230;
            EditorLevelObjectsUI.smallToggle.positionOffset_Y = 260;
            EditorLevelObjectsUI.smallToggle.positionScale_X  = 1f;
            EditorLevelObjectsUI.smallToggle.sizeOffset_X     = 40;
            EditorLevelObjectsUI.smallToggle.sizeOffset_Y     = 40;
            EditorLevelObjectsUI.smallToggle.addLabel(local.format("SmallLabel"), ESleekSide.RIGHT);
            EditorLevelObjectsUI.smallToggle.state = true;
            SleekToggle sleekToggle3 = EditorLevelObjectsUI.smallToggle;

            if (EditorLevelObjectsUI.< > f__mg$cache5 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache5 = new Toggled(EditorLevelObjectsUI.onToggledSmallToggle);
            }
            sleekToggle3.onToggled = EditorLevelObjectsUI.< > f__mg$cache5;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.smallToggle);
            EditorLevelObjectsUI.barricadesToggle = new SleekToggle();
            EditorLevelObjectsUI.barricadesToggle.positionOffset_X = -130;
            EditorLevelObjectsUI.barricadesToggle.positionOffset_Y = 160;
            EditorLevelObjectsUI.barricadesToggle.positionScale_X  = 1f;
            EditorLevelObjectsUI.barricadesToggle.sizeOffset_X     = 40;
            EditorLevelObjectsUI.barricadesToggle.sizeOffset_Y     = 40;
            EditorLevelObjectsUI.barricadesToggle.addLabel(local.format("BarricadesLabel"), ESleekSide.RIGHT);
            EditorLevelObjectsUI.barricadesToggle.state = true;
            SleekToggle sleekToggle4 = EditorLevelObjectsUI.barricadesToggle;

            if (EditorLevelObjectsUI.< > f__mg$cache6 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache6 = new Toggled(EditorLevelObjectsUI.onToggledBarricadesToggle);
            }
            sleekToggle4.onToggled = EditorLevelObjectsUI.< > f__mg$cache6;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.barricadesToggle);
            EditorLevelObjectsUI.structuresToggle = new SleekToggle();
            EditorLevelObjectsUI.structuresToggle.positionOffset_X = -130;
            EditorLevelObjectsUI.structuresToggle.positionOffset_Y = 210;
            EditorLevelObjectsUI.structuresToggle.positionScale_X  = 1f;
            EditorLevelObjectsUI.structuresToggle.sizeOffset_X     = 40;
            EditorLevelObjectsUI.structuresToggle.sizeOffset_Y     = 40;
            EditorLevelObjectsUI.structuresToggle.addLabel(local.format("StructuresLabel"), ESleekSide.RIGHT);
            EditorLevelObjectsUI.structuresToggle.state = true;
            SleekToggle sleekToggle5 = EditorLevelObjectsUI.structuresToggle;

            if (EditorLevelObjectsUI.< > f__mg$cache7 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache7 = new Toggled(EditorLevelObjectsUI.onToggledStructuresToggle);
            }
            sleekToggle5.onToggled = EditorLevelObjectsUI.< > f__mg$cache7;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.structuresToggle);
            EditorLevelObjectsUI.npcsToggle = new SleekToggle();
            EditorLevelObjectsUI.npcsToggle.positionOffset_X = -130;
            EditorLevelObjectsUI.npcsToggle.positionOffset_Y = 260;
            EditorLevelObjectsUI.npcsToggle.positionScale_X  = 1f;
            EditorLevelObjectsUI.npcsToggle.sizeOffset_X     = 40;
            EditorLevelObjectsUI.npcsToggle.sizeOffset_Y     = 40;
            EditorLevelObjectsUI.npcsToggle.addLabel(local.format("NPCsLabel"), ESleekSide.RIGHT);
            EditorLevelObjectsUI.npcsToggle.state = true;
            SleekToggle sleekToggle6 = EditorLevelObjectsUI.npcsToggle;

            if (EditorLevelObjectsUI.< > f__mg$cache8 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache8 = new Toggled(EditorLevelObjectsUI.onToggledNPCsToggle);
            }
            sleekToggle6.onToggled = EditorLevelObjectsUI.< > f__mg$cache8;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.npcsToggle);
            EditorLevelObjectsUI.assetsScrollBox = new SleekScrollBox();
            EditorLevelObjectsUI.assetsScrollBox.positionOffset_X = -230;
            EditorLevelObjectsUI.assetsScrollBox.positionOffset_Y = 310;
            EditorLevelObjectsUI.assetsScrollBox.positionScale_X  = 1f;
            EditorLevelObjectsUI.assetsScrollBox.sizeOffset_X     = 230;
            EditorLevelObjectsUI.assetsScrollBox.sizeOffset_Y     = -310;
            EditorLevelObjectsUI.assetsScrollBox.sizeScale_Y      = 1f;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.assetsScrollBox);
            EditorObjects.selectedObjectAsset = null;
            EditorObjects.selectedItemAsset   = null;
            if (EditorLevelObjectsUI.< > f__mg$cache9 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache9 = new DragStarted(EditorLevelObjectsUI.onDragStarted);
            }
            EditorObjects.onDragStarted = EditorLevelObjectsUI.< > f__mg$cache9;
            if (EditorLevelObjectsUI.< > f__mg$cacheA == null)
            {
                EditorLevelObjectsUI.< > f__mg$cacheA = new DragStopped(EditorLevelObjectsUI.onDragStopped);
            }
            EditorObjects.onDragStopped  = EditorLevelObjectsUI.< > f__mg$cacheA;
            EditorLevelObjectsUI.dragBox = new SleekBox();
            EditorUI.window.add(EditorLevelObjectsUI.dragBox);
            EditorLevelObjectsUI.dragBox.isVisible  = false;
            EditorLevelObjectsUI.snapTransformField = new SleekSingleField();
            EditorLevelObjectsUI.snapTransformField.positionOffset_Y = -230;
            EditorLevelObjectsUI.snapTransformField.positionScale_Y  = 1f;
            EditorLevelObjectsUI.snapTransformField.sizeOffset_X     = 200;
            EditorLevelObjectsUI.snapTransformField.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.snapTransformField.text             = (Mathf.Floor(EditorObjects.snapTransform * 100f) / 100f).ToString();
            EditorLevelObjectsUI.snapTransformField.addLabel(local.format("SnapTransformLabelText"), ESleekSide.RIGHT);
            SleekSingleField sleekSingleField = EditorLevelObjectsUI.snapTransformField;

            if (EditorLevelObjectsUI.< > f__mg$cacheB == null)
            {
                EditorLevelObjectsUI.< > f__mg$cacheB = new TypedSingle(EditorLevelObjectsUI.onTypedSnapTransformField);
            }
            sleekSingleField.onTypedSingle = EditorLevelObjectsUI.< > f__mg$cacheB;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.snapTransformField);
            EditorLevelObjectsUI.snapRotationField = new SleekSingleField();
            EditorLevelObjectsUI.snapRotationField.positionOffset_Y = -190;
            EditorLevelObjectsUI.snapRotationField.positionScale_Y  = 1f;
            EditorLevelObjectsUI.snapRotationField.sizeOffset_X     = 200;
            EditorLevelObjectsUI.snapRotationField.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.snapRotationField.text             = (Mathf.Floor(EditorObjects.snapRotation * 100f) / 100f).ToString();
            EditorLevelObjectsUI.snapRotationField.addLabel(local.format("SnapRotationLabelText"), ESleekSide.RIGHT);
            SleekSingleField sleekSingleField2 = EditorLevelObjectsUI.snapRotationField;

            if (EditorLevelObjectsUI.< > f__mg$cacheC == null)
            {
                EditorLevelObjectsUI.< > f__mg$cacheC = new TypedSingle(EditorLevelObjectsUI.onTypedSnapRotationField);
            }
            sleekSingleField2.onTypedSingle = EditorLevelObjectsUI.< > f__mg$cacheC;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.snapRotationField);
            EditorLevelObjectsUI.transformButton = new SleekButtonIcon((Texture2D)bundle.load("Transform"));
            EditorLevelObjectsUI.transformButton.positionOffset_Y = -150;
            EditorLevelObjectsUI.transformButton.positionScale_Y  = 1f;
            EditorLevelObjectsUI.transformButton.sizeOffset_X     = 200;
            EditorLevelObjectsUI.transformButton.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.transformButton.text             = local.format("TransformButtonText", new object[]
            {
                ControlsSettings.tool_0
            });
            EditorLevelObjectsUI.transformButton.tooltip = local.format("TransformButtonTooltip");
            SleekButton sleekButton2 = EditorLevelObjectsUI.transformButton;

            if (EditorLevelObjectsUI.< > f__mg$cacheD == null)
            {
                EditorLevelObjectsUI.< > f__mg$cacheD = new ClickedButton(EditorLevelObjectsUI.onClickedTransformButton);
            }
            sleekButton2.onClickedButton = EditorLevelObjectsUI.< > f__mg$cacheD;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.transformButton);
            EditorLevelObjectsUI.rotateButton = new SleekButtonIcon((Texture2D)bundle.load("Rotate"));
            EditorLevelObjectsUI.rotateButton.positionOffset_Y = -110;
            EditorLevelObjectsUI.rotateButton.positionScale_Y  = 1f;
            EditorLevelObjectsUI.rotateButton.sizeOffset_X     = 200;
            EditorLevelObjectsUI.rotateButton.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.rotateButton.text             = local.format("RotateButtonText", new object[]
            {
                ControlsSettings.tool_1
            });
            EditorLevelObjectsUI.rotateButton.tooltip = local.format("RotateButtonTooltip");
            SleekButton sleekButton3 = EditorLevelObjectsUI.rotateButton;

            if (EditorLevelObjectsUI.< > f__mg$cacheE == null)
            {
                EditorLevelObjectsUI.< > f__mg$cacheE = new ClickedButton(EditorLevelObjectsUI.onClickedRotateButton);
            }
            sleekButton3.onClickedButton = EditorLevelObjectsUI.< > f__mg$cacheE;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.rotateButton);
            EditorLevelObjectsUI.scaleButton = new SleekButtonIcon((Texture2D)bundle.load("Scale"));
            EditorLevelObjectsUI.scaleButton.positionOffset_Y = -70;
            EditorLevelObjectsUI.scaleButton.positionScale_Y  = 1f;
            EditorLevelObjectsUI.scaleButton.sizeOffset_X     = 200;
            EditorLevelObjectsUI.scaleButton.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.scaleButton.text             = local.format("ScaleButtonText", new object[]
            {
                ControlsSettings.tool_3
            });
            EditorLevelObjectsUI.scaleButton.tooltip = local.format("ScaleButtonTooltip");
            SleekButton sleekButton4 = EditorLevelObjectsUI.scaleButton;

            if (EditorLevelObjectsUI.< > f__mg$cacheF == null)
            {
                EditorLevelObjectsUI.< > f__mg$cacheF = new ClickedButton(EditorLevelObjectsUI.onClickedScaleButton);
            }
            sleekButton4.onClickedButton = EditorLevelObjectsUI.< > f__mg$cacheF;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.scaleButton);
            EditorLevelObjectsUI.coordinateButton = new SleekButtonState(new GUIContent[]
            {
                new GUIContent(local.format("CoordinateButtonTextGlobal"), (Texture)bundle.load("Global")),
                new GUIContent(local.format("CoordinateButtonTextLocal"), (Texture)bundle.load("Local"))
            });
            EditorLevelObjectsUI.coordinateButton.positionOffset_Y = -30;
            EditorLevelObjectsUI.coordinateButton.positionScale_Y  = 1f;
            EditorLevelObjectsUI.coordinateButton.sizeOffset_X     = 200;
            EditorLevelObjectsUI.coordinateButton.sizeOffset_Y     = 30;
            EditorLevelObjectsUI.coordinateButton.tooltip          = local.format("CoordinateButtonTooltip");
            SleekButtonState sleekButtonState = EditorLevelObjectsUI.coordinateButton;

            if (EditorLevelObjectsUI.< > f__mg$cache10 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache10 = new SwappedState(EditorLevelObjectsUI.onSwappedStateCoordinate);
            }
            sleekButtonState.onSwappedState = EditorLevelObjectsUI.< > f__mg$cache10;
            EditorLevelObjectsUI.container.add(EditorLevelObjectsUI.coordinateButton);
            bundle.unload();
            EditorLevelObjectsUI.onAssetsRefreshed();
            if (EditorLevelObjectsUI.< > f__mg$cache11 == null)
            {
                EditorLevelObjectsUI.< > f__mg$cache11 = new AssetsRefreshed(EditorLevelObjectsUI.onAssetsRefreshed);
            }
            Assets.onAssetsRefreshed = EditorLevelObjectsUI.< > f__mg$cache11;
        }
Beispiel #7
0
 private void StartDrag()
 {
     RunThumbAnimation("Press");
     DragStarted?.Invoke();
 }
Beispiel #8
0
 protected virtual void OnDragStarted(Dock position, double delta)
 {
     DragStarted?.Invoke(this, position, delta);
 }
Beispiel #9
0
 protected virtual void OnDragStarted()
 {
     DragStarted?.Invoke(this, EventArgs.Empty);
 }
 void OnMouseUp()
 {
     Dragging = false;
     DragStarted?.Invoke(InstanceId, Dragging);
 }
Beispiel #11
0
 public void OnDragStarted()
 {
     DragStarted?.Invoke(this, EventArgs.Empty);
 }
 protected virtual void OnDragStarted()
 {
     _isDragging = true;
     DragStarted?.Invoke(this, EventArgs.Empty);
 }
Beispiel #13
0
 void SetupSliderDragHandlers(Slider slider)
 {
     slider.DragStarted += () => DragStarted?.Invoke();
     slider.DragEnded   += () => DragEnded?.Invoke();
     slider.Changed     += () => Changed?.Invoke();
 }
Beispiel #14
0
        // Dragging Methods - on drag start this will callback to the parent component to let it know which child component is being dragged

        //then it

        async Task DragStart()
        {
            await DragStarted.InvokeAsync(Exercise);

            DragClass = "dragging";
        }
 private void MaxThumb_DragStarted(object sender, DragStartedEventArgs e)
 {
     _aggregatedDrag = 0;
     _initialLeft    = Canvas.GetLeft(MaxThumb);
     DragStarted?.Invoke(this, EventArgs.Empty);
 }
 protected override void OnThumbDragStarted(DragStartedEventArgs e)
 {
     base.OnThumbDragStarted(e);
     DragStarted?.Invoke(this, e);
 }
Beispiel #17
0
        // Token: 0x060038F8 RID: 14584 RVA: 0x001A28D8 File Offset: 0x001A0CD8
        public PlayerWorkzoneUI()
        {
            Local  local  = Localization.read("/Editor/EditorLevelObjects.dat");
            Bundle bundle = Bundles.getBundle("/Bundles/Textures/Edit/Icons/EditorLevelObjects/EditorLevelObjects.unity3d");

            PlayerWorkzoneUI.container = new Sleek();
            PlayerWorkzoneUI.container.positionOffset_X = 10;
            PlayerWorkzoneUI.container.positionOffset_Y = 10;
            PlayerWorkzoneUI.container.positionScale_X  = 1f;
            PlayerWorkzoneUI.container.sizeOffset_X     = -20;
            PlayerWorkzoneUI.container.sizeOffset_Y     = -20;
            PlayerWorkzoneUI.container.sizeScale_X      = 1f;
            PlayerWorkzoneUI.container.sizeScale_Y      = 1f;
            PlayerUI.window.add(PlayerWorkzoneUI.container);
            PlayerWorkzoneUI.active = false;
            PlayerWorkzone workzone = Player.player.workzone;

            if (PlayerWorkzoneUI.< > f__mg$cache0 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache0 = new DragStarted(PlayerWorkzoneUI.onDragStarted);
            }
            workzone.onDragStarted = PlayerWorkzoneUI.< > f__mg$cache0;
            PlayerWorkzone workzone2 = Player.player.workzone;

            if (PlayerWorkzoneUI.< > f__mg$cache1 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache1 = new DragStopped(PlayerWorkzoneUI.onDragStopped);
            }
            workzone2.onDragStopped  = PlayerWorkzoneUI.< > f__mg$cache1;
            PlayerWorkzoneUI.dragBox = new SleekBox();
            PlayerUI.window.add(PlayerWorkzoneUI.dragBox);
            PlayerWorkzoneUI.dragBox.isVisible  = false;
            PlayerWorkzoneUI.snapTransformField = new SleekSingleField();
            PlayerWorkzoneUI.snapTransformField.positionOffset_Y = -190;
            PlayerWorkzoneUI.snapTransformField.positionScale_Y  = 1f;
            PlayerWorkzoneUI.snapTransformField.sizeOffset_X     = 200;
            PlayerWorkzoneUI.snapTransformField.sizeOffset_Y     = 30;
            PlayerWorkzoneUI.snapTransformField.text             = (Mathf.Floor(Player.player.workzone.snapTransform * 100f) / 100f).ToString();
            PlayerWorkzoneUI.snapTransformField.addLabel(local.format("SnapTransformLabelText"), ESleekSide.RIGHT);
            SleekSingleField sleekSingleField = PlayerWorkzoneUI.snapTransformField;

            if (PlayerWorkzoneUI.< > f__mg$cache2 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache2 = new TypedSingle(PlayerWorkzoneUI.onTypedSnapTransformField);
            }
            sleekSingleField.onTypedSingle = PlayerWorkzoneUI.< > f__mg$cache2;
            PlayerWorkzoneUI.container.add(PlayerWorkzoneUI.snapTransformField);
            PlayerWorkzoneUI.snapRotationField = new SleekSingleField();
            PlayerWorkzoneUI.snapRotationField.positionOffset_Y = -150;
            PlayerWorkzoneUI.snapRotationField.positionScale_Y  = 1f;
            PlayerWorkzoneUI.snapRotationField.sizeOffset_X     = 200;
            PlayerWorkzoneUI.snapRotationField.sizeOffset_Y     = 30;
            PlayerWorkzoneUI.snapRotationField.text             = (Mathf.Floor(Player.player.workzone.snapRotation * 100f) / 100f).ToString();
            PlayerWorkzoneUI.snapRotationField.addLabel(local.format("SnapRotationLabelText"), ESleekSide.RIGHT);
            SleekSingleField sleekSingleField2 = PlayerWorkzoneUI.snapRotationField;

            if (PlayerWorkzoneUI.< > f__mg$cache3 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache3 = new TypedSingle(PlayerWorkzoneUI.onTypedSnapRotationField);
            }
            sleekSingleField2.onTypedSingle = PlayerWorkzoneUI.< > f__mg$cache3;
            PlayerWorkzoneUI.container.add(PlayerWorkzoneUI.snapRotationField);
            PlayerWorkzoneUI.transformButton = new SleekButtonIcon((Texture2D)bundle.load("Transform"));
            PlayerWorkzoneUI.transformButton.positionOffset_Y = -110;
            PlayerWorkzoneUI.transformButton.positionScale_Y  = 1f;
            PlayerWorkzoneUI.transformButton.sizeOffset_X     = 200;
            PlayerWorkzoneUI.transformButton.sizeOffset_Y     = 30;
            PlayerWorkzoneUI.transformButton.text             = local.format("TransformButtonText", new object[]
            {
                ControlsSettings.tool_0
            });
            PlayerWorkzoneUI.transformButton.tooltip = local.format("TransformButtonTooltip");
            SleekButton sleekButton = PlayerWorkzoneUI.transformButton;

            if (PlayerWorkzoneUI.< > f__mg$cache4 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache4 = new ClickedButton(PlayerWorkzoneUI.onClickedTransformButton);
            }
            sleekButton.onClickedButton = PlayerWorkzoneUI.< > f__mg$cache4;
            PlayerWorkzoneUI.container.add(PlayerWorkzoneUI.transformButton);
            PlayerWorkzoneUI.rotateButton = new SleekButtonIcon((Texture2D)bundle.load("Rotate"));
            PlayerWorkzoneUI.rotateButton.positionOffset_Y = -70;
            PlayerWorkzoneUI.rotateButton.positionScale_Y  = 1f;
            PlayerWorkzoneUI.rotateButton.sizeOffset_X     = 200;
            PlayerWorkzoneUI.rotateButton.sizeOffset_Y     = 30;
            PlayerWorkzoneUI.rotateButton.text             = local.format("RotateButtonText", new object[]
            {
                ControlsSettings.tool_1
            });
            PlayerWorkzoneUI.rotateButton.tooltip = local.format("RotateButtonTooltip");
            SleekButton sleekButton2 = PlayerWorkzoneUI.rotateButton;

            if (PlayerWorkzoneUI.< > f__mg$cache5 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache5 = new ClickedButton(PlayerWorkzoneUI.onClickedRotateButton);
            }
            sleekButton2.onClickedButton = PlayerWorkzoneUI.< > f__mg$cache5;
            PlayerWorkzoneUI.container.add(PlayerWorkzoneUI.rotateButton);
            PlayerWorkzoneUI.coordinateButton = new SleekButtonState(new GUIContent[]
            {
                new GUIContent(local.format("CoordinateButtonTextGlobal"), (Texture)bundle.load("Global")),
                new GUIContent(local.format("CoordinateButtonTextLocal"), (Texture)bundle.load("Local"))
            });
            PlayerWorkzoneUI.coordinateButton.positionOffset_Y = -30;
            PlayerWorkzoneUI.coordinateButton.positionScale_Y  = 1f;
            PlayerWorkzoneUI.coordinateButton.sizeOffset_X     = 200;
            PlayerWorkzoneUI.coordinateButton.sizeOffset_Y     = 30;
            PlayerWorkzoneUI.coordinateButton.tooltip          = local.format("CoordinateButtonTooltip");
            SleekButtonState sleekButtonState = PlayerWorkzoneUI.coordinateButton;

            if (PlayerWorkzoneUI.< > f__mg$cache6 == null)
            {
                PlayerWorkzoneUI.< > f__mg$cache6 = new SwappedState(PlayerWorkzoneUI.onSwappedStateCoordinate);
            }
            sleekButtonState.onSwappedState = PlayerWorkzoneUI.< > f__mg$cache6;
            PlayerWorkzoneUI.container.add(PlayerWorkzoneUI.coordinateButton);
            bundle.unload();
        }
Beispiel #18
0
 public virtual void StartDrag(Vector3 mousePosition) => DragStarted?.Invoke(this, mousePosition);
Beispiel #19
0
 protected void RaiseDragStarted() => DragStarted?.Invoke();