//----------------------------------------------------------------------------------- public CNEditView(CNHierarchy controller, int itemIdx, string title) { Controller = controller; itemIdx_ = itemIdx; nodeName_ = Controller.GetItemName(itemIdx); title_ = title; }
//----------------------------------------------------------------------------------- public CNNodesController(CNFieldController fController, CommandNodeEditor ownerEditor) { fController_ = fController; field_ = fController.Field; manager_ = CNManager.Instance; hierarchy_ = manager_.Hierarchy; ownerNode_ = ownerEditor.Data; listCommandNodeAllowed_ = new List <CommandNode>(); listCommandNodeCurrent_ = new List <CommandNode>(); listSelectedIdx_ = new List <int>(); listTreeNodeAux_ = new List <CRTreeNode>(); SetSelectableNodes(); }
public override void OnInspectorGUI() { serializedObject.Update(); bool isEditing = false; if (CarManagerEditor.IsOpen) { window_ = CarManagerEditor.Instance; window_.WantRepaint -= Repaint; window_.WantRepaint += Repaint; } if (CarManager.IsInitedStatic) { manager_ = CarManager.Instance; hierarchy_ = manager_.Hierarchy; manager_.GetBodiesData(listBodyData_); isEditing = manager_.Player.IsEditing; } else { listBodyData_.Clear(); } CRBodyData bdData = null; uint idBody = uint.MaxValue; int nBodyData = listBodyData_.Count; BodyType bodyType; string bodyTypeText; string bodyIdText; if (nBodyData == 0) { bodyType = BodyType.None; bodyTypeText = "-"; bodyIdText = "-"; } else { bdData = listBodyData_[0]; bodyType = bdData.bodyType_; bodyTypeText = GetBodyTypeString(bdData.bodyType_); idBody = bdData.idBody_; for (int i = 1; i < nBodyData; i++) { bdData = listBodyData_[i]; if (bdData.bodyType_ != bodyType) { bodyType = BodyType.None; bodyTypeText = "-"; bodyIdText = "-"; break; } } if (idBody == uint.MaxValue || nBodyData > 1) { bodyIdText = "-"; } else { bodyIdText = idBody.ToString(); } } HashSet <CommandNode> setBodyDefinition = new HashSet <CommandNode>(); HashSet <CommandNode> setBodyReference = new HashSet <CommandNode>(); for (int i = 0; i < nBodyData; i++) { bdData = listBodyData_[i]; List <CommandNode> bdDataNodes = bdData.listNode_; int nDataNodes = bdDataNodes.Count; for (int j = 0; j < nDataNodes; j++) { CommandNode node = bdDataNodes[j]; if (j == 0) { setBodyDefinition.Add(node); } else { setBodyReference.Add(node); } } } EditorGUILayout.Space(); EditorGUILayout.LabelField("Body type: ", bodyTypeText); EditorGUILayout.LabelField("Body id:", bodyIdText); EditorGUILayout.Space(); if (bodyType == BodyType.None) { DrawFullBodySection(); } else if (bodyType == BodyType.Ropebody) { DrawRopeColliderSection(isEditing); } else if (IsNotBodyMesh(bodyType)) { DrawBodyColliderSection(); } EditorGUILayout.Space(); EditorGUILayout.LabelField("Body Definition: "); scrollVecDefinition_ = GUILayout.BeginScrollView(scrollVecDefinition_, GUILayout.ExpandHeight(false)); DrawNodeGUI(setBodyDefinition); GUILayout.EndScrollView(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Referenced in: "); scrollVecReferenced_ = GUILayout.BeginScrollView(scrollVecReferenced_, GUILayout.ExpandHeight(false)); DrawNodeGUI(setBodyReference); GUILayout.EndScrollView(); CarGUIUtils.Splitter(); if (!CarManagerEditor.IsOpen) { EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("Open CaronteFx Editor", GUILayout.Height(30f))) { window_ = (CarManagerEditor)CarManagerEditor.Init(); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } serializedObject.ApplyModifiedProperties(); }
public CNEditorFactory(CNHierarchy hierarchy) { hierarchy_ = hierarchy; InitDictionaries(); }