예제 #1
0
    private IEnumerator DoOption(Animator ani, uint dialogID)
    {
        // 选择过需等待动画播放哦。
        if (m_IsPlayOptionSeleteAni == true)
        {
            yield return(Yielders.GetWaitForSeconds(1.0f));
        }
        m_IsPlayOptionSeleteAni = true;
        if (ani != null)
        {
            ani.SetTrigger("Selected");
        }
        yield return(Yielders.GetWaitForSeconds(1.0f));

        m_IsPlayOptionSeleteAni = false;
        SceneDialogueConfig cfg = SceneDialogueDao.Inst.GetCfg(dialogID);

        if (cfg != null)
        {
            StartCoroutine(Play(m_curCofig, cfg, 0, false, true));
            m_curCofig = cfg;
        }
        else
        {
            // StartCoroutine(Play(m_curCofig, null, 0, false, true));
            // m_curCofig = null;
        }
    }
예제 #2
0
 private IEnumerator PlayEmoji(SceneDialogueConfig cfg)
 {
     m_playStep = PlaySetp.playEmojy;
     if (cfg != null)
     {
         if (cfg.Direction == 0)
         {
             if (cfg.Emotion > 0)
             {
                 m_Emoji1.gameObject.SetActive(true);
                 m_Emoji1.SetIndexSprite((int)cfg.Emotion - 1);
             }
         }
         else
         {
             if (cfg.Emotion > 0)
             {
                 m_Emoji2.gameObject.SetActive(true);
                 m_Emoji2.SetIndexSprite((int)cfg.Emotion - 1);
             }
         }
         yield return(Yielders.GetWaitForSeconds(waitShowDialogTime));
     }
     else
     {
         yield return(null);
     }
 }
예제 #3
0
 private bool CheckHaveOption(SceneDialogueConfig cur)
 {
     if (cur == null)
     {
         return(false);
     }
     else
     {
         if (cur.OptionDialogue1 > 0 || cur.OptionDialogue2 > 0 || cur.OptionDialogue3 > 0)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #4
0
 private SceneDialogueConfig FindNextOption(SceneDialogueConfig cur)
 {
     if (cur == null)
     {
         return(null);
     }
     else
     {
         if (cur.OptionDialogue1 > 0 || cur.OptionDialogue2 > 0 || cur.OptionDialogue3 > 0)
         {
             return(cur);
         }
         else
         {
             SceneDialogueConfig c = SceneDialogueDao.Inst.GetCfg(cur.NextDialogueId);
             return(FindNextOption(c));
         }
     }
 }
예제 #5
0
    private void DoSkipCall(IMsgBoxResult reslut)
    {
        // 回调的时候已经销毁了
        if (this == null)
        {
            return;
        }

        if (reslut.ClickButton == TipButton.Ok)
        {
            if (m_curCofig != null)
            {
                SceneDialogueConfig cfg = FindNextOption(m_curCofig);
                if (cfg == m_curCofig)
                {
                    return;
                }
                else
                {
                    if (cfg == null)
                    {
                        m_DialogAni.SetTrigger("Dialogue_out");
                        m_OptionAni.SetTrigger("Option_Main_out");
                        StartCoroutine(PlayOut(m_curCofig, true));
                        //WndManager.DestoryWnd<AdventureDialogueWnd>(0.5f + waitCloseDialogTime);
                    }
                    else
                    {
                        StartCoroutine(Play(m_curCofig, cfg, 0, true, false));
                        m_curCofig = cfg;
                    }
                }
            }
            else
            {
                WndManager.DestoryWnd <AdventureDialogueWnd>(0.5f + waitCloseDialogTime);
            }
        }
    }
예제 #6
0
    private IEnumerator Play(SceneDialogueConfig oldCfg, SceneDialogueConfig cfg, float WaitTime, bool showOption, bool isPrint)
    {
        SoundManager.StopMusic(SoundType.dialog);
        if (WaitTime > 0)
        {
            yield return(Yielders.GetWaitForSeconds(WaitTime));
        }
        // 同一个人就不用退场了。
        if (oldCfg != null && cfg != null && oldCfg.NpcFlag == cfg.NpcFlag)
        {
            if (m_IsHaveOption == true)
            {
                m_OptionAni.SetTrigger("Option_Main_out");
                m_IsHaveOption = false;
                if (m_List != null && m_List.Count > 0)
                {
                    foreach (GameObject g in m_List)
                    {
                        GameObject.Destroy(g);
                    }
                }
                m_List.Clear();
                yield return(Yielders.GetWaitForSeconds(0.33f));
            }
            yield return(PlayIn(cfg, showOption, isPrint, true));
        }
        else
        {
            yield return(PlayOut(oldCfg, false));

            yield return(PlayIn(cfg, showOption, isPrint, false));
        }

        m_playStep = PlaySetp.end;
        if (DialogDC.AutoDialog == true)
        {
            BtnNextClick();
        }
    }
예제 #7
0
    private IEnumerator PlayIn(SceneDialogueConfig cfg, bool showOption, bool isPrint, bool isSameNpc)
    {
        m_Emoji1.gameObject.SetActive(false);
        m_Emoji2.gameObject.SetActive(false);
        gDialog1.SetActive(false);
        gDialog2.SetActive(false);
        gDialog3.SetActive(false);
        gArrow1.SetActive(false);
        gArrow2.SetActive(false);
        gArrow3.SetActive(false);
        // 播放剧情背景音乐
        if (cfg != null && cfg.DialogueMusic != 0)
        {
            SoundManager.PlayMusic(cfg.DialogueMusic);
        }
        else
        {
            SoundManager.PlayMusic(m_PlayMusicID);
        }
        if (isSameNpc == false)
        {
            yield return(PlayHeroIconAndDialogDialog(cfg));

            // emoji 打印机效果
            yield return(PlayEmoji(cfg));

            // dialog 打印机效果
            yield return(PlayDialogPrint(cfg, isPrint));
        }
        else
        {
            // dialog 打印机效果
            yield return(PlayDialogPrint(cfg, isPrint));
        }

        // 玩家选项卡播放
        yield return(PlayOption(cfg, showOption));
    }
예제 #8
0
 public void BtnNextClick()
 {
     if (m_IsHaveOption == true)
     {
         return;
     }
     //
     if (m_curCofig == null)
     {
         SoundManager.StopMusic(SoundType.dialog);
         WndManager.DestoryWnd <AdventureDialogueWnd>(0.5f + waitCloseDialogTime);
     }
     else
     {
         if (m_playStep == PlaySetp.end)
         {
             SceneDialogueConfig cfg = SceneDialogueDao.Inst.GetCfg(m_curCofig.NextDialogueId);
             if (cfg != null)
             {
                 StartCoroutine(Play(m_curCofig, cfg, 0, false, true));
                 m_curCofig = cfg;
             }
             else
             {
                 StartCoroutine(PlayOut(m_curCofig, true));
             }
         }
         else if (m_playStep == PlaySetp.playOption)
         {
             m_isClickNext = true;
         }
         else if (m_playStep == PlaySetp.playDialogPrint)
         {
             m_isClickNext = true;
         }
     }
 }
예제 #9
0
    private IEnumerator PlayDialogPrint(SceneDialogueConfig cfg, bool isPrint)
    {
        float t = 0;

        m_playStep = PlaySetp.playDialogPrint;
        if (cfg != null)
        {
            if (cfg.DialogueVoice != 0)
            {
                SoundManager.PlayDialog(cfg.DialogueVoice);
            }
            List <string> l  = new List <string>();
            float         t1 = 0.0f;
            if (isPrint == true)
            {
                if (cfg.DialogueFrame == 0)
                {
                    gDialog1.SetActive(true);
                    l.Clear();
                    l.Add(cfg.NameTid);
                    txtDialogTitle1.SetString(l);
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    t1 = txtDialogContent1.SetPrintString(l, cfg.DialogueSpeed);
                }
                else if (cfg.DialogueFrame == 1)
                {
                    gDialog2.SetActive(true);
                    l.Clear();
                    l.Add(cfg.NameTid);
                    txtDialogTitle2.SetString(l);
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    t1 = txtDialogContent2.SetPrintString(l, cfg.DialogueSpeed);
                }
                else
                {
                    gDialog3.SetActive(true);
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    t1 = txtDialogContent3.SetPrintString(l, cfg.DialogueSpeed);
                }

                // add by hlw: 策划要求时间根据策划自己配置的
                t1 = cfg.DialogueTime / 10f;
                float total = t1 + AutoTime;
                while (t < total && m_isClickNext == false)
                {
                    t += Time.deltaTime;
                    yield return(null);
                }
                m_isClickNext = false;
                if (cfg.DialogueFrame == 0)
                {
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    txtDialogContent1.SetString(l);
                    gArrow1.SetActive(true);
                }
                else if (cfg.DialogueFrame == 1)
                {
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    txtDialogContent2.SetString(l);
                    gArrow2.SetActive(true);
                }
                else
                {
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    txtDialogContent3.SetString(l);
                    gArrow3.SetActive(true);
                }
            }
            else
            {
                if (cfg.DialogueFrame == 0)
                {
                    gDialog1.SetActive(true);
                    l.Clear();
                    l.Add(cfg.NameTid);
                    txtDialogTitle1.SetString(l);
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    txtDialogContent1.SetString(l);
                    gArrow1.SetActive(true);
                }
                else if (cfg.DialogueFrame == 1)
                {
                    gDialog2.SetActive(true);
                    l.Clear();
                    l.Add(cfg.NameTid);
                    txtDialogTitle2.SetString(l);
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    txtDialogContent2.SetString(l);
                    gArrow2.SetActive(true);
                }
                else
                {
                    gDialog3.SetActive(true);
                    l.Clear();
                    l.Add(cfg.DialogueTid);
                    txtDialogContent3.SetString(l);
                    gArrow3.SetActive(true);
                }
            }

            //
        }
        else
        {
            yield return(null);
        }
    }
예제 #10
0
 private IEnumerator PlayOption(SceneDialogueConfig cfg, bool showOption)
 {
     m_playStep = PlaySetp.playOption;
     if (cfg != null)
     {
         if (showOption == true)
         {
             m_IsHaveOption = false;
             if (cfg.OptionDialogue1 > 0)
             {
                 m_IsHaveOption = true;
                 AddOption(cfg.OptionTid1, cfg.OptionDialogue1, true);
             }
             if (cfg.OptionDialogue2 > 0)
             {
                 m_IsHaveOption = true;
                 AddOption(cfg.OptionTid2, cfg.OptionDialogue2, false);
             }
             if (cfg.OptionDialogue3 > 0)
             {
                 m_IsHaveOption = true;
                 AddOption(cfg.OptionTid3, cfg.OptionDialogue3, false);
             }
             if (m_IsHaveOption == true)
             {
                 m_OptionAni.SetTrigger("Option_Main_in");
                 yield return(Yielders.GetWaitForSeconds(0.33f));
             }
         }
         else if (CheckHaveOption(cfg) == true)
         {
             while (m_isClickNext == false)
             {
                 yield return(null);
             }
             //
             m_isClickNext  = false;
             m_IsHaveOption = false;
             if (cfg.OptionDialogue1 > 0)
             {
                 m_IsHaveOption = true;
                 AddOption(cfg.OptionTid1, cfg.OptionDialogue1, true);
             }
             if (cfg.OptionDialogue2 > 0)
             {
                 m_IsHaveOption = true;
                 AddOption(cfg.OptionTid2, cfg.OptionDialogue2, false);
             }
             if (cfg.OptionDialogue3 > 0)
             {
                 m_IsHaveOption = true;
                 AddOption(cfg.OptionTid3, cfg.OptionDialogue3, false);
             }
             if (m_IsHaveOption == true)
             {
                 m_OptionAni.SetTrigger("Option_Main_in");
                 yield return(Yielders.GetWaitForSeconds(0.33f));
             }
         }
     }
 }
예제 #11
0
    private IEnumerator PlayHeroIconAndDialogDialog(SceneDialogueConfig cfg)
    {
        m_playStep = PlaySetp.playHeroIcon;
        if (cfg != null)
        {
            // 英雄头像。
            /*if (cfg.Image != "")*/ {
                if (cfg.Direction == 0)
                {
                    //SetImage(m_HeroIcon1, "Icon", cfg.Image);
                    //m_HeroIcon1.SetNativeSize();
                    ShowAniGo(cfg.Direction, cfg.TalkAnim);
                    m_HeroAni1.GetComponent <RectTransform>().localPosition = m_HeroPos1 + new Vector3(cfg.ImagePosX, cfg.ImagePosY, 0);
                    if (cfg.ImageEnter == 1)    // 滑入
                    {
                        m_HeroAni1.SetTrigger("In_1");
                    }
                    else if (cfg.ImageEnter == 2)
                    {
                        //淡入
                        m_HeroAni1.SetTrigger("In_2");
                    }
                }
                else
                {
                    //SetImage(m_HeroIcon2, "Icon", cfg.Image);
                    //m_HeroIcon2.SetNativeSize();
                    ShowAniGo(cfg.Direction, cfg.TalkAnim);
                    m_HeroAni2.GetComponent <RectTransform>().localPosition = m_HeroPos2 + new Vector3(cfg.ImagePosX, cfg.ImagePosY, 0);
                    if (cfg.ImageEnter == 1)
                    {
                        m_HeroAni2.SetTrigger("In_1");
                    }
                    else if (cfg.ImageEnter == 2)
                    {
                        m_HeroAni2.SetTrigger("In_2");
                    }
                }
            }

            // 对白。
            List <string> l = new List <string>();
            if (cfg.DialogueFrame == 0)
            {
                gDialog1.SetActive(true);
                l.Clear();
                l.Add("");
                txtDialogTitle1.SetString(l);
                l.Clear();
                l.Add("");
                txtDialogContent1.SetString(l);
            }
            else if (cfg.DialogueFrame == 1)
            {
                gDialog2.SetActive(true);
                l.Clear();
                l.Add("");
                txtDialogTitle2.SetString(l);
                l.Clear();
                l.Add("");
                txtDialogContent2.SetString(l);
            }
            else
            {
                gDialog3.SetActive(true);
                l.Clear();
                l.Add("");
                txtDialogContent3.SetString(l);
            }
            if (cfg.DialogueEnter == 1)
            {
                m_DialogAni.SetTrigger("Dialogue_in");
            }
            yield return(Yielders.GetWaitForSeconds(0.33f));
        }
        else
        {
            yield return(null);
        }
    }
예제 #12
0
    private IEnumerator PlayOut(SceneDialogueConfig cfg, bool isDestroyWnd)
    {
        m_playStep = PlaySetp.playout;
        if (cfg == null)
        {
            m_IsHaveOption = false;
            if (m_List != null && m_List.Count > 0)
            {
                foreach (GameObject g in m_List)
                {
                    GameObject.Destroy(g);
                }
            }
            m_List.Clear();
            yield return(null);
        }
        else
        {
            // 退出动画
            if (cfg.Image != "")
            {
                if (cfg.Direction == 0)
                {
                    if (cfg.ImageExit == 1)    // 滑出
                    {
                        m_HeroAni1.SetTrigger("Out_1");
                    }
                    else if (cfg.ImageExit == 2)     // 淡出
                    {
                        m_HeroAni1.SetTrigger("Out_2");
                    }
                }
                else
                {
                    if (cfg.ImageExit == 1)
                    {
                        m_HeroAni2.SetTrigger("Out_1");
                    }
                    else if (cfg.ImageExit == 2)      // 淡出
                    {
                        m_HeroAni2.SetTrigger("Out_2");
                    }
                }
            }

            // 退出
            if (cfg.DialogueExit == 1)
            {
                m_DialogAni.SetTrigger("Dialogue_out");
            }

            if (m_IsHaveOption == true)
            {
                m_OptionAni.SetTrigger("Option_Main_out");
            }
            yield return(Yielders.GetWaitForSeconds(0.33f));

            m_IsHaveOption = false;
            if (m_List != null && m_List.Count > 0)
            {
                foreach (GameObject g in m_List)
                {
                    GameObject.Destroy(g);
                }
            }
            m_List.Clear();
            if (isDestroyWnd == true)
            {
                WndManager.DestoryWnd <AdventureDialogueWnd>(0.5f + waitCloseDialogTime);
            }
        }
    }
예제 #13
0
 /// <summary>
 /// 打开窗口传参数
 /// </summary>
 /// <param name="obj"></param>
 public override void SetData(object obj)
 {
     m_dialogID    = (uint)obj;
     m_curCofig    = SceneDialogueDao.Inst.GetCfg(m_dialogID);
     m_PlayMusicID = SoundManager.PlayMusicID;
 }