Пример #1
0
        public void SetData(TelephoneVo vo, bool showAnimation)
        {
            OpenAnimation(showAnimation);

            _telephoneVo = vo;

            _bgBlurEffect.StartRecord(
                ResourceManager.Load <Texture>(AssetLoader.GetStoryBgImage(_telephoneVo.bgImageId), ModuleName), tex =>
            {
                _bgImage.texture = tex;
            });
            _roleNameText.text = vo.GetRoleName();

            _headImage.sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_Story_Role" + (int)vo.Role);

            _currentIndex = 0;
            IsWait        = false;
            _dialogFrame.gameObject.Show();

            if (_continueAutoPlay)
            {
                OnAutoPlay(_continueAutoPlay);
            }
            else
            {
                NextStep(null);
            }
        }
Пример #2
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;
            }
        }