Example #1
0
        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;
            }
        }