void Awake() { #region Check Root DropControl dc = this.GetComponent <DropControl>(); if (dc == null) { rd = (RootData)gameObject.AddComponent <RootData>(); rd.HiddenData = HiddObj; rd.BaseDropPanelPrefab = BaseDropPanelPrefab; IsRoot = true; Folded = false; rd.ArrowAlpha = ArrowAlpha; } else { dc.ArrowToggle += ArrowToggle; MyDropControl = dc; } #endregion #region Initialize Prefab Dic if (IsRoot) { if (PrefabKeys.Count == PrefabReferences.Count) { for (int i = 0; i < PrefabKeys.Count; i++) { rd.PrefabDic.Add(PrefabKeys[i], PrefabReferences[i]); } } rfmm = this; rd.HighlightColor = HighlightColor; InitializeRDA(); } #endregion }
private void OnDisable() { foreach (var cach in cache) { FoldManager.SetFold(cach.Value.atr.Id, cach.Value.expanded); cach.Value.Dispose(); } }
private Transform CreateNewDropFold() { Transform df = (Transform)GameObject.Instantiate(rd.BaseDropPanelPrefab, Vector3.zero, Quaternion.identity); FoldManager fm = df.GetComponent <FoldManager>(); fm.Initialize(ChildrenArgs); fm.SetArrowAlpha(rd.ArrowAlpha); DropControl dc = fm.GetComponent <DropControl>(); DropDownPanelScript ddps = dc.ContainerObj.transform.GetComponent <DropDownPanelScript>(); ddps.InstallRD(rd); return(df); }
private void Create(params string[] lines) { _textView = EditorUtil.CreateTextView(lines); _visualBuffer = _textView.TextViewModel.VisualBuffer; _adhocOutliner = EditorUtil.FactoryService.AdhocOutlinerFactory.GetAdhocOutliner(_textView.TextBuffer); _outliningeManager = EditorUtil.FactoryService.OutliningManagerService.GetOutliningManager(_textView); _statusUtil = new Mock <IStatusUtil>(MockBehavior.Strict); _foldData = EditorUtil.FactoryService.FoldManagerFactory.GetFoldData(_textView.TextBuffer); _foldManagerRaw = new FoldManager( _textView, _foldData, _statusUtil.Object, FSharpOption.Create(EditorUtil.FactoryService.OutliningManagerService.GetOutliningManager(_textView))); _foldManager = _foldManagerRaw; }
private void Create(params string[] lines) { _textView = CreateTextView(lines); _textBuffer = _textView.TextBuffer; _visualBuffer = _textView.TextViewModel.VisualBuffer; _adhocOutliner = EditorUtilsFactory.GetOrCreateOutliner(_textView.TextBuffer); _outliningeManager = OutliningManagerService.GetOutliningManager(_textView); _statusUtil = new Mock<IStatusUtil>(MockBehavior.Strict); _foldData = FoldManagerFactory.GetFoldData(_textView.TextBuffer); _foldManagerRaw = new FoldManager( _textView, _foldData, _statusUtil.Object, FSharpOption.Create(OutliningManagerService.GetOutliningManager(_textView))); _foldManager = _foldManagerRaw; }
public void Initialize(RootDataArgs rda) { rd = rda.rd; rfmm = rda.Root; ArrowSize = rda.ArrowSize; Parent = rda.Prev; Indent = rda.Indent; Padding = rda.Padding; if (!Parent.IsRoot) { rda.MaxWidth -= rda.Indent; } MaxWidth = rda.MaxWidth; InitializeRDA(); LayoutArrow(); MyDropControl.MaximumWid = MaxWidth; if (IsRoot) { MyDropControl.MaximumWid -= (PaddingLftRgtTpBt[1] + PaddingLftRgtTpBt[3]); } }
public void TearDown() { _textBuffer = null; _manager = null; }
public void SetUp(params string[] lines) { _textBuffer = EditorUtil.CreateBuffer(lines); _manager = new FoldManager(_textBuffer); }
void Awake() { fm = this.GetComponent <FoldManager>(); }
public override void OnInspectorGUI() { serializedObject.Update(); if (!initialized) { for (var i = 0; i < length; i++) { var fold = Attribute.GetCustomAttribute(objectFields[i], typeof(FoldoutAttribute)) as FoldoutAttribute; Cache c; if (fold == null) { if (prevFold != null && prevFold.FoldEverything) { if (!cache.TryGetValue(prevFold.Name, out c)) { cache.Add(prevFold.Name, new Cache { atr = prevFold, types = new HashSet <string> { objectFields[i].Name } }); cache[prevFold.Name].expanded = FoldManager.GetFold(prevFold.Id); } else { c.types.Add(objectFields[i].Name); } } continue; } prevFold = fold; fold.Id = fold.Name + target.GetHashCode().ToString(); if (!cache.TryGetValue(fold.Name, out c)) { cache.Add(fold.Name, new Cache { atr = fold, types = new HashSet <string> { objectFields[i].Name } }); cache[prevFold.Name].expanded = FoldManager.GetFold(fold.Id); } else { c.types.Add(objectFields[i].Name); } } var property = serializedObject.GetIterator(); var next = property.NextVisible(true); if (next) { do { HandleProp(property); } while (property.NextVisible(false)); } } if (props.Count == 0) { DrawDefaultInspector(); return; } initialized = true; using (new EditorGUI.DisabledScope("m_Script" == props[0].propertyPath)) { EditorGUILayout.PropertyField(props[0], true); } EditorGUILayout.Space(); foreach (var pair in cache) { var rect = EditorGUILayout.BeginVertical(); EditorGUILayout.Space(); EditorGUI.DrawRect(new Rect(rect.x - 1, rect.y - 1, rect.width + 1, rect.height + 1), colors.col0); EditorGUI.DrawRect(new Rect(rect.x - 1, rect.y - 1, rect.width + 1, rect.height + 1), colors.col1); pair.Value.expanded = EditorGUILayout.Foldout(pair.Value.expanded, pair.Value.atr.Name, true, style != null ? style : EditorStyles.foldout); EditorGUILayout.EndVertical(); rect = EditorGUILayout.BeginVertical(); EditorGUI.DrawRect(new Rect(rect.x - 1, rect.y - 1, rect.width + 1, rect.height + 1), colors.col2); if (pair.Value.expanded) { for (int i = 0; i < pair.Value.props.Count; i++) { EditorGUI.indentLevel = 1; EditorGUILayout.PropertyField(pair.Value.props[i], new GUIContent(pair.Value.props[i].name.FirstLetterToUpperCase()), true); if (i == pair.Value.props.Count - 1) { EditorGUILayout.Space(); } } } EditorGUI.indentLevel = 0; EditorGUILayout.EndVertical(); } for (var i = 1; i < props.Count; i++) { EditorGUILayout.PropertyField(props[i], true); } serializedObject.ApplyModifiedProperties(); EditorGUILayout.Space(); }