private void _InitAssetFilters() { assetFilterList.Add(new NullTypeFilter()); assetFilterList.Add(new AssetTypeFilter(new string[] { "AnimationClip" }, "动画片段")); assetFilterList.Add(new AssetTypeFilter(new string[] { "AnimatorController", "OverrideController" }, "动画控制器")); assetFilterList.Add(new AssetTypeFilter(new string[] { "AudioClip" }, "音频片段")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Prefab" }, "Prefab")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Model" }, "模型文件")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Shader", "ComputeShader" }, "Shader")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Material" }, "材质")); assetFilterList.Add(new AssetTypeFilter(new string[] { "PhyMaterial", "Phy2DMaterial" }, "物理材质")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Texture", "RenderTexture", "CubeMap" }, "纹理")); assetFilterList.Add(new AssetTypeFilter(new string[] { "GUISkin" }, "GUISkin")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Font", "TrueTypeFont" }, "字体")); assetFilterList.Add(new AssetTypeFilter(new string[] { "AvatarMask" }, "AvatarMask")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Flare" }, "Flare")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Scene" }, "场景")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Script", "MonoAssembly" }, "脚本")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Text" }, "文本文件")); assetFilterList.Add(new AssetTypeFilter(new string[] { "UnKnown" }, "未知")); assetFilterList.Add(new AssetTypeFilter(new string[] { "Corrupted" }, "已破损")); int i = 0; //分配类型索引 foreach (var filter in assetFilterList) { AssetTypeFilter tFilter = filter as AssetTypeFilter; tFilter.TypeIndex = i++; } currAssetFilter = assetFilterList[0]; }
//设置当前所用过滤器 public void SetFilter(int typeIndx) { foreach (var filter in AssetFilterList) { AssetTypeFilter f = filter as AssetTypeFilter; if (f.TypeIndex == typeIndx) { currAssetFilter = f; _UpdateAllAssetList(); _NotifyAssetDatabaseUpdate(); return; } } }
int GetAssetTypeIndex(U3DAssetInfo info) { if (info.TypeName.Equals("Folder")) { return(0); } foreach (var filter in assetFilters) { if ((filter as NullTypeFilter) != null) { continue; } AssetTypeFilter typeFilter = filter as AssetTypeFilter; if (typeFilter.Check(info)) { return(typeFilter.TypeIndex); } } return(0); }
public PagedResultDto <AssetTypeDto> GetAssetTypesByFilter(AssetTypeFilter input) { //var admin = userRepository.GetAll().Where(x => x.Name == "admin").FirstOrDefault(); //if (admin != null) //{ // var user = admin.ToUserIdentifier(); // //Console.WriteLine(user.UserId); // Console.WriteLine(user.TenantId); // notificationPublisher.PublishAsync( // AppNotificationNames.WelcomeToTheApplication, // new MessageNotificationData(L("WelcomeToTheApplicationNotificationMessage")), // severity: NotificationSeverity.Success, // userIds: new[] { user } // ); //} IQueryable <AssetType> assetTypes = assetTypeRepository.GetAll() .Where(item => !item.IsDelete); // Filter if (!string.IsNullOrWhiteSpace(input.AssetTypeName)) { input.AssetTypeName = input.AssetTypeName.ToLower(); assetTypes = assetTypes .Where(assetType => assetType.AssetTypeName.ToLower().Contains(input.AssetTypeName)); } int totalCount = assetTypes.Count(); //Sorting System.Collections.Generic.List <AssetTypeDto> items = assetTypes .OrderBy(input.Sorting) .PageBy(input) .Select(item => ObjectMapper.Map <AssetTypeDto>(item)) .ToList(); return(new PagedResultDto <AssetTypeDto>(totalCount, items)); }
public PagedResultDto <AssetTypeDto> GetAssetTypesByFilter(AssetTypeFilter filter) => appService.GetAssetTypesByFilter(filter);
//这个方法就是利用EditorManager回调回来的一个EditorRoot实例; //构建了一个树形结构; public static void InitControls(EditorRoot editorRoot) { //将之前实例化的那个EditorWindow赋值给s_root s_root = editorRoot; //s_root.position = new Rect(100f, 100f, 1024, 768f); {//对编辑器全局消息响应; EditorApplication.projectWindowItemOnGUI += OnProjectWindowItem; EditorApplication.projectWindowChanged += OnProjectWindowChanged; } {//协程回调 s_root.onCoroutineMessage = OnCoroutineMessage; s_root.onCoroutineTaskFinished = OnCoroutineTaskFinished; s_root.onDestroy = OnDestroy; s_root.onEnable = OnEnable; } {//注册数据库变化回调 ResourceManageToolModel.GetInstance().onResourceDBUpdate = OnAssetDatabaseUpdate; ResourceManageToolModel.GetInstance().onResrouceDBStateChange = OnAssetDatabaseStateChange; } HSpliterCtrl hspliter = new HSpliterCtrl(); s_root.RootCtrl = hspliter; hspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30f); //用来放置上方菜单 HBoxCtrl hb0 = new HBoxCtrl(); VSpliterCtrl vspliter = new VSpliterCtrl(); vspliter.layoutConstraint = LayoutConstraint.GetSpliterConstraint(300f); vspliter.Dragable = true; hspliter.Add(hb0); hspliter.Add(vspliter); //用来存放 资源列表、无引用资源列表 VBoxCtrl vb0 = new VBoxCtrl(); //用来存放 资源依赖项、反向引用 VBoxCtrl vb1 = new VBoxCtrl(); vspliter.Add(vb0); vspliter.Add(vb1); //左侧TabView TabViewCtrl leftTabView = new TabViewCtrl(); //右侧TabView TabViewCtrl rightTabView = new TabViewCtrl(); vb0.Add(leftTabView); vb1.Add(rightTabView); //资源列表 TreeViewCtrl resTreeList = new TreeViewCtrl(); resTreeList.Caption = "资源列表"; resTreeList.Name = "_ResTreeList"; resTreeList.onItemSelected = OnResourcesTreeViewSelectChanged; //无引用资源列表 ListViewCtrl unUsedList = new ListViewCtrl(); unUsedList.Caption = "无引用资源"; unUsedList.Name = "_UnUsedResList"; unUsedList.onItemSelected = OnUnUsedResourcesListViewSelectChanged; leftTabView.Add(resTreeList); leftTabView.Add(unUsedList); //资源依赖项 TreeViewCtrl resRefTreeView = new TreeViewCtrl(); resRefTreeView.Caption = "资源依赖项"; resRefTreeView.Name = "_ResRefTreeView"; //反向引用 TreeViewCtrl resReverseRefTreeView = new TreeViewCtrl(); resReverseRefTreeView.Caption = "反向引用"; resReverseRefTreeView.Name = "_ResReverseRefTreeView"; rightTabView.Add(resRefTreeView); rightTabView.Add(resReverseRefTreeView); Rect btnRect = new Rect(0, 0, 120, 20); ButtonCtrl searchBtn = new ButtonCtrl(); searchBtn.Name = "_SearchAllResources"; searchBtn.Caption = "扫描资源!"; searchBtn.Size = btnRect; searchBtn.onClick += OnSearchAllAssets; searchBtn.BtnColor = Color.green; searchBtn.Visiable = true; Rect comboBoxRect = new Rect(0, 0, 100, 20); ComboBoxCtrl <int> assetTypeCombo = new ComboBoxCtrl <int>(0); assetTypeCombo.Size = comboBoxRect; assetTypeCombo.Name = "_AssetTypeCombo"; assetTypeCombo.onValueChange = OnFilterComboSelectChanged; List <IAssetFilter> assetFilters = ResourceManageToolModel.GetInstance().AssetFilterList; foreach (var filter in assetFilters) { AssetTypeFilter f = filter as AssetTypeFilter; assetTypeCombo.AddItem(new ComboItem(f.DisplayTypeName, f.TypeIndex)); } assetTypeCombo.CurrValue = 0; TextBoxCtrl searchTextBox = new TextBoxCtrl(); searchTextBox.Size = comboBoxRect; searchTextBox.Icon = UnityInternalIconCache.GetInstance().GetCacheIcon("d_ViewToolZoom"); searchTextBox.Name = "_SearchBox"; searchTextBox.Caption = "搜索"; searchTextBox.Visiable = true; searchTextBox.onValueChange = OnSearchTextBoxChange; ButtonCtrl helpBtn = new ButtonCtrl(); helpBtn.Name = "_HelpButton"; helpBtn.Caption = "帮助文档"; helpBtn.onClick = OnHelp; helpBtn.Size = btnRect; helpBtn.Visiable = true; LabelCtrl stateLabel = new LabelCtrl(); stateLabel.Name = "_StateLabel"; stateLabel.textColor = Color.red; stateLabel.Caption = "数据库没有更新,无法查看无用资源列表与反向引用!"; stateLabel.layoutConstraint = LayoutConstraint.GetExtensibleViewConstraint(); hb0.Add(searchBtn); hb0.Add(assetTypeCombo); hb0.Add(searchTextBox); hb0.Add(helpBtn); hb0.Add(stateLabel); }