Пример #1
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);
     }
 }
Пример #2
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();
        }
    }
Пример #3
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);
        }
    }
Пример #4
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));
             }
         }
     }
 }
Пример #5
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);
        }
    }
Пример #6
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);
            }
        }
    }