示例#1
0
    private void InitData(string str)
    {
        Debug.LogError(str);
        JsonData jsonData = JsonMapper.ToObject(str);
        JsonData dataList = jsonData["data"];

        for (int i = 0; i < dataList.Count; i++)
        {
            try
            {
                JsonData          jData   = dataList[i];
                string            title   = jData["title"].ToString();
                string            imgsStr = jData["imgs"].ToString();
                string[]          imgs    = imgsStr.Split('|');
                string            content = jData["content"].ToString();
                Page_4_3_ItemData data    = new Page_4_3_ItemData();
                data.title   = title;
                data.imgs    = imgs;
                data.content = content;
                ItemDataList.Add(data);
            }
            catch (Exception ex)
            {
            }
        }

        isPlay  = true;
        endTime = Time.time;
    }
示例#2
0
    void ClickItem(Page_3_1_ItemData data)
    {
        Page4_3_1         ui       = UIMgr.ShowUI <Page4_3_1>("Page_4_3_1", this.transform.parent.gameObject);
        Page_4_3_ItemData itemData = new Page_4_3_ItemData();

        itemData.title   = data.title;
        itemData.content = data.content;
        itemData.imgs    = data.imgs;

        ui.InitData(itemData);
    }
示例#3
0
    // Use this for initialization
    public void InitData(Page_4_3_ItemData data)
    {
        GameTools.AddClickEvent(button.gameObject, this.BackButton_ClickEvent);
        txt_content.text = data.content;
        LayoutElement rt = txt_content.gameObject.transform.parent.GetComponent <LayoutElement>();

        rt.preferredHeight = txt_content.preferredHeight;

        title_1.text = data.title;
        title_2.text = data.title;
        if (data.imgs != null)
        {
            if (data.imgs.Length == 1)
            {
                GameTools.Instance.LoadImage(image1, data.imgs[0], 4, 4);
                GameTools.Instance.LoadImage(image2, data.imgs[0], 4, 4);
            }
            else if (data.imgs.Length == 2)
            {
                GameTools.Instance.LoadImage(image1, data.imgs[0], 4, 4);
                GameTools.Instance.LoadImage(image2, data.imgs[1], 4, 4);
            }
        }
    }
示例#4
0
    void Update()
    {
        if (isPlay && Time.time > this.endTime)
        {
            mEnhancelScrollView.scrollViewItems = new List <EnhanceItem>();
            for (int i = 0; i < ItemDataList.Count; i++)
            {
                Page_4_3_ItemData data = ItemDataList[i];

                GameObject        go     = GameObject.Instantiate(prefab.gameObject, prefab.transform.parent).gameObject;
                MyUGUIEnhanceItem ueItem = go.GetComponent <MyUGUIEnhanceItem>();
                go.gameObject.SetActive(true);
                mEnhancelScrollView.scrollViewItems.Add(ueItem);
                string imagePath = "";
                if (data.imgs != null && data.imgs.Length > 0)
                {
                    imagePath = data.imgs[0];
                }
                string content = data.content;

                Image image = go.transform.Find("Img_1").GetComponent <Image>();
                Text  text  = go.transform.Find("txt_1").GetComponent <Text>();

                GameTools.Instance.LoadImage(image, imagePath, 4, 4);
                text.text = content;

                GameTools.AddClickEvent(image.gameObject, () =>
                {
                    ClickItem(data);
                });
            }

            isPlay = false;
            mEnhancelScrollView.gameObject.SetActive(true);
        }
    }
示例#5
0
    void ClickItem(Page_4_3_ItemData data)
    {
        Page4_3_1 ui = UIMgr.ShowUI <Page4_3_1>("Page_4_3_1", this.transform.parent.gameObject);

        ui.InitData(data);
    }