示例#1
0
    void Start()
    {
        //Insert the email & home commands,
        //if the email comamnd should exist.
        //Then set the current menu to the home menu.
        if (emailInfo.hasEmail)
        {
            //Email menu should always be the first in the list.
            emailCommand = new EmailMenuCommand();
            //menus.Commands.Insert(0, emailCommand);

            //Populate the email list.
            emailCommand.AssignEmails(emailInfo.Commands);
            //Set the email menu password.
            emailCommand.password = emailInfo.password;

            //Home menu should always be after the email menu, if email menu exists.
            //menus.Commands.Insert(1, homeCommand);
            //Set the current menu to the home menu.
            currentCommandMenu = menus.Commands[1];
        }
        else
        {
            //If no email menu exists for the computer, then assign
            //the home menu to be first in the list, and set as current menu.
            //menus.Commands.Insert(0, homeCommand);
            currentCommandMenu = menus.Commands[0];
        }
    }
示例#2
0
    //Display the correct menu & commands.
    void ShowMenu(CompMenuCommand openMenu)
    {
        currentCommandMenu = openMenu;
        currentScreenType  = ScreenType.Menu;

        menuScreens.Find(x => x.sentString == openMenu.commandText).Raise();
        menuEvent.Raise();
    }
示例#3
0
 public void SwitchMenu(string menu)
 {
     currentMenu          = menuCmdList.Commands.Find(x => x.commandText == menu);
     menuTitleText.text   = currentMenu.menuPanelTitle;
     menuListText.text    = currentMenu.displayText;
     commandListText.text = currentMenu.commandsDisplayText;
     OnMenuSwitch(menu);
     SetEmailText();
 }
示例#4
0
    //User has exited the computer.
    void ExitScreen()
    {
        //Set the current menu back to the home menu.
        if (emailInfo.hasEmail)
        {
            currentCommandMenu = menus.Commands[1];
        }
        else
        {
            currentCommandMenu = menus.Commands[0];
        }

        menuScreens.Find(x => x.sentString == "home").Raise();

        //Raise deactivate game event (SO).
        deactivate.Raise();

        //Set the static variable so other scripts know the user
        //is no longer using a computer.
        usingComputer = false;

        RigidbodyFirstPersonController.frozen = false;
    }
示例#5
0
    //The method that runs when a command is entered.
    public void CommandEnter()
    {
        ComputerCommand enteredCommand;
        string          commandString = commandText.text;

        if (currentScreenType == ScreenType.Error)
        {
            ShowMenu(currentCommandMenu);
            return;
        }

        //If user is on a display page
        if (currentScreenType == ScreenType.DisplayText || currentScreenType == ScreenType.Error || currentScreenType == ScreenType.Help)
        {
            //If the user presses enter on the display page.
            if (Input.GetKey(KeyCode.Return))
            {
                commandString = currentCommandMenu.commandText;
                //SelectCommandText();
                displayText = false;
                ShowMenu(currentCommandMenu);
                return;
            }
        }

        if (commandString == CommonCompStrings.cmdDict[CommonCompStrings.Command.Quit])
        {
            ExitScreen(); return;
        }
        if (commandString == CommonCompStrings.cmdDict[CommonCompStrings.Command.Help])
        {
            ShowHelpText(); return;
        }

        enteredCommand = currentCommandMenu.subCommands.Find(x => x.commandText.Equals(commandString, System.StringComparison.Ordinal));
        if (enteredCommand != null)
        {
            //mainText.text = enteredCommand.displayText;

            currentScreenType = ScreenType.DisplayText;

            commandText.interactable = false;
            displayText = true;
            displayList.Events.Find(x => x.sentString == commandText.text).Raise();
            displayScreen.Raise();

            return;
        }
        else
        {
            CompMenuCommand enteredMenu = menus.Commands.Find(x => x.commandText.Equals(commandString, System.StringComparison.Ordinal));
            if (enteredMenu != null)
            {
                if (enteredMenu.hackable)
                {
                    currentCommandMenu = enteredMenu;
                    if (!currentCommandMenu.alreadyHacked)
                    {
                        ShowHacking();
                        return;
                    }
                    else
                    {
                        PasswordEnter(currentCommandMenu.password);
                        return;

                        //Make sure that the other commands don't enter a password if
                        //the menu has already been hacked.
                        //if (currentScreenType == ScreenType.Password)
                        //{
                        //    return;
                        //}
                    }
                }
                else
                {
                    if (currentScreenType != ScreenType.DisplayText && currentScreenType != ScreenType.Error &&
                        currentScreenType != ScreenType.Help)
                    {
                        computerAudioSource.PlayOneShot(computerSounds.audioDict[ComputerSounds.Clips.Accept]);
                    }

                    if (currentCommandMenu.commandText.Equals(CommonCompStrings.cmdDict[CommonCompStrings.Command.Email],
                                                              System.StringComparison.Ordinal))
                    {
                        ShowEmailMenu();
                    }
                    else
                    {
                        ShowMenu(enteredMenu);
                    }
                }
            }
            //if user entered "list" command
            else if (commandString.Equals(CommonCompStrings.cmdDict[CommonCompStrings.Command.List], System.StringComparison.Ordinal))
            {
                ShowMenu(currentCommandMenu);
            }
            //else the user entered an invalid command.
            else
            {
                computerAudioSource.PlayOneShot(computerSounds.audioDict[ComputerSounds.Clips.Error]);
                ShowErrorText();
            }
        }
    }
示例#6
0
 public void SwitchMenu(string menu)
 {
     currentMenu = menuCmdList.Commands.Find(x => x.commandText == menu);
 }
示例#7
0
 public void SwitchMenu(string menu)
 {
     currentMenu = menuCmdList.Commands.Find(x => x.commandText == menu);
     SwitchState(ScreenType.Menu);
 }