コード例 #1
0
    public void BuilderInWorldQuickBar()
    {
        BuilderInWorldTestHelper.CreateTestCatalogLocalSingleObject();
        CatalogItem item = DataStore.i.builderInWorld.catalogItemDict.GetValues()[0];

        CatalogItemAdapter adapter = BuilderInWorldTestHelper.CreateCatalogItemAdapter(gameObjectToUse);

        adapter.SetContent(item);

        CatalogAssetGroupAdapter groupAdatper = new CatalogAssetGroupAdapter();

        groupAdatper.AddAdapter(adapter);

        CatalogGroupListView catalogGroupListView = new CatalogGroupListView();

        catalogGroupListView.AddAdapter(groupAdatper);
        catalogGroupListView.generalCanvas = Utils.GetOrCreateComponent <Canvas>(gameObjectToUse);

        QuickBarView quickBarView = new QuickBarView();

        quickBarView.catalogGroupListView = catalogGroupListView;

        QuickBarController quickBarController = new QuickBarController(quickBarView);
        int slots = quickBarController.GetSlotsCount();

        quickBarView.shortcutsImgs = new QuickBarSlot[slots];

        for (int i = 0; i < slots; i++)
        {
            quickBarView.SetIndexToDrop(i);
            adapter.AdapterStartDragging(null);
            quickBarView.SceneObjectDropped(null);
            Assert.AreEqual(item, quickBarController.QuickBarObjectSelected(i));
        }
    }
コード例 #2
0
 public void AddAdapter(CatalogAssetGroupAdapter adapter)
 {
     adapter.OnCatalogItemClicked   += CatalogItemSelected;
     adapter.OnCatalogItemFavorite  += CatalogItemFavorite;
     adapter.OnAdapterStartDragging += AdapterStartDragging;
     adapter.OnAdapterDrag          += OnDrag;
     adapter.OnAdapterEndDrag       += OnEndDrag;
 }
コード例 #3
0
 public void UnsubscribeToEvents(CatalogAssetGroupAdapter adapter)
 {
     adapter.OnCatalogItemClicked    -= CatalogItemSelected;
     adapter.OnCatalogItemFavorite   -= CatalogItemFavorite;
     adapter.OnAdapterStartDragging  -= AdapterStartDragging;
     adapter.OnAdapterDrag           -= OnDrag;
     adapter.OnAdapterEndDrag        -= OnEndDrag;
     adapter.OnPointerEnterInAdapter -= OnPointerEnter;
     adapter.OnPointerExitInAdapter  -= OnPointerExit;
 }
コード例 #4
0
    public override void AddAdapters()
    {
        base.AddAdapters();

        if (contentList == null)
        {
            return;
        }

        foreach (Dictionary <string, List <CatalogItem> > assetPackGroups in contentList)
        {
            foreach (KeyValuePair <string, List <CatalogItem> > assetPackGroup in assetPackGroups)
            {
                CatalogAssetGroupAdapter adapter = Instantiate(categoryItemAdapterPrefab, contentPanelTransform).GetComponent <CatalogAssetGroupAdapter>();
                adapter.SetContent(assetPackGroup.Key, assetPackGroup.Value);
                AddAdapter(adapter);
            }
        }
    }
コード例 #5
0
    public override void RemoveAdapters()
    {
        if (contentPanelTransform == null ||
            contentPanelTransform.transform == null ||
            contentPanelTransform.transform.childCount == 0)
        {
            return;
        }

        for (int i = 0; i < contentPanelTransform.transform.childCount; i++)
        {
            CatalogAssetGroupAdapter toRemove = contentPanelTransform.transform.GetChild(i).GetComponent <CatalogAssetGroupAdapter>();
            if (toRemove != null)
            {
                UnsubscribeToEvents(toRemove);
                Destroy(toRemove.gameObject);
            }
        }
    }
コード例 #6
0
    public override void AddAdapters()
    {
        base.AddAdapters();

        if (contentList == null)
        {
            return;
        }

        foreach (Dictionary <string, List <SceneObject> > assetPackGroups in contentList)
        {
            foreach (KeyValuePair <string, List <SceneObject> > assetPackGroup in assetPackGroups)
            {
                CatalogAssetGroupAdapter adapter = Instantiate(categoryItemAdapterPrefab, contentPanelTransform).GetComponent <CatalogAssetGroupAdapter>();

                adapter.SetContent(assetPackGroup.Key, assetPackGroup.Value);
                adapter.OnSceneObjectClicked   += SceneObjectSelected;
                adapter.OnSceneObjectFavorite  += SceneObjectFavorite;
                adapter.OnAdapterStartDragging += AdapterStartDragging;
                adapter.OnAdapterDrag          += OnDrag;
                adapter.OnAdapterEndDrag       += OnEndDrag;
            }
        }
    }
コード例 #7
0
    public override void AddAdapters()
    {
        base.AddAdapters();

        if (contentList == null)
        {
            return;
        }

        foreach (Dictionary <string, List <CatalogItem> > assetPackGroups in contentList)
        {
            foreach (KeyValuePair <string, List <CatalogItem> > assetPackGroup in assetPackGroups)
            {
                CatalogAssetGroupAdapter adapter = Instantiate(categoryItemAdapterPrefab, contentPanelTransform).GetComponent <CatalogAssetGroupAdapter>();
                adapter.SetContent(assetPackGroup.Key, assetPackGroup.Value);
                SubscribeToEvents(adapter);
            }
        }

        if (dynamicScrollSensitivity != null)
        {
            dynamicScrollSensitivity.RecalculateSensitivity();
        }
    }