Ejemplo n.º 1
0
    //刷新界面
    public override void RefreshUI()
    {
        GameObject hintItem = m_type == 0 ? hintItem1 : hintItem2;
        Transform  parent   = m_type == 0 ? parent1 : parent2;

        if (hintItem != null)
        {
            parent.gameObject.SetActive(true);
            GameObject go = GameObject.Instantiate(hintItem, parent);
            go.SetActive(true);
            IggText txt = go.GetComponentInChildren <IggText>();
            if (txt != null)
            {
                List <string> l = new List <string>();
                l.Add(m_msg);
                txt.SetString(l);
            }
            m_List.Add(go);
        }
        // 只留3个
        int count = m_List.Count;

        if (count > 3)
        {
            for (int i = 0; i < count - 3; i++)
            {
                GameObject g = m_List[0];
                if (g != null)
                {
                    GameObject.Destroy(g);
                }
                m_List.RemoveAt(0);
            }
        }
    }
Ejemplo n.º 2
0
 private void AddOption(string strOption, uint DialogID, bool first)
 {
     if (OptionPrefab != null)
     {
         OptionPrefab.SetActive(false);
         GameObject go = GameObject.Instantiate(OptionPrefab, tOptionParent);
         go.SetActive(true);
         Button btn = go.GetComponent <Button>();
         btn.onClick.AddListener(() => {
             StartCoroutine(DoOption(go.GetComponent <Animator>(), DialogID));
         });
         List <string> l = new List <string>();
         l.Add(strOption);
         IggText txt = go.transform.Find("Text_text_1").GetComponent <IggText>();
         if (txt != null)
         {
             txt.SetString(l);
         }
         IggText txt1 = go.transform.Find("Text_text_2").GetComponent <IggText>();
         if (txt1 != null)
         {
             txt1.SetString(l);
         }
         m_List.Add(go);
     }
 }
Ejemplo n.º 3
0
    public override void RefreshUI()
    {
        List <string> lParam = new List <string>();

        if (m_Data != null)
        {
            // 攻击力
            lParam.Clear();
            lParam.Add(m_Data.Attack.ToString());
            txtAttack.SetString(lParam);
            // 防御力
            lParam.Clear();
            lParam.Add(m_Data.Defence.ToString());
            txtDefence.SetString(lParam);
            // HP
            lParam.Clear();
            lParam.Add(m_Data.Hp.ToString());
            txtHp.SetString(lParam);
            // buff
            if (gBuffPrefab != null)
            {
            }
            else
            {
                tBuffNode.SetActive(false);
            }

            if (m_Data.IsSelf == true)
            {
                // 星级
                iconHeroStar.gameObject.SetActive(true);
                if (iconHeroStar != null)
                {
                    iconHeroStar.SetIndexSprite((int)m_Data.Star - 1);
                }
            }
            else
            {
                // 名称
                iconHeroStar.gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 4
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);
        }
    }