示例#1
0
    public override void BindView()
    {
        view.Close = root.Find("Close").GetComponent <Button>();

        view.ItemContainer = root.Find("ItemContainer");
        view.DetailPanel   = root.Find("DetailPanel");

        view.DetailDesp       = view.DetailPanel.Find("DetailDesp").GetComponent <Text>();
        view.DetailName       = view.DetailPanel.Find("DetailName").GetComponent <Text>();
        view.DetailEffectDesp = view.DetailPanel.Find("DetailEffectDesp").GetComponent <Text>();

        view.NextPage = root.Find("Next").GetComponent <Button>();
        view.PrePage  = root.Find("Pre").GetComponent <Button>();
        view.PageNum  = root.Find("PageNum").GetComponent <Text>();

        view.ConfirmBuyView = root.Find("确认购买").GetComponent <Image>();
        view.ConfirmBuy     = view.ConfirmBuyView.transform.Find("Confirm").GetComponent <Button>();
        view.ConfirmCancel  = view.ConfirmBuyView.transform.Find("Cancel").GetComponent <Button>();

        //view.Buy = root.Find("Buy").GetComponent<Button>();


        foreach (TaobaoItemView vv in view.ItemList)
        {
            pResLoader.ReleaseGO("UI/Apps/TaobaoItem", vv.root.gameObject);
        }

        view.ItemList.Clear();

        for (int i = 0; i < PageFixItemNum; i++)
        {
            GameObject     go = pResLoader.Instantiate("UI/Apps/TaobaoItem", view.ItemContainer);
            TaobaoItemView vv = new TaobaoItemView();
            vv.BindView(go.transform);
            view.ItemList.Add(vv);
            vv.Hint.gameObject.SetActive(false);
            int idx = i;
            vv.root.gameObject.SetActive(false);
            {
                DragEventListener listener = vv.ItemBG.gameObject.GetComponent <DragEventListener>();
                if (listener == null)
                {
                    listener = vv.ItemBG.gameObject.AddComponent <DragEventListener>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    //ChooseOne(vv);
                    BuyOne(vv);
                };
                listener.PointerEnterEvent += delegate {
                    ShowPopupInfo(idx);
                    //idx
                };
                listener.PointerExitEvent += delegate {
                    HidePopupInfo(idx);
                };
            }
        }
    }
示例#2
0
    public void ShowItems()
    {
        foreach (TaobaoItemView vv in view.ItemList)
        {
            pResLoader.ReleaseGO("UI/Apps/TaobaoItem", vv.root.gameObject);
        }
        view.ItemList.Clear();
        preItemView = null;

        List <TaobaoItemInfo> fakeList = new List <TaobaoItemInfo>();

        {
            fakeList.Add(new TaobaoItemInfo("1"));
        }

        {
            fakeList.Add(new TaobaoItemInfo("2"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("3"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("4"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("s"));
        }
        {
            fakeList.Add(new TaobaoItemInfo("4ss"));
        }
        for (int i = 0; i < fakeList.Count; i++)
        {
            TaobaoItemInfo info = fakeList[i];
            GameObject     go   = pResLoader.Instantiate("UI/Apps/TaobaoItem", view.ItemContainer);
            TaobaoItemView vv   = new TaobaoItemView();
            vv.BindView(go.transform);
            view.ItemList.Add(vv);
            vv.Hint.gameObject.SetActive(false);
            {
                ClickEventListerner listener = vv.ItemBG.gameObject.GetComponent <ClickEventListerner>();
                if (listener == null)
                {
                    listener = vv.ItemBG.gameObject.AddComponent <ClickEventListerner>();
                }

                listener.ClearClickEvent();
                listener.OnClickEvent += delegate {
                    ChooseOne(vv);
                };
            }

            vv.ItemName.text = info.Name;
        }
    }