Example #1
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();
            }
        }
Example #2
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();
            }
        }