/** * <summary>Checks if the dragging should be cancelled.</summary> * <param name = "mousePosition">The position of the mouse cursor</param> * <returns>True if the dragging should be cancelled</returns> */ public bool CheckStop(Vector2 mousePosition) { if (menuToDrag == null) { return(false); } if (dragType == DragElementType.EntireMenu && !menuToDrag.IsPointerOverSlot(this, 0, mousePosition)) { return(true); } if (dragType == DragElementType.SingleElement && elementToDrag != null && !menuToDrag.IsPointerOverSlot(this, 0, mousePosition)) { return(true); } return(false); }
private void OnGUI() { if (!Application.isPlaying) { if (AdvGame.GetReferences()) { menuManager = AdvGame.GetReferences().menuManager; if (menuManager && menuManager.drawInEditor && AdvGame.GetReferences().viewingMenuManager) { if (menuManager.GetSelectedMenu() != null) { AC.Menu menu = menuManager.GetSelectedMenu(); if (menu.IsUnityUI()) { return; } CheckScreenSize(menu); if ((menu.appearType == AppearType.Manual || menu.appearType == AppearType.OnInputKey) && menu.pauseWhenEnabled && menuManager.pauseTexture) { GUI.DrawTexture(AdvGame.GUIRect(0.5f, 0.5f, 1f, 1f), menuManager.pauseTexture, ScaleMode.ScaleToFit, true, 0f); } if ((menu.positionType == AC_PositionType.FollowCursor || menu.positionType == AC_PositionType.AppearAtCursorAndFreeze || menu.positionType == AC_PositionType.OnHotspot || menu.positionType == AC_PositionType.AboveSpeakingCharacter || menu.positionType == AC_PositionType.AbovePlayer) && AdvGame.GetReferences().cursorManager&& AdvGame.GetReferences().cursorManager.pointerIcon.texture) { CursorIconBase icon = AdvGame.GetReferences().cursorManager.pointerIcon; GUI.DrawTexture(AdvGame.GUIBox(new Vector2(AdvGame.GetMainGameViewSize().x / 2f, AdvGame.GetMainGameViewSize().y / 2f), icon.size), icon.texture, ScaleMode.ScaleToFit, true, 0f); } menu.StartDisplay(); foreach (MenuElement element in menu.visibleElements) { SetStyles(element); for (int i = 0; i < element.GetNumSlots(); i++) { if (menuManager.GetSelectedElement() == element && element.isClickable && i == 0) { // element.PreDisplay (i, true, 0); element.Display(highlightedStyle, i, 1f, true); } else { // element.PreDisplay (i, true, 0); element.Display(normalStyle, i, 1f, false); } } if (UnityEditor.EditorWindow.mouseOverWindow != null && UnityEditor.EditorWindow.mouseOverWindow.ToString().Contains("(UnityEditor.GameView)")) { if (menu.IsPointerOverSlot(element, 0, Event.current.mousePosition + new Vector2(menu.GetRect().x, menu.GetRect().y))) { menuManager.SelectElementFromPreview(menu, element); } } } menu.EndDisplay(); if (menuManager.drawOutlines) { menu.DrawOutline(menuManager.GetSelectedElement()); } } } } } }