protected virtual void HandleHideCtxMenu() { IsShowing = false; _gameMgr.RequestPauseStateChange(toPause: false); InputManager.Instance.InputMode = GameInputMode.Normal; _directiveLookup.Clear(); CleanupMenuArrays(); // not really needed as all CtxMenu.Item arrays get assigned new arrays when used again _nextAvailableItemId = Constants.Zero; _optimalFocusDistanceItemID = Constants.Zero; _remoteUserOwnedSelectedItem = null; _menuOpenedMode = CtxMenuOpenedMode.None; }
/// <summary> /// Tries to show this Item's context menu appropriate to the Item that is /// currently selected, if any. Returns <c>true</c> if the context menu was shown. /// </summary> /// <remarks>remote* = an item that is not the item that owns this menu.</remarks> /// <returns></returns> public bool AttemptShowContextMenu() { bool toShow = false; var selectedItem = SelectionManager.Instance.CurrentSelection; if (selectedItem != null) { if (IsSelectedItemMenuOperator(selectedItem)) { // the item that operates this context menu is selected _menuOpenedMode = CtxMenuOpenedMode.MenuOperatorIsSelected; _remoteUserOwnedSelectedItem = null; toShow = true; } else { FleetCmdItem selectedFleet; if (TryIsSelectedItemUserRemoteFleet(selectedItem, out selectedFleet)) { // a remote* user owned fleet is selected _menuOpenedMode = CtxMenuOpenedMode.UserRemoteFleetIsSelected; _remoteUserOwnedSelectedItem = selectedFleet; toShow = true; } else { AUnitBaseCmdItem selectedBase; if (TryIsSelectedItemUserRemoteBase(selectedItem, out selectedBase)) { // a remote* user owned base is selected _menuOpenedMode = CtxMenuOpenedMode.UserRemoteBaseIsSelected; _remoteUserOwnedSelectedItem = selectedBase; toShow = true; } else { ShipItem selectedShip; if (TryIsSelectedItemUserRemoteShip(selectedItem, out selectedShip)) { // a remote* user owned ship is selected _menuOpenedMode = CtxMenuOpenedMode.UserRemoteShipIsSelected; _remoteUserOwnedSelectedItem = selectedShip; toShow = true; } else { _menuOpenedMode = CtxMenuOpenedMode.None; _remoteUserOwnedSelectedItem = null; } } } } } //D.Log("{0}.{1}.TryShowContextMenu called. Resulting AccessSource = {2}.", OperatorName, GetType().Name, _accessSource.GetValueName()); if (toShow) { _lastPressReleasePosition = UICamera.lastWorldPosition; Show(true); } return toShow; }