Exemple #1
0
        protected void MovePageToTop(int a1)
        {
            JournalPage tempPage = pages[a1];

            pages.Insert(0, tempPage);
            pages.RemoveAt(a1 + 1);
        }
Exemple #2
0
        private void SwapPages(int a1, int a2)
        {
            JournalPage tempPage = pages[a1];

            pages[a1] = pages[a2];
            pages[a2] = tempPage;
        }
Exemple #3
0
        protected void MovePageToBottom(int a1)
        {
            JournalPage tempPage = pages[a1];

            pages.Add(tempPage);
            pages.RemoveAt(a1);
        }
Exemple #4
0
        protected void SwapPages(int a1, int a2)
        {
            JournalPage tempPage = pages[a1];

            pages[a1] = pages[a2];
            pages[a2] = tempPage;
        }
Exemple #5
0
 private string TranslatePage(JournalPage page, int languageNumber)
 {
     if (Application.isPlaying)
     {
         return(KickStarter.runtimeLanguages.GetTranslation(page.text, page.lineID, languageNumber, AC_TextType.JournalEntry));
     }
     return(page.text);
 }
Exemple #6
0
 private string TranslatePage(JournalPage page, int languageNumber)
 {
     if (languageNumber > 0)
     {
         return(KickStarter.runtimeLanguages.GetTranslation(page.text, page.lineID, languageNumber));
     }
     return(page.text);
 }
Exemple #7
0
 /**
  * <summary>Gets the text of a given page</summary>
  * <param name = "pageIndex">The index of the page</param>
  * <param name = "languageNumber">The index number of the language to get the text in, where 0 = original language and >0 = translations</param>
  * <returns>The page text</returns>
  */
 public string GetPageText(int pageIndex, int languageNumber = 0)
 {
     if (pages != null && pageIndex < pages.Count && pageIndex > 0)
     {
         JournalPage page = pages[pageIndex];
         return(KickStarter.runtimeLanguages.GetTranslation(page.text, page.lineID, languageNumber, GetTranslationType(0)));
     }
     return(string.Empty);
 }
Exemple #8
0
        /**
         * <summary>Adds a page to the journal.</summary>
         * <param name = "newPage">The page to add</param>
         * <param name = "onlyAddNew">If True, then the page will not be added if its lineID number matches that of any page already in the journal</param>
         * <param name = "index">The index number to insert the page into. A value of -1 will cause it to be added at the end.<param>
         */
        public void AddPage(JournalPage newPage, bool onlyAddNew, int index = -1)
        {
            if (journalType == JournalType.DisplayExistingJournal)
            {
                ACDebug.LogWarning("The journal '" + title + "' cannot be added to - instead its linked journal (" + otherJournalTitle + ") must be modified instead.");
                return;
            }

            if (journalType == JournalType.DisplayActiveDocument)
            {
                ACDebug.LogWarning("The journal '" + title + "' cannot be added to.");
                return;
            }

            if (onlyAddNew && newPage.lineID >= 0 && pages != null && pages.Count > 0)
            {
                // Check for existing to avoid duplicates
                foreach (JournalPage page in pages)
                {
                    if (page.lineID == newPage.lineID)
                    {
                        return;
                    }
                }
            }

            if (index == -1)
            {
                index = pages.Count;
            }

            if (index < 0 || index >= pages.Count)
            {
                pages.Add(newPage);
                index = pages.IndexOf(newPage);
            }
            else
            {
                pages.Insert(index, newPage);
            }

            if (showPage > index || showPage == 0)
            {
                showPage++;
            }

            KickStarter.eventManager.Call_OnModifyJournalPage(this, newPage, index, true);

            AdvGame.RunActionListAsset(actionListOnAddPage);
        }
Exemple #9
0
        /**
         * <summary>Removes a page from the journal.</summary>
         * <param name = "index">The page number to remove. A value of -1 will cause the last page to be removed.<param>
         */
        public void RemovePage(int index = -1)
        {
            if (journalType == JournalType.DisplayExistingJournal)
            {
                ACDebug.LogWarning("The journal '" + title + "' cannot be modified - instead its linked journal (" + otherJournalTitle + ") must be modified instead.");
                return;
            }

            if (pages.Count == 0)
            {
                return;
            }

            if (index == -1)
            {
                index = pages.Count - 1;
            }

            if (index < 0)
            {
                index = pages.Count - 1;
            }
            else if (index >= pages.Count)
            {
                ACDebug.LogWarning("The journal '" + title + "' cannot have it's " + index + " page removed, as it only has " + pages.Count + " pages!");
                return;
            }

            if (pages[index].lineID == -1)
            {
                ACDebug.LogWarning("The removed Journal page has no ID number, and the change will not be included in save game files - this can be corrected by clicking 'Gather text' in the Speech Manager.");
            }

            JournalPage removedPage = pages[index];

            pages.RemoveAt(index);

            if (showPage > index)            // && showPage > 1)
            {
                showPage--;
            }

            KickStarter.eventManager.Call_OnModifyJournalPage(this, removedPage, index, false);
        }
Exemple #10
0
        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);
        }
Exemple #11
0
        /**
         * <summary>Adds a page to the journal.</summary>
         * <param name = "newPage">The page to add</param>
         * <param name = "onlyAddNew">If True, then the page will not be added if its lineID number matches that of any page already in the journal</param>
         */
        public void AddPage(JournalPage newPage, bool onlyAddNew)
        {
            if (journalType == JournalType.DisplayExistingJournal)
            {
                ACDebug.LogWarning("The journal '" + title + "' cannot be added to - instead its linked journal (" + otherJournalTitle + ") must be modified instead.");
                return;
            }

            if (onlyAddNew && newPage.lineID >= 0 && pages != null && pages.Count > 0)
            {
                // Check for existing to avoid duplicates
                foreach (JournalPage page in pages)
                {
                    if (page.lineID == newPage.lineID)
                    {
                        return;
                    }
                }
            }
            pages.Add(newPage);
            AdvGame.RunActionListAsset(actionListOnAddPage);
        }
Exemple #12
0
 private string TranslatePage(JournalPage page, int languageNumber)
 {
     return(SpeechManager.GetTranslation(page.text, page.lineID, languageNumber));
 }
Exemple #13
0
 public JournalPage(JournalPage journalPage)
 {
     lineID = journalPage.lineID;
     text   = journalPage.text;
 }
Exemple #14
0
        /**
         * <summary>Adds a page to the journal.</summary>
         * <param name = "newPage">The page to add</param>
         * <param name = "onlyAddNew">If True, then the page will not be added if its lineID number matches that of any page already in the journal</param>
         */
        public void AddPage(JournalPage newPage, bool onlyAddNew)
        {
            if (journalType == JournalType.DisplayExistingJournal)
            {
                ACDebug.LogWarning ("The journal '" + title + "' cannot be added to - instead its linked journal (" + otherJournalTitle + ") must be modified instead.");
                return;
            }

            if (onlyAddNew && newPage.lineID >= 0 && pages != null && pages.Count > 0)
            {
                // Check for existing to avoid duplicates
                foreach (JournalPage page in pages)
                {
                    if (page.lineID == newPage.lineID)
                    {
                        return;
                    }
                }
            }
            pages.Add (newPage);
            AdvGame.RunActionListAsset (actionListOnAddPage);
        }
		override public float Run ()
		{
			if (!isRunning)
			{
				isRunning = true;
				Menu _menu = PlayerMenus.GetMenuWithName (menuToChange);
				
				if (_menu != null)
				{
					if (changeType == MenuChangeType.TurnOnMenu)
					{
						if (_menu.appearType == AppearType.Manual || _menu.appearType == AppearType.OnInputKey)
						{
							if (!_menu.TurnOn (doFade))
							{
								// Menu is already on
								isRunning = false;
								return 0f;
							}
							
							if (doFade && willWait)
							{
								return defaultPauseTime;
							}
						}
						else
						{
							Debug.LogWarning ("Can only turn on menus with an Appear Type of Manual and OnInputKey.");
						}
					}
					else if (changeType == MenuChangeType.TurnOffMenu)
					{
						if (_menu.appearType == AppearType.Manual || _menu.appearType == AppearType.OnInputKey || _menu.appearType == AppearType.OnContainer)
						{
							if (!_menu.TurnOff (doFade))
							{
								// Menu is already off
								isRunning = false;
								return 0f;
							}
							
							if (doFade && willWait)
							{
								return defaultPauseTime;
							}
						}
						else
						{
							Debug.LogWarning ("Can only turn off menus with an Appear Type of Manual, OnContainer, and OnInputKey.");
						}
					}
					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
						{
							Debug.LogWarning ("Could not find menu element of name '" + elementToChange + "'");
						}
					}
					else if (changeType == MenuChangeType.LockMenu)
					{
						if (doFade)
						{
							_menu.TurnOff (true);
						}
						else
						{
							_menu.ForceOff ();
						}
						_menu.isLocked = true;
						
						if (doFade && willWait)
						{
							return defaultPauseTime;
						}
					}
					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.pages.Add (newPage);
								}
								else
								{
									Debug.LogWarning (_element.title + " is not a journal!");
								}
							}
							else
							{
								Debug.LogWarning ("No journal text to add!");
							}
						}
						else
						{
							Debug.LogWarning ("Could not find menu element of name '" + elementToChange + "' inside '" + menuToChange + "'");
						}
					}
				}
				else if (menuToChange != "")
				{
					Debug.LogWarning ("Could not find menu of name '" + menuToChange + "'");
				}
			}
			
			else
			{
				Menu _menu = PlayerMenus.GetMenuWithName (menuToChange);
				
				if (_menu != null)
				{
					if (_menu.IsFading ())
					{
						return defaultPauseTime;
					}
					else
					{
						isRunning = false;
						return 0f;
					}
				}
			}
			
			return 0f;
		}
        public override 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 string TranslatePage(JournalPage page, int languageNumber)
 {
     if (languageNumber > 0)
     {
         return (KickStarter.runtimeLanguages.GetTranslation (page.text, page.lineID, languageNumber));
     }
     return page.text;
 }
 /**
  * <summary>Adds a page to the journal.</summary>
  * <param name = "newPage">The page to add</param>
  * <param name = "onlyAddNew">If True, then the page will not be added if it's lineID number matches that of any page already in the journal</param>
  */
 public void AddPage(JournalPage newPage, bool onlyAddNew)
 {
     if (onlyAddNew && newPage.lineID >= 0 && pages != null && pages.Count > 0)
     {
         // Check for existing to avoid duplicates
         foreach (JournalPage page in pages)
         {
             if (page.lineID == newPage.lineID)
             {
                 return;
             }
         }
     }
     pages.Add (newPage);
     AdvGame.RunActionListAsset (actionListOnAddPage);
 }
Exemple #19
0
        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();
            }
        }
Exemple #20
0
 private string TranslatePage(JournalPage page, int languageNumber)
 {
     return (SpeechManager.GetTranslation (page.text, page.lineID, languageNumber));
 }
Exemple #21
0
        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);
                            }
                        }
                    }
                }
            }
        }
 public JournalPage(JournalPage journalPage)
 {
     lineID = -1;
     text = journalPage.text;
 }
Exemple #23
0
        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 override 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;
        }
Exemple #25
0
        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();
            }
        }