Exemplo n.º 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();
            }
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
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);
                            }
                        }
                    }
                }
            }
        }