示例#1
0
 internal void SetSelectedGroups(string groupNames)
 {
     assets.Clear();
     if (string.IsNullOrEmpty(groupNames))
     {
         this.group = null;
     }
     else
     {
         this.group = AssetMode.GetGroupInfo(groupNames);
         string[] datas = AssetMode.resInfo.GetAssetsNames(this.group.Name);
         int      id    = 0;
         foreach (string str in datas)
         {
             AssetMode.AssetInfo info = new AssetMode.AssetInfo(id++, str);
             assets.Add(info);
         }
     }
     //m_Controller.SetSelectedItems(null);
     //m_SourceBundles = bundles.ToList();
     SetSelection(new List <int>());
     Reload();
 }
    protected override void ContextClickedItem(int id)
    {
        if (mContextOnItem)
        {
            mContextOnItem = false;
            return;
        }
        mContextOnItem = true;
        List <AssetMode.GroupInfo> selectedNodes = new List <AssetMode.GroupInfo>();

        foreach (var nodeID in GetSelection())
        {
            selectedNodes.Add(AssetMode.GetGroupInfo(nodeID));
        }
        GenericMenu menu = new GenericMenu();

        if (selectedNodes.Count == 1)
        {
            menu.AddItem(new GUIContent("删除 " + selectedNodes[0].Name + "资源组"), false, DeleteGroups, selectedNodes);
            menu.AddItem(new GUIContent("Rename"), false, RenameGroupName, selectedNodes);
            menu.AddItem(new GUIContent("添加资源组 "), false, CreateResGroup, null);
        }
        menu.ShowAsContext();
    }
    void CreateResGroup(object context)
    {
        string name = AssetMode.HandleGroupCreate();

        ReloadAndSelect(AssetMode.GetGroupInfo(name).NameHashCode, true);
    }