private void MainSectionEventsContainerConditionsContainer(HealthEvent.Event.Condition current, SerializedProperty currentProperty) { LabelWidth(53); PropertyContainer1(currentProperty.FindPropertyRelative("source")); MainSectionEventsContainerConditionsContainerIndexContainer(current, currentProperty); Operator(currentProperty.FindPropertyRelative("operator"), ref operatorIsExpanded); LabelWidth(50); PropertyContainer1(currentProperty.FindPropertyRelative("health")); }
private void MainSectionEventsContainerConditionsContainerIndexContainer(HealthEvent.Event.Condition current, SerializedProperty currentProperty) { OpenVerticalSubsection(); { OpenHorizontalBar(); { string[] healthNames = new string[current.source ? current.source.healths.Count + 1 : 1]; healthNames[0] = "Not Specified"; for (int a = 1, A = healthNames.Length; a < A; a++) { healthNames[a] = "[" + (a - 1).ToString() + "] " + current.source.healths[a - 1].name; } LabelWidth(46); FieldWidth(1); Property(currentProperty.FindPropertyRelative("index")); LabelWidth(40); FieldWidth(10); EditorGUI.BeginChangeCheck(); int popup = EditorGUILayout.Popup("Health", current.source && current.source.healths.Count != 0 ? current.index + 1 : 0, healthNames); if (current.source && current.source.healths.Count != 0) { popup = popup - 1; } else if (current.index == -1) { popup = -1; } FieldWidth(); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(target, "Inspector"); current.index = popup; } } CloseHorizontal(); } CloseVertical(); }