예제 #1
0
        public override void Awake()
        {
            base.Awake();

            if (mDMono.ObjectParamList != null)
            {
                var count = mDMono.ObjectParamList.Count;

                if (count > 0 && mDMono.ObjectParamList[0] != null)
                {
                    m_Icon = ((GameObject)mDMono.ObjectParamList[0]).GetComponentEx <DialogueTextureCmp>();
                }
                if (count > 1 && mDMono.ObjectParamList[1] != null)
                {
                    m_SpriteIcon = ((GameObject)mDMono.ObjectParamList[1]).GetComponentEx <CampaignTextureCmp>();
                }
                if (count > 2 && mDMono.ObjectParamList[2] != null)
                {
                    m_SpeakName = ((GameObject)mDMono.ObjectParamList[2]).GetComponentEx <UILabel>();
                }
                if (count > 3 && mDMono.ObjectParamList[3] != null)
                {
                    m_SpeakContext = ((GameObject)mDMono.ObjectParamList[3]).GetComponentEx <UILabel>();
                }
                if (count > 4 && mDMono.ObjectParamList[4] != null)
                {
                    ContextBg = ((GameObject)mDMono.ObjectParamList[4]).GetComponentEx <UISprite>();
                }
                if (count > 5 && mDMono.ObjectParamList[5] != null)
                {
                    m_LazySpeakContext = ((GameObject)mDMono.ObjectParamList[5]).GetMonoILRComponent <UILazyLabel>();
                }
                if (count > 6 && mDMono.ObjectParamList[6] != null)
                {
                    lobbyTexture = ((GameObject)mDMono.ObjectParamList[6]).GetComponentEx <UITexture>();
                }
            }

            if (mDMono.Vector3ParamList != null)
            {
                var count = mDMono.Vector3ParamList.Count;

                if (count > 0)
                {
                    dialogueLightRotate = mDMono.Vector3ParamList[0];
                }
            }

            if (mDMono.StringParamList != null)
            {
                var count = mDMono.StringParamList.Count;

                if (count > 0)
                {
                    m_Soujin = mDMono.StringParamList[0];
                }
                if (count > 1)
                {
                    currentAudioName = mDMono.StringParamList[1];
                }
            }
        }
예제 #2
0
        public void Play(DialogueStepData data)
        {
            if (m_Icon != null && data.Icon.StartsWith("Header_"))
            {
                m_Icon.enabled    = true;
                m_Icon.spriteName = ReplaceIcon(data.Icon);
            }

            if (data.Layout != (int)eDialogueLayout.Middle)
            {
                m_SpeakName.text = string.Format("{0}:", ReplaceName(data.SpeakName));
            }
            else
            {
                if (m_SpeakName != null)
                {
                    m_SpeakName.gameObject.CustomSetActive(false);
                }
            }

            // 防止同一个人连续多次说话动画还连续播放多次
            if (lastDialogueId != data.DialogueId)
            {
                lastIcon       = string.Empty;
                lastStepId     = -1;
                lastDialogueId = data.DialogueId;
            }

            if (lastIcon != data.Icon || data.StepId - lastStepId > 1)
            {
                string DLGid          = string.Format("{0}/{1}", data.DialogueId, data.StepId);
                string audioEventName = Hotfix_LT.Data.GuideAudioTemplateManager.Instance.GetDLGAudio(DLGid);
                string audioBGMName   = Hotfix_LT.Data.GuideAudioTemplateManager.Instance.GetDLGBGM(DLGid);

                if (audioEventName != null)
                {
                    if (!string.IsNullOrEmpty(currentAudioName))
                    {
                        FusionAudio.PostEvent(currentAudioName, false);
                        currentAudioName = audioEventName;
                    }
                    FusionAudio.PostEvent(audioEventName, true);
                    FusionAudio.PostBGMEvent(audioBGMName, true);
                }

                UITweener[] tweeners = mDMono.transform.GetComponentsInChildren <UITweener>();

                for (int i = 0; i < tweeners.Length; i++)
                {
                    tweeners[i].ResetToBeginning();
                    tweeners[i].PlayForward();
                }
            }

            lastIcon   = data.Icon;
            lastStepId = data.StepId;

            if (m_LazySpeakContext == null)
            {
                m_LazySpeakContext = m_SpeakContext.transform.GetMonoILRComponent <UILazyLabel>();
            }

            m_LazySpeakContext.Text = string.Format("{0}{1}", (global::UserData.Locale == EB.Language.ChineseSimplified || global::UserData.Locale == EB.Language.ChineseTraditional) ? m_Soujin : "      ", data.Context);
            m_SpeakContext.fontSize = data.FontSize;
        }