示例#1
0
    private void OnItemRenderer(int index, GObject obj)
    {
        var id     = m_UI.m_List.GetData <int>(index);
        var deploy = WantSellDeploy.GetInfo(id);

        var item = obj as UI_WantBuyItem;

        item.m_LabelName.SetText(deploy.Name);
        item.m_LabelDesc.SetText(deploy.Desc);
        item.m_LoaderIcon.icon = UIUtil.GetBuyPlaceUrl(id);
        item.m_BtnSell.onClick.Set(OnClickBuy);
        item.m_BtnSell.data = id;
    }
示例#2
0
    private void OnClickBuy(EventContext context)
    {
        var id     = (int)(context.sender as GObject).data;
        var deploy = WantSellDeploy.GetInfo(id);

        var itemData = new ItemData();

        itemData.Name  = Data.Name;
        itemData.Value = deploy.Value;
        itemData.Id    = Data.Id;
        itemData.Type  = Data.Type;
        itemData.Count = 1;
        ShopFacade.getInstance().SellGoods(itemData);
        Hide();
    }