Esempio n. 1
0
        protected void UpdateDialogue(string name, string text)
        {
            NameText.text    = name;
            ContentText.text = text;

            foreach (var item in m_ShopItemUIList)
            {
                Destroy(item.gameObject);
            }
            m_ShopItemUIList.Clear();

            ShopItemUI itemUI = null;

            foreach (var good in m_GoodDataList)
            {
                itemUI = Instantiate(ShopItemUIPrefab);
                itemUI.transform.parent     = ShopItemUIPrefab.transform.parent;
                itemUI.transform.localScale = Vector3.one;
                itemUI.SetText(good.Text);
                itemUI.gameObject.SetActive(true);

                m_ShopItemUIList.Add(itemUI);
            }

            itemUI = Instantiate(ShopItemUIPrefab);
            itemUI.transform.parent     = ShopItemUIPrefab.transform.parent;
            itemUI.transform.localScale = Vector3.one;
            itemUI.SetText("离开");
            itemUI.gameObject.SetActive(true);

            m_ShopItemUIList.Add(itemUI);
        }
Esempio n. 2
0
        public void ClickShopItem(ShopItemUI itemUI)
        {
            var index = m_ShopItemUIList.IndexOf(itemUI);

            if (index >= m_GoodDataList.Count)
            {
                FinishDialogue();
            }
            else
            {
                if (m_Callback != null)
                {
                    m_Callback(index);
                }
            }
        }