Exemple #1
0
 public void freshShopItem(int index, MDShopData data)
 {
     _index = index;
     if (leftCell == null)
     {
         leftCell = CShopScrollCellView.CreateItemCell(data);
         leftCell.transform.parent        = this.transform;
         leftCell.transform.localPosition = new Vector3(0, 0, 0);
         leftCell.transform.localScale    = Vector3.one;
     }
     else
     {
         leftCell.freshViewWithData(data);
     }
 }
Exemple #2
0
    public static CShopScrollCellView CreateItemCell(MDShopData sd)
    {
        Object mObj = null;

        if (sd.type == MDShopData.ITEM)
        {
            mObj = Resources.Load("shopItemCell");
        }
        else if (sd.type == MDShopData.COIN)
        {
            mObj = Resources.Load("shopCoinCell");
        }
        else if (sd.type == MDShopData.JEWEL)
        {
            mObj = Resources.Load("shopJewelCell");
        }
        GameObject          go   = Instantiate(mObj) as GameObject;
        CShopScrollCellView cell = go.GetComponent <CShopScrollCellView>();

        cell.freshViewWithData(sd);

        return(cell);
    }