private void DrawPreviewMenu(Menu menu) { if (menu == null || menu.IsUnityUI()) { return; } if (KickStarter.mainCamera != null) { KickStarter.mainCamera.DrawBorders(); } CheckScreenSize(menu); if (menu.CanPause() && 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.Display(highlightedStyle, i, 1f, true); } else { element.Display(normalStyle, i, 1f, false); } } if (UnityEditor.EditorWindow.mouseOverWindow != null && UnityEditor.EditorWindow.mouseOverWindow.ToString() != 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()); } }
public void DrawArrows() { if (alpha > 0f) { if (directionToAnimate != AC_Direction.None) { SetGUIAlpha(alpha); if (directionToAnimate == AC_Direction.Up) { upArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.5f, 0.1f, arrowSize * 2, arrowSize)); } else if (directionToAnimate == AC_Direction.Down) { downArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.5f, 0.9f, arrowSize * 2, arrowSize)); } else if (directionToAnimate == AC_Direction.Left) { leftArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.05f, 0.5f, arrowSize, arrowSize * 2)); } else if (directionToAnimate == AC_Direction.Right) { rightArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.95f, 0.5f, arrowSize, arrowSize * 2)); } } else { SetGUIAlpha(alpha); if (upArrow.isPresent) { upArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.5f, 0.1f, 0.1f, 0.05f)); } if (downArrow.isPresent) { downArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.5f, 0.9f, 0.1f, 0.05f)); } if (leftArrow.isPresent) { leftArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.05f, 0.5f, 0.05f, 0.1f)); } if (rightArrow.isPresent) { rightArrow.rect = KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.95f, 0.5f, 0.05f, 0.1f)); } } upArrow.Draw(); downArrow.Draw(); leftArrow.Draw(); rightArrow.Draw(); } }
private Rect GetRightRect(float scale = 0.05f) { return(KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(1f - (0.05f * positionFactor * 2f), 0.5f, scale * scaleFactor, scale * 2f * scaleFactor))); }
protected Rect GetLeftRect(float scale = 0.05f) { return(KickStarter.mainCamera.LimitMenuToAspect(AdvGame.GUIRect(0.05f * positionFactor * 2f, 0.5f, scale * scaleFactor, scale * 2f * scaleFactor))); }
private void OnGUI() { if (!Application.isPlaying) { if (AdvGame.GetReferences()) { menuManager = AdvGame.GetReferences().menuManager; if (menuManager && menuManager.drawInEditor) { 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 (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()); } } } } } }