private void UpdateAllPosition() { if (_tooltipPrefab == null || _cursorPrefab == null) { return; } if (_currentTooltip == null) { _currentTooltip = Instantiate(_tooltipPrefab); } if (_currentCursor == null) { _currentCursor = Instantiate(_cursorPrefab).GetComponent <CursorDisplay>(); } bool exitRight = Input.mousePosition.x >= (Screen.width - _tooltipScreenEdgeToolTipLimit); float displacementRatioX = exitRight ? _tooltipDisplacementRatioXLeft : _tooltipDisplacementRatioXRight; float displacementRatioY = _tooltipDisplacementRatioY; displacementRatioX *= Screen.width; displacementRatioY *= Screen.height; Transform tooltipTransform = _currentTooltip.transform.GetComponentInChildren <Image>()?.transform; if (tooltipTransform != null) { tooltipTransform.position = Input.mousePosition + new Vector3(displacementRatioX, displacementRatioY, 0); } if (_currentCursor != null && _currentSetting != null) { _currentCursor.SetCursorsPosition(Input.mousePosition + new Vector3(_currentSetting.Displacement.x, _currentSetting.Displacement.y, 0)); } }
public void ShowGUI () { settingsManager = AdvGame.GetReferences().settingsManager; cursorRendering = (CursorRendering) EditorGUILayout.EnumPopup ("Cursor rendering:", cursorRendering); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Main cursor", EditorStyles.boldLabel); cursorDisplay = (CursorDisplay) EditorGUILayout.EnumPopup ("Display cursor:", cursorDisplay); allowMainCursor = EditorGUILayout.Toggle ("Replace mouse cursor?", allowMainCursor); if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController)) { IconBaseGUI ("Main cursor:", pointerIcon); IconBaseGUI ("Walk cursor (optional):", walkIcon); onlyWalkWhenOverNavMesh = EditorGUILayout.ToggleLeft ("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh); } EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Hotspot settings", EditorStyles.boldLabel); addHotspotPrefix = EditorGUILayout.Toggle ("Prefix cursor labels?", addHotspotPrefix); IconBaseGUI ("Mouse-over cursor:", mouseOverIcon); EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Inventory cursor", EditorStyles.boldLabel); if ((settingsManager && settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction) || (settingsManager && settingsManager.SelectInteractionMethod () == SelectInteractions.CyclingCursorAndClickingHotspot)) { inventoryHandling = (InventoryHandling) EditorGUILayout.EnumPopup ("When inventory selected:", inventoryHandling); if (inventoryHandling == InventoryHandling.ChangeCursor || inventoryHandling == InventoryHandling.ChangeCursorAndHotspotLabel) { inventoryCursorSize = EditorGUILayout.FloatField ("Inventory cursor size:", inventoryCursorSize); } } EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Syntax:", GUILayout.Width (60f)); hotspotPrefix1.label = EditorGUILayout.TextField (hotspotPrefix1.label, GUILayout.MaxWidth (80f)); EditorGUILayout.LabelField ("(item)", GUILayout.MaxWidth (40f)); hotspotPrefix2.label = EditorGUILayout.TextField (hotspotPrefix2.label, GUILayout.MaxWidth (80f)); EditorGUILayout.LabelField ("(hotspot)", GUILayout.MaxWidth (55f)); EditorGUILayout.EndHorizontal (); EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Interaction icons", EditorStyles.boldLabel); if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction) { allowInteractionCursor = EditorGUILayout.BeginToggleGroup ("Change cursor when over Hotspots?", allowInteractionCursor); if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { cycleCursors = EditorGUILayout.Toggle ("Cycle with right click?", cycleCursors); } if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { allowInteractionCursorForInventory = EditorGUILayout.Toggle ("Change for inventory too?", allowInteractionCursorForInventory); } EditorGUILayout.EndToggleGroup (); } IconsGUI (); EditorGUILayout.Space (); if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { LookIconGUI (); } EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); IconBaseGUI ("Wait cursor", waitIcon); EditorGUILayout.EndVertical (); if (GUI.changed) { EditorUtility.SetDirty (this); } }
/** * Shows the GUI. */ public void ShowGUI() { settingsManager = AdvGame.GetReferences().settingsManager; EditorGUILayout.BeginVertical(CustomStyles.thinBox); showSettings = CustomGUILayout.ToggleHeader(showSettings, "Global cursor settings"); if (showSettings) { cursorRendering = (CursorRendering)CustomGUILayout.EnumPopup("Cursor rendering:", cursorRendering, "AC.KickStarter.cursorManager.cursorRendering", "The rendering method of all cursors"); if (cursorRendering == CursorRendering.Software) { lockSystemCursor = CustomGUILayout.ToggleLeft("Lock system cursor when locking AC cursor?", lockSystemCursor, "AC.KickStarter.cursorManager.lockSystemCursor", "If True, the system cursor will be locked when the AC cursor is"); } forceCursorInEditor = CustomGUILayout.ToggleLeft("Always show system cursor in Editor?", forceCursorInEditor, "AC.KickStarter.cursorManager.forceCursorInEditor"); if (cursorRendering == CursorRendering.Software) { keepCursorWithinScreen = CustomGUILayout.ToggleLeft("Always keep cursor within screen boundary?", keepCursorWithinScreen, "AC.KickStarter.cursorManager.keepCursorWithinScreen", "If True, then the cursor will always be kept within the boundary of the game window"); } else { keepCursorWithinScreen = CustomGUILayout.ToggleLeft("Always keep perceived cursor within screen boundary?", keepCursorWithinScreen, "AC.KickStarter.cursorManager.keepCursorWithinScreen", "If True, then the cursor will always be kept within the boundary of the game window"); } #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN confineSystemCursor = CustomGUILayout.ToggleLeft("Confine system cursor to game window?", confineSystemCursor, "AC.KickStarter.cursorManager.confineSystemCursor", "If True, then the system cursor will be confined to the game window"); #endif } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showMainCursor = CustomGUILayout.ToggleHeader(showMainCursor, "Main cursor settings"); if (showMainCursor) { cursorDisplay = (CursorDisplay)CustomGUILayout.EnumPopup("Display cursor:", cursorDisplay, "AC.KickStarter.cursorManager.cursorDisplay", "The rule that defines when the main cursor is shown"); if (cursorDisplay != CursorDisplay.Never) { allowMainCursor = CustomGUILayout.Toggle("Replace mouse cursor?", allowMainCursor, "AC.KickStarter.cursorManager.allowMainCursor", "If True, then the system's default hardware cursor will replaced with a custom one"); if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController)) { IconBaseGUI("", pointerIcon, "AC.KickStarter.cursorManager.pointerIcon", "The game's default cursor", false); } } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showWalkCursor = CustomGUILayout.ToggleHeader(showWalkCursor, "Walk cursor"); if (showWalkCursor) { if (allowMainCursor) { allowWalkCursor = CustomGUILayout.Toggle("Provide walk cursor?", allowWalkCursor, "AC.KickStarter.cursorManager.allowWalkCursor", "If True, then a separate cursor will display when in 'walk mode'"); if (allowWalkCursor) { if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot && allowIconInput) { EditorGUILayout.LabelField("Input button:", "Icon_Walk"); } IconBaseGUI("", walkIcon, "AC.KickStarter.cursorManager.walkIcon", "The cursor when in 'walk mode'"); onlyWalkWhenOverNavMesh = CustomGUILayout.ToggleLeft("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh, "AC.KickStarter.cursorManager.onlyWalkWhenOverNavMesh", "If True, then the walk cursor will only show when the cursor is hovering over a NavMesh"); } } addWalkPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addWalkPrefix, "AC.KickStarter.cursorManager.addWalkPrefix", "If True, then a prefix can be added to the Hotspot label when in 'walk mode'"); if (addWalkPrefix) { walkPrefix.label = CustomGUILayout.TextField("Walk prefix:", walkPrefix.label, "AC.KickStarter.cursorManager.walkPrefix"); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showHotspotCursor = CustomGUILayout.ToggleHeader(showHotspotCursor, "Hotspot cursor"); if (showHotspotCursor) { addHotspotPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addHotspotPrefix, "AC.KickStarter.cursorManager.addHotspotPrefix", "If True, then the Cursor's interaction verb will prefix the Hotspot label when hovering over Hotspots"); IconBaseGUI("", mouseOverIcon, "AC.KickStarter.cursorManager.mouseOverIcon"); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showInventoryCursor = CustomGUILayout.ToggleHeader(showInventoryCursor, "Inventory cursor"); if (showInventoryCursor) { inventoryHandling = (InventoryHandling)CustomGUILayout.EnumPopup("When inventory selected:", inventoryHandling, "AC.KickStarter.cursorManager.inventoryHandling", "What happens to the cursor when an inventory item is selected"); if (inventoryHandling != InventoryHandling.ChangeCursor) { onlyShowInventoryLabelOverHotspots = CustomGUILayout.ToggleLeft("Only show label when over Hotspots and Inventory?", onlyShowInventoryLabelOverHotspots, "AC.KickStarter.cursorManager.onlyShowInventoryLabelOverHotspots", "If True, then Hotspot labels will not show when an inventory item is selected unless the cursor is over another inventory item or a Hotspot"); } if (inventoryHandling != InventoryHandling.ChangeHotspotLabel) { inventoryCursorSize = CustomGUILayout.FloatField("Inventory cursor size:", inventoryCursorSize, "AC.KickStarter.cursorManager.inventoryCursorSize", "The size of selected inventory item graphics when used as a cursor"); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f)); hotspotPrefix1.label = CustomGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix1"); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix2.label = CustomGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix2"); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); if (AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.CanGiveItems()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Give syntax:", GUILayout.Width(100f)); hotspotPrefix3.label = CustomGUILayout.TextField(hotspotPrefix3.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix3"); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix4.label = CustomGUILayout.TextField(hotspotPrefix4.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix4"); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showInteractionIcons = CustomGUILayout.ToggleHeader(showInteractionIcons, "Interaction icons"); if (showInteractionIcons) { if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction) { allowInteractionCursor = CustomGUILayout.ToggleLeft("Change cursor based on Interaction?", allowInteractionCursor, "AC.KickStarter.cursorManager.allowInteractionCursor", "If True, then the cursor will be controlled by the current Interaction when hovering over a Hotspot"); if (allowInteractionCursor && (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)) { allowInteractionCursorForInventory = CustomGUILayout.ToggleLeft("Change when over Inventory items too?", allowInteractionCursorForInventory, "AC.KickStarter.cursorManager.allowInteractionCursorForInventory", "If True, then the cursor will be controlled by the current Interaction when hovering over an inventory item (see InvItem)"); } if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { cycleCursors = CustomGUILayout.ToggleLeft("Cycle Interactions with right-click?", cycleCursors, "AC.KickStarter.cursorManager.cycleCursors", "If True, then cursor modes can by clicked by right-clicking"); allowIconInput = CustomGUILayout.ToggleLeft("Set Interaction with specific inputs?", allowIconInput, "AC.KickStarter.cursorManager.allowIconInput", "then the player can switch the active icon by invoking a specific input"); onlyAnimateOverHotspots = CustomGUILayout.ToggleLeft("Only animate icons when over Hotspots?", onlyAnimateOverHotspots, "AC.KickStarter.cursorManager.onlyAnimateOverHotspots", "If True, then animated cursors will only animate if the cursor is over a Hotspot"); } } IconsGUI(); EditorGUILayout.Space(); if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { LookIconGUI(); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showCutsceneCursor = CustomGUILayout.ToggleHeader(showCutsceneCursor, "Cutscene cursor"); if (showCutsceneCursor) { IconBaseGUI("", waitIcon, "AC.KickStarter.cursorManager.waitIcon", "The cursor while the game is running a gameplay-blocking cutscene"); } EditorGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(this); } }
/** * Shows the GUI. */ public void ShowGUI() { settingsManager = AdvGame.GetReferences().settingsManager; EditorGUILayout.BeginVertical(CustomStyles.thinBox); showSettings = CustomGUILayout.ToggleHeader(showSettings, "Global cursor settings"); if (showSettings) { cursorRendering = (CursorRendering)CustomGUILayout.EnumPopup("Cursor rendering:", cursorRendering, "AC.KickStarter.cursorManager.cursorRendering"); if (cursorRendering == CursorRendering.Software) { lockSystemCursor = CustomGUILayout.ToggleLeft("Lock system cursor when locking AC cursor?", lockSystemCursor, "AC.KickStarter.cursorManager.lockSystemCursor"); } forceCursorInEditor = CustomGUILayout.ToggleLeft("Always show system cursor in Editor?", forceCursorInEditor, "AC.KickStarter.cursorManager.forceCursorInEditor"); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showMainCursor = CustomGUILayout.ToggleHeader(showMainCursor, "Main cursor settings"); if (showMainCursor) { cursorDisplay = (CursorDisplay)CustomGUILayout.EnumPopup("Display cursor:", cursorDisplay, "AC.KickStarter.cursorManager.cursorDisplay"); if (cursorDisplay != CursorDisplay.Never) { allowMainCursor = CustomGUILayout.Toggle("Replace mouse cursor?", allowMainCursor, "AC.KickStarter.cursorManager.allowMainCursor"); if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController)) { IconBaseGUI("", pointerIcon, "AC.KickStarter.cursorManager.pointerIcon"); } } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showWalkCursor = CustomGUILayout.ToggleHeader(showWalkCursor, "Walk cursor"); if (showWalkCursor) { if (allowMainCursor) { allowWalkCursor = CustomGUILayout.Toggle("Provide walk cursor?", allowWalkCursor, "AC.KickStarter.cursorManager.allowWalkCursor"); if (allowWalkCursor) { if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { EditorGUILayout.LabelField("Input button:", "Icon_Walk"); } IconBaseGUI("", walkIcon, "AC.KickStarter.cursorManager.walkIcon"); onlyWalkWhenOverNavMesh = CustomGUILayout.ToggleLeft("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh, "AC.KickStarter.cursorManager.onlyWalkWhenOverNavMesh"); } } addWalkPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addWalkPrefix, "AC.KickStarter.cursorManager.addWalkPrefix"); if (addWalkPrefix) { walkPrefix.label = CustomGUILayout.TextField("Walk prefix:", walkPrefix.label, "AC.KickStarter.cursorManager.walkPrefix"); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showHotspotCursor = CustomGUILayout.ToggleHeader(showHotspotCursor, "Hotspot cursor"); if (showHotspotCursor) { addHotspotPrefix = CustomGUILayout.Toggle("Prefix cursor labels?", addHotspotPrefix, "AC.KickStarter.cursorManager.addHotspotPrefix"); IconBaseGUI("", mouseOverIcon, "AC.KickStarter.cursorManager.mouseOverIcon"); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showInventoryCursor = CustomGUILayout.ToggleHeader(showInventoryCursor, "Inventory cursor"); if (showInventoryCursor) { inventoryHandling = (InventoryHandling)CustomGUILayout.EnumPopup("When inventory selected:", inventoryHandling, "AC.KickStarter.cursorManager.inventoryHandling"); if (inventoryHandling != InventoryHandling.ChangeCursor) { onlyShowInventoryLabelOverHotspots = CustomGUILayout.ToggleLeft("Only show label when over Hotspots and Inventory?", onlyShowInventoryLabelOverHotspots, "AC.KickStarter.cursorManager.onlyShowInventoryLabelOverHotspots"); } if (inventoryHandling != InventoryHandling.ChangeHotspotLabel) { inventoryCursorSize = CustomGUILayout.FloatField("Inventory cursor size:", inventoryCursorSize, "AC.KickStarter.cursorManager.inventoryCursorSize"); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f)); hotspotPrefix1.label = CustomGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix1"); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix2.label = CustomGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix2"); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); if (AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.CanGiveItems()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Give syntax:", GUILayout.Width(100f)); hotspotPrefix3.label = CustomGUILayout.TextField(hotspotPrefix3.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix3"); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix4.label = CustomGUILayout.TextField(hotspotPrefix4.label, GUILayout.MaxWidth(80f), "AC.KickStarter.cursorManager.hotspotPrefix4"); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showInteractionIcons = CustomGUILayout.ToggleHeader(showInteractionIcons, "Interaction icons"); if (showInteractionIcons) { if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction) { allowInteractionCursor = CustomGUILayout.ToggleLeft("Change cursor based on Interaction?", allowInteractionCursor, "AC.KickStarter.cursorManager.allowInteractionCursor"); if (allowInteractionCursor && (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)) { allowInteractionCursorForInventory = CustomGUILayout.ToggleLeft("Change when over Inventory items too?", allowInteractionCursorForInventory, "AC.KickStarter.cursorManager.allowInteractionCursorForInventory"); } if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { cycleCursors = CustomGUILayout.ToggleLeft("Cycle Interactions with right-click?", cycleCursors, "AC.KickStarter.cursorManager.cycleCursors"); onlyAnimateOverHotspots = CustomGUILayout.ToggleLeft("Only animate icons when over Hotspots?", onlyAnimateOverHotspots, "AC.KickStarter.cursorManager.onlyAnimateOverHotspots"); } } IconsGUI(); EditorGUILayout.Space(); if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { LookIconGUI(); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(CustomStyles.thinBox); showCutsceneCursor = CustomGUILayout.ToggleHeader(showCutsceneCursor, "Cutscene cursor"); if (showCutsceneCursor) { IconBaseGUI("", waitIcon, "AC.KickStarter.cursorManager.waitIcon"); } EditorGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(this); } }
/** * Shows the GUI. */ public void ShowGUI() { settingsManager = AdvGame.GetReferences().settingsManager; cursorRendering = (CursorRendering)EditorGUILayout.EnumPopup("Cursor rendering:", cursorRendering); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Main cursor", EditorStyles.boldLabel); cursorDisplay = (CursorDisplay)EditorGUILayout.EnumPopup("Display cursor:", cursorDisplay); if (cursorDisplay != CursorDisplay.Never) { allowMainCursor = EditorGUILayout.Toggle("Replace mouse cursor?", allowMainCursor); if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController)) { IconBaseGUI("Main cursor:", pointerIcon); } } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Walk settings", EditorStyles.boldLabel); if (allowMainCursor) { allowWalkCursor = EditorGUILayout.Toggle("Provide walk cursor?", allowWalkCursor); if (allowWalkCursor) { if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { EditorGUILayout.LabelField("Input button:", "Icon_Walk"); } IconBaseGUI("Walk cursor:", walkIcon); onlyWalkWhenOverNavMesh = EditorGUILayout.ToggleLeft("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh); } } addWalkPrefix = EditorGUILayout.Toggle("Prefix cursor labels?", addWalkPrefix); if (addWalkPrefix) { walkPrefix.label = EditorGUILayout.TextField("Walk prefix:", walkPrefix.label); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Hotspot settings", EditorStyles.boldLabel); addHotspotPrefix = EditorGUILayout.Toggle("Prefix cursor labels?", addHotspotPrefix); IconBaseGUI("Mouse-over cursor:", mouseOverIcon); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Inventory cursor", EditorStyles.boldLabel); inventoryHandling = (InventoryHandling)EditorGUILayout.EnumPopup("When inventory selected:", inventoryHandling); if (inventoryHandling != InventoryHandling.ChangeCursor) { onlyShowInventoryLabelOverHotspots = EditorGUILayout.ToggleLeft("Only show label when over Hotspots and Inventory?", onlyShowInventoryLabelOverHotspots); } if (inventoryHandling != InventoryHandling.ChangeHotspotLabel) { inventoryCursorSize = EditorGUILayout.FloatField("Inventory cursor size:", inventoryCursorSize); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Use syntax:", GUILayout.Width(100f)); hotspotPrefix1.label = EditorGUILayout.TextField(hotspotPrefix1.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix2.label = EditorGUILayout.TextField(hotspotPrefix2.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); if (AdvGame.GetReferences().settingsManager&& AdvGame.GetReferences().settingsManager.CanGiveItems()) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Give syntax:", GUILayout.Width(100f)); hotspotPrefix3.label = EditorGUILayout.TextField(hotspotPrefix3.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(item)", GUILayout.MaxWidth(40f)); hotspotPrefix4.label = EditorGUILayout.TextField(hotspotPrefix4.label, GUILayout.MaxWidth(80f)); EditorGUILayout.LabelField("(hotspot)", GUILayout.MaxWidth(55f)); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); EditorGUILayout.LabelField("Interaction icons", EditorStyles.boldLabel); if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction) { allowInteractionCursor = EditorGUILayout.ToggleLeft("Change cursor based on Interaction?", allowInteractionCursor); if (allowInteractionCursor && (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)) { allowInteractionCursorForInventory = EditorGUILayout.ToggleLeft("Change when over Inventory items too?", allowInteractionCursorForInventory); } if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { cycleCursors = EditorGUILayout.ToggleLeft("Cycle Interactions with right-click?", cycleCursors); } } IconsGUI(); EditorGUILayout.Space(); if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { LookIconGUI(); } EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginVertical("Button"); IconBaseGUI("Wait cursor", waitIcon); EditorGUILayout.EndVertical(); if (GUI.changed) { EditorUtility.SetDirty(this); } }
/** * Shows the GUI. */ public void ShowGUI() { settingsManager = AdvGame.GetReferences().settingsManager; cursorRendering = (CursorRendering) EditorGUILayout.EnumPopup ("Cursor rendering:", cursorRendering); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Main cursor", EditorStyles.boldLabel); cursorDisplay = (CursorDisplay) EditorGUILayout.EnumPopup ("Display cursor:", cursorDisplay); if (cursorDisplay != CursorDisplay.Never) { allowMainCursor = EditorGUILayout.Toggle ("Replace mouse cursor?", allowMainCursor); if (allowMainCursor || (settingsManager && settingsManager.inputMethod == InputMethod.KeyboardOrController)) { IconBaseGUI ("Main cursor:", pointerIcon); } } EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Walk settings", EditorStyles.boldLabel); if (allowMainCursor) { allowWalkCursor = EditorGUILayout.Toggle ("Provide walk cursor?", allowWalkCursor); if (allowWalkCursor) { if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { EditorGUILayout.LabelField ("Input button:", "Icon_Walk"); } IconBaseGUI ("Walk cursor:", walkIcon); onlyWalkWhenOverNavMesh = EditorGUILayout.ToggleLeft ("Only show 'Walk' Cursor when over NavMesh?", onlyWalkWhenOverNavMesh); } } addWalkPrefix = EditorGUILayout.Toggle ("Prefix cursor labels?", addWalkPrefix); if (addWalkPrefix) { walkPrefix.label = EditorGUILayout.TextField ("Walk prefix:", walkPrefix.label); } EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Hotspot settings", EditorStyles.boldLabel); addHotspotPrefix = EditorGUILayout.Toggle ("Prefix cursor labels?", addHotspotPrefix); IconBaseGUI ("Mouse-over cursor:", mouseOverIcon); EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Inventory cursor", EditorStyles.boldLabel); inventoryHandling = (InventoryHandling) EditorGUILayout.EnumPopup ("When inventory selected:", inventoryHandling); if (inventoryHandling != InventoryHandling.ChangeCursor) { onlyShowInventoryLabelOverHotspots = EditorGUILayout.ToggleLeft ("Only show label when over Hotspots and Inventory?", onlyShowInventoryLabelOverHotspots); } if (inventoryHandling != InventoryHandling.ChangeHotspotLabel) { inventoryCursorSize = EditorGUILayout.FloatField ("Inventory cursor size:", inventoryCursorSize); } EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Use syntax:", GUILayout.Width (100f)); hotspotPrefix1.label = EditorGUILayout.TextField (hotspotPrefix1.label, GUILayout.MaxWidth (80f)); EditorGUILayout.LabelField ("(item)", GUILayout.MaxWidth (40f)); hotspotPrefix2.label = EditorGUILayout.TextField (hotspotPrefix2.label, GUILayout.MaxWidth (80f)); EditorGUILayout.LabelField ("(hotspot)", GUILayout.MaxWidth (55f)); EditorGUILayout.EndHorizontal (); if (AdvGame.GetReferences ().settingsManager && AdvGame.GetReferences ().settingsManager.CanGiveItems ()) { EditorGUILayout.BeginHorizontal (); EditorGUILayout.LabelField ("Give syntax:", GUILayout.Width (100f)); hotspotPrefix3.label = EditorGUILayout.TextField (hotspotPrefix3.label, GUILayout.MaxWidth (80f)); EditorGUILayout.LabelField ("(item)", GUILayout.MaxWidth (40f)); hotspotPrefix4.label = EditorGUILayout.TextField (hotspotPrefix4.label, GUILayout.MaxWidth (80f)); EditorGUILayout.LabelField ("(hotspot)", GUILayout.MaxWidth (55f)); EditorGUILayout.EndHorizontal (); } EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); EditorGUILayout.LabelField ("Interaction icons", EditorStyles.boldLabel); if (settingsManager == null || settingsManager.interactionMethod != AC_InteractionMethod.ChooseHotspotThenInteraction) { allowInteractionCursor = EditorGUILayout.ToggleLeft ("Change cursor based on Interaction?", allowInteractionCursor); if (allowInteractionCursor && (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive)) { allowInteractionCursorForInventory = EditorGUILayout.ToggleLeft ("Change when over Inventory items too?", allowInteractionCursorForInventory); } if (settingsManager && settingsManager.interactionMethod == AC_InteractionMethod.ChooseInteractionThenHotspot) { cycleCursors = EditorGUILayout.ToggleLeft ("Cycle Interactions with right-click?", cycleCursors); } } IconsGUI (); EditorGUILayout.Space (); if (settingsManager == null || settingsManager.interactionMethod == AC_InteractionMethod.ContextSensitive) { LookIconGUI (); } EditorGUILayout.EndVertical (); EditorGUILayout.Space (); EditorGUILayout.BeginVertical ("Button"); IconBaseGUI ("Wait cursor", waitIcon); EditorGUILayout.EndVertical (); if (GUI.changed) { EditorUtility.SetDirty (this); } }
private void CreateCursorDisplay() { cursorDisplay = new CursorDisplay(); cursorDisplay.Name = "handCursor"; cursorDisplay.IsHitTestVisible = false; }