Exemple #1
0
        public void OnMenuClose()
        {
            if (Selection.ExperienceType == ExperienceType.MANDALA && m_experienceMachine.CurrentExperience == ExperienceType.MANDALA && Selection.VoiceOver == null)
            {
                m_experienceMachine.GetExperience(ExperienceType.MANDALA).ResumeGuide();
                return;
            }

            if (!Experience.AudioSelectionFlag && m_lastVo != null)
            {
                AudioSource audioSource = m_audio.GetAudioSource(AudioType.VO);

                if (audioSource.isPlaying)
                {
                    float     lastTime = m_lastVo.Time;
                    AudioArgs args     = new AudioArgs(null, AudioType.VO)
                    {
                        FadeTime = .5f,
                        Done     = () =>
                        {
                            AudioArgs voArgs = new AudioArgs(Selection.VoiceOver, AudioType.VO);
                            voArgs.FadeTime   = 2;
                            voArgs.ResumeTime = lastTime;
                            m_audio.Resume(voArgs);
                        }
                    };
                    m_audio.Stop(args);
                    m_lastVo = null;
                }
                else
                {
                    AudioArgs voArgs = new AudioArgs(Selection.VoiceOver, AudioType.VO);
                    voArgs.FadeTime   = 2;
                    voArgs.ResumeTime = m_lastVo.Time;
                    m_audio.Resume(voArgs);
                    m_lastVo = null;
                }
            }
        }
Exemple #2
0
        public virtual void ExecuteMenuCommand(MenuClickArgs args)
        {
            //Debug.Log(args.Name + " " + args.Path + " " + args.Command + " " + args.CommandType.ToString());
            if (args.CommandType == MenuCommandType.SAVE_PRESET)
            {
                m_experienceMachine.GetExperience(ExperienceType.MANDALA).ExecuteMenuCommand(args);
                return;
            }

            if (args.CommandType == MenuCommandType.QUIT)
            {
                #if UNITY_EDITOR
                UnityEditor.EditorApplication.ExecuteMenuItem("Edit/Play");
                #else
                Application.Quit();
                #endif
                return;
            }

            if (args.CommandType == MenuCommandType.HOME)
            {
                Selection.Location       = args.Path;
                Selection.ExperienceType = ExperienceType.HOME;
                ToggleMenu();
                m_experienceMachine.LoadExperience();
            }

            if (args.CommandType == MenuCommandType.LOBBY)
            {
                if (PhotonNetwork.InRoom)
                {
                    m_network.LeaveRoom();
                }
                else
                {
                    //Selection.Location = args.Path;
                    //Selection.ExperienceType = ExperienceType.LOBBY;
                    //m_uiEngine.Close();
                    //m_experienceMachine.LoadExperience();
                }
            }

            if (args.CommandType == MenuCommandType.SETTINGS)
            {
                m_uiEngine.OpenSettingsInterface(m_commonResource.GetGuideClip(MenuCommandType.SETTINGS));
            }
            if (args.CommandType == MenuCommandType.INVENTORY)
            {
                var resourceType = ResourceType.OBJECT;
                var categories   = m_commonResource.GetCategories(ResourceType.OBJECT);

                if (categories.Length == 0 || (categories.Length == 1 && string.IsNullOrEmpty(categories[0].Name)))
                {
                    throw new NotImplementedException();
                }
                else
                {
                    MenuItemInfo[] categoryItems = GetCategoryMenu(categories, resourceType);

                    m_uiEngine.OpenGridMenu(new GridArgs()
                    {
                        AudioClip = m_commonResource.GetGuideClip(GetCommandType(resourceType)),
                        Items     = categoryItems,
                        Title     = "WHAT KIND OF ITEM WOULD YOU LIKE TO LOAD?",
                    });
                }
            }

            if (args.CommandType == MenuCommandType.MUSIC)
            {
                var categories = GetCategories(ResourceType.MUSIC);
                if (categories.Length == 0 || (categories.Length == 1 && string.IsNullOrEmpty(categories[0].Name)))
                {
                    m_uiEngine.OpenGridMenu(new GridArgs()
                    {
                        AudioClip = m_commonResource.GetGuideClip(MenuCommandType.MUSIC),
                        Items     = ResourceToMenuItems(GetResource(ResourceType.MUSIC, "")),
                        Title     = "SELECT MUSIC",
                    });
                }
                else
                {
                    m_uiEngine.OpenGridMenu(new GridArgs()
                    {
                        AudioClip = m_commonResource.GetGuideClip(MenuCommandType.MUSIC),
                        Items     = GetCategoryMenu(categories, ResourceType.MUSIC),
                        Title     = "WHAT MUSIC IS THE RIGHT FIT?",
                    });
                }
            }
            else if (args.CommandType == MenuCommandType.SELECTION)
            {
                ExecuteSelectionCommand(args);
            }
        }