Exemplo n.º 1
0
        private void Start()
        {
            // Get References
            ui_manager = FindObjectOfType <UIManager>();

            // Get Current Options Settings
            options            = new Options();
            options.text_speed = ui_manager.text_speed;
            // TODO get other current option settings
            options.menu_frame    = ui_manager.menu_frame;
            options.message_frame = ui_manager.message_frame;

            // Set Windowskin and Text Color
            title_panel.sprite                 = ui_manager.GetCurrentMenuSkin();
            title_text_field.color             = ui_manager.GetBestTextColor(title_panel);
            options_panel.sprite               = ui_manager.GetCurrentMenuSkin();
            options_text_field.color           = ui_manager.GetBestTextColor(options_panel);
            options_selection_text_field.color = ui_manager.GetBestTextColor(options_panel);
            message_panel.sprite               = ui_manager.GetCurrentMessageSkin();
            message_text_field.color           = ui_manager.GetBestTextColor(message_panel);

            // Build Menu
            num_options       = MENU_OPTIONS.Length;
            current_selection = 0;
            BuildMenuText();
            message_text_field.text = GetMessageText(current_selection);
            setting_changed         = false;
            awaiting_input          = true;
        }
Exemplo n.º 2
0
        private void Start()
        {
            // Get references
            ui_manager = FindObjectOfType <UIManager>();

            // Get current party info
            player = ui_manager.GetPlayerTrainer();
            party  = player.party;

            // Set windowskin and text color
            message_panel.sprite     = ui_manager.GetCurrentMenuSkin();
            message_text_field.color = ui_manager.GetBestTextColor(message_panel);
            button_text.color        = CANCEL_TEXT_COLOR;

            // Show pokemon info and build rest of scene
            BuildPokemonPanels();
            message_text_field.text = WELCOME_MESSAGE;
            button_text.text        = CANCEL_TEXT;

            // Ready for interaction
            anim_time         = 0;
            anim_frame        = 0;
            temp_pokemon      = null;
            current_selection = 0;
            swapping          = false;
            awaiting_input    = true;
        }
Exemplo n.º 3
0
        private void Start()
        {
            // Get References
            ui_manager = FindObjectOfType <UIManager>();

            // Set Windowskin and Text Color
            panel.sprite     = ui_manager.GetCurrentMessageSkin();
            text_field.color = ui_manager.GetBestTextColor(panel);

            // Initialize View Settings
            text_field_width    = text_field.rectTransform.rect.width;
            message             = text_field.text;
            pause_arrow.enabled = false;
            text_field.text     = null;

            // Divide Message
            message_lines     = BreakUpMessage();
            num_lines         = message_lines.Length;
            num_lines_written = 0;

            // Ready for Interaction
            speed           = Constants.TEXT_SPEEDS[(int)ui_manager.text_speed];
            awaiting_action = false;
            writing         = false;
            on_final_line   = false;
            finished        = false;
        }
Exemplo n.º 4
0
        private void Start()
        {
            // Get references
            ui_manager    = FindObjectOfType <UIManager>();
            event_manager = FindObjectOfType <EventManager>();
            player        = ui_manager.GetPlayerTrainer();

            // Pause Game
            event_manager.DisablePlayerControl();
            event_manager.DisableAllEvents();

            // Set Windowskin and Text Color
            panel.sprite     = ui_manager.GetCurrentMenuSkin();
            text_field.color = ui_manager.GetBestTextColor(panel);

            // Build Menu
            BuildMenuOptions();
            if (ui_manager.pause_menu_selection != null)
            {
                current_selection = menu_options.IndexOf((PauseMenuOptions)ui_manager.pause_menu_selection);
            }
            else
            {
                current_selection = 0;
            }
            BuildMenuText();
            BuildMenuIcons();
            interactable = true;
        }
Exemplo n.º 5
0
        private void Start()
        {
            // Get References
            ui_manager = FindObjectOfType <UIManager>();

            // Set Windowskin and Text Color
            panel.sprite     = ui_manager.GetCurrentMenuSkin();
            text_field.color = ui_manager.GetBestTextColor(panel);
            if (ui_manager.IsDarkBG(panel))
            {
                sel_arrow.enabled = false;
            }
            else
            {
                sel_arrow_white.enabled = false;
            }

            // Initialize View Settings
            choices         = text_field.text.Split('\n');
            text_field.text = null;
            BuildChoicePanel();

            // Ready for Interaction
            choice_package    = ui_manager.choice_package;
            current_selection = choice_package.starting_choice;
            SetPointerStartPos();
            finished = false;
        }
Exemplo n.º 6
0
        private void Update()
        {
            // Get player input
            if (interactable)
            {
                if (Input.GetKeyDown(KeyCode.DownArrow))
                {
                    if (current_selection == menu_options.Count - 1)
                    {
                        current_selection = 0;
                    }
                    else
                    {
                        current_selection += 1;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.UpArrow))
                {
                    if (current_selection == 0)
                    {
                        current_selection = menu_options.Count - 1;
                    }
                    else
                    {
                        current_selection -= 1;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.X))
                {
                    CloseMenu();
                }
                else if (Input.GetKeyDown(KeyCode.Z))
                {
                    OpenMenuOption(current_selection);
                }
            }

            // Check if open menu scene was closed
            if (!interactable && open_menu == null)
            {
                panel.sprite     = ui_manager.GetCurrentMenuSkin();
                text_field.color = ui_manager.GetBestTextColor(panel);
                interactable     = true;
            }

            // Update icons based on selection and gender
            for (int i = 0; i < menu_options.Count; i++)
            {
                if (i == current_selection && player.gender == Pokemon.Genders.Female && f_selected[(int)menu_options[i]] != null)
                {
                    menu_icons[i].sprite = f_selected[(int)menu_options[i]];
                }
                else if (i == current_selection)
                {
                    menu_icons[i].sprite = selected[(int)menu_options[i]];
                }
                else
                {
                    menu_icons[i].sprite = non_selected[(int)menu_options[i]];
                }
            }
        }
Exemplo n.º 7
0
        private void ChangeSelectionLeft(int index)
        {
            if (MENU_OPTIONS[index].Length > 2)
            {
                switch (index)
                {
                case 0:     // Text Speed
                    if (options.text_speed != TextSpeeds.Slow)
                    {
                        options.text_speed -= 1;
                    }
                    break;

                case 1:     // Battle Effects
                    if (options.battle_effect != BattleEffects.On)
                    {
                        options.battle_effect -= 1;
                    }
                    break;

                case 2:     // Battle Style
                    if (options.battle_style != BattleStyles.Switch)
                    {
                        options.battle_style -= 1;
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                if (index == MESSAGE_FRAME_OPTION_INDEX)
                {
                    if (options.message_frame == 0)
                    {
                        options.message_frame = (MessageFrames)(Enum.GetValues(typeof(MessageFrames)).Length - 1);
                    }
                    else
                    {
                        options.message_frame -= 1;
                    }
                    message_panel.sprite     = ui_manager.GetMessageSkin(options.message_frame);
                    message_text_field.color = ui_manager.GetBestTextColor(message_panel);
                }
                else if (index == MENU_FRAME_OPTION_INDEX)
                {
                    if (options.menu_frame == 0)
                    {
                        options.menu_frame = (MenuFrames)(Enum.GetValues(typeof(MenuFrames)).Length - 1);
                    }
                    else
                    {
                        options.menu_frame -= 1;
                    }
                    title_panel.sprite                 = ui_manager.GetMenuSkin(options.menu_frame);
                    title_text_field.color             = ui_manager.GetBestTextColor(title_panel);
                    options_panel.sprite               = ui_manager.GetMenuSkin(options.menu_frame);
                    options_text_field.color           = ui_manager.GetBestTextColor(options_panel);
                    options_selection_text_field.color = ui_manager.GetBestTextColor(options_panel);
                }
            }

            BuildMenuText();
        }