public void Perform(AssetList list, BaseObject source = null, BaseObject target = null) { switch (_mode) { case Mode.Source: if (source != null) { if (_operator == Operator.Add) { list.Add(source); } else { list.Remove(source); } } break; case Mode.Target: if (target != null) { if (_operator == Operator.Add) { list.Add(target); } else { list.Remove(target); } } break; case Mode.AssetList: if (_assetList != null) { if (_operator == Operator.Add) { list.AddRange(_assetList); } else { list.RemoveRange(_assetList); } } break; } }
public void DeleteAsset(AssetViewModel selectedAsset) { if (selectedAsset == null) { return; } AssetList.Remove(selectedAsset); }
public void RemoveAssetCall(object sender) { ExportAsset asset = sender as ExportAsset; AssetEventArgs eventArgs = new AssetEventArgs() { Object = asset }; RemoveAssetHandler?.Invoke(this, eventArgs); AssetList.Remove(asset); }
static void OnPostHeaderGUI(Editor editor) { if (editor.target == null) { return; } string assetPath = AssetDatabase.GetAssetPath(editor.target).ToLower(); if (IsValid(assetPath) == false) { return; } if (s_ToggleMixed == null) { s_ToggleMixed = new GUIStyle("ToggleMixed"); } var asset = GetAssetFile(editor.target); GUILayout.BeginHorizontal(); bool isSelectAsset = asset != null && list.Contains(asset.name); bool isSelectMixed = IsMixedSelect(editor.targets); if (isSelectMixed) { isSelectAsset = false; } bool isSelectGroup; if (isSelectMixed) { isSelectGroup = GUILayout.Toggle(isSelectAsset, "Asset", s_ToggleMixed, GUILayout.ExpandWidth(false)); } else { isSelectGroup = GUILayout.Toggle(isSelectAsset, "Asset", GUILayout.ExpandWidth(false)); } if (isSelectAsset && isSelectGroup == false) { RemoveFromList(editor.targets); asset = null; } else if (isSelectAsset == false && isSelectGroup) { AddToList(editor.targets); } if (asset != null && isSelectAsset && editor.targets.Length == 1) { asset.asset = assetPath; var assetName = EditorGUILayout.DelayedTextField(asset.name, GUILayout.ExpandWidth(true)); if (assetName != asset.name) { list.Remove(asset); asset.name = assetName.ToLower(); list.Add(asset); SaveAssetList(); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (asset != null && list.Contains(asset.name)) { isSelectAsset = string.IsNullOrEmpty(asset.bundle) == false; isSelectMixed = IsMixedGroup(editor.targets); if (isSelectMixed) { isSelectGroup = GUILayout.Toggle(isSelectAsset, "Bundle", s_ToggleMixed, GUILayout.ExpandWidth(false)); } else { isSelectGroup = GUILayout.Toggle(isSelectAsset, "Bundle", GUILayout.ExpandWidth(false)); } if (isSelectGroup == false && isSelectAsset) { SetAssetsBundle(editor.targets, null); SaveAssetList(); } else { if (isSelectGroup) { if (isSelectAsset == false) { string dir = Path.GetDirectoryName(asset.asset); asset.bundle = dir.Substring(dir.LastIndexOf("\\", System.StringComparison.Ordinal) + 1); } var group = EditorGUILayout.DelayedTextField(asset.bundle, GUILayout.ExpandWidth(true)); if (isSelectAsset == false || group != asset.bundle) { //Debug.Log(check + "," + select + "," + asset.group + "," + group); SetAssetsBundle(editor.targets, group); SaveAssetList(); } } } } GUILayout.EndHorizontal(); }