mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-19 23:10:06 +00:00
增加代码API注释文档,整理代码
This commit is contained in:
@@ -10,7 +10,7 @@ namespace XCharts
|
||||
[CustomEditor(typeof(CoordinateChart), false)]
|
||||
public class CoordinateChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Coordinate;
|
||||
protected SerializedProperty m_Grid;
|
||||
protected SerializedProperty m_MultipleXAxis;
|
||||
protected SerializedProperty m_XAxises;
|
||||
protected SerializedProperty m_MultipleYAxis;
|
||||
@@ -21,7 +21,7 @@ namespace XCharts
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (CoordinateChart)target;
|
||||
m_Coordinate = serializedObject.FindProperty("m_Coordinate");
|
||||
m_Grid = serializedObject.FindProperty("m_Grid");
|
||||
m_XAxises = serializedObject.FindProperty("m_XAxises");
|
||||
m_YAxises = serializedObject.FindProperty("m_YAxises");
|
||||
m_DataZoom = serializedObject.FindProperty("m_DataZoom");
|
||||
@@ -31,7 +31,7 @@ namespace XCharts
|
||||
{
|
||||
base.OnStartInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_DataZoom);
|
||||
EditorGUILayout.PropertyField(m_Coordinate);
|
||||
EditorGUILayout.PropertyField(m_Grid);
|
||||
for (int i = 0; i < m_XAxises.arraySize; i++)
|
||||
{
|
||||
SerializedProperty axis = m_XAxises.GetArrayElementAtIndex(i);
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(BarChart.Bar), true)]
|
||||
[CustomPropertyDrawer(typeof(Bar), true)]
|
||||
public class BarDrawer : PropertyDrawer
|
||||
{
|
||||
SerializedProperty m_InSameBar;
|
||||
|
||||
@@ -3,27 +3,27 @@ using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Coordinate), true)]
|
||||
public class CoordinateDrawer : PropertyDrawer
|
||||
[CustomPropertyDrawer(typeof(Grid), true)]
|
||||
public class GridDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_CoordinateModuleToggle = false;
|
||||
private bool m_GridModuleToggle = false;
|
||||
|
||||
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_Left = prop.FindPropertyRelative("m_Left");
|
||||
SerializedProperty m_Right = prop.FindPropertyRelative("m_Right");
|
||||
SerializedProperty m_Top = prop.FindPropertyRelative("m_Top");
|
||||
SerializedProperty m_Bottom = prop.FindPropertyRelative("m_Bottom");
|
||||
SerializedProperty m_Tickness = prop.FindPropertyRelative("m_Tickness");
|
||||
SerializedProperty m_FontSize = prop.FindPropertyRelative("m_FontSize");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_CoordinateModuleToggle, "Coordinate");
|
||||
EditorGUI.LabelField(drawRect, "Coordinate", EditorStyles.boldLabel);
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_GridModuleToggle, "Grid",m_Show);
|
||||
EditorGUI.LabelField(drawRect, "Grid", EditorStyles.boldLabel);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_CoordinateModuleToggle)
|
||||
if (m_GridModuleToggle)
|
||||
{
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.PropertyField(drawRect, m_Left);
|
||||
@@ -34,9 +34,7 @@ namespace XCharts
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Bottom);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Tickness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_FontSize);
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
@@ -44,8 +42,8 @@ namespace XCharts
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_CoordinateModuleToggle)
|
||||
return 7 * EditorGUIUtility.singleLineHeight + 6 * EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_GridModuleToggle)
|
||||
return 6 * EditorGUIUtility.singleLineHeight + 5 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38e8e72dd7107db429232ccab308e27c
|
||||
timeCreated: 1554506762
|
||||
licenseType: Free
|
||||
guid: f4142159d55a64e1d88d81ac84b714d0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -20,7 +20,7 @@ namespace XCharts
|
||||
SerializedProperty m_Theme = prop.FindPropertyRelative("m_Theme");
|
||||
SerializedProperty m_Font = prop.FindPropertyRelative("m_Font");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
SerializedProperty m_TextColor = prop.FindPropertyRelative("m_TextColor");
|
||||
SerializedProperty m_TextColor = prop.FindPropertyRelative("m_TitleTextColor");
|
||||
SerializedProperty m_SubTextColor = prop.FindPropertyRelative("m_TitleSubTextColor");
|
||||
SerializedProperty m_LegendTextColor = prop.FindPropertyRelative("m_LegendTextColor");
|
||||
SerializedProperty m_LegendUnableColor = prop.FindPropertyRelative("m_LegendUnableColor");
|
||||
@@ -39,7 +39,7 @@ namespace XCharts
|
||||
|
||||
SerializedProperty m_CustomFont = prop.FindPropertyRelative("m_CustomFont");
|
||||
SerializedProperty m_CustomBackgroundColor = prop.FindPropertyRelative("m_CustomBackgroundColor");
|
||||
SerializedProperty m_CustomTextColor = prop.FindPropertyRelative("m_CustomTextColor");
|
||||
SerializedProperty m_CustomTextColor = prop.FindPropertyRelative("m_CustomTitleTextColor");
|
||||
SerializedProperty m_CustomSubTextColor = prop.FindPropertyRelative("m_CustomTitleSubTextColor");
|
||||
SerializedProperty m_CustomLegendTextColor = prop.FindPropertyRelative("m_CustomLegendTextColor");
|
||||
SerializedProperty m_CustomLegendUnableColor = prop.FindPropertyRelative("m_CustomLegendUnableColor");
|
||||
@@ -97,7 +97,7 @@ namespace XCharts
|
||||
}
|
||||
m_Font.objectReferenceValue = defaultThemeInfo.font;
|
||||
m_BackgroundColor.colorValue = defaultThemeInfo.backgroundColor;
|
||||
m_TextColor.colorValue = defaultThemeInfo.textColor;
|
||||
m_TextColor.colorValue = defaultThemeInfo.titleTextColor;
|
||||
m_SubTextColor.colorValue = defaultThemeInfo.titleSubTextColor;
|
||||
m_LegendTextColor.colorValue = defaultThemeInfo.legendTextColor;
|
||||
m_LegendUnableColor.colorValue = defaultThemeInfo.legendUnableColor;
|
||||
@@ -143,7 +143,7 @@ namespace XCharts
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomTextColor.colorValue != Color.clear ? m_CustomTextColor : m_TextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Text Color"));
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Title Text Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomTextColor.colorValue = color.colorValue;
|
||||
@@ -152,7 +152,7 @@ namespace XCharts
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
color = m_CustomSubTextColor.colorValue != Color.clear ? m_CustomSubTextColor : m_SubTextColor;
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("SubText Color"));
|
||||
EditorGUI.PropertyField(drawRect, color, new GUIContent("Title SubText Color"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_CustomSubTextColor.colorValue = color.colorValue;
|
||||
|
||||
Reference in New Issue
Block a user