Пример #1
0
        public void SetData(TelephoneDialogVo vo, string roleName)
        {
            _headContainer.gameObject.SetActive(false);

            _telephoneDialogVo = vo;

            if (vo.IsHeroine)
            {
                _roleName = GlobalData.PlayerModel.PlayerVo.UserName;
            }
            else
            {
                _roleName = roleName;
            }

            _nameTxt.text  = _roleName;
            _nameTxt2.text = _roleName;

            if (!string.IsNullOrEmpty(_telephoneDialogVo.HeadId))
            {
                _headRole.texture = ResourceManager.Load <Texture>(AssetLoader.GetHeadImageById(vo.HeadId), ModuleConfig.MODULE_STORY);
            }

            _isPlaying     = true;
            _lastLineCount = 0;

            if (_contentTxt != null)
            {
                _contentTxt.text = "";
            }

            ChangeStyle();
        }
Пример #2
0
        public TelephoneDialogVo Clone()
        {
            TelephoneDialogVo vo = new TelephoneDialogVo();

            vo.DialogFrameStyle = DialogFrameStyle;
            vo.IsHeroine        = IsHeroine;
            vo.Content          = Content;
            vo.HeadId           = HeadId;
            vo.AudioId          = AudioId;

            return(vo);
        }
Пример #3
0
        public void AddDialog(object obj, string heroName)
        {
            if (stringBuilder == null)
            {
                stringBuilder = new StringBuilder();
            }

            Type type = obj.GetType();

            if (type == typeof(EntityVo))
            {
                EntityVo entity = (EntityVo)obj;
                if (entity.id == "0")
                {
                    stringBuilder.Append("【旁白】");
                }
                else
                {
                    stringBuilder.Append("【")
                    .Append(heroName)
                    .Append("】");
                }

                stringBuilder.Append(entity.dialog)
                .Append("\n\n");
            }
            else if (type == typeof(TelephoneDialogVo))
            {
                TelephoneDialogVo telDialogVo = (TelephoneDialogVo)obj;
                stringBuilder.Append("【")
                .Append(heroName)
                .Append("】");
                stringBuilder.Append(telDialogVo.Content)
                .Append("\n\n");
            }
            else if (type == typeof(SmsDialogVo))
            {
                SmsDialogVo smsDialogVo = (SmsDialogVo)obj;
                stringBuilder.Append("【")
                .Append(heroName)
                .Append("】");
                stringBuilder.Append(smsDialogVo.ContextText)
                .Append("\n\n");
            }
        }
Пример #4
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;
            }
        }