コード例 #1
0
    static public IView CreateView(AvailableItemListView viewComponent, AvailableItemListView.ViewType viewType)
    {
        IView view = null;

        switch (viewType)
        {
        case AvailableItemListView.ViewType.Text:
            view = new TextView()
            {
                Prefab = viewComponent.AvailableItemTextPrefab
            };
            break;

        case AvailableItemListView.ViewType.Silhouette:
            view = new SilhouetteView()
            {
                Prefab = viewComponent.AvailableItemSilhouettePrefab
            };
            break;

        default:
            throw new UnityException("Unsupported view type " + viewType);
        }

        return(view);
    }
コード例 #2
0
    public Transform CreateItem(Transform parent)
    {
        if (Prefab == null)
        {
            return(null);
        }

        Transform itemView = AvailableItemListView.Instantiate(Prefab, parent) as Transform;

        return(itemView);
    }
コード例 #3
0
    public Transform CreateItem(Transform parent)
    {
        if (Prefab == null)
        {
            return(null);
        }

        Transform itemView = AvailableItemListView.Instantiate(Prefab, parent) as Transform;

        itemView.GetComponent <Text>().text = "";
        return(itemView);
    }