public override void OnCreated() { BloxSettingsWindow.onSavedBlocksSettings = (Action)Delegate.Remove(BloxSettingsWindow.onSavedBlocksSettings, new Action(MemberBindProviderEd.OnBlockSelectionChanged)); BloxSettingsWindow.onSavedBlocksSettings = (Action)Delegate.Combine(BloxSettingsWindow.onSavedBlocksSettings, new Action(MemberBindProviderEd.OnBlockSelectionChanged)); BloxSettingsWindow.onSavedBlocksSettings = (Action)Delegate.Remove(BloxSettingsWindow.onSavedBlocksSettings, new Action(this.OnBlockSelectionChanged2)); BloxSettingsWindow.onSavedBlocksSettings = (Action)Delegate.Combine(BloxSettingsWindow.onSavedBlocksSettings, new Action(this.OnBlockSelectionChanged2)); if (MemberBindProviderEd.loader == null) { MemberBindProviderEd.loader = plyEdCoroutine.Start(MemberBindProviderEd.Loader(), true); } }
public void OnThemeChanged() { plyEdCoroutine obj = this.loader; if (obj != null) { obj.Stop(); } this.loader = null; this.treeView = null; }
private static void OnBlockSelectionChanged() { if (MemberBindProviderEd.loader != null) { MemberBindProviderEd.loader.Stop(); MemberBindProviderEd.loader = null; } MemberBindProviderEd.scanTypes = null; MemberBindProviderEd.getterBindables = null; MemberBindProviderEd.setterBindables = null; MemberBindProviderEd.loader = plyEdCoroutine.Start(MemberBindProviderEd.Loader(), true); }
public override void OnOpen() { base.OnOpen(); if (this.loader == null) { this.treeLoading = true; this.loader = plyEdCoroutine.Start(this.LoadEventDefs(), true); } else if (this.treeView != null) { this.treeView.Reset(); } }
public void Clear() { this._loading = false; plyEdCoroutine loader = this._loader; if (loader != null) { loader.Stop(); } this.ev = null; this.def = null; this.firstBlock = null; this.hasUndefinedblocks = false; this.unlinkedBlocks.Clear(); }
public static void ReloadBlockDefs() { if (BloxBlocksList._instance != null) { plyEdCoroutine obj = BloxBlocksList._instance.loader; if (obj != null) { obj.Stop(); } BloxBlocksList._instance.treeView = null; BloxBlocksList._instance.loader = plyEdCoroutine.Start(BloxBlocksList._instance.Load(), true); EditorWindow obj2 = BloxBlocksList._instance.ed; if ((object)obj2 != null) { obj2.Repaint(); } } }
public void Set(BloxEvent ev, bool forScriptGen = false) { Debug.Log("Set ", "BloxEventEd", UnityEngine.Color.green); if (this.ev != ev) { this.hasUndefinedblocks = false; this.Clear(); if (ev != null) { this.def = BloxEd.Instance.FindEventDef(ev); if (this.def != null) { this.ev = ev; if (forScriptGen) { Debug.Log("forScriptGen " + forScriptGen, "BloxEventEd", UnityEngine.Color.green); this.firstBlock = ((ev.firstBlock == null) ? null : new BloxBlockEd(ev.firstBlock, null, null, null, -1, false)); if (this.firstBlock != null) { BloxBlockEd next = this.firstBlock; while (next.b.next != null) { next.next = new BloxBlockEd(next.b.next, next, null, null, -1, false); next = next.next; } } } else { Debug.Log("forScriptGen " + forScriptGen, "BloxEventEd", UnityEngine.Color.green); this._loading = true; this._loader = plyEdCoroutine.Start(this.LoadEvent(), true); } } } } }
private static IEnumerator Loader() { Debug.Log("Loader", "MemberBindProviderEd", Color.blue); int count = 0; int countBeforeYield = 20; if (MemberBindProviderEd.getterBindables == null || MemberBindProviderEd.setterBindables == null) { MemberBindProviderEd.getterBindables = new Dictionary <string, BindableData>(); MemberBindProviderEd.setterBindables = new Dictionary <string, BindableData>(); if (MemberBindProviderEd.scanTypes == null) { MemberBindProviderEd.scanTypes = new List <Type>(); List <Type> usedValueTypes = new List <Type>(20) { typeof(bool), typeof(int), typeof(float), typeof(string), typeof(Vector2), typeof(Vector3), typeof(Rect), typeof(Color) }; new List <Type>(); List <string> lines = plyEdUtil.ReadCompressedLines(plyEdUtil.ProjectFullPath + BloxEdGlobal.MiscPath + "blocks.bin"); if (lines.Count > 0) { yield return((object)null); for (int i = 0; i < lines.Count; i++) { string text = lines[i]; if (!string.IsNullOrEmpty(text)) { BloxMemberInfo bloxMemberInfo = BloxMemberInfo.DecodeMember(text); if (bloxMemberInfo != null && !MemberBindProviderEd.scanTypes.Contains(bloxMemberInfo.ReflectedType)) { MemberBindProviderEd.scanTypes.Add(bloxMemberInfo.ReflectedType); } count++; if (count >= countBeforeYield) { count = 0; yield return((object)null); } } } } foreach (Type item in usedValueTypes) { if (!MemberBindProviderEd.scanTypes.Contains(item)) { MemberBindProviderEd.scanTypes.Add(item); } } yield return((object)null); MemberBindProviderEd.scanTypes.Sort((Type a, Type b) => a.FullName.CompareTo(b.FullName)); } List <Type> .Enumerator enumerator2 = MemberBindProviderEd.scanTypes.GetEnumerator(); try { while (enumerator2.MoveNext()) { Type current2 = enumerator2.Current; if (current2.IsClass && !current2.IsEnum && (!current2.IsAbstract || current2.IsSealed) && !current2.IsSpecialName && !current2.IsSubclassOf(typeof(Attribute)) && current2 != typeof(Attribute) && !current2.IsSubclassOf(typeof(Delegate)) && current2 != typeof(Delegate) && !current2.IsSubclassOf(typeof(Exception)) && current2 != typeof(Exception) && !current2.IsSubclassOf(typeof(BloxEventHandler)) && current2 != typeof(BloxEventHandler)) { bool inclOnlySpecifiedMembers = false; object[] customAttributes = current2.GetCustomAttributes(typeof(ExcludeFromBloxAttribute), true); if (customAttributes.Length != 0) { if (!((ExcludeFromBloxAttribute)customAttributes[0]).ExceptForSpecifiedMembers) { continue; } inclOnlySpecifiedMembers = true; } bool flag = true; BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; if (BloxEd.Instance.includeDeclaredOnly | flag) { bindingFlags = (BindingFlags)((int)bindingFlags | 2); } PropertyInfo[] properties = current2.GetProperties(bindingFlags); for (int j = 0; j < properties.Length; j++) { PropertyInfo propertyInfo = properties[j]; MemberBindProviderEd.ProcessBindableMember(propertyInfo, propertyInfo.PropertyType, inclOnlySpecifiedMembers); } FieldInfo[] fields = current2.GetFields(bindingFlags); for (int j = 0; j < fields.Length; j++) { FieldInfo fieldInfo = fields[j]; MemberBindProviderEd.ProcessBindableMember(fieldInfo, fieldInfo.FieldType, inclOnlySpecifiedMembers); } MethodInfo[] methods = current2.GetMethods(bindingFlags); for (int j = 0; j < methods.Length; j++) { MethodInfo methodInfo = methods[j]; if (!methodInfo.IsSpecialName) { MemberBindProviderEd.ProcessBindableMember(methodInfo, methodInfo.ReturnType, inclOnlySpecifiedMembers); } } count++; if (count >= countBeforeYield) { count = 0; yield return((object)null); } } } } finally { ((IDisposable)enumerator2).Dispose(); } enumerator2 = default(List <Type> .Enumerator); } yield return((object)null); MemberBindProviderEd.loader.Stop(); MemberBindProviderEd.loader = null; }