Example #1
0
        void InitDialogueData()
        {
            int dialogueId = Random.Range(900001, 900005);

            m_Dialogue_data = Hotfix_LT.Data.DialogueTemplateManager.Instance.GetDialogueData(dialogueId);
            if (m_Dialogue_data == null)
            {
                m_Dialogue_data = Hotfix_LT.Data.DialogueTemplateManager.Instance.GetDialogueData(10000101);
                EB.Debug.LogError("m_Dialogue_data is null for dialogue_id={0}", dialogueId);
            }
        }
Example #2
0
        public void Play(int DialogueId, System.Action callback)
        {
            IsLobbyLoadOk = false;
            DialogueData data = Hotfix_LT.Data.DialogueTemplateManager.Instance.GetDialogueData(DialogueId);

            if (data == null)
            {
                DoFinishCallBack();
                return;
            }
            m_CurrentDialogueId = DialogueId;

            Play(data, callback);
        }
Example #3
0
 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();
     }
 }