/** * <summary>Performs what should happen when the element is clicked on.</summary> * <param name = "_menu">The element's parent Menu</param> * <param name = "_slot">The index number of ths slot that was clicked</param> * <param name = "_mouseState">The state of the mouse button</param> */ public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState) { if (KickStarter.stateHandler.gameState == GameState.Cutscene) { return; } base.ProcessClick(_menu, _slot, _mouseState); bool isSuccess = true; if (saveListType == AC_SaveListType.Save && autoHandle) { if (newSaveSlot && _slot == (numSlots - 1)) { isSuccess = SaveSystem.SaveNewGame(); if (KickStarter.settingsManager.orderSavesByUpdateTime) { offset = 0; } else { Shift(AC_ShiftInventory.ShiftRight, 1); } } else { isSuccess = SaveSystem.SaveGame(_slot + offset, optionToShow, fixedOption); } } else if (saveListType == AC_SaveListType.Load && autoHandle) { isSuccess = SaveSystem.LoadGame(_slot + offset, optionToShow, fixedOption); } else if (saveListType == AC_SaveListType.Import) { isSuccess = SaveSystem.ImportGame(_slot + offset, optionToShow, fixedOption); } if (isSuccess) { if (saveListType == AC_SaveListType.Save) { _menu.TurnOff(true); } else if (saveListType == AC_SaveListType.Load) { _menu.TurnOff(false); } AdvGame.RunActionListAsset(actionListOnSave, parameterID, _slot); } else if (!autoHandle && saveListType != AC_SaveListType.Import) { AdvGame.RunActionListAsset(actionListOnSave, parameterID, _slot); } }
public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState) { if (KickStarter.stateHandler.gameState == GameState.Cutscene) { return; } bool isSuccess = true; if (saveListType == AC_SaveListType.Save) { if (newSaveSlot && _slot == (numSlots - 1)) { SaveSystem.SaveNewGame(); } else { SaveSystem.SaveGame(_slot, optionToShow, fixedOption); } } else if (saveListType == AC_SaveListType.Load) { if (fixedOption && newSaveSlot) { isSuccess = false; } else { isSuccess = SaveSystem.LoadGame(_slot, optionToShow, fixedOption); } } else if (saveListType == AC_SaveListType.Import) { if (fixedOption && newSaveSlot) { isSuccess = false; } else { isSuccess = SaveSystem.ImportGame(_slot, optionToShow, fixedOption); } } if (isSuccess) { if (saveListType == AC_SaveListType.Save) { _menu.TurnOff(true); } else if (saveListType == AC_SaveListType.Load) { _menu.TurnOff(false); } AdvGame.RunActionListAsset(actionListOnSave); } }
override public float Run() { if (string.IsNullOrEmpty(inputName) && (KickStarter.settingsManager.inputMethod != InputMethod.TouchScreen || qteType == QTEType.SingleAxis)) { isRunning = false; return(0f); } if (duration <= 0f) { isRunning = false; return(0f); } if (!isRunning) { isRunning = true; Animator animator = null; if (!string.IsNullOrEmpty(menuName)) { AC.Menu menu = PlayerMenus.GetMenuWithName(menuName); if (menu != null) { menu.TurnOn(true); if (animateUI && menu.RuntimeCanvas != null && menu.RuntimeCanvas.GetComponent <Animator>()) { animator = menu.RuntimeCanvas.GetComponent <Animator>(); } } } if (qteType == QTEType.SingleKeypress) { KickStarter.playerQTE.StartSinglePressQTE(inputName, duration, animator, wrongKeyFails); } else if (qteType == QTEType.SingleAxis) { KickStarter.playerQTE.StartSingleAxisQTE(inputName, duration, axisThreshold, animator, wrongKeyFails); } else if (qteType == QTEType.HoldKey) { KickStarter.playerQTE.StartHoldKeyQTE(inputName, duration, holdDuration, animator, wrongKeyFails); } else if (qteType == QTEType.ButtonMash) { KickStarter.playerQTE.StartButtonMashQTE(inputName, duration, targetPresses, doCooldown, cooldownTime, animator, wrongKeyFails); } return(defaultPauseTime); } else { if (KickStarter.playerQTE.GetState() == QTEState.None) { return(defaultPauseTime); } if (!string.IsNullOrEmpty(menuName)) { AC.Menu menu = PlayerMenus.GetMenuWithName(menuName); if (menu != null) { menu.TurnOff(true); } } isRunning = false; return(0f); } }
override public float Run() { if (!isRunning) { isRunning = true; AC.Menu _menu = PlayerMenus.GetMenuWithName(_menuToChange); if (_menu != null) { if (changeType == MenuChangeType.TurnOnMenu) { if (_menu.IsManualControlled()) { if (!_menu.TurnOn(doFade)) { // Menu is already on isRunning = false; return(0f); } if (doFade && willWait) { return(_menu.fadeSpeed); } } else { ACDebug.LogWarning("Can only turn on Menus with an Appear Type of Manual, OnInputKey, OnContainer or OnViewDocument - did you mean 'Unlock Menu'?"); } } else if (changeType == MenuChangeType.TurnOffMenu) { if (_menu.IsManualControlled() || _menu.appearType == AppearType.OnInteraction) { if (!_menu.TurnOff(doFade)) { // Menu is already off isRunning = false; return(0f); } if (doFade && willWait) { return(_menu.fadeSpeed); } } else { ACDebug.LogWarning("Can only turn off Menus with an Appear Type of Manual, OnInputKey, OnContainer or OnViewDocument - did you mean 'Lock Menu'?"); } } else if (changeType == MenuChangeType.LockMenu) { if (doFade) { _menu.TurnOff(true); } else { _menu.ForceOff(); } _menu.isLocked = true; if (doFade && willWait) { return(_menu.fadeSpeed); } } else { RunInstant(_menu); } } else if (menuToChange != "") { ACDebug.LogWarning("Could not find menu of name '" + menuToChange + "'"); } } else { isRunning = false; return(0f); } return(0f); }
/** * <summary>Performs what should happen when the element is clicked on.</summary> * <param name = "_menu">The element's parent Menu</param> * <param name = "_slot">Ignored by this subclass</param> * <param name = "_mouseState">The state of the mouse button</param> */ public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState) { if (KickStarter.stateHandler.gameState == GameState.Cutscene) { return; } base.ProcessClick(_menu, _slot, _mouseState); ShowClick(); if (buttonClickType == AC_ButtonClickType.TurnOffMenu) { _menu.TurnOff(doFade); } else if (buttonClickType == AC_ButtonClickType.Crossfade) { AC.Menu menuToSwitchTo = PlayerMenus.GetMenuWithName(switchMenuTitle); if (menuToSwitchTo != null) { KickStarter.playerMenus.CrossFade(menuToSwitchTo); } else { ACDebug.LogWarning("Cannot find any menu of name '" + switchMenuTitle + "'"); } } else if (buttonClickType == AC_ButtonClickType.OffsetElementSlot) { if (elementToShift != null) { elementToShift.Shift(shiftInventory, shiftAmount); elementToShift.RecalculateSize(_menu.menuSource); _menu.Recalculate(); } else { ACDebug.LogWarning("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'"); } } else if (buttonClickType == AC_ButtonClickType.OffsetJournal) { MenuJournal journalToShift = (MenuJournal)PlayerMenus.GetElementWithName(_menu.title, inventoryBoxTitle); if (journalToShift != null) { journalToShift.Shift(shiftInventory, loopJournal, shiftAmount); journalToShift.RecalculateSize(_menu.menuSource); _menu.Recalculate(); } else { ACDebug.LogWarning("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'"); } } else if (buttonClickType == AC_ButtonClickType.RunActionList) { if (actionList) { AdvGame.RunActionListAsset(actionList, parameterID, parameterValue); } } else if (buttonClickType == AC_ButtonClickType.CustomScript) { MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState); } else if (buttonClickType == AC_ButtonClickType.SimulateInput) { KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue); } }
public override float Run() { if (!isRunning) { AC.Menu _menu = PlayerMenus.GetMenuWithName(runtimeMenuToChange); if (_menu == null) { if (!string.IsNullOrEmpty(runtimeMenuToChange)) { ACDebug.LogWarning("Could not find menu of name '" + runtimeMenuToChange + "'", this); } return(0f); } isRunning = true; switch (changeType) { case MenuChangeType.TurnOnMenu: if (_menu.IsManualControlled()) { if (!_menu.TurnOn(doFade)) { // Menu is already on isRunning = false; return(0f); } if (doFade && willWait) { return(_menu.fadeSpeed); } } else { LogWarning("Can only turn on Menus with an Appear Type of Manual, OnInputKey, OnContainer or OnViewDocument - did you mean 'Unlock Menu'?"); } break; case MenuChangeType.TurnOffMenu: if (_menu.IsManualControlled() || _menu.appearType == AppearType.OnInteraction) { if (!_menu.TurnOff(doFade)) { // Menu is already off isRunning = false; return(0f); } if (doFade && willWait) { return(_menu.fadeSpeed); } } else { LogWarning("Can only turn off Menus with an Appear Type of Manual, OnInputKey, OnContainer or OnViewDocument - did you mean 'Lock Menu'?"); } break; case MenuChangeType.LockMenu: if (doFade) { _menu.TurnOff(true); } else { _menu.ForceOff(); } _menu.isLocked = true; if (doFade && willWait) { return(_menu.fadeSpeed); } break; default: RunInstant(_menu); break; } } else { isRunning = false; return(0f); } return(0f); }
public override bool ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState) { if (!_menu.IsClickable() || _mouseState != MouseState.SingleClick) { return(false); } ShowClick(); switch (buttonClickType) { case AC_ButtonClickType.TurnOffMenu: _menu.TurnOff(doFade); break; case AC_ButtonClickType.Crossfade: Menu menuToSwitchTo = PlayerMenus.GetMenuWithName(switchMenuTitle); if (menuToSwitchTo != null) { KickStarter.playerMenus.CrossFade(menuToSwitchTo); } else { ACDebug.LogWarning("Cannot find any menu of name '" + switchMenuTitle + "'"); } break; case AC_ButtonClickType.OffsetElementSlot: if (elementToShift != null) { elementToShift.Shift(shiftInventory, shiftAmount); elementToShift.RecalculateSize(_menu.menuSource); _menu.Recalculate(); } else { ACDebug.LogWarning("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'"); } break; case AC_ButtonClickType.OffsetJournal: MenuJournal journalToShift = (MenuJournal)PlayerMenus.GetElementWithName(_menu.title, inventoryBoxTitle); if (journalToShift != null) { journalToShift.Shift(shiftInventory, loopJournal, shiftAmount); journalToShift.RecalculateSize(_menu.menuSource); _menu.Recalculate(); } else { ACDebug.LogWarning("Cannot find '" + inventoryBoxTitle + "' inside '" + _menu.title + "'"); } break; case AC_ButtonClickType.RunActionList: if (actionList) { if (!actionList.canRunMultipleInstances) { KickStarter.actionListAssetManager.EndAssetList(actionList); } AdvGame.RunActionListAsset(actionList, parameterID, parameterValue); } break; case AC_ButtonClickType.CustomScript: MenuSystem.OnElementClick(_menu, this, _slot, (int)_mouseState); break; case AC_ButtonClickType.SimulateInput: KickStarter.playerInput.SimulateInput(simulateInput, inputAxis, simulateValue); break; default: break; } return(base.ProcessClick(_menu, _slot, _mouseState)); }
override public float Run() { if (!isRunning) { isRunning = true; AC.Menu _menu = PlayerMenus.GetMenuWithName(menuToChange); if (_menu != null) { if (changeType == MenuChangeType.TurnOnMenu) { if (_menu.IsManualControlled()) { if (!_menu.TurnOn(doFade)) { // Menu is already on isRunning = false; return(0f); } if (doFade && willWait) { return(_menu.fadeSpeed); } } else { ACDebug.LogWarning("Can only turn on Menus with an Appear Type of Manual, OnInputKey or OnContainer - did you mean 'Unlock Menu'?"); } } else if (changeType == MenuChangeType.TurnOffMenu) { if (_menu.IsManualControlled()) { if (!_menu.TurnOff(doFade)) { // Menu is already off isRunning = false; return(0f); } if (doFade && willWait) { return(_menu.fadeSpeed); } } else { ACDebug.LogWarning("Can only turn off Menus with an Appear Type of Manual, OnInputKey or OnContainer - did you mean 'Lock Menu'?"); } } else if (changeType == MenuChangeType.HideMenuElement || changeType == MenuChangeType.ShowMenuElement) { MenuElement _element = PlayerMenus.GetElementWithName(menuToChange, elementToChange); if (_element != null) { if (changeType == MenuChangeType.HideMenuElement) { _element.isVisible = false; } else { _element.isVisible = true; } _menu.ResetVisibleElements(); _menu.Recalculate(); KickStarter.playerMenus.FindFirstSelectedElement(); } else { ACDebug.LogWarning("Could not find element of name '" + elementToChange + "' on menu '" + menuToChange + "'"); } } else if (changeType == MenuChangeType.LockMenu) { if (doFade) { _menu.TurnOff(true); } else { _menu.ForceOff(); } _menu.isLocked = true; if (doFade && willWait) { return(_menu.fadeSpeed); } } else if (changeType == MenuChangeType.UnlockMenu) { _menu.isLocked = false; } else if (changeType == MenuChangeType.AddJournalPage) { MenuElement _element = PlayerMenus.GetElementWithName(menuToChange, elementToChange); if (_element != null) { if (journalText != "") { if (_element is MenuJournal) { MenuJournal journal = (MenuJournal)_element; JournalPage newPage = new JournalPage(lineID, journalText); journal.AddPage(newPage, onlyAddNewJournal); } else { ACDebug.LogWarning(_element.title + " is not a journal!"); } } else { ACDebug.LogWarning("No journal text to add!"); } } else { ACDebug.LogWarning("Could not find menu element of name '" + elementToChange + "' inside '" + menuToChange + "'"); } } } else if (menuToChange != "") { ACDebug.LogWarning("Could not find menu of name '" + menuToChange + "'"); } } else { isRunning = false; return(0f); } return(0f); }
public void ProcessInventoryBoxClick(AC.Menu _menu, MenuInventoryBox inventoryBox, int _slot, MouseState _mouseState) { if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Default || inventoryBox.inventoryBoxType == AC_InventoryBoxType.DisplayLastSelected) { if (KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.playerInput.interactionMenuIsOn) { KickStarter.playerMenus.SetInteractionMenus(false); KickStarter.playerInteraction.ClickInvItemToInteract(); } else if (KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Multiple && KickStarter.settingsManager.SelectInteractionMethod() == AC.SelectInteractions.CyclingCursorAndClickingHotspot) { if (KickStarter.settingsManager.autoCycleWhenInteract && _mouseState == MouseState.SingleClick && (selectedItem == null || KickStarter.settingsManager.cycleInventoryCursors)) { int originalIndex = KickStarter.playerInteraction.GetInteractionIndex(); KickStarter.playerInteraction.SetNextInteraction(); KickStarter.playerInteraction.SetInteractionIndex(originalIndex); } if (!KickStarter.settingsManager.cycleInventoryCursors && selectedItem != null) { inventoryBox.HandleDefaultClick(_mouseState, _slot, KickStarter.settingsManager.interactionMethod); } else if (_mouseState != MouseState.RightClick) { KickStarter.playerMenus.SetInteractionMenus(false); KickStarter.playerInteraction.ClickInvItemToInteract(); } if (KickStarter.settingsManager.autoCycleWhenInteract && _mouseState == MouseState.SingleClick) { KickStarter.playerInteraction.RestoreInventoryInteraction(); } } else if (KickStarter.settingsManager.interactionMethod != AC_InteractionMethod.ContextSensitive && KickStarter.settingsManager.inventoryInteractions == InventoryInteractions.Single) { inventoryBox.HandleDefaultClick(_mouseState, _slot, AC_InteractionMethod.ContextSensitive); } else { inventoryBox.HandleDefaultClick(_mouseState, _slot, KickStarter.settingsManager.interactionMethod); } _menu.Recalculate(); } else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.Container) { inventoryBox.ClickContainer(_mouseState, _slot, KickStarter.playerInput.activeContainer); _menu.Recalculate(); } else if (inventoryBox.inventoryBoxType == AC_InventoryBoxType.HostpotBased) { if (KickStarter.settingsManager.interactionMethod == AC_InteractionMethod.ChooseHotspotThenInteraction) { if (hoverItem != null) { Combine(hoverItem, inventoryBox.items [_slot]); } else if (KickStarter.playerInteraction.GetActiveHotspot()) { InvItem _item = inventoryBox.items [_slot]; if (_item != null) { SelectItem(_item, SelectItemMode.Use); _menu.TurnOff(false); KickStarter.playerInteraction.ClickButton(InteractionType.Inventory, -2, _item.id); KickStarter.playerCursor.ResetSelectedCursor(); } } else { Debug.LogWarning("Cannot handle inventory click since there is no active Hotspot."); } } else { Debug.LogWarning("This type of InventoryBox only works with the Choose Hotspot Then Interaction method of interaction."); } } }