示例#1
0
        public IAudioSource PlayVocabularyData(ILivingLetterData data,
                                               bool exclusive                = false,
                                               bool isKeeper                 = true, bool autoClose = true, Action _callback = null,
                                               KeeperMode keeperMode         = KeeperMode.Default,
                                               LetterDataSoundType soundType = LetterDataSoundType.Phoneme)
        {
            //Debug.LogWarning("Keeper playing Vocabulary " + data.Id);

            if (keeperMode == KeeperMode.Default)
            {
                keeperMode = AppManager.I.ParentEdition.DefaultKeeperMode;
            }

            bool withSubtitles = keeperMode == KeeperMode.LearningThenNativeAndSubtitles ||
                                 keeperMode == KeeperMode.LearningAndSubtitles ||
                                 keeperMode == KeeperMode.NativeAndSubtitles || keeperMode == KeeperMode.SubtitlesOnly;

            if (withSubtitles)
            {
                WidgetSubtitles.I.DisplayVocabularyData(data, 2, isKeeper);
            }

            if (!withSubtitles)
            {
                autoClose = false;
            }

            IAudioSource playingSource = null;

            switch (keeperMode)
            {
            case KeeperMode.LearningAndSubtitles:
            case KeeperMode.LearningNoSubtitles:
                playingSource = AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Learning, () => OnEndSpeaking(_callback, autoClose), true);
                break;

            case KeeperMode.NativeAndSubtitles:
            case KeeperMode.NativeNoSubtitles:
                playingSource = AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Native, () => OnEndSpeaking(_callback, autoClose), true);
                break;

            case KeeperMode.LearningThenNativeAndSubtitles:
            case KeeperMode.LearningThenNativeNoSubtitles:
                playingSource = AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Learning,
                                                                       () => {
                    AudioManager.I.PlayVocabularyDataAudio(data, exclusive, soundType, LanguageUse.Native, () => OnEndSpeaking(_callback, autoClose), true);
                }
                                                                       , true);
                break;

            case KeeperMode.SubtitlesOnly:
                // Nothing, we must close manually
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(keeperMode), keeperMode, null);
            }
            return(playingSource);
        }
示例#2
0
 /// <summary>
 /// Shows a popup with a YES/NO button and relative callbacks
 /// </summary>
 public static void ShowPrompt(Database.LocalizationDataId id, Action _onYesCallback = null, Action _onNoCallback = null, KeeperMode keeperMode = KeeperMode.Default)
 {
     Prompt.Show(id, _onYesCallback, _onNoCallback, keeperMode);
 }
示例#3
0
 public TimeKeeper(KeeperMode mode)
 {
     this.mode = mode;
 }
示例#4
0
        private void PlayDialogue(LocalizationData data, bool isKeeper = true, bool autoClose = true, Action _callback = null, KeeperMode keeperMode = KeeperMode.Default)
        {
            if (ApplicationConfig.I.VerboseAudio)
            {
                Debug.Log("Keeper trying to play audio for PlayDialogue: " + data.Id);
            }

            if (keeperMode == KeeperMode.Default)
            {
                keeperMode = AppManager.I.ParentEdition.DefaultKeeperMode;
            }

            if (AppManager.I.SpecificEdition.LearningLanguage == AppManager.I.SpecificEdition.NativeLanguage)
            {
                if (keeperMode == KeeperMode.LearningThenNativeAndSubtitles)
                {
                    keeperMode = KeeperMode.LearningAndSubtitles;
                }
                else if (keeperMode == KeeperMode.LearningThenNativeNoSubtitles)
                {
                    keeperMode = KeeperMode.LearningNoSubtitles;
                }
            }

            bool withSubtitles = keeperMode == KeeperMode.LearningThenNativeAndSubtitles ||
                                 keeperMode == KeeperMode.LearningAndSubtitles ||
                                 keeperMode == KeeperMode.NativeAndSubtitles || keeperMode == KeeperMode.SubtitlesOnly;

            if (withSubtitles)
            {
                WidgetSubtitles.I.DisplayDialogue(data, 2, isKeeper);
            }
            else
            {
                WidgetSubtitles.I.Close();
                autoClose = false;
            }

            switch (keeperMode)
            {
            case KeeperMode.LearningAndSubtitles:
            case KeeperMode.LearningNoSubtitles:
                AudioManager.I.PlayDialogue(data, LanguageUse.Learning, () => OnEndSpeaking(_callback, autoClose), true);
                break;

            case KeeperMode.NativeAndSubtitles:
            case KeeperMode.NativeNoSubtitles:
                AudioManager.I.PlayDialogue(data, LanguageUse.Native, () => OnEndSpeaking(_callback, autoClose), true);
                break;

            case KeeperMode.LearningThenNativeAndSubtitles:
            case KeeperMode.LearningThenNativeNoSubtitles:
                AudioManager.I.PlayDialogue(data, LanguageUse.Learning,
                                            () => {
                    AudioManager.I.PlayDialogue(data, LanguageUse.Native, () => OnEndSpeaking(_callback, autoClose), true);
                }, true);
                break;

            case KeeperMode.SubtitlesOnly:
                // Nothing, we must close manually
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(keeperMode), keeperMode, null);
            }
        }
示例#5
0
 public void PlayDialogue(string id, KeeperMode keeperMode)
 {
     PlayDialogue(LocalizationManager.GetLocalizationData(id), true, true, null, keeperMode);
 }
示例#6
0
 public void PlayDialogue(LocalizationDataId id, bool isKeeper = true, bool autoClose = true, Action _callback = null, KeeperMode keeperMode = KeeperMode.Default)
 {
     PlayDialogue(LocalizationManager.GetLocalizationData(id), isKeeper, autoClose, _callback, keeperMode);
 }
 public TimeKeeper(KeeperMode mode)
 {
     this.mode = mode;
 }
示例#8
0
 public void PlayDialogue(LocalizationDataId text, System.Action callback = null, KeeperMode keeperMode = KeeperMode.Default, bool isKeeper = true)
 {
     KeeperManager.I.PlayDialogue(text.ToString(), _callback: callback, keeperMode: keeperMode, isKeeper: isKeeper);
 }
示例#9
0
 public IAudioSource PlayVocabularyData(ILivingLetterData data, bool exclusive = true, LetterDataSoundType soundType = LetterDataSoundType.Phoneme,
                                        System.Action callback = null, KeeperMode keeperMode = KeeperMode.LearningNoSubtitles,
                                        bool autoClose         = true, bool isKeeper = false)
 {
     return(KeeperManager.I.PlayVocabularyData(data, exclusive, isKeeper: isKeeper, _callback: callback, autoClose: autoClose, keeperMode: keeperMode, soundType: soundType));
 }
示例#10
0
        public void Show(Database.LocalizationDataId id, Action _onYes, Action _onNo, KeeperMode keeperMode = KeeperMode.Default)
        {
            var localizationData = LocalizationManager.GetLocalizationData(id);

            KeeperManager.I.PlayDialogue(id, keeperMode: keeperMode);

            if (keeperMode == KeeperMode.NativeNoSubtitles || keeperMode == KeeperMode.NativeAndSubtitles)
            {
                Show(localizationData.NativeText, localizationData.GetNativeText(), _onYes, _onNo);
            }
            else
            {
                Show(LocalizationManager.GetLearning(id), localizationData.GetNativeText(), _onYes, _onNo);
            }
        }