コード例 #1
0
    public override List <ItemsBean> GetDropItems(BlockBean blockData)
    {
        List <ItemsBean> listData  = base.GetDropItems(blockData);
        ItemsInfoBean    itemsInfo = ItemsHandler.Instance.manager.GetItemsInfoByBlockType(blockData.GetBlockType());

        //加一个自己
        listData.Add(new ItemsBean(itemsInfo.id, 1, null));
        //添加箱子里的物品
        if (blockData == null)
        {
            return(listData);
        }
        BlockMetaBox blockBoxData = FromMetaData <BlockMetaBox>(blockData.meta);

        if (blockBoxData == null)
        {
            return(listData);
        }
        for (int i = 0; i < blockBoxData.items.Length; i++)
        {
            ItemsBean itemData = blockBoxData.items[i];
            listData.Add(itemData);
        }
        return(listData);
    }
コード例 #2
0
 /// <summary>
 /// 初始化数据
 /// </summary>
 public void SetData(Vector3Int worldPosition, BlockBean blockData)
 {
     if (blockData == null)
     {
         return;
     }
     this.blockWorldPosition = worldPosition;
     this.blockData          = blockData;
     this.blockBoxData       = Block.FromMetaData <BlockMetaBox>(blockData.meta);
     if (blockBoxData == null)
     {
         blockBoxData = new BlockMetaBox(7 * 7);
     }
     ui_ItemList.SetCellCount(blockBoxData.items.Length);
     ui_ItemList.RefreshAllCells();
 }