private void CopyJournal(MenuJournal _element) { uiText = _element.uiText; pages = new List <JournalPage>(); foreach (JournalPage page in _element.pages) { pages.Add(new JournalPage(page)); } numPages = _element.numPages; startFromPage = _element.startFromPage; if (startFromPage) { showPage = _element.showPage; } else { showPage = 1; } anchor = _element.anchor; textEffects = _element.textEffects; fullText = ""; actionListOnAddPage = _element.actionListOnAddPage; journalType = _element.journalType; pageOffset = _element.pageOffset; otherJournalTitle = _element.otherJournalTitle;; base.Copy(_element); }
public override MenuElement DuplicateSelf(bool fromEditor, bool ignoreUnityUI) { MenuJournal newElement = CreateInstance <MenuJournal>(); newElement.Declare(); newElement.CopyJournal(this, fromEditor, ignoreUnityUI); return(newElement); }
/** * <summary>Creates and returns a new MenuJournal that has the same values as itself.</summary> * <returns>A new MenuJournal with the same values as itself</returns> */ public override MenuElement DuplicateSelf() { MenuJournal newElement = CreateInstance <MenuJournal>(); newElement.Declare(); newElement.CopyJournal(this); return(newElement); }
public override void Initialise(AC.Menu _menu) { if (journalType == JournalType.DisplayExistingJournal) { MenuElement sharedElement = _menu.GetElementWithName(otherJournalTitle); if (sharedElement != null && sharedElement is MenuJournal) { otherJournal = (MenuJournal)sharedElement; } } }
public void CopyJournal(MenuJournal _element) { uiText = _element.uiText; pages = new List<JournalPage>(); foreach (JournalPage page in _element.pages) { pages.Add (page); } numPages = _element.numPages; showPage = 1; anchor = _element.anchor; textEffects = _element.textEffects; fullText = ""; base.Copy (_element); }
public void CopyJournal(MenuJournal _element) { uiText = _element.uiText; pages = new List <JournalPage>(); foreach (JournalPage page in _element.pages) { pages.Add(page); } numPages = _element.numPages; showPage = 1; anchor = _element.anchor; textEffects = _element.textEffects; fullText = ""; base.Copy(_element); }
private void CopyJournal(MenuJournal _element, bool fromEditor, bool ignoreUnityUI) { if (ignoreUnityUI) { uiText = null; } else { uiText = _element.uiText; } pages = new List <JournalPage>(); foreach (JournalPage page in _element.pages) { JournalPage newPage = new JournalPage(page); if (fromEditor) { newPage.lineID = -1; } pages.Add(newPage); } numPages = _element.numPages; startFromPage = _element.startFromPage; if (startFromPage) { showPage = _element.showPage; } else { showPage = 1; } anchor = _element.anchor; textEffects = _element.textEffects; outlineSize = _element.outlineSize; fullText = ""; actionListOnAddPage = _element.actionListOnAddPage; journalType = _element.journalType; pageOffset = _element.pageOffset; otherJournalTitle = _element.otherJournalTitle;; base.Copy(_element); }
public override float Run() { MenuElement _element = PlayerMenus.GetElementWithName(menuToChange, elementToChange); if (_element != null) { if (_element is MenuJournal) { MenuJournal journal = (MenuJournal)_element; if (journal.pages.Count > 0) { if (setJournalPage == SetJournalPage.FirstPage) { journal.showPage = 1; } else if (setJournalPage == SetJournalPage.LastPage) { journal.showPage = journal.pages.Count; } else if (setJournalPage == SetJournalPage.SetHere) { journal.showPage = Mathf.Min(journal.pages.Count, pageNumber); } } } else { LogWarning(_element.title + " is not a journal!"); } } else { LogWarning("Could not find menu element of name '" + elementToChange + "' inside '" + menuToChange + "'"); } return(0f); }
private void SearchForInstances(bool justLocal, ActionType actionType) { if (searchedAssets != null) { searchedAssets.Clear(); } if (justLocal) { SearchSceneForType("", actionType); return; } string[] sceneFiles = AdvGame.GetSceneFiles(); // First look for lines that already have an assigned lineID foreach (string sceneFile in sceneFiles) { SearchSceneForType(sceneFile, actionType); } // Settings if (KickStarter.settingsManager) { SearchAssetForType(KickStarter.settingsManager.actionListOnStart, actionType); if (KickStarter.settingsManager.activeInputs != null) { foreach (ActiveInput activeInput in KickStarter.settingsManager.activeInputs) { SearchAssetForType(activeInput.actionListAsset, actionType); } } } // Inventory if (KickStarter.inventoryManager) { SearchAssetForType(KickStarter.inventoryManager.unhandledCombine, actionType); SearchAssetForType(KickStarter.inventoryManager.unhandledHotspot, actionType); SearchAssetForType(KickStarter.inventoryManager.unhandledGive, actionType); // Item-specific events if (KickStarter.inventoryManager.items.Count > 0) { foreach (InvItem item in (KickStarter.inventoryManager.items)) { SearchAssetForType(item.useActionList, actionType); SearchAssetForType(item.lookActionList, actionType); SearchAssetForType(item.unhandledActionList, actionType); SearchAssetForType(item.unhandledCombineActionList, actionType); foreach (ActionListAsset actionList in item.combineActionList) { SearchAssetForType(actionList, actionType); } foreach (InvInteraction interaction in item.interactions) { if (interaction.actionList != null) { SearchAssetForType(interaction.actionList, actionType); } } } } foreach (Recipe recipe in KickStarter.inventoryManager.recipes) { SearchAssetForType(recipe.invActionList, actionType); SearchAssetForType(recipe.actionListOnCreate, actionType); } } // Cursor if (KickStarter.cursorManager) { // Prefixes foreach (ActionListAsset actionListAsset in KickStarter.cursorManager.unhandledCursorInteractions) { SearchAssetForType(actionListAsset, actionType); } } // Menus if (KickStarter.menuManager) { // Gather elements if (KickStarter.menuManager.menus.Count > 0) { foreach (AC.Menu menu in KickStarter.menuManager.menus) { SearchAssetForType(menu.actionListOnTurnOff, actionType); SearchAssetForType(menu.actionListOnTurnOn, actionType); foreach (MenuElement element in menu.elements) { if (element is MenuButton) { MenuButton button = (MenuButton)element; if (button.buttonClickType == AC_ButtonClickType.RunActionList) { SearchAssetForType(button.actionList, actionType); } } else if (element is MenuSavesList) { MenuSavesList button = (MenuSavesList)element; SearchAssetForType(button.actionListOnSave, actionType); } else if (element is MenuCycle) { MenuCycle cycle = (MenuCycle)element; SearchAssetForType(cycle.actionListOnClick, actionType); } else if (element is MenuJournal) { MenuJournal journal = (MenuJournal)element; SearchAssetForType(journal.actionListOnAddPage, actionType); } else if (element is MenuSlider) { MenuSlider slider = (MenuSlider)element; SearchAssetForType(slider.actionListOnChange, actionType); } else if (element is MenuToggle) { MenuToggle toggle = (MenuToggle)element; SearchAssetForType(toggle.actionListOnClick, actionType); } else if (element is MenuProfilesList) { MenuProfilesList profilesList = (MenuProfilesList)element; SearchAssetForType(profilesList.actionListOnClick, actionType); } } } } } searchedAssets.Clear(); }
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); }
override public void Skip() { AC.Menu _menu = PlayerMenus.GetMenuWithName(menuToChange); if (_menu != null) { if (changeType == MenuChangeType.TurnOnMenu) { if (_menu.appearType == AppearType.Manual || _menu.appearType == AppearType.OnInputKey) { _menu.TurnOn(false); } } else if (changeType == MenuChangeType.TurnOffMenu) { if (_menu.appearType == AppearType.Manual || _menu.appearType == AppearType.OnInputKey || _menu.appearType == AppearType.OnContainer) { _menu.ForceOff(); } } 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(); } } else if (changeType == MenuChangeType.LockMenu) { _menu.isLocked = true; _menu.ForceOff(); } 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); } } } } } }
private void RunInstant(AC.Menu _menu) { if (changeType == MenuChangeType.HideMenuElement || changeType == MenuChangeType.ShowMenuElement) { MenuElement _element = PlayerMenus.GetElementWithName(_menuToChange, _elementToChange); if (_element != null) { if (changeType == MenuChangeType.HideMenuElement) { _element.IsVisible = false; KickStarter.playerMenus.DeselectInputBox(_element); } 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.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, journalPageIndex); if (lineID == -1) { ACDebug.LogWarning("The new Journal page has no ID number, and will not be included in save game files - this can be corrected by clicking 'Gather text' in the Speech Manager"); } } 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 + "'"); } _menu.Recalculate(); } else if (changeType == MenuChangeType.RemoveJournalPage) { MenuElement _element = PlayerMenus.GetElementWithName(_menuToChange, _elementToChange); if (_element != null) { if (_element is MenuJournal) { MenuJournal journal = (MenuJournal)_element; if (removeJournalPageMethod == RemoveJournalPageMethod.RemoveAllPages) { journal.RemoveAllPages(); } else if (removeJournalPageMethod == RemoveJournalPageMethod.RemoveSinglePage) { journal.RemovePage(journalPageIndex); } } else { ACDebug.LogWarning(_element.title + " is not a journal!"); } } else { ACDebug.LogWarning("Could not find menu element of name '" + elementToChange + "' inside '" + menuToChange + "'"); } _menu.Recalculate(); } }
public override void Initialise(AC.Menu _menu) { if (journalType == JournalType.DisplayExistingJournal) { MenuElement sharedElement = _menu.GetElementWithName (otherJournalTitle); if (sharedElement != null && sharedElement is MenuJournal) { otherJournal = (MenuJournal) sharedElement; } } }
private void CopyJournal(MenuJournal _element) { uiText = _element.uiText; pages = new List<JournalPage>(); foreach (JournalPage page in _element.pages) { pages.Add (new JournalPage (page)); } numPages = _element.numPages; startFromPage = _element.startFromPage; if (startFromPage) { showPage = _element.showPage; } else { showPage = 1; } anchor = _element.anchor; textEffects = _element.textEffects; fullText = ""; actionListOnAddPage = _element.actionListOnAddPage; base.Copy (_element); }
/** * <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); } }
private void ExtractJournalElement(MenuJournal journal, List<JournalPage> pages, bool onlySeekNew) { foreach (JournalPage page in pages) { if (onlySeekNew && page.lineID == -1) { // Assign a new ID on creation SpeechLine newLine; newLine = new SpeechLine (GetIDArray(), "", journal.title, page.text, languages.Count - 1, AC_TextType.JournalEntry); page.lineID = newLine.lineID; lines.Add (newLine); } else if (!onlySeekNew && page.lineID > -1) { // Already has an ID, so don't replace SpeechLine existingLine = new SpeechLine (page.lineID, "", journal.title, page.text, languages.Count - 1, AC_TextType.JournalEntry); int lineID = SmartAddLine (existingLine); if (lineID >= 0) page.lineID = lineID; } } }
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)); }
private void RunInstant(AC.Menu _menu) { 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.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, journalPageIndex); } 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 + "'"); } _menu.Recalculate(); } else if (changeType == MenuChangeType.RemoveJournalPage) { MenuElement _element = PlayerMenus.GetElementWithName(menuToChange, elementToChange); if (_element != null) { if (_element is MenuJournal) { MenuJournal journal = (MenuJournal)_element; journal.RemovePage(journalPageIndex); } else { ACDebug.LogWarning(_element.title + " is not a journal!"); } } else { ACDebug.LogWarning("Could not find menu element of name '" + elementToChange + "' inside '" + menuToChange + "'"); } _menu.Recalculate(); } }