void PlayDialogue() { if (m_Dialogue_data == null) { if (mDialogueFinishCallback != null) { mDialogueFinishCallback(); } OnCancelButtonClick(); return; } if (m_Dialogue_data.Steps.Length >= m_CurrentStepIndex) { DialogueStepData step = m_Dialogue_data.Steps[m_CurrentStepIndex - 1]; ContentLabel.Text = step.Context; } else { if (mDialogueFinishCallback != null) { mDialogueFinishCallback(); } OnCancelButtonClick(); } m_CurrentStepIndex++; }
private void PlayStep(DialogueStepData step) { m_CurrentStepIndex = step.StepId; mStep = step; m_DialogueFrame.CreateBuddle(step); IsPlayStep = true; }
public void AddStep(GM.DataCache.DialogueInfo steph) { DialogueStepData step = new DialogueStepData(steph); //Steps.Insert(3, step); if (step.StepId > Steps.Length || step.StepId < 1) { EB.Debug.LogError("Dialogue stepsnum is Illigal id={0}", DialogueId); return; } Steps[step.StepId - 1] = step; }
public void SetFrameActive(DialogueStepData data) { if (data.Layout == (int)eDialogueLayout.Left) { m_Right.mDMono.gameObject.CustomSetActive(false); m_Left.mDMono.gameObject.CustomSetActive(true); } else { m_Right.mDMono.gameObject.CustomSetActive(true); m_Left.mDMono.gameObject.CustomSetActive(false); } m_Middle.mDMono.gameObject.CustomSetActive(false); }
public void Play(DialogueStepData data) { try { m_DialogueStepData = data; m_Container.CustomSetActive(true); if (data.Layout == (int)eDialogueLayout.Middle) { m_Left.mDMono.gameObject.CustomSetActive(false); m_Right.mDMono.gameObject.CustomSetActive(false); m_Middle.Play(data); m_Middle.mDMono.gameObject.CustomSetActive(true); } else if (data.Layout == (int)eDialogueLayout.Left) { m_Right.mDMono.gameObject.CustomSetActive(false); m_Middle.mDMono.gameObject.CustomSetActive(false); m_Left.mDMono.gameObject.CustomSetActive(true); //if (DialoguePlayUtil.Instance.Lobby != null) DialoguePlayUtil.Instance.Lobby.ConnectorTexture = m_Left.lobbyTexture; m_Left.Play(data); } else { m_Left.mDMono.gameObject.CustomSetActive(false); m_Middle.mDMono.gameObject.CustomSetActive(false); m_Right.mDMono.gameObject.CustomSetActive(true); //if (DialoguePlayUtil.Instance.Lobby != null) DialoguePlayUtil.Instance.Lobby.ConnectorTexture = m_Right.lobbyTexture; m_Right.Play(data); } m_State = true; if (m_DialogueStepData.StayTime > 0) { StartCoroutine(Play(data.StayTime)); } else { m_Container.CustomSetActive(true); } } catch (System.Exception e) { EB.Debug.LogError(e.StackTrace); Finish(); } }
public void CreateBuddle(DialogueStepData data) { if (data.Layout != (int)eDialogueLayout.Middle) { //DialoguePlayUtil.Instance.m_DialogueFrame.SetFrameActive(data); if (data.Layout == (int)eDialogueLayout.Left) { if (!data.Icon.StartsWith("Header_")) { StartCoroutine(m_Left.CreateBuddyModel(data.Layout, data)); } } else { if (!data.Icon.StartsWith("Header_")) { StartCoroutine(m_Right.CreateBuddyModel(data.Layout, data)); } } } }
private void Play(DialogueData data, System.Action callback) { try { onFinish = callback; if (data == null) { DoFinishCallBack(); return; } m_Panel.enabled = true; controller.Open(); m_state = true; m_DialogueData = data; m_DialogueFrame.onFinish += OnDialogueStepFinish; m_CurrentStepIndex = 1; if (data.Steps.Length >= m_CurrentStepIndex) { DialogueStepData step = data.Steps[m_CurrentStepIndex - 1]; if (step != null) { PlayStep(step); } else { EB.Debug.LogError(string.Format("Dialogue step null in index {0} for {1}", m_CurrentStepIndex, data.DialogueId)); DialogueFinish(); } } else { DialogueFinish(); } } catch (System.Exception e) { EB.Debug.LogError(e.StackTrace); DialogueFinish(); } }
private void OnDialogueStepFinish() { try { m_DialogueFrame.onFinish -= OnDialogueStepFinish; m_CurrentStepIndex += 1; if (m_DialogueData.Steps.Length >= m_CurrentStepIndex) { if (m_state == false)//跳过 { DialogueFinish(); return; } m_DialogueFrame.onFinish += OnDialogueStepFinish; DialogueStepData step = m_DialogueData.Steps[m_CurrentStepIndex - 1]; if (step != null) { PlayStep(step); } else { EB.Debug.LogError(string.Format("Dialogue step null in index {0} for {1}", m_CurrentStepIndex, m_DialogueData.DialogueId)); DialogueFinish(); } } else { DialogueFinish(); } } catch (System.Exception e) { EB.Debug.LogError(e.StackTrace); DialogueFinish(); } }
public IEnumerator CreateBuddyModel(int layout, DialogueStepData data) { string ShowPortraitSprite = null;//是否是显示半身像,否则显示模型 lobbyTexture.uvRect = new Rect(0.0f, 0.0f, 1.0f, 1.0f); if (data != null) { int characterId = Convert.ToInt32(data.Icon); var charTpl = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroInfo(characterId); if (charTpl == null) { EB.Debug.LogError("No Character for id = {0}", characterId); yield break; } if (!string.IsNullOrEmpty(charTpl.portrait)) { ShowPortraitSprite = charTpl.portrait; } if (charTpl.model_name == DialoguePlayUtil.Instance.ModelName && layout == DialoguePlayUtil.Instance.Layout) { yield break; } DialoguePlayUtil.Instance.ModelName = charTpl.model_name; } else { yield break; } ContextBg.gameObject.CustomSetActive(false); if (ShowPortraitSprite != null)//显示半身像 { lobbyTexture.gameObject.CustomSetActive(false); m_SpriteIcon.gameObject.CustomSetActive(true); DialoguePlayUtil.Instance.Layout = layout; m_SpriteIcon.spriteName = ShowPortraitSprite; } else//显示模型 { m_SpriteIcon.gameObject.CustomSetActive(false); lobbyTexture.gameObject.CustomSetActive(true); DialoguePlayUtil.Instance.Layout = layout; Vector3 charLightDirection = Quaternion.Euler(dialogueLightRotate) * Vector3.forward; Shader.SetGlobalVector("_CharTopDirectionToLight0", Vector3.zero - charLightDirection.normalized); if (DialoguePlayUtil.Instance.Lobby == null && DialoguePlayUtil.Instance.Loader == null) { DialoguePlayUtil.Instance.Loader = new GM.AssetLoader <GameObject>("UI3DLobby", mDMono.gameObject); UI3DLobby.Preload(DialoguePlayUtil.Instance.ModelName); yield return(DialoguePlayUtil.Instance.Loader); if (DialoguePlayUtil.Instance.Loader.Instance != null) { DialoguePlayUtil.Instance.Loader.Instance.transform.SetParent(mDMono.transform.parent); } if (DialoguePlayUtil.Instance.Loader.Success) { DialoguePlayUtil.Instance.Lobby = DialoguePlayUtil.Instance.Loader.Instance.GetMonoILRComponent <UI3DLobby>(); DialoguePlayUtil.Instance.Lobby.CharacterPoolSize = CharacterPoolSize; if (DialoguePlayUtil.Instance.repaceTopShader != null) { DialoguePlayUtil.Instance.Lobby.renderSettings.gameObject.CustomSetActive(false); DialoguePlayUtil.Instance.Lobby.lobbyCamera.SetReplacementShader(DialoguePlayUtil.Instance.repaceTopShader, "RenderType"); Shader.SetGlobalFloat("_CharTopOutlineScale", DialoguePlayUtil.Instance.dialogueOutlineScale); } } else { EB.Debug.LogError("DialoguePlayUtil.Instance.Loader Load Fail!"); EB.Assets.UnloadAssetByName("UI3DLobby", false); if (DialoguePlayUtil.Instance.Loader.Instance != null) { UnityEngine.Object.Destroy(DialoguePlayUtil.Instance.Loader.Instance.gameObject); } DialoguePlayUtil.Instance.Loader = null; } DialoguePlayUtil.Instance.IsLobbyLoadOk = true; } if (DialoguePlayUtil.Instance.Lobby != null) { DialoguePlayUtil.Instance.Lobby.ConnectorTexture = lobbyTexture; DialoguePlayUtil.Instance.Lobby.mDMono.transform.SetChildLayer(LayerMask.NameToLayer("UI3D")); DialoguePlayUtil.Instance.Lobby.VariantName = DialoguePlayUtil.Instance.ModelName; LobbyCameraData cameraData = null; cameraData = Hotfix_LT.Data.CharacterTemplateManager.Instance.GetHeroInfo(data.Icon).lobby_camera; if (cameraData != null) { DialoguePlayUtil.Instance.Lobby.SetCameraPos(cameraData.Position); DialoguePlayUtil.Instance.Lobby.SetCameraRot(cameraData.Rotation); DialoguePlayUtil.Instance.Lobby.SetCameraMode(cameraData.Size, cameraData.Orthographic); } else { EB.Debug.LogError("CreateBuddyModel: lobby_camera = null"); } Vector3 iconRotation = lobbyTexture.transform.eulerAngles; if ((eDialogueLayout)layout == eDialogueLayout.Left) { lobbyTexture.transform.GetComponent <TweenPosition>().from.x = -2730; lobbyTexture.transform.GetComponent <TweenPosition>().to.x = 0; lobbyTexture.transform.localPosition = cameraData.IconPosition; lobbyTexture.transform.localEulerAngles = cameraData.IconRotation; } else if ((eDialogueLayout)layout == eDialogueLayout.Right) { lobbyTexture.transform.GetComponent <TweenPosition>().from.x = 2730; lobbyTexture.transform.GetComponent <TweenPosition>().to.x = 0; iconRotation.y = 180; lobbyTexture.transform.localRotation = Quaternion.Euler(iconRotation); } } } ContextBg.gameObject.CustomSetActive(true); DialoguePlayUtil.Instance.ShowContext = true; }
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; }