public static void InitAndAdd(Data data, bool overrideValues = false) { data.SetupCache(); Manager.currentData.Add(ClipType.Music, data, overrideValues); Manager.currentData.Add(ClipType.SFX, data, overrideValues); }
public Data.FlowWindow CreateWindow(Data.FlowWindow.Flags flags) { return this.CreateWindow_INTERNAL(flags); }
private Data.FlowWindow CreateWindow_INTERNAL(Data.FlowWindow.Flags flags) { var newId = this.AllocateId(); //var window = new Data.FlowWindow(newId, flags); //this.windows.Add(window); var window = Data.FlowWindow.CreateInstance<Data.FlowWindow>(); #if UNITY_EDITOR window.name = window.ToString(); UnityEditor.AssetDatabase.AddObjectToAsset(window, this); #endif window.Setup(newId, flags); this.windowAssets.Add(window); this.windowsCache.Clear(); this.isDirty = true; this.Save(); #if UNITY_EDITOR UnityEditor.AssetDatabase.ImportAsset(UnityEditor.AssetDatabase.GetAssetPath(window), UnityEditor.ImportAssetOptions.ForceUpdate); UnityEditor.AssetDatabase.SaveAssets(); UnityEditor.EditorUtility.SetDirty(window); #endif return window; }
public void AddTag(Data.FlowWindow window, FlowTag tag) { var contains = this.tags.FirstOrDefault((t) => t.title.ToLower() == tag.title.ToLower()); if (contains == null) { this.tags.Add(tag); } else { tag = contains; } window.AddTag(tag); this.isDirty = true; }
public void RemoveTag(Data.FlowWindow window, FlowTag tag) { window.RemoveTag(tag); this.isDirty = true; }
public static Data.FlowWindow CreateWindow(Data.FlowWindow.Flags flags) { return FlowSystem.instance.data.CreateWindow(flags); }
public static void RemoveTag(Data.FlowWindow window, FlowTag tag) { FlowSystem.instance.data.RemoveTag(window, tag); }
private static int Draw_INTERNAL(int id, System.Action <int> onResult, ClipType clipType, UnityEngine.UI.Windows.Audio.Data data, GUIContent label, Rect rect, bool layout) { if (data != null) { var states = data.GetStates(clipType); var keys = new int[states.Count + 1]; var options = new GUIContent[states.Count + 1]; var selected = string.Empty; var k = 0; for (int i = -1; i < states.Count; ++i) { var category = string.Empty; var name = string.Empty; if (i == -1) { name = "None"; } else { category = states[i].category; keys[k] = states[i].key; var clip = states[i].clip; name = clip == null ? "Null" : clip.ToString(); } if (string.IsNullOrEmpty(category) == false) { category = category.Trim('/').Trim() + "/"; } options[k] = new GUIContent((i >= 0) ? string.Format(category + "[{0}] {1}", keys[k], name) : name); if (id == keys[k]) { selected = options[k].text; } ++k; } if (layout == true) { Popup.DrawInt(label, selected, onResult, options, keys); } else { Popup.DrawInt(rect, selected, label, onResult, options, keys); } } return(id); }
public static int DrawLayout(int id, System.Action <int> onResult, ClipType clipType, UnityEngine.UI.Windows.Audio.Data data, GUIContent label) { return(AudioPopupEditor.Draw_INTERNAL(id, onResult, clipType, data, label, new Rect(), layout: true)); }
public void Add(ClipType clipType, Data other, bool overrideValues = false) { List<State> source = null; List<State> target = null; if (clipType == ClipType.Music) { source = other.music; target = this.music; } else if (clipType == ClipType.SFX) { source = other.fx; target = this.fx; } if (source == null || target == null) return; for (int i = 0; i < source.Count; ++i) { if (this.ContainsKey(clipType, source[i].key) == false) { target.Add(source[i]); } else if (overrideValues == true) { target.Remove(this.GetState(clipType, source[i].key)); target.Add(source[i]); } } this.SetupCache(); }