private static bool TreeNodeCtrl_AddNode(TreeNodeCtrl __instance, TreeNodeObject _parent, ref TreeNodeObject __result, ref List <TreeNodeObject> ___m_TreeNodeObject) { if (IsStudio) { return(true); } GameObject gob = new GameObject(); TreeNodeObject com = gob.AddComponent <TreeNodeObject>(); Traverse.Create(com).Field("m_TreeNodeCtrl").SetValue(__instance); if (_parent != null) { com.SetParent(_parent); } else { ___m_TreeNodeObject.Add(com); } __result = com; return(false); }
private static bool TreeNodeCtrl_DeleteNode(TreeNodeCtrl __instance, TreeNodeObject _node, ref List <TreeNodeObject> ___m_TreeNodeObject, ref ScrollRect ___scrollRect) { if (IsStudio) { return(true); } if (_node.enableDelete) { _node.SetParent(null); ___m_TreeNodeObject.Remove(_node); _node.onDelete?.Invoke(); Traverse.Create(__instance).Method("DeleteNodeLoop").GetValue(_node); if (___m_TreeNodeObject.Count == 0) { //Added null check if (___scrollRect != null) { ___scrollRect.verticalNormalizedPosition = 1f; } } } return(false); }
private static bool TreeNodeCtrl_SetParent(TreeNodeObject _node, TreeNodeObject _parent, TreeNodeCtrl __instance, ref GUITree.TreeRoot ___m_TreeRoot, ref Action <TreeNodeObject, TreeNodeObject> ___onParentage) { if (IsStudio) { return(true); } if (_node != null && _node.enableChangeParent && (!(bool)Traverse.Create(__instance).Method("RefreshHierachy").GetValue(_node) || !(_parent == null)) && _node.SetParent(_parent)) { Traverse.Create(__instance).Method("RefreshHierachy").GetValue(); //Added null check if (___m_TreeRoot != null) { ___m_TreeRoot.Invoke("SetDirty", 0f); } ___onParentage?.Invoke(_parent, _node); } return(false); }