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)); } }
public void BuilderInWorldQuickBar() { BIWTestHelper.CreateTestCatalogLocalSingleObject(); CatalogItem item = DataStore.i.dataStoreBuilderInWorld.catalogItemDict.GetValues()[0]; CatalogItemAdapter adapter = BIWTestHelper.CreateCatalogItemAdapter(gameObjectToUse); adapter.SetContent(item); CatalogAssetGroupAdapter groupAdapter = new GameObject("_CatalogAssetGroupAdapter").AddComponent <CatalogAssetGroupAdapter>(); groupAdapter.SubscribeToEvents(adapter); CatalogGroupListView catalogGroupListView = new GameObject("_CatalogGroupListView").AddComponent <CatalogGroupListView>(); catalogGroupListView.SubscribeToEvents(groupAdapter); catalogGroupListView.generalCanvas = Utils.GetOrCreateComponent <Canvas>(gameObjectToUse); SceneCatalogView sceneCatalogView = SceneCatalogView.Create(); sceneCatalogView.catalogGroupListView = catalogGroupListView; SceneCatalogController sceneCatalogController = new SceneCatalogController(); QuickBarView quickBarView = QuickBarView.Create(); QuickBarController quickBarController = new QuickBarController(); sceneCatalogController.Initialize(sceneCatalogView, quickBarController); quickBarController.Initialize(quickBarView, sceneCatalogController); int slots = quickBarController.GetSlotsCount(); quickBarView.shortcutsImgs = new QuickBarSlot[slots]; for (int i = 0; i < slots; i++) { quickBarController.SetIndexToDrop(i); adapter.AdapterStartDragging(null); quickBarController.SetQuickBarShortcut(item, i, new Texture2D(10, 10)); Assert.AreEqual(item, quickBarController.QuickBarObjectSelected(i)); } }