public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_Width = prop.FindPropertyRelative("m_Width"); SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity"); SerializedProperty m_BarBackgroundColor = prop.FindPropertyRelative("m_BarBackgroundColor"); SerializedProperty m_BarColor = prop.FindPropertyRelative("m_BarColor"); SerializedProperty m_StageColor = prop.FindPropertyRelative("m_StageColor"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_Toggle, prop, "Axis Line", show, false); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (ChartEditorHelper.IsToggle(m_Toggle, prop)) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, m_Width); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Opacity); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BarColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BarBackgroundColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Stage Color"); drawRect.width = pos.width; drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_DataFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_StageColor); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { InitProperty(prop); Rect drawRect = pos; float defaultLabelWidth = EditorGUIUtility.labelWidth; float defaultFieldWidth = EditorGUIUtility.fieldWidth; drawRect.height = EditorGUIUtility.singleLineHeight; int index = ChartEditorHelper.GetIndexFromPath(prop); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, prop, "Radar " + index, null, true); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (ChartEditorHelper.IsToggle(m_RadarModuleToggle, prop)) { ++EditorGUI.indentLevel; EditorGUIUtility.labelWidth = defaultLabelWidth; EditorGUIUtility.fieldWidth = defaultFieldWidth; EditorGUI.PropertyField(drawRect, m_Shape); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_PositionType); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.LabelField(drawRect, "Center"); var startX = drawRect.x + EditorGUIUtility.labelWidth - EditorGUI.indentLevel * 15; var tempWidth = (pos.width - startX + 35) / 2; var centerXRect = new Rect(startX, drawRect.y, tempWidth, drawRect.height); var centerYRect = new Rect(centerXRect.x + tempWidth - 20, drawRect.y, tempWidth, drawRect.height); while (m_Center.arraySize < 2) { m_Center.InsertArrayElementAtIndex(m_Center.arraySize); } EditorGUI.PropertyField(centerXRect, m_Center.GetArrayElementAtIndex(0), GUIContent.none); EditorGUI.PropertyField(centerYRect, m_Center.GetArrayElementAtIndex(1), GUIContent.none); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Radius); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_SplitNumber); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_SplitLine); drawRect.y += EditorGUI.GetPropertyHeight(m_SplitLine); EditorGUI.PropertyField(drawRect, m_SplitArea); drawRect.y += EditorGUI.GetPropertyHeight(m_SplitArea); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; ChartEditorHelper.MakeFoldout(ref drawRect, ref m_IndicatorToggle, prop, "Indicators", m_Indicator, false); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_IndicatorJsonAreaToggle, ref m_IndicatorJsonAreaText, prop, pos.width, 20); drawRect.width = pos.width; drawRect.x = pos.x; if (ChartEditorHelper.IsToggle(m_IndicatorToggle, prop)) { EditorGUI.PropertyField(drawRect, m_IndicatorGap); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; ChartEditorHelper.MakeList(ref drawRect, ref m_IndicatorSize, m_IndicatorList); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_SelectedMode = prop.FindPropertyRelative("m_SelectedMode"); SerializedProperty orient = prop.FindPropertyRelative("m_Orient"); SerializedProperty location = prop.FindPropertyRelative("m_Location"); SerializedProperty itemWidth = prop.FindPropertyRelative("m_ItemWidth"); SerializedProperty itemHeight = prop.FindPropertyRelative("m_ItemHeight"); SerializedProperty itemGap = prop.FindPropertyRelative("m_ItemGap"); SerializedProperty m_ItemAutoColor = prop.FindPropertyRelative("m_ItemAutoColor"); SerializedProperty m_Formatter = prop.FindPropertyRelative("m_Formatter"); SerializedProperty m_Data = prop.FindPropertyRelative("m_Data"); SerializedProperty m_Icons = prop.FindPropertyRelative("m_Icons"); SerializedProperty m_TextStyle = prop.FindPropertyRelative("m_TextStyle"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_LegendModuleToggle, "Legend", show); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_LegendModuleToggle) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, itemWidth); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, itemHeight); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, itemGap); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_ItemAutoColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_SelectedMode); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, orient); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, location); drawRect.y += EditorGUI.GetPropertyHeight(location); EditorGUI.PropertyField(drawRect, m_Formatter); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = EditorGUIUtility.labelWidth + 10; m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data"); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop, pos.width); drawRect.width = pos.width; if (m_DataFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data); } m_IconsFoldout = EditorGUI.Foldout(drawRect, m_IconsFoldout, "Icons"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_IconsFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_IconsSize, m_Icons); } EditorGUI.PropertyField(drawRect, m_TextStyle); drawRect.y += EditorGUI.GetPropertyHeight(m_TextStyle); --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_Color = prop.FindPropertyRelative("m_Color"); SerializedProperty m_ToColor = prop.FindPropertyRelative("m_ToColor"); SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor"); SerializedProperty m_BackgroundWidth = prop.FindPropertyRelative("m_BackgroundWidth"); SerializedProperty m_CenterColor = prop.FindPropertyRelative("m_CenterColor"); SerializedProperty m_CenterGap = prop.FindPropertyRelative("m_CenterGap"); SerializedProperty m_BorderType = prop.FindPropertyRelative("m_BorderType"); SerializedProperty m_BorderWidth = prop.FindPropertyRelative("m_BorderWidth"); SerializedProperty m_BorderColor = prop.FindPropertyRelative("m_BorderColor"); SerializedProperty m_Opacity = prop.FindPropertyRelative("m_Opacity"); SerializedProperty m_TooltipFormatter = prop.FindPropertyRelative("m_TooltipFormatter"); SerializedProperty m_NumericFormatter = prop.FindPropertyRelative("m_NumericFormatter"); SerializedProperty m_CornerRadius = prop.FindPropertyRelative("m_CornerRadius"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_ItemStyleToggle, prop, "Item Style", show, false); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (ChartEditorHelper.IsToggle(m_ItemStyleToggle, prop)) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, m_Color); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_ToColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BackgroundColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BackgroundWidth); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_CenterColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_CenterGap); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BorderType); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BorderWidth); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BorderColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Opacity); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_TooltipFormatter); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_NumericFormatter); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; ChartEditorHelper.MakeFoldout(ref drawRect, ref m_CornerRadiusToggle, m_CornerRadius, "Corner Radius", null, false); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (ChartEditorHelper.IsToggle(m_CornerRadiusToggle, m_CornerRadius)) { ChartEditorHelper.MakeList(ref drawRect, ref this.m_CornerRadius, m_CornerRadius, false, false); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty m_Series = prop.FindPropertyRelative("m_Series"); drawRect.width = EditorGUIUtility.labelWidth + 10; ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SeriesModuleToggle, "Series"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = pos.width; if (m_SeriesModuleToggle) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Series, true); } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); //SerializedProperty type = prop.FindPropertyRelative("m_Type"); SerializedProperty name = prop.FindPropertyRelative("m_Name"); SerializedProperty stack = prop.FindPropertyRelative("m_Stack"); SerializedProperty m_Data = prop.FindPropertyRelative("m_Data"); string moduleName = "Serie " + prop.displayName.Split(' ')[1]; if (!string.IsNullOrEmpty(name.stringValue)) { moduleName += ":" + name.stringValue; } m_SerieModuleToggle = EditorGUI.Foldout(drawRect, m_SerieModuleToggle, "Serie"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_SerieModuleToggle) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, show); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, name); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, stack); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = EditorGUIUtility.labelWidth + 10; m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data"); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop); drawRect.width = pos.width; if (m_DataFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_Color = prop.FindPropertyRelative("m_Color"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_SplitAreaToggle, "Split Area", show, false); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_SplitAreaToggle) { ++EditorGUI.indentLevel; m_ColorFoldout = EditorGUI.Foldout(drawRect, m_ColorFoldout, "Color"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = pos.width; if (m_ColorFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_ColorSize, m_Color); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_AxisLine = prop.FindPropertyRelative("m_AxisLine"); SerializedProperty m_SplitLine = prop.FindPropertyRelative("m_SplitLine"); SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick"); SerializedProperty m_AxisLabel = prop.FindPropertyRelative("m_AxisLabel"); SerializedProperty m_AxisLabelText = prop.FindPropertyRelative("m_AxisLabelText"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisLineToggle, prop, "Gauge Axis", show, false); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (ChartEditorHelper.IsToggle(m_AxisLineToggle, prop)) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, m_AxisLine); drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLine); EditorGUI.PropertyField(drawRect, m_SplitLine); drawRect.y += EditorGUI.GetPropertyHeight(m_SplitLine); EditorGUI.PropertyField(drawRect, m_AxisTick); drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick); EditorGUI.PropertyField(drawRect, m_AxisLabel); drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLabel); drawRect.width = EditorGUIUtility.labelWidth + 10; m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Axis Label Text"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = pos.width; if (m_DataFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_AxisLabelText); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty m_Show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_Type = prop.FindPropertyRelative("m_Type"); SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber"); SerializedProperty m_TextRotation = prop.FindPropertyRelative("m_TextRotation"); SerializedProperty m_ShowSplitLine = prop.FindPropertyRelative("m_ShowSplitLine"); SerializedProperty m_SplitLineType = prop.FindPropertyRelative("m_SplitLineType"); SerializedProperty m_BoundaryGap = prop.FindPropertyRelative("m_BoundaryGap"); SerializedProperty m_Data = prop.FindPropertyRelative("m_Data"); SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick"); SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType"); SerializedProperty m_Min = prop.FindPropertyRelative("m_Min"); SerializedProperty m_Max = prop.FindPropertyRelative("m_Max"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_AxisModuleToggle, prop.displayName, m_Show); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_AxisModuleToggle) { Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex; EditorGUI.indentLevel++; EditorGUI.PropertyField(drawRect, m_Type); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (type == Axis.AxisType.Value) { EditorGUI.PropertyField(drawRect, m_MinMaxType); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex; switch (minMaxType) { case Axis.AxisMinMaxType.Default: break; case Axis.AxisMinMaxType.MinMax: break; case Axis.AxisMinMaxType.Custom: EditorGUI.indentLevel++; EditorGUI.PropertyField(drawRect, m_Min); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Max); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.indentLevel--; break; } } EditorGUI.PropertyField(drawRect, m_SplitNumber); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_TextRotation); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_ShowSplitLine.boolValue) { drawRect.width = EditorGUIUtility.labelWidth + 10; EditorGUI.PropertyField(drawRect, m_ShowSplitLine); //drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.x = EditorGUIUtility.labelWidth + 35; drawRect.width = EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth - 55; EditorGUI.PropertyField(drawRect, m_SplitLineType, GUIContent.none); drawRect.x = pos.x; drawRect.width = pos.width; drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } else { EditorGUI.PropertyField(drawRect, m_ShowSplitLine); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } EditorGUI.PropertyField(drawRect, m_BoundaryGap); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_AxisTick); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick); if (type == Axis.AxisType.Category) { drawRect.width = EditorGUIUtility.labelWidth + 10; m_DataFoldout = EditorGUI.Foldout(drawRect, m_DataFoldout, "Data"); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop); drawRect.width = pos.width; if (m_DataFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data); } } EditorGUI.indentLevel--; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { base.OnGUI(pos, prop, label); if (MakeFoldout(prop, "m_Show")) { SerializedProperty m_Type = prop.FindPropertyRelative("m_Type"); SerializedProperty m_LogBase = prop.FindPropertyRelative("m_LogBase"); SerializedProperty m_Data = prop.FindPropertyRelative("m_Data"); SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType"); Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex; var chart = prop.serializedObject.targetObject as BaseChart; var isPolar = chart is PolarChart; EditorGUI.indentLevel++; PropertyField(prop, isPolar ? "m_PolarIndex" : "m_GridIndex"); PropertyField(prop, "m_Type"); PropertyField(prop, "m_Position"); PropertyField(prop, "m_Offset"); if (type == Axis.AxisType.Log) { PropertyField(prop, "m_LogBaseE"); EditorGUI.BeginChangeCheck(); PropertyField(prop, "m_LogBase"); if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1) { m_LogBase.floatValue = 10; } EditorGUI.EndChangeCheck(); } if (type == Axis.AxisType.Value) { PropertyField(prop, "m_MinMaxType"); Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex; switch (minMaxType) { case Axis.AxisMinMaxType.Default: break; case Axis.AxisMinMaxType.MinMax: break; case Axis.AxisMinMaxType.Custom: EditorGUI.indentLevel++; PropertyField(prop, "m_Min"); PropertyField(prop, "m_Max"); EditorGUI.indentLevel--; break; } PropertyField(prop, "m_CeilRate"); PropertyField(prop, "m_Inverse"); } PropertyField(prop, "m_SplitNumber"); if (type == Axis.AxisType.Category) { PropertyField(prop, "m_BoundaryGap"); } else { PropertyField(prop, "m_Interval"); } DrawExtendeds(prop); PropertyField(prop, "m_AxisLine"); PropertyField(prop, "m_AxisName"); PropertyField(prop, "m_AxisTick"); PropertyField(prop, "m_AxisLabel"); PropertyField(prop, "m_SplitLine"); PropertyField(prop, "m_SplitArea"); if (type == Axis.AxisType.Category) { m_DrawRect.width = EditorGUIUtility.labelWidth + 10; m_DataToggles[m_KeyName] = EditorGUI.Foldout(m_DrawRect, m_DataToggles[m_KeyName], "Data"); AddSingleLineHeight(); m_DrawRect.width = pos.width; if (m_DataToggles[m_KeyName]) { var height = m_Heights[m_KeyName]; ChartEditorHelper.MakeList(ref m_DrawRect, ref height, ref m_DataSize, m_Data); m_Heights[m_KeyName] = height; } } EditorGUI.indentLevel--; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty m_Show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_Type = prop.FindPropertyRelative("m_Type"); SerializedProperty m_LogBaseE = prop.FindPropertyRelative("m_LogBaseE"); SerializedProperty m_LogBase = prop.FindPropertyRelative("m_LogBase"); SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber"); SerializedProperty m_Interval = prop.FindPropertyRelative("m_Interval"); SerializedProperty m_AxisLabel = prop.FindPropertyRelative("m_AxisLabel"); SerializedProperty m_BoundaryGap = prop.FindPropertyRelative("m_BoundaryGap"); SerializedProperty m_Data = prop.FindPropertyRelative("m_Data"); SerializedProperty m_AxisLine = prop.FindPropertyRelative("m_AxisLine"); SerializedProperty m_AxisName = prop.FindPropertyRelative("m_AxisName"); SerializedProperty m_AxisTick = prop.FindPropertyRelative("m_AxisTick"); SerializedProperty m_SplitArea = prop.FindPropertyRelative("m_SplitArea"); SerializedProperty m_SplitLine = prop.FindPropertyRelative("m_SplitLine"); SerializedProperty m_MinMaxType = prop.FindPropertyRelative("m_MinMaxType"); SerializedProperty m_Min = prop.FindPropertyRelative("m_Min"); SerializedProperty m_Max = prop.FindPropertyRelative("m_Max"); SerializedProperty m_CeilRate = prop.FindPropertyRelative("m_CeilRate"); SerializedProperty m_Inverse = prop.FindPropertyRelative("m_Inverse"); int index = InitToggle(prop); bool toggle = m_AxisModuleToggle[index]; m_AxisModuleToggle[index] = ChartEditorHelper.MakeFoldout(ref drawRect, ref toggle, GetDisplayName(prop.displayName), m_Show); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_AxisModuleToggle[index]) { Axis.AxisType type = (Axis.AxisType)m_Type.enumValueIndex; EditorGUI.indentLevel++; EditorGUI.PropertyField(drawRect, m_Type); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (type == Axis.AxisType.Log) { EditorGUI.PropertyField(drawRect, m_LogBaseE); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.BeginChangeCheck(); EditorGUI.PropertyField(drawRect, m_LogBase); if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1) { m_LogBase.floatValue = 10; } EditorGUI.EndChangeCheck(); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } if (type == Axis.AxisType.Value) { EditorGUI.PropertyField(drawRect, m_MinMaxType); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; Axis.AxisMinMaxType minMaxType = (Axis.AxisMinMaxType)m_MinMaxType.enumValueIndex; switch (minMaxType) { case Axis.AxisMinMaxType.Default: break; case Axis.AxisMinMaxType.MinMax: break; case Axis.AxisMinMaxType.Custom: EditorGUI.indentLevel++; EditorGUI.PropertyField(drawRect, m_Min); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Max); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.indentLevel--; break; } EditorGUI.PropertyField(drawRect, m_CeilRate); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Inverse); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } EditorGUI.PropertyField(drawRect, m_SplitNumber); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (type == Axis.AxisType.Category) { EditorGUI.PropertyField(drawRect, m_BoundaryGap); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } else { EditorGUI.PropertyField(drawRect, m_Interval); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; } DrawExtended(ref drawRect, prop); EditorGUI.PropertyField(drawRect, m_AxisLine); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLine); EditorGUI.PropertyField(drawRect, m_AxisName); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_AxisName); EditorGUI.PropertyField(drawRect, m_AxisTick); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_AxisTick); EditorGUI.PropertyField(drawRect, m_AxisLabel); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_AxisLabel); EditorGUI.PropertyField(drawRect, m_SplitLine); drawRect.y += EditorGUI.GetPropertyHeight(m_SplitLine); EditorGUI.PropertyField(drawRect, m_SplitArea); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.y += EditorGUI.GetPropertyHeight(m_SplitArea); if (type == Axis.AxisType.Category) { drawRect.width = EditorGUIUtility.labelWidth + 10; m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data"); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop, pos.width); drawRect.width = pos.width; if (m_DataFoldout[index]) { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_Data); } } EditorGUI.indentLevel--; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty show = prop.FindPropertyRelative("m_Show"); SerializedProperty type = prop.FindPropertyRelative("m_Type"); SerializedProperty name = prop.FindPropertyRelative("m_Name"); SerializedProperty stack = prop.FindPropertyRelative("m_Stack"); SerializedProperty m_AxisIndex = prop.FindPropertyRelative("m_AxisIndex"); SerializedProperty m_TwoDimensionData = prop.FindPropertyRelative("m_TwoDimensionData"); SerializedProperty m_XData = prop.FindPropertyRelative("m_XData"); SerializedProperty m_YData = prop.FindPropertyRelative("m_YData"); int index = InitToggle(prop); string moduleName = "Serie " + index; bool toggle = m_SerieModuleToggle[index]; m_SerieModuleToggle[index] = ChartEditorHelper.MakeFoldout(ref drawRect, ref toggle, moduleName, show); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_SerieModuleToggle[index]) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, type); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, name); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, stack); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_AxisIndex); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_TwoDimensionData); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = EditorGUIUtility.labelWidth + 10; m_DataFoldout[index] = EditorGUI.Foldout(drawRect, m_DataFoldout[index], "Data"); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_ShowJsonDataArea, ref m_JsonDataAreaText, prop); drawRect.width = pos.width; if (m_DataFoldout[index]) { if (m_TwoDimensionData.boolValue) { EditorGUI.indentLevel++; var listSize = m_YData.arraySize; listSize = EditorGUI.IntField(drawRect, "Size", listSize); if (listSize < 0) { listSize = 0; } drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (listSize != m_XData.arraySize) { while (listSize > m_XData.arraySize) { m_XData.InsertArrayElementAtIndex(m_XData.arraySize); } while (listSize < m_XData.arraySize) { m_XData.DeleteArrayElementAtIndex(m_XData.arraySize - 1); } } if (listSize != m_YData.arraySize) { while (listSize > m_YData.arraySize) { m_YData.InsertArrayElementAtIndex(m_YData.arraySize); } while (listSize < m_YData.arraySize) { m_YData.DeleteArrayElementAtIndex(m_YData.arraySize - 1); } } if (listSize > 30) { int num = listSize > 10 ? 10 : listSize; for (int i = 0; i < num; i++) { DrawTwoDimensionDataElement(ref drawRect, m_XData, m_YData, i); } if (num >= 10) { EditorGUI.LabelField(drawRect, "..."); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; DrawTwoDimensionDataElement(ref drawRect, m_XData, m_YData, listSize - 1); } } else { for (int i = 0; i < m_YData.arraySize; i++) { DrawTwoDimensionDataElement(ref drawRect, m_XData, m_YData, i); } } EditorGUI.indentLevel--; } else { ChartEditorHelper.MakeList(ref drawRect, ref m_DataSize, m_YData); } } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { InitProperty(prop); Rect drawRect = pos; float defaultLabelWidth = EditorGUIUtility.labelWidth; float defaultFieldWidth = EditorGUIUtility.fieldWidth; drawRect.height = EditorGUIUtility.singleLineHeight; ChartEditorHelper.MakeFoldout(ref drawRect, ref m_RadarModuleToggle, "Radar"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_RadarModuleToggle) { ++EditorGUI.indentLevel; EditorGUIUtility.fieldWidth = 10; EditorGUIUtility.labelWidth = 50; drawRect.width = 60; EditorGUI.PropertyField(drawRect, m_Cricle); EditorGUIUtility.labelWidth = 45; drawRect.x += 60; EditorGUI.PropertyField(drawRect, m_Area); EditorGUIUtility.labelWidth = 70; drawRect.x += 55; drawRect.width = 80; EditorGUI.PropertyField(drawRect, m_Indicator); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.x = pos.x; drawRect.width = pos.width; EditorGUIUtility.labelWidth = defaultLabelWidth; EditorGUIUtility.fieldWidth = defaultFieldWidth; EditorGUI.PropertyField(drawRect, m_Radius); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_SplitNumber); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Left); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Right); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Top); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Bottom); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_LineTickness); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_LinePointSize); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_AreaAlpha); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_LineColor); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; m_BackgroundColorToggle = EditorGUI.Foldout(drawRect, m_BackgroundColorToggle, "BackgroundColors"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; drawRect.width = pos.width; if (m_BackgroundColorToggle) { ChartEditorHelper.MakeList(ref drawRect, ref m_BackgroundColorSize, m_BackgroundColorList); } drawRect.width = EditorGUIUtility.labelWidth + 10; m_IndicatorToggle = EditorGUI.Foldout(drawRect, m_IndicatorToggle, "Indicators"); ChartEditorHelper.MakeJsonData(ref drawRect, ref m_IndicatorJsonAreaToggle, ref m_IndicatorJsonAreaText, prop); drawRect.width = pos.width; if (m_IndicatorToggle) { ChartEditorHelper.MakeList(ref drawRect, ref m_IndicatorSize, m_IndicatorList); } --EditorGUI.indentLevel; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { Rect drawRect = pos; drawRect.height = EditorGUIUtility.singleLineHeight; SerializedProperty m_Enable = prop.FindPropertyRelative("m_Enable"); SerializedProperty m_Type = prop.FindPropertyRelative("m_Type"); SerializedProperty m_Show = prop.FindPropertyRelative("m_Show"); SerializedProperty m_SelectedMode = prop.FindPropertyRelative("m_SelectedMode"); SerializedProperty m_Min = prop.FindPropertyRelative("m_Min"); SerializedProperty m_Max = prop.FindPropertyRelative("m_Max"); SerializedProperty m_Range = prop.FindPropertyRelative("m_Range"); SerializedProperty m_Text = prop.FindPropertyRelative("m_Text"); // SerializedProperty m_TextGap = prop.FindPropertyRelative("m_TextGap"); SerializedProperty m_SplitNumber = prop.FindPropertyRelative("m_SplitNumber"); SerializedProperty m_Calculable = prop.FindPropertyRelative("m_Calculable"); SerializedProperty m_ItemWidth = prop.FindPropertyRelative("m_ItemWidth"); SerializedProperty m_ItemHeight = prop.FindPropertyRelative("m_ItemHeight"); SerializedProperty m_BorderWidth = prop.FindPropertyRelative("m_BorderWidth"); SerializedProperty m_Dimension = prop.FindPropertyRelative("m_Dimension"); SerializedProperty m_HoverLink = prop.FindPropertyRelative("m_HoverLink"); SerializedProperty m_Orient = prop.FindPropertyRelative("m_Orient"); SerializedProperty m_Location = prop.FindPropertyRelative("m_Location"); SerializedProperty m_InRange = prop.FindPropertyRelative("m_InRange"); SerializedProperty m_AutoMinMax = prop.FindPropertyRelative("m_AutoMinMax"); SerializedProperty m_Direction = prop.FindPropertyRelative("m_Direction"); SerializedProperty m_OutOfRange = prop.FindPropertyRelative("m_OutOfRange"); ChartEditorHelper.MakeFoldout(ref drawRect, ref m_VisualMapModuleToggle, "Visual Map", m_Enable); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_VisualMapModuleToggle) { ++EditorGUI.indentLevel; EditorGUI.PropertyField(drawRect, m_Type); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Direction); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_AutoMinMax); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Min); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Max); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_SplitNumber); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Dimension); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; m_InRangeFoldout = EditorGUI.Foldout(drawRect, m_InRangeFoldout, "InRange"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_InRangeFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_InRangeSize, m_InRange); } // drawRect.width = pos.width; m_OutOfRangeFoldout = EditorGUI.Foldout(drawRect, m_OutOfRangeFoldout, "OutOfRange"); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_OutOfRangeFoldout) { ChartEditorHelper.MakeList(ref drawRect, ref m_OutOfRangeSize, m_OutOfRange); } // drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Show); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; if (m_Show.boolValue) { EditorGUI.PropertyField(drawRect, m_SelectedMode); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Range, "Range"); ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Text, "Text"); ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Text, "TextGap"); EditorGUI.PropertyField(drawRect, m_HoverLink); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Calculable); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_ItemWidth); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_ItemHeight); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_BorderWidth); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Orient); drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing; EditorGUI.PropertyField(drawRect, m_Location); drawRect.y += EditorGUI.GetPropertyHeight(m_Location); } --EditorGUI.indentLevel; } }