private void UnloadBundles() { foreach (var dialogVo in _dialogList) { if (string.IsNullOrEmpty(dialogVo.DubbingId) == false) { AssetLoader.UnloadBundle(AssetLoader.GetDubbingById(dialogVo.DubbingId)); } if (string.IsNullOrEmpty(dialogVo.BgMusicId) == false) { AssetLoader.UnloadBundle(AssetLoader.GetBackgrounMusicById(dialogVo.BgMusicId)); } foreach (var key in _bgImageCache.Keys) { AssetManager.Instance.UnloadBundle(AssetLoader.GetStoryBgImage(key)); } foreach (var key in _headImageCache.Keys) { AssetManager.Instance.UnloadBundle(AssetLoader.GetHeadImageById(key)); } foreach (var key in _roleImageCache.Keys) { AssetManager.Instance.UnloadBundle(AssetLoader.GetStoryRoleImageById(key)); } } }
private void NextStep(GameObject go) { if (IsWait || _hasSelection) { return; } if (_telephoneVo.dialogList.Count > _currentIndex) { if (_dialogFrame.IsPlaying) { _dialogFrame.Typing(); } else { TelephoneDialogVo data = _telephoneVo.dialogList[_currentIndex++]; _dialogFrame.SetData(data, _telephoneVo.GetRoleName()); _dialogFrame.Show(0.5f); if (!string.IsNullOrEmpty(data.AudioId)) { new AssetLoader().LoadAudio(AssetLoader.GetDubbingById(data.AudioId), (clip, loader) => { if (clip == null) { Debug.LogWarning("TelephoneView AssetLoader Error->" + loader.FilePath); return; } ClientTimer.Instance.DelayCall(() => { _dialogFrame.SetAudioTime(clip.length); AudioManager.Instance.PlayDubbing(clip); }, 0.5f); }); } else { AudioManager.Instance.StopDubbing(); } string roleName = data.IsHeroine ? GlobalData.PlayerModel.PlayerVo.UserName : _telephoneVo.GetRoleName(); SendMessage(new Message(MessageConst.CMD_STORY_RECODE_DIALOG, Message.MessageReciverType.DEFAULT, data, roleName)); } } else { if (_dialogFrame.IsPlaying) { _dialogFrame.Typing(); return; } if (_telephoneVo.Event != null) { if (_telephoneVo.Event.EventType == EventType.Selection) { CreateSelection(_telephoneVo.Event); } else { OnEvent(_telephoneVo.Event); } } else { EndStory(); } IsWait = true; } }