public static void DrawDragDrop(string label, OnDrop onDrop, float height = 50.0f) { Event evt = Event.current; GUIStyle guiStyle = GUI.skin.GetStyle("Box"); guiStyle.alignment = TextAnchor.MiddleCenter; Rect dropArea = GUILayoutUtility.GetRect(0.0f, height, GUILayout.ExpandWidth(true)); GUI.Box(dropArea, label, guiStyle); switch (evt.type) { case EventType.DragUpdated: case EventType.DragPerform: if (!dropArea.Contains(evt.mousePosition)) { return; } DragAndDrop.visualMode = DragAndDropVisualMode.Copy; if (evt.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); onDrop(DragAndDrop.objectReferences); } break; } }
internal protected virtual void TriggerOnDrop(Component sender, int x, int y, MouseButton button) { if (OnDrop != null) { OnDrop.Invoke(new MouseButtonEventArgs(sender, x, y, button)); } }
/// <summary> /// Raises a notification that a collection of specified <paramref name="fileNames"/> /// has been dropped. /// </summary> /// <param name="fileNames"> /// A collection with the file names of the dropped files. /// </param> public void Drop(string[] fileNames) { bool onlyFiles = fileNames.Where(IsFilePath).Count() == fileNames.Length; bool onlyDirectories = !onlyFiles && fileNames.Where(x => !IsFilePath(x)).Count() == fileNames.Length; bool directoriesAndFiles = !onlyFiles && !onlyDirectories; OnDrop?.Invoke(this, new DropDataEventArgs(fileNames, onlyDirectories, onlyFiles, directoriesAndFiles)); }
public void OnEndDrag(PointerEventData eventData) { DraggedInstance = null; _offsetToMouse = Vector3.zero; OnDrop?.Invoke(Camera.main.ScreenToWorldPoint( new Vector3(Input.mousePosition.x, Input.mousePosition.y, _zDistanceToCamera) ), gameObject); }
/// <summary> /// The SmashDown /// </summary> public void SmashDown() { while (CanMoveDown(CurrentPiece)) { CurrentPiece.MoveDown(); OnSlide?.Invoke(); } Checkout(); OnDrop?.Invoke(); }
public void DropOverhead() { if (overheadRB != null) { overheadRB.transform.parent = null; overheadRB.bodyType = RigidbodyType2D.Dynamic; overheadRB = null; OnDrop?.Invoke(); playerControl.overhead.SwitchState(OverheadState.None); } }
public async Task OnDropCallback(string returnValue) { try { var response = JsonConvert.DeserializeObject <CalendarEventChangeResponse>(returnValue); await OnDrop.InvokeAsync(response); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
protected override void OnDragDropStart() { onRelease = transform.parent.FindChild("Icon").GetComponent <ItemAssistRoleDrag>().onRelease; base.OnDragDropStart(); //UICamera.currentTouch.dragged.transform.FindChild("GetInfo").gameObject.SetActive(false); //UICamera.currentTouch.dragged.transform.FindChild("Name").gameObject.SetActive(false); //UICamera.currentTouch.dragged.transform.FindChild("Position").gameObject.SetActive(false); //UICamera.currentTouch.dragged.transform.GetComponent<UISprite>().enabled = false; UICamera.currentTouch.dragged.transform.FindChild("Side").gameObject.SetActive(false); NGUITools.BringForward(UICamera.currentTouch.dragged); }
public void Drop() { if (GrabInteractor != null) { OnDrop?.Invoke(this, GrabInteractor); var tempTransform = GrabInteractor; // Do this to prevent an endless loop of dropping GrabInteractor = null; tempTransform.GetComponent <PlayerInput_Interactor>().ForceDrop(); } ChangeLayerOfAllColliders(InitialLayer); }
IEnumerator DropCoroutine(HandBehavior hand) { OnDrop?.Invoke(hand); this.held = false; this.transform.parent = null; this.holder = null; this.gameObject.layer = layerBak; this.rigidbody.isKinematic = false; this.rigidbody.useGravity = true; yield return(new WaitForSeconds(.3f)); foreach (Collider collider in colliders) { Physics.IgnoreCollision(collider, hand.collider, false); } Physics.IgnoreCollision(this.collider, hand.collider, false); }
public void OnEndDrag(PointerEventData eventData) { if (state == SwipeState.DISABLE) { return; } if (cardController != null) { cardController.OnEndDrag(); } OnDrop?.Invoke(); Vector2 distance = rectTransform.anchoredPosition - pivotPoint; if (distance.magnitude >= swipeDetectionLimit_LR) { if (rectTransform.anchoredPosition.x < pivotPoint.x) { TriggerLeft(); } else { TriggerRight(); } state = SwipeState.DISABLE; eventData.pointerDrag = null; OnEndSwipe?.Invoke(); if (isActiveAndEnabled) { Coroutine _coroutine = StartCoroutine(OnFideOut()); _coroutine = null; } } else { state = SwipeState.RETURN; } }
private void CallOnDropChain(UiDragDropArgs args) { args.Handled = false; OnDrop?.Invoke(args); if (args.Handled) { return; } if (args.Target is IDragDropAware targetAware) { targetAware.OnDrop(args); if (args.Handled) { return; } } if (args.TargetElement != containerElement && containerElement.DataContext is IDragDropAware elementAware) { elementAware.OnDrop(args); } }
/// <summary> /// Prevents a default instance of the <see cref="GameController"/> class from being created. /// </summary> /// <param name="width">The width<see cref="int"/></param> /// <param name="height">The height<see cref="int"/></param> private GameController(int width, int height) { if (width < 10) { throw new ArgumentException(nameof(width)); } if (height < 10) { throw new ArgumentException(nameof(height)); } _board = new Board(new StatsRepository(), width, height); _board.OnRefresh += () => OnRefresh?.Invoke(); _board.OnFinish += () => OnFinish?.Invoke(); _board.OnLose += () => OnLose?.Invoke(); _board.OnClear += () => OnClear?.Invoke(); _board.OnMove += () => OnMove?.Invoke(); _board.OnSlide += () => OnSlide?.Invoke(); _board.OnPause += () => OnPause?.Invoke(); _board.OnContinue += () => OnContinue?.Invoke(); _board.OnDrop += () => OnDrop?.Invoke(); }
public void TriggerOnDrop(Widget dropWidget, Widget dragWidget, PointerEventData eventData) { OnDrop?.Invoke(dropWidget, dragWidget, eventData); }
protected virtual Task HandleDrop(DragEventArgs args) { return(OnDrop.InvokeAsync(args)); }
void ObjectDrop(OnDrop pEvent) { PlayEmitter(SFX_OBJ_DROP_STRING); }
void OnSceneDragableMouseUp(ISceneDragable currentSceneDragable) { OnDrop?.Invoke(currentSceneDragable); OnSceneDragableDragEnd?.Invoke(); OnSceneDragableActions -= OnSceneDragableMouseUp; }
/// <summary> /// Trigger the drag-and-drop end event /// </summary> /// <param name="dropObject">The object being dragged</param> /// <param name="jointType">Joint type</param> protected void OnDropAction(T dropObject, JointType jointType) { OnDrop?.Invoke(dropObject, jointType); }
private void OnMouseDragEnd(object?sender, MouseEventArgs e) { OnDrop?.Invoke(this); this.Close(); }
public void ParentDrop(int id) { ParentId = id; OnDrop?.Invoke(this, null); }
public bool Drop(IItem item) { inventory.Remove(item); OnDrop?.Invoke(item); return(true); }
public void Drop() { OnDrop?.Invoke(); }
private void Drop(Glfw.Window window, int num, string[] files) { OnDrop?.Invoke(this, new WindowFileDropEventArgs { FilesPath = new List<string>(files) }); }
public void Dropped(IDraggable element) { OnDrop?.Invoke(element); }
public void InvokeDrop(GameObject self, Interactable on) { //transform.parent = previousParent; //previousParent = null; OnDrop?.Invoke(self, on); }
public static void DropItems() { OnDrop?.Invoke(); }
public void Drop(CallInfo callInfo) { OnDrop?.Invoke(callInfo); }
public virtual void Drop() { PickedUp = false; OnDrop?.Invoke(this); }
internal virtual void DoDrop(GuiElement elem) { OnDrop?.Invoke(elem); }