mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-26 10:50:08 +00:00
增加LiquidChart水位图
This commit is contained in:
34
Assets/XCharts/Editor/LiquidChartEditor.cs
Normal file
34
Assets/XCharts/Editor/LiquidChartEditor.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor class used to edit UI LiquidChart.
|
||||
/// </summary>
|
||||
|
||||
[CustomEditor(typeof(LiquidChart), false)]
|
||||
public class LiquidChartEditor : BaseChartEditor
|
||||
{
|
||||
protected SerializedProperty m_Vessels;
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
base.OnEnable();
|
||||
m_Target = (LiquidChart)target;
|
||||
m_Vessels = serializedObject.FindProperty("m_Vessels");
|
||||
}
|
||||
|
||||
protected override void OnStartInspectorGUI()
|
||||
{
|
||||
base.OnStartInspectorGUI();
|
||||
EditorGUILayout.PropertyField(m_Vessels, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/LiquidChartEditor.cs.meta
Normal file
11
Assets/XCharts/Editor/LiquidChartEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 307a1578a6be1403c98fdc27d99d1808
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -30,6 +30,7 @@ namespace XCharts
|
||||
SerializedProperty m_AxisIndex = prop.FindPropertyRelative("m_AxisIndex");
|
||||
SerializedProperty m_RadarType = prop.FindPropertyRelative("m_RadarType");
|
||||
SerializedProperty m_RadarIndex = prop.FindPropertyRelative("m_RadarIndex");
|
||||
SerializedProperty m_VesselIndex = prop.FindPropertyRelative("m_VesselIndex");
|
||||
SerializedProperty m_MinShow = prop.FindPropertyRelative("m_MinShow");
|
||||
SerializedProperty m_MaxShow = prop.FindPropertyRelative("m_MaxShow");
|
||||
SerializedProperty m_MaxCache = prop.FindPropertyRelative("m_MaxCache");
|
||||
@@ -78,6 +79,10 @@ namespace XCharts
|
||||
SerializedProperty m_Large = prop.FindPropertyRelative("m_Large");
|
||||
SerializedProperty m_LargeThreshold = prop.FindPropertyRelative("m_LargeThreshold");
|
||||
SerializedProperty m_AvoidLabelOverlap = prop.FindPropertyRelative("m_AvoidLabelOverlap");
|
||||
SerializedProperty m_WaveHeight = prop.FindPropertyRelative("m_WaveHeight");
|
||||
SerializedProperty m_WaveLength = prop.FindPropertyRelative("m_WaveLength");
|
||||
SerializedProperty m_WaveSpeed = prop.FindPropertyRelative("m_WaveSpeed");
|
||||
SerializedProperty m_WaveOffset = prop.FindPropertyRelative("m_WaveOffset");
|
||||
SerializedProperty m_Datas = prop.FindPropertyRelative("m_Data");
|
||||
|
||||
int index = InitToggle(prop);
|
||||
@@ -322,6 +327,26 @@ namespace XCharts
|
||||
EditorGUI.PropertyField(drawRect, m_Emphasis);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Emphasis);
|
||||
break;
|
||||
case SerieType.Liquid:
|
||||
EditorGUI.PropertyField(drawRect, m_VesselIndex);
|
||||
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_WaveLength);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_WaveHeight);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_WaveSpeed);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_WaveOffset);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ItemStyle);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_ItemStyle);
|
||||
EditorGUI.PropertyField(drawRect, m_Label);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Label);
|
||||
break;
|
||||
}
|
||||
EditorGUI.PropertyField(drawRect, m_Animation);
|
||||
drawRect.y += EditorGUI.GetPropertyHeight(m_Animation);
|
||||
@@ -589,6 +614,12 @@ namespace XCharts
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Emphasis"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
|
||||
break;
|
||||
case SerieType.Liquid:
|
||||
height += 11 * EditorGUIUtility.singleLineHeight + 10 * EditorGUIUtility.standardVerticalSpacing;
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_ItemStyle"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Label"));
|
||||
height += EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("m_Animation"));
|
||||
break;
|
||||
}
|
||||
if (m_DataFoldout[index])
|
||||
{
|
||||
|
||||
68
Assets/XCharts/Editor/PropertyDrawers/VesselDrawer.cs
Normal file
68
Assets/XCharts/Editor/PropertyDrawers/VesselDrawer.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Vessel), true)]
|
||||
public class VesselDrawer : PropertyDrawer
|
||||
{
|
||||
private bool m_VesselModuleToggle = false;
|
||||
|
||||
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_Shape = prop.FindPropertyRelative("m_Shape");
|
||||
SerializedProperty m_Center = prop.FindPropertyRelative("m_Center");
|
||||
SerializedProperty m_Radius = prop.FindPropertyRelative("m_Radius");
|
||||
SerializedProperty m_ShapeWidth = prop.FindPropertyRelative("m_ShapeWidth");
|
||||
SerializedProperty m_Gap = prop.FindPropertyRelative("m_Gap");
|
||||
SerializedProperty m_Smoothness = prop.FindPropertyRelative("m_Smoothness");
|
||||
SerializedProperty m_AutoColor = prop.FindPropertyRelative("m_AutoColor");
|
||||
SerializedProperty m_Color = prop.FindPropertyRelative("m_Color");
|
||||
SerializedProperty m_BackgroundColor = prop.FindPropertyRelative("m_BackgroundColor");
|
||||
|
||||
int index = ChartEditorHelper.GetIndexFromPath(prop);
|
||||
ChartEditorHelper.MakeFoldout(ref drawRect, ref m_VesselModuleToggle, "Vessel " + index, show);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
if (m_VesselModuleToggle)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.PropertyField(drawRect, m_Shape);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_ShapeWidth);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Gap);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
ChartEditorHelper.MakeTwoField(ref drawRect, pos.width, m_Center, "Center");
|
||||
EditorGUI.PropertyField(drawRect, m_Radius);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_BackgroundColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Color);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_AutoColor);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.PropertyField(drawRect, m_Smoothness);
|
||||
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
|
||||
{
|
||||
if (m_VesselModuleToggle)
|
||||
return 10 * EditorGUIUtility.singleLineHeight + 9 * EditorGUIUtility.standardVerticalSpacing;
|
||||
else
|
||||
return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/XCharts/Editor/PropertyDrawers/VesselDrawer.cs.meta
Normal file
11
Assets/XCharts/Editor/PropertyDrawers/VesselDrawer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 744a68155f2f349dc8fe26536ec83f80
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -134,5 +134,12 @@ namespace XCharts
|
||||
{
|
||||
AddChart<PolarChart>("PolarChart");
|
||||
}
|
||||
|
||||
[MenuItem("XCharts/LiquidChart", priority = 53)]
|
||||
[MenuItem("GameObject/XCharts/LiquidChart", priority = 53)]
|
||||
public static void AddLiquidChart()
|
||||
{
|
||||
AddChart<LiquidChart>("LiquidChart");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user