private void AddHidden(ApexComponentMaster.ComponentInfo c) { if (c.idx > 29) { UnityEngine.Debug.LogWarning("Apex Component Master cannot manage more than 30 components."); return; } this._hiddenComponents = this._hiddenComponents | 1 << (c.idx & 31); }
public void Toggle(ApexComponentMaster.ComponentInfo cinfo) { cinfo.isVisible = !cinfo.isVisible; HideFlags hideFlag = cinfo.component.hideFlags; if (cinfo.isVisible) { this.RemoveHidden(cinfo); cinfo.component.hideFlags = hideFlag & (HideFlags.HideInHierarchy | HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild | HideFlags.DontUnloadUnusedAsset | HideFlags.DontSave | HideFlags.HideAndDontSave); return; } this.AddHidden(cinfo); cinfo.component.hideFlags = hideFlag | HideFlags.HideInInspector; }
public void Cleanup() { ApexComponentMaster.ComponentInfo componentInfo = null; foreach (ApexComponentMaster.ComponentInfo value in this._components.Values) { if (!value.component.Equals(null)) { continue; } componentInfo = value; } if (componentInfo != null) { this.RemoveHidden(componentInfo); this._components.Remove(componentInfo.id); componentInfo.category.Remove(componentInfo); if (componentInfo.category.count == 0) { this._categories.Remove(componentInfo.category.name); } } }
public bool Init(IEnumerable <ApexComponentMaster.ComponentCandidate> candidates) { ApexComponentMaster.ComponentInfo componentInfo; ApexComponentMaster.ComponentCategory componentCategory; this.Cleanup(); bool flag = false; int num = 0; foreach (ApexComponentMaster.ComponentCandidate candidate in candidates) { int instanceID = candidate.component.GetInstanceID(); bool flag1 = this._components.TryGetValue(instanceID, out componentInfo); if ((candidate.component.hideFlags & HideFlags.HideInInspector) == HideFlags.None && (this._hiddenComponents & 1 << (num & 31)) > 0) { MonoBehaviour monoBehaviour = candidate.component; monoBehaviour.hideFlags = monoBehaviour.hideFlags | HideFlags.HideInInspector; flag = true; } if (!flag1) { ApexComponentMaster.ComponentInfo componentInfo1 = new ApexComponentMaster.ComponentInfo() { component = candidate.component, id = instanceID }; int num1 = num; num = num1 + 1; componentInfo1.idx = num1; componentInfo1.name = candidate.component.GetType().Name.Replace("Component", string.Empty).ExpandFromPascal(); componentInfo1.isVisible = (candidate.component.hideFlags & HideFlags.HideInInspector) == HideFlags.None; componentInfo = componentInfo1; this._components.Add(instanceID, componentInfo); if (!this._categories.TryGetValue(candidate.categoryName, out componentCategory)) { componentCategory = new ApexComponentMaster.ComponentCategory() { name = candidate.categoryName }; this._categories.Add(candidate.categoryName, componentCategory); } componentCategory.Add(componentInfo); componentInfo.category = componentCategory; } else { num++; componentInfo.isVisible = (candidate.component.hideFlags & HideFlags.HideInInspector) == HideFlags.None; } } FunctionComparer <ApexComponentMaster.ComponentInfo> functionComparer = new FunctionComparer <ApexComponentMaster.ComponentInfo>((ApexComponentMaster.ComponentInfo a, ApexComponentMaster.ComponentInfo b) => a.name.CompareTo(b.name)); foreach (ApexComponentMaster.ComponentCategory value in this._categories.Values) { value.Sort(functionComparer); } if (!this._firstTime) { return(flag); } this.ToggleAll(); this._firstTime = false; return(true); }