Exemplo n.º 1
0
        /**
         * <summary>Creates a new instance of the 'Menu: Change state' Action, set to alter a menu element's visibility</summary>
         * <param name = "menuName">The name of the menu with the element</param>
         * <param name = "elementToAffect">The name of the element to affect</param>
         * <param name = "makeVisible">If True, the element will be made visible. Otherwise, it will be made invisible</param>
         * <returns>The generated Action</returns>
         */
        public static ActionMenuState CreateNew_SetElementVisibility(string menuName, string elementToAffect, bool makeVisible)
        {
            ActionMenuState newAction = (ActionMenuState)CreateInstance <ActionMenuState>();

            newAction.changeType      = (makeVisible) ? MenuChangeType.ShowMenuElement : MenuChangeType.HideMenuElement;
            newAction.menuToChange    = menuName;
            newAction.elementToChange = elementToAffect;
            return(newAction);
        }
Exemplo n.º 2
0
        /**
         * <summary>Creates a new instance of the 'Menu: Change state' Action, set to turn a menu off</summary>
         * <param name = "menuToTurnOff">The name of the menu to turn off</param>
         * <param name = "lockMenu">If True, the menu will be locked as well</param>
         * <param name = "doTransition">If True, the menu will transition off - as opposed to turning off instantly</param>
         * <param name = "waitUntilFinish">If True, the Action will wait until the transition has completed</param>
         * <returns>The generated Action</returns>
         */
        public static ActionMenuState CreateNew_TurnOffMenu(string menuToTurnOff, bool lockMenu = false, bool doTransition = true, bool waitUntilFinish = false)
        {
            ActionMenuState newAction = (ActionMenuState)CreateInstance <ActionMenuState>();

            newAction.changeType   = (lockMenu) ? MenuChangeType.LockMenu : MenuChangeType.TurnOffMenu;
            newAction.menuToChange = menuToTurnOff;
            newAction.doFade       = doTransition;
            newAction.willWait     = waitUntilFinish;
            return(newAction);
        }
Exemplo n.º 3
0
        public static ActionMenuState CreateNew_RemoveJournalPage(string menuName, string journalElementName, RemoveJournalPageMethod removeJournalPageMethod = RemoveJournalPageMethod.RemoveSinglePage, int pageIndexToRemove = -1)
        {
            ActionMenuState newAction = (ActionMenuState)CreateInstance <ActionMenuState>();

            newAction.changeType              = MenuChangeType.RemoveJournalPage;
            newAction.menuToChange            = menuName;
            newAction.elementToChange         = journalElementName;
            newAction.removeJournalPageMethod = removeJournalPageMethod;
            newAction.journalPageIndex        = pageIndexToRemove;
            return(newAction);
        }
Exemplo n.º 4
0
        /**
         * <summary>Creates a new instance of the 'Menu: Change state' Action, set to add a new page to a journal elemnt</summary>
         * <param name = "menuName">The name of the menu with the journal</param>
         * <param name = "journalElementName">The name of the journal element to update</param>
         * <param name = "newPageText">The text of the new page to add</param>
         * <param name = "newPageranslationID">The new page's translation ID number, as generated by the Speech Manager</param>
         * <param name = "pageIndexToInsertInto">The index number of the journal's existing pages to insert the new page into. If negative, it will be inserted at the end</param>
         * <param name = "avoidDuplicated">If True, the page will only be added if not already present in the journal</param>
         * <returns>The generated Action</returns>
         */
        public static ActionMenuState CreateNew_AddJournalPage(string menuName, string journalElementName, string newPageText, int newPageTranslationID = -1, int pageIndexToInsertInto = -1, bool avoidDuplicates = true)
        {
            ActionMenuState newAction = (ActionMenuState)CreateInstance <ActionMenuState>();

            newAction.changeType        = MenuChangeType.AddJournalPage;
            newAction.menuToChange      = menuName;
            newAction.elementToChange   = journalElementName;
            newAction.journalText       = newPageText;
            newAction.lineID            = newPageTranslationID;
            newAction.journalPageIndex  = pageIndexToInsertInto;
            newAction.onlyAddNewJournal = avoidDuplicates;
            return(newAction);
        }
Exemplo n.º 5
0
        private void ExtractJournalEntry(ActionMenuState action, bool onlySeekNew, bool isInScene)
        {
            if (action.changeType == ActionMenuState.MenuChangeType.AddJournalPage && action.journalText != "")
            {
                if (onlySeekNew && action.lineID == -1)
                {
                    // Assign a new ID on creation
                    SpeechLine newLine;
                    if (isInScene)
                    {
                        newLine = new SpeechLine (GetIDArray(), UnityVersionHandler.GetCurrentSceneName (), action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }
                    else
                    {
                        newLine = new SpeechLine (GetIDArray(), "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }
                    action.lineID = newLine.lineID;
                    lines.Add (newLine);
                }

                else if (!onlySeekNew && action.lineID > -1)
                {
                    // Already has an ID, so don't replace
                    SpeechLine existingLine;
                    if (isInScene)
                    {
                        existingLine = new SpeechLine (action.lineID, UnityVersionHandler.GetCurrentSceneName (), action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }
                    else
                    {
                        existingLine = new SpeechLine (action.lineID, "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
                    }

                    int lineID = SmartAddLine (existingLine);
                    if (lineID >= 0) action.lineID = lineID;
                }
            }
            else
            {
                // Remove from SpeechManager
                action.lineID = -1;
            }
        }
Exemplo n.º 6
0
		private void ExtractJournalEntry (ActionMenuState action, bool onlySeekNew, bool isInScene)
		{
			if (action.changeType == ActionMenuState.MenuChangeType.AddJournalPage && action.journalText != "")
			{
				if (onlySeekNew && action.lineID == -1)
				{
					// Assign a new ID on creation
					SpeechLine newLine;
					if (isInScene)
					{
						newLine = new SpeechLine (GetIDArray(), EditorApplication.currentScene, action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
					}
					else
					{
						newLine = new SpeechLine (GetIDArray(), "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry);
					}
					action.lineID = newLine.lineID;
					lines.Add (newLine);
				}
				
				else if (!onlySeekNew && action.lineID > -1)
				{
					// Already has an ID, so don't replace
					if (isInScene)
					{
						lines.Add (new SpeechLine (action.lineID, EditorApplication.currentScene, action.journalText, languages.Count - 1, AC_TextType.JournalEntry));
					}
					else
					{
						lines.Add (new SpeechLine (action.lineID, "", action.journalText, languages.Count - 1, AC_TextType.JournalEntry));
					}
				}
			}
			else
			{
				// Remove from SpeechManager
				action.lineID = -1;
			}
		}