private void Draw_Integer(SerializedProperty Element) { if (useInt.boolValue) { MalbersEditor.DrawLineHelpBox(); var useAdvInteger = Element.FindPropertyRelative("AdvancedInteger"); useAdvInteger.boolValue = GUILayout.Toggle(useAdvInteger.boolValue, new GUIContent("Use Integer Comparer", "Compare the Event entry value with a new one to make a new Int Response"), EditorStyles.foldoutHeader); if (useAdvInteger.boolValue) { var compare = Element.FindPropertyRelative("IntEventList"); ReorderableList Reo_AbilityList; string listKey = Element.propertyPath; if (innerListDict.ContainsKey(listKey)) { // fetch the reorderable list in dict Reo_AbilityList = innerListDict[listKey]; } else { Reo_AbilityList = new ReorderableList(serializedObject, compare, true, true, true, true) { drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) => { var element = compare.GetArrayElementAtIndex(index); var name = element.FindPropertyRelative("name"); var comparer = element.FindPropertyRelative("comparer"); var Value = element.FindPropertyRelative("Value"); rect.y += 1; var height = UnityEditor.EditorGUIUtility.singleLineHeight; var split = rect.width / 3; var p = 5; var rectName = new Rect(rect.x, rect.y, (split + p - 2) * 1.2f, height); var rectComparer = new Rect(rect.x + (split + p) * 1.2f, rect.y, (split - p) * 0.75f, height); var rectValue = new Rect(rect.x + split * 2 + p + 15, rect.y, split - p - 10, height); EditorGUI.PropertyField(rectName, name, GUIContent.none); EditorGUI.PropertyField(rectComparer, comparer, GUIContent.none); EditorGUI.PropertyField(rectValue, Value, GUIContent.none); }, drawHeaderCallback = (Rect rect) => { rect.y += 1; var height = UnityEditor.EditorGUIUtility.singleLineHeight; var split = rect.width / 3; var p = (split * 0.3f); var rectName = new Rect(rect.x, rect.y, split + p - 2, height); var rectComparer = new Rect(rect.x + split + p, rect.y, split - p + 15, height); var rectValue = new Rect(rect.x + split * 2 + p + 5, rect.y, split - p, height); var DebugRect = new Rect(rect.width, rect.y - 1, 25, height + 2); EditorGUI.LabelField(rectName, " Name"); EditorGUI.LabelField(rectComparer, " Compare"); EditorGUI.LabelField(rectValue, " Value"); }, }; innerListDict.Add(listKey, Reo_AbilityList); //Store it on the Editor } Reo_AbilityList.DoLayoutList(); int SelectedAbility = Reo_AbilityList.index; if (SelectedAbility != -1) { var element = compare.GetArrayElementAtIndex(SelectedAbility); if (element != null) { var Response = element.FindPropertyRelative("Response"); var name = element.FindPropertyRelative("name").stringValue; UnityEditor.EditorGUILayout.PropertyField(Response, new GUIContent("Response: [" + name + "] ")); } } } // else { MalbersEditor.DrawLineHelpBox(); EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseInt"), new GUIContent("Response")); } } }
private void DrawSequence(int ModeIndex, SerializedProperty combo, SerializedProperty sequence) { ReorderableList Reo_AbilityList; string listKey = combo.propertyPath; if (SequenceReordable.ContainsKey(listKey)) { Reo_AbilityList = SequenceReordable[listKey]; // fetch the reorderable list in dict } else { Reo_AbilityList = new ReorderableList(combo.serializedObject, sequence, true, true, true, true) { drawElementCallback = (rect, index, isActive, isFocused) => { rect.y += 2; var Height = EditorGUIUtility.singleLineHeight; var element = sequence.GetArrayElementAtIndex(index); //var Activation = element.FindPropertyRelative("Activation"); var PreviewsAbility = element.FindPropertyRelative("PreviewsAbility"); var Ability = element.FindPropertyRelative("Ability"); var Branch = element.FindPropertyRelative("Branch"); var useD = element.FindPropertyRelative("Used"); var IDRect = new Rect(rect) { height = Height }; float wid = rect.width / 3; var IndexRect = new Rect(IDRect) { width = 25 }; var BranchRect = new Rect(IDRect) { x = IDRect.x + 30, width = wid - 40 }; var PrevARect = new Rect(IDRect) { x = wid + 40, width = wid - 15 }; var AbilityRect = new Rect(IDRect) { x = wid * 2 + 50, width = wid - 15 }; var style = new GUIStyle(EditorStyles.label); if (!useD.boolValue && Application.isPlaying) { style.normal.textColor = Color.green; } EditorGUI.LabelField(IndexRect, "(" + index.ToString() + ")", style); var oldColor = GUI.contentColor; if (PreviewsAbility.intValue <= 0) { GUI.contentColor = Color.green; } EditorGUI.PropertyField(BranchRect, Branch, GUIContent.none); EditorGUI.PropertyField(PrevARect, PreviewsAbility, GUIContent.none); EditorGUI.PropertyField(AbilityRect, Ability, GUIContent.none); GUI.contentColor = oldColor; if (index == abiliIndex) { branch = Branch.intValue; prev = PreviewsAbility.intValue; current = Ability.intValue; } //if (index == abiliIndex) //{ // IDRect.y += Height + 2; // EditorGUI.PropertyField(IDRect, Activation, new GUIContent("Activation")); //} }, drawHeaderCallback = rect => { var Height = EditorGUIUtility.singleLineHeight; var IDRect = new Rect(rect) { height = Height }; float wid = rect.width / 3; var IndexRect = new Rect(IDRect) { width = 38 }; var BranchRect = new Rect(IDRect) { x = IDRect.x + 40, width = wid - 40 }; var PrevARect = new Rect(IDRect) { x = wid + 40, width = wid - 15 }; var AbilityRect = new Rect(IDRect) { x = wid * 2 + 50, width = wid - 15 }; EditorGUI.LabelField(IndexRect, "Index"); EditorGUI.LabelField(BranchRect, " Branch"); EditorGUI.LabelField(PrevARect, "Activation Ability"); EditorGUI.LabelField(AbilityRect, "Next Ability"); }, //elementHeightCallback = (index) => //{ // Repaint(); // if (index == abiliIndex) // return EditorGUIUtility.singleLineHeight * 3; // else // return EditorGUIUtility.singleLineHeight + 5; //} }; SequenceReordable.Add(listKey, Reo_AbilityList); //Store it on the Editor } Reo_AbilityList.DoLayoutList(); abiliIndex = Reo_AbilityList.index; if (abiliIndex != -1) { var element = sequence.GetArrayElementAtIndex(abiliIndex); var Activation = element.FindPropertyRelative("Activation"); var OnSequencePlay = element.FindPropertyRelative("OnSequencePlay"); var lbl = "B[" + branch + "] AA[" + prev + "] NA[" + current + "]"; EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.LabelField("Sequence Properties - " + lbl); EditorGUILayout.PropertyField(Activation, new GUIContent("Activation", "Range of the Preview Animation the Sequence can be activate")); } EditorGUILayout.EndVertical(); EditorGUILayout.PropertyField(OnSequencePlay, new GUIContent("Sequence Play - " + lbl)); } }
private void DrawSequence(int ModeIndex, SerializedProperty combo, SerializedProperty sequence) { ReorderableList Reo_AbilityList; string listKey = combo.propertyPath; if (SequenceReordable.ContainsKey(listKey)) { Reo_AbilityList = SequenceReordable[listKey]; // fetch the reorderable list in dict } else { Reo_AbilityList = new ReorderableList(combo.serializedObject, sequence, true, true, true, true) { drawElementCallback = (rect, index, isActive, isFocused) => { rect.y += 2; var Height = EditorGUIUtility.singleLineHeight; var element = sequence.GetArrayElementAtIndex(index); //var Activation = element.FindPropertyRelative("Activation"); var PreviewsAbility = element.FindPropertyRelative("PreviewsAbility"); var Ability = element.FindPropertyRelative("Ability"); var Branch = element.FindPropertyRelative("Branch"); var useD = element.FindPropertyRelative("Used"); var finisher = element.FindPropertyRelative("Finisher"); var IDRect = new Rect(rect) { height = Height }; float wid = rect.width / 3; var IRWidth = 30f; var Sep = -10f; var Offset = 40f; float xx = IRWidth + Offset; var IndexRect = new Rect(IDRect) { width = IRWidth }; var BranchRect = new Rect(IDRect) { x = xx, width = wid - 15 }; var PrevARect = new Rect(IDRect) { x = wid + xx + Sep, width = wid - 15 - Sep }; var AbilityRect = new Rect(IDRect) { x = wid * 2 + xx + Sep, width = wid - 15 - 20 }; var FinisherRect = new Rect(IDRect) { x = IDRect.width + 30, width = 20 }; var style = new GUIStyle(EditorStyles.label); if (!useD.boolValue && Application.isPlaying) { style.normal.textColor = Color.green; //If the Combo is not used turn the combos to Green } EditorGUI.LabelField(IndexRect, "(" + index.ToString() + ")", style); var oldCColor = GUI.contentColor; var oldColor = GUI.color; if (PreviewsAbility.intValue <= 0) { GUI.contentColor = Color.green; } if (Application.isPlaying) { if (M.CurrentCombo != null) { var Index = M.CurrentCombo.ActiveSecuenceIndex; if (Index == index) //Paint Active Index { GUI.contentColor = GUI.color = Color.yellow; if (M.CurrentComboSequence.Finisher) //Paint finisher { GUI.contentColor = GUI.color = (Color.red + Color.yellow) / 2; } } else if (Index > index) //Paint Used Index { GUI.contentColor = GUI.color = Color.gray; } } } EditorGUI.PropertyField(BranchRect, Branch, GUIContent.none); EditorGUI.PropertyField(PrevARect, PreviewsAbility, GUIContent.none); EditorGUI.PropertyField(AbilityRect, Ability, GUIContent.none); EditorGUI.PropertyField(FinisherRect, finisher, GUIContent.none); GUI.contentColor = oldCColor; GUI.color = oldColor; if (index == abiliIndex) { branch = Branch.intValue; prev = PreviewsAbility.intValue; current = Ability.intValue; } }, drawHeaderCallback = rect => { var Height = EditorGUIUtility.singleLineHeight; var IDRect = new Rect(rect) { height = Height }; float wid = rect.width / 3; var IRWidth = 30f; var Sep = -10f; var Offset = 40f; float xx = IRWidth + Offset; var IndexRect = new Rect(IDRect) { width = IRWidth + 5 }; var BranchRect = new Rect(IDRect) { x = xx, width = wid - 15 }; var PrevARect = new Rect(IDRect) { x = wid + xx + Sep, width = wid - 15 }; var AbilityRect = new Rect(IDRect) { x = wid * 2 + xx + Sep - 10, width = wid - 80 }; var FinisherRect = new Rect(IDRect) { x = IDRect.width - 15, width = 45 }; EditorGUI.LabelField(IndexRect, "Index"); EditorGUI.LabelField(BranchRect, " Branch"); EditorGUI.LabelField(PrevARect, new GUIContent("Activation Ability", "Current Mode Ability [Index] Playing on the Animal needed to activate a sequence")); EditorGUI.LabelField(AbilityRect, new GUIContent("Next Ability", "Next Mode Ability [Index] to Play on the Animal if the Active Mode Animation is withing the Activation Range limit ")); EditorGUI.LabelField(FinisherRect, new GUIContent("Finisher", "Combo Finisher")); }, //elementHeightCallback = (index) => //{ // Repaint(); // if (index == abiliIndex) // return EditorGUIUtility.singleLineHeight * 3; // else // return EditorGUIUtility.singleLineHeight + 5; //} }; SequenceReordable.Add(listKey, Reo_AbilityList); //Store it on the Editor } Reo_AbilityList.DoLayoutList(); abiliIndex = Reo_AbilityList.index; if (abiliIndex != -1) { var element = sequence.GetArrayElementAtIndex(abiliIndex); var Activation = element.FindPropertyRelative("Activation"); var OnSequencePlay = element.FindPropertyRelative("OnSequencePlay"); var lbl = "B[" + branch + "] AA[" + prev + "] NA[" + current + "]"; EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EditorGUILayout.LabelField("Sequence Properties - " + lbl); EditorGUILayout.PropertyField(Activation, new GUIContent("Activation", "Range of the Preview Animation the Sequence can be activate")); } EditorGUILayout.EndVertical(); EditorGUILayout.PropertyField(OnSequencePlay, new GUIContent("Sequence Play - " + lbl)); } }