XcharT表格功能提交

This commit is contained in:
lujiajian 2025-12-09 14:28:45 +08:00
parent c9b86a5a20
commit 20a2074d69
862 changed files with 75666 additions and 13 deletions

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using XCharts.Runtime;
public class ChartTable : MonoBehaviour
{
public LineChart chart;
void Start()
{
}
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 67c1a80086b64da4cabdad54a59dbbb8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -48,6 +48,7 @@ public class LineManager : MonoBehaviour
} }
} }
bool isshow;
void Update() void Update()
{ {
if (Input.GetMouseButtonDown(2)) if (Input.GetMouseButtonDown(2))
@ -56,6 +57,12 @@ public class LineManager : MonoBehaviour
point2 = null; point2 = null;
PlayerPrefs.SetString("LineData", ""); PlayerPrefs.SetString("LineData", "");
} }
if (allline >= Models.Count && !isshow)
{
isshow = true;
TipTexts.text = "ÏßÒÑÈ«²¿Á¬½Ó£¡";
StartCoroutine(WaitHide(Tips));
}
} }
/// <summary> /// <summary>
/// Êó±êµã»÷µÄÎïÌå /// Êó±êµã»÷µÄÎïÌå
@ -79,6 +86,7 @@ public class LineManager : MonoBehaviour
{ {
if (!lineData.Modelname.Contains(point.name)) if (!lineData.Modelname.Contains(point.name))
{ {
allline++;
lineData.Modelname.Add(point.name); lineData.Modelname.Add(point.name);
string json = JsonConvert.SerializeObject(lineData); string json = JsonConvert.SerializeObject(lineData);
PlayerPrefs.SetString("LineData", json); PlayerPrefs.SetString("LineData", json);
@ -97,9 +105,8 @@ public class LineManager : MonoBehaviour
{ {
if (!JudgmentLine(line, line2)) if (!JudgmentLine(line, line2))
{ {
Tips.SetActive(true); yield return null;
yield return new WaitForSeconds(2); StartCoroutine(WaitHide(Tips));
Tips.SetActive(false);
} }
} }
@ -195,6 +202,7 @@ public class LineManager : MonoBehaviour
{ {
if (!lineData.Modelname.Contains(Models[i].name)) if (!lineData.Modelname.Contains(Models[i].name))
{ {
allline++;
lineData.Modelname.Add(Models[i].name); lineData.Modelname.Add(Models[i].name);
string json = JsonConvert.SerializeObject(lineData); string json = JsonConvert.SerializeObject(lineData);
PlayerPrefs.SetString("LineData", json); PlayerPrefs.SetString("LineData", json);
@ -207,11 +215,19 @@ public class LineManager : MonoBehaviour
return true; return true;
} }
} }
int allline = 0;
public void Init() public void Init()
{ {
point2 = null; point2 = null;
point1 = null; point1 = null;
} }
IEnumerator WaitHide(GameObject game)
{
game.SetActive(true);
yield return new WaitForSeconds(1.5f);
game.SetActive(false);
}
} }
public class LineData public class LineData

View File

@ -63,6 +63,16 @@ public class LineShowModel : MonoBehaviour
// 单例模式,便于外部调用 // 单例模式,便于外部调用
public static LineShowModel Instance { get; private set; } public static LineShowModel Instance { get; private set; }
[Header("动态粗细设置")]
public bool enableDynamicThickness = true; // 启用动态粗细
public float minThickness = 0.005f; // 最小粗细
public float maxThickness = 0.02f; // 最大粗细
public float closeDistance = 1.0f; // 视为"近"的距离阈值
public float farDistance = 10.0f;
// 添加相机引用,用于计算距离
private Camera mainCamera;
void Awake() void Awake()
{ {
// 设置单例 // 设置单例
@ -74,6 +84,8 @@ public class LineShowModel : MonoBehaviour
{ {
Destroy(gameObject); Destroy(gameObject);
} }
mainCamera = Camera.main;
} }
void Update() void Update()
@ -94,8 +106,99 @@ public class LineShowModel : MonoBehaviour
{ {
ClearSnapHighlight(); ClearSnapHighlight();
} }
// 更新所有连线的动态粗细
if (enableDynamicThickness && useCylinderWire)
{
UpdateAllWiresThickness();
}
}
// 新增方法:更新所有连线的动态粗细
void UpdateAllWiresThickness()
{
if (mainCamera == null) return;
foreach (GameObject wire in allWires)
{
if (wire == null) continue;
LineShowModelCylinderWireData wireData = wire.GetComponent<LineShowModelCylinderWireData>();
if (wireData == null) continue;
// 计算连线中点与相机的距离
Vector3 wireMidPoint = (wireData.startPoint + wireData.endPoint) / 2f;
float distanceToCamera = Vector3.Distance(wireMidPoint, mainCamera.transform.position);
// 根据距离计算粗细
float targetThickness = CalculateDynamicThickness(distanceToCamera);
// 更新圆柱体粗细
Transform cylinderTransform = wire.transform.Find("WireCylinder");
if (cylinderTransform != null)
{
Vector3 currentScale = cylinderTransform.localScale;
cylinderTransform.localScale = new Vector3(
targetThickness,
currentScale.y, // 保持高度不变
targetThickness
);
// 更新数据
wireData.wireDiameter = targetThickness;
}
}
}
// 新增方法:根据距离计算动态粗细
float CalculateDynamicThickness(float distance)
{
// 使用线性插值计算粗细
float t = Mathf.InverseLerp(closeDistance, farDistance, distance);
t = Mathf.Clamp01(t); // 确保在0-1范围内
// 距离越近线条越细使用1-t来反转关系
float thickness = Mathf.Lerp(minThickness, maxThickness, 1 - t);
return thickness;
}
// 新增方法:基于相对距离的粗细计算(可选)
float CalculateDynamicThicknessRelative(Vector3 start, Vector3 end, Vector3 cameraPos)
{
// 计算连线中点到相机的距离
Vector3 midPoint = (start + end) / 2f;
float distanceToCamera = Vector3.Distance(midPoint, cameraPos);
// 计算连线长度
float lineLength = Vector3.Distance(start, end);
// 基于连线长度和相机距离的综合计算
float lengthFactor = Mathf.Clamp01(lineLength / farDistance);
float cameraFactor = Mathf.Clamp01(distanceToCamera / farDistance);
// 综合因素:连线越长或距离相机越近,线条越细
float combinedFactor = (lengthFactor + (1 - cameraFactor)) / 2f;
return Mathf.Lerp(minThickness, maxThickness, 1 - combinedFactor);
} }
// 新增方法:批量更新连线的动态粗细
public void RefreshAllWiresThickness()
{
if (!enableDynamicThickness || !useCylinderWire) return;
UpdateAllWiresThickness();
}
// 新增方法:设置动态粗细参数
public void SetDynamicThicknessParams(float newMinThickness, float newMaxThickness,
float newCloseDistance, float newFarDistance)
{
minThickness = Mathf.Max(0.001f, newMinThickness);
maxThickness = Mathf.Max(minThickness, newMaxThickness);
closeDistance = Mathf.Max(0.1f, newCloseDistance);
farDistance = Mathf.Max(closeDistance + 0.1f, newFarDistance);
RefreshAllWiresThickness();
}
void HandleInput() void HandleInput()
{ {
if (Input.GetMouseButtonDown(0)) // 左键点击 if (Input.GetMouseButtonDown(0)) // 左键点击
@ -319,7 +422,7 @@ public class LineShowModel : MonoBehaviour
} }
} }
} }
// 修改预览连线的更新方法,也加入动态粗细
void UpdateCylinderPreviewWire(Vector3 start, Vector3 end) void UpdateCylinderPreviewWire(Vector3 start, Vector3 end)
{ {
Transform cylinderTransform = previewWireObject.transform.Find("PreviewCylinder"); Transform cylinderTransform = previewWireObject.transform.Find("PreviewCylinder");
@ -340,15 +443,23 @@ public class LineShowModel : MonoBehaviour
Vector3 midPoint = (start + end) / 2f; Vector3 midPoint = (start + end) / 2f;
// 计算预览连线的动态粗细
float previewThickness = previewWireDiameter;
if (enableDynamicThickness && mainCamera != null)
{
float distanceToCamera = Vector3.Distance(midPoint, mainCamera.transform.position);
previewThickness = CalculateDynamicThickness(distanceToCamera);
}
// 设置圆柱体的位置和旋转 // 设置圆柱体的位置和旋转
cylinder.transform.position = midPoint; cylinder.transform.position = midPoint;
cylinder.transform.up = direction.normalized; cylinder.transform.up = direction.normalized;
// 设置圆柱体的缩放 // 设置圆柱体的缩放(使用动态粗细)
cylinder.transform.localScale = new Vector3( cylinder.transform.localScale = new Vector3(
previewWireDiameter, previewThickness,
distance / 2f, distance / 2f,
previewWireDiameter previewThickness
); );
} }
@ -396,12 +507,23 @@ public class LineShowModel : MonoBehaviour
return wireObject; return wireObject;
} }
// 修改最终连线的创建方法,初始使用动态粗细
void CreateCylinderWire(GameObject wireObject, Vector3 start, Vector3 end) void CreateCylinderWire(GameObject wireObject, Vector3 start, Vector3 end)
{ {
GameObject cylinder = GameObject.CreatePrimitive(PrimitiveType.Cylinder); GameObject cylinder = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
cylinder.name = "WireCylinder"; cylinder.name = "WireCylinder";
cylinder.transform.SetParent(wireObject.transform); cylinder.transform.SetParent(wireObject.transform);
// 计算初始动态粗细
Vector3 midPoint = (start + end) / 2f;
float initialThickness = cylinderWireDiameter;
if (enableDynamicThickness && mainCamera != null)
{
float distanceToCamera = Vector3.Distance(midPoint, mainCamera.transform.position);
initialThickness = CalculateDynamicThickness(distanceToCamera);
}
// 设置材质 // 设置材质
if (cylinderWireMaterial != null) if (cylinderWireMaterial != null)
{ {
@ -417,17 +539,16 @@ public class LineShowModel : MonoBehaviour
// 计算连线的方向、长度和中点 // 计算连线的方向、长度和中点
Vector3 direction = end - start; Vector3 direction = end - start;
float distance = direction.magnitude; float distance = direction.magnitude;
Vector3 midPoint = (start + end) / 2f;
// 设置圆柱体的位置和旋转 // 设置圆柱体的位置和旋转
cylinder.transform.position = midPoint; cylinder.transform.position = midPoint;
cylinder.transform.up = direction.normalized; cylinder.transform.up = direction.normalized;
// 设置圆柱体的缩放 // 设置圆柱体的缩放(使用动态粗细)
cylinder.transform.localScale = new Vector3( cylinder.transform.localScale = new Vector3(
cylinderWireDiameter, initialThickness,
distance / 2f, distance / 2f,
cylinderWireDiameter initialThickness
); );
// 可选:添加碰撞器 // 可选:添加碰撞器

View File

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
using XCharts.Runtime;
public class LineChart : MonoBehaviour
{
void Start()
{
LineChart chart = GetComponent<LineChart>();
DataZoom dataZoom = chart.GetComponent<DataZoom>();
dataZoom.enable = true;
dataZoom.supportInside = true; // 启用鼠标拖拽和滚轮缩放
dataZoom.supportSlider = true; // 显示底部滑动条
dataZoom.zoomLock = false; // 允许缩放
// 设置初始显示范围为50%到100%
dataZoom.start = 50;
dataZoom.end = 100;
}
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 08ae6d23a484eba43bb4f3162ed67cf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -26,7 +26,7 @@ public class SubjectToggle : BaseItem, IPointerEnterHandler, IPointerExitHandler
Bootstrap.Instance.uiManager.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) => Bootstrap.Instance.uiManager.ShowPanel<UI_LoadingPanel>(this, E_UI_Layer.System, (panel) =>
{ {
Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.5f); Bootstrap.Instance.eventCenter.EventTrigger(Enum_EventType.UpdateProgress, 0.5f);
Bootstrap.Instance.scenesManager.LoadSceneAsyn(this, "xianchang-TSQ1", () => Bootstrap.Instance.scenesManager.LoadSceneAsyn(this, "xianchang", () =>
{ {
Bootstrap.Instance.uiManager.ShowPanel<UI_TopTitlePanel>(this, E_UI_Layer.Top, (panel) => Bootstrap.Instance.uiManager.ShowPanel<UI_TopTitlePanel>(this, E_UI_Layer.Top, (panel) =>
{ {

View File

@ -29,7 +29,7 @@ public class UI_TopTitlePanel : BasePanel
{ {
base.ShowMe(); base.ShowMe();
Scene currentScene = SceneManager.GetActiveScene(); Scene currentScene = SceneManager.GetActiveScene();
if (currentScene.name == "xianchang-TSQ1") if (currentScene.name == "xianchang")
{ {
AskBtn.gameObject.SetActive(true); AskBtn.gameObject.SetActive(true);
ReturnBtn.gameObject.SetActive(true); ReturnBtn.gameObject.SetActive(true);

8
Assets/XCharts.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 27636d97cef7446ffba2e3036a207851
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 98b750952a34c427693ac70f09008bae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8e7c19967ca244147b0fcbb129201b46
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using System;
namespace XCharts.Editor
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class ComponentEditorAttribute : Attribute
{
public readonly Type componentType;
public ComponentEditorAttribute(Type componentType)
{
this.componentType = componentType;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f433acf13ec404a6d91eb78352d18d4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using System;
namespace XCharts.Editor
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public sealed class SerieEditorAttribute : Attribute
{
public readonly Type serieType;
public SerieEditorAttribute(Type serieType)
{
this.serieType = serieType;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dcdc7a72224af419d96584fa40f822c9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9e4407eed14ec4e518a373f4d8ae9b3c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,325 @@
using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomEditor(typeof(BaseChart), true)]
public class BaseChartEditor : UnityEditor.Editor
{
class Styles
{
public static readonly GUIContent btnAddSerie = new GUIContent("Add Serie", "");
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
public static readonly GUIContent btnConvertXYAxis = new GUIContent("Convert XY Axis", "");
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Chart Object", "");
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
}
protected BaseChart m_Chart;
protected SerializedProperty m_Script;
protected SerializedProperty m_EnableTextMeshPro;
protected SerializedProperty m_Settings;
protected SerializedProperty m_Theme;
protected SerializedProperty m_ChartName;
protected SerializedProperty m_DebugInfo;
protected SerializedProperty m_RaycastTarget;
protected List<SerializedProperty> m_Components = new List<SerializedProperty>();
protected List<SerializedProperty> m_Series = new List<SerializedProperty>();
private bool m_BaseFoldout;
private bool m_CheckWarning = false;
private int m_LastComponentCount = 0;
private int m_LastSerieCount = 0;
private string m_VersionString = "";
private StringBuilder sb = new StringBuilder();
MainComponentListEditor m_ComponentList;
SerieListEditor m_SerieList;
protected virtual void OnEnable()
{
if (target == null) return;
m_Chart = (BaseChart) target;
m_Script = serializedObject.FindProperty("m_Script");
m_EnableTextMeshPro = serializedObject.FindProperty("m_EnableTextMeshPro");
m_ChartName = serializedObject.FindProperty("m_ChartName");
m_Theme = serializedObject.FindProperty("m_Theme");
m_Settings = serializedObject.FindProperty("m_Settings");
m_DebugInfo = serializedObject.FindProperty("m_DebugInfo");
m_RaycastTarget = serializedObject.FindProperty("m_RaycastTarget");
RefreshComponent();
m_ComponentList = new MainComponentListEditor(this);
m_ComponentList.Init(m_Chart, serializedObject, m_Components);
RefreshSeries();
m_SerieList = new SerieListEditor(this);
m_SerieList.Init(m_Chart, serializedObject, m_Series);
m_VersionString = "v" + XChartsMgr.fullVersion;
if (m_EnableTextMeshPro.boolValue)
m_VersionString += "-tmp";
}
public List<SerializedProperty> RefreshComponent()
{
m_Components.Clear();
serializedObject.UpdateIfRequiredOrScript();
foreach (var kv in m_Chart.typeListForComponent)
{
InitComponent(kv.Value.Name);
}
return m_Components;
}
public List<SerializedProperty> RefreshSeries()
{
m_Series.Clear();
serializedObject.UpdateIfRequiredOrScript();
foreach (var kv in m_Chart.typeListForSerie)
{
InitSerie(kv.Value.Name);
}
return m_Series;
}
public override void OnInspectorGUI()
{
if (m_Chart == null && target == null)
{
base.OnInspectorGUI();
return;
}
serializedObject.UpdateIfRequiredOrScript();
if (m_LastComponentCount != m_Chart.components.Count)
{
m_LastComponentCount = m_Chart.components.Count;
RefreshComponent();
m_ComponentList.UpdateComponentsProperty(m_Components);
}
if (m_LastSerieCount != m_Chart.series.Count)
{
m_LastSerieCount = m_Chart.series.Count;
RefreshSeries();
m_SerieList.UpdateSeriesProperty(m_Series);
}
OnStartInspectorGUI();
OnDebugInspectorGUI();
EditorGUILayout.Space();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI()
{
ShowVersion();
m_BaseFoldout = ChartEditorHelper.DrawHeader("Base", m_BaseFoldout, false, null, null);
if (m_BaseFoldout)
{
EditorGUILayout.PropertyField(m_Script);
EditorGUILayout.PropertyField(m_ChartName);
EditorGUILayout.PropertyField(m_RaycastTarget);
if (XChartsMgr.IsRepeatChartName(m_Chart, m_ChartName.stringValue))
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.HelpBox("chart name is repeated: " + m_ChartName.stringValue, MessageType.Error);
EditorGUILayout.EndHorizontal();
}
}
EditorGUILayout.PropertyField(m_Theme);
EditorGUILayout.PropertyField(m_Settings);
m_ComponentList.OnGUI();
m_SerieList.OnGUI();
}
protected virtual void OnDebugInspectorGUI()
{
EditorGUILayout.PropertyField(m_DebugInfo, true);
EditorGUILayout.Space();
AddSerie();
AddComponent();
CheckWarning();
}
protected void PropertyComponnetList(SerializedProperty prop)
{
for (int i = 0; i < prop.arraySize; i++)
{
EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), true);
}
}
private void InitComponent(string propName)
{
var prop = serializedObject.FindProperty(propName);
for (int i = 0; i < prop.arraySize; i++)
{
m_Components.Add(prop.GetArrayElementAtIndex(i));
}
m_Components.Sort((a, b) => { return a.propertyPath.CompareTo(b.propertyPath); });
}
private void InitSerie(string propName)
{
var prop = serializedObject.FindProperty(propName);
for (int i = 0; i < prop.arraySize; i++)
{
m_Series.Add(prop.GetArrayElementAtIndex(i));
}
m_Series.Sort(delegate(SerializedProperty a, SerializedProperty b)
{
var index1 = a.FindPropertyRelative("m_Index").intValue;
var index2 = b.FindPropertyRelative("m_Index").intValue;
return index1.CompareTo(index2);
});
}
private void ShowVersion()
{
EditorGUILayout.HelpBox(m_VersionString, MessageType.None);
}
private void AddComponent()
{
if (GUILayout.Button(Styles.btnAddComponent))
{
var menu = new GenericMenu();
foreach (var type in GetMainComponentTypeNames())
{
var title = ChartEditorHelper.GetContent(type.Name);
bool exists = !m_Chart.CanAddChartComponent(type);
if (!exists)
menu.AddItem(title, false, () =>
{
m_ComponentList.AddChartComponent(type);
});
else
{
menu.AddDisabledItem(title);
}
}
menu.ShowAsContext();
}
}
private void AddSerie()
{
if (GUILayout.Button(Styles.btnAddSerie))
{
var menu = new GenericMenu();
foreach (var type in GetSerieTypeNames())
{
var title = ChartEditorHelper.GetContent(type.Name);
if (m_Chart.CanAddSerie(type))
{
menu.AddItem(title, false, () =>
{
m_SerieList.AddSerie(type);
});
}
else
{
menu.AddDisabledItem(title);
}
}
menu.ShowAsContext();
}
}
private List<Type> GetMainComponentTypeNames()
{
var list = new List<Type>();
var typeMap = RuntimeUtil.GetAllTypesDerivedFrom<MainComponent>();
foreach (var kvp in typeMap)
{
var type = kvp;
if (RuntimeUtil.HasSubclass(type)) continue;
if (type.IsDefined(typeof(ComponentHandlerAttribute), false))
{
var attribute = type.GetAttribute<ComponentHandlerAttribute>();
if (attribute != null && attribute.handler != null)
list.Add(type);
}
else
{
list.Add(type);
}
}
list.Sort((a, b) => { return a.Name.CompareTo(b.Name); });
return list;
}
private List<Type> GetSerieTypeNames()
{
var list = new List<Type>();
var typeMap = RuntimeUtil.GetAllTypesDerivedFrom<Serie>();
foreach (var kvp in typeMap)
{
var type = kvp;
if (type.IsDefined(typeof(SerieHandlerAttribute), false))
list.Add(type);
}
list.Sort((a, b) => { return a.Name.CompareTo(b.Name); });
return list;
}
private void CheckWarning()
{
if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>())
{
if (GUILayout.Button(Styles.btnConvertXYAxis))
m_Chart.ConvertXYAxis(0);
}
if (GUILayout.Button(Styles.btnRebuildChartObject))
{
m_Chart.RebuildChartObject();
}
if (GUILayout.Button(Styles.btnSaveAsImage))
{
m_Chart.SaveAsImage();
}
if (m_CheckWarning)
{
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(Styles.btnCheckWarning))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
if (GUILayout.Button(Styles.btnHideWarning))
{
m_CheckWarning = false;
}
EditorGUILayout.EndHorizontal();
sb.Length = 0;
sb.AppendFormat("v{0}", XChartsMgr.fullVersion);
if (!string.IsNullOrEmpty(m_Chart.warningInfo))
{
sb.AppendLine();
sb.Append(m_Chart.warningInfo);
}
else
{
sb.AppendLine();
sb.Append("Perfect! No warning!");
}
EditorGUILayout.HelpBox(sb.ToString(), MessageType.Warning);
}
else
{
if (GUILayout.Button(Styles.btnCheckWarning))
{
m_CheckWarning = true;
m_Chart.CheckWarning();
}
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d7f1cff1e5bae244a872040086b1cfa8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7861b681552cf4bc9b2c2f16d25c628c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,95 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationInfo), true)]
public class AnimationInfoDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Delay");
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Speed");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationChange), true)]
public class AnimationChangeDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Speed");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationAddition), true)]
public class AnimationAdditionDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Speed");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(XCharts.Runtime.AnimationInteraction), true)]
public class AnimationInteractionDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Duration");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Radius");
PropertyField(prop, "m_Offset");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AnimationStyle), true)]
public class AnimationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Animation"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_UnscaledTime");
PropertyField(prop, "m_FadeIn");
PropertyField(prop, "m_FadeOut");
PropertyField(prop, "m_Change");
PropertyField(prop, "m_Addition");
PropertyField(prop, "m_Interaction");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 844042f92a581474ba0491427f3fd592
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(AreaStyle), true)]
public class AreaStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AreaStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Origin");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_ToTop");
PropertyField(prop, "m_InnerFill");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c51fd822c8be44490832d81652d1aef5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Background), true)]
public class BackgroundDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Background"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_ImageColor");
PropertyField(prop, "m_ImageWidth");
PropertyField(prop, "m_ImageHeight");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_BorderStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88c83fad35bc544cab4106096d171189
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,219 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace XCharts.Editor
{
public delegate void DelegateMenuAction(Vector2 postion);
public class BasePropertyDrawer : PropertyDrawer
{
protected int m_Index;
protected int m_DataSize;
protected float m_DefaultWidth;
protected string m_DisplayName;
protected string m_KeyName;
protected Rect m_DrawRect;
protected Dictionary<string, float> m_Heights = new Dictionary<string, float>();
protected Dictionary<string, bool> m_PropToggles = new Dictionary<string, bool>();
protected Dictionary<string, bool> m_DataToggles = new Dictionary<string, bool>();
public virtual string ClassName { get { return ""; } }
public virtual List<string> IngorePropertys { get { return new List<string> { }; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
m_DrawRect = pos;
m_DrawRect.height = EditorGUIUtility.singleLineHeight;
m_DefaultWidth = pos.width;
var list = prop.displayName.Split(' ');
if (list.Length > 0)
{
if (!int.TryParse(list[list.Length - 1], out m_Index))
{
m_Index = 0;
m_DisplayName = prop.displayName;
m_KeyName = prop.propertyPath + "_" + m_Index;
}
else
{
m_DisplayName = ClassName + " " + m_Index;
m_KeyName = prop.propertyPath + "_" + m_Index;
}
}
else
{
m_DisplayName = prop.displayName;
}
if (!m_PropToggles.ContainsKey(m_KeyName))
{
m_PropToggles.Add(m_KeyName, false);
}
if (!m_DataToggles.ContainsKey(m_KeyName))
{
m_DataToggles.Add(m_KeyName, false);
}
if (!m_Heights.ContainsKey(m_KeyName))
{
m_Heights.Add(m_KeyName, 0);
}
else
{
m_Heights[m_KeyName] = 0;
}
}
private string GetKeyName(SerializedProperty prop)
{
var index = 0;
var list = prop.displayName.Split(' ');
if (list.Length > 0)
{
int.TryParse(list[list.Length - 1], out index);
}
return prop.propertyPath + "_" + index;
}
protected void AddHelpBox(string message, MessageType type = MessageType.Warning, int line = 2)
{
var offset = EditorGUI.indentLevel * ChartEditorHelper.INDENT_WIDTH;
EditorGUI.HelpBox(new Rect(m_DrawRect.x + offset, m_DrawRect.y, m_DrawRect.width - offset, EditorGUIUtility.singleLineHeight * line), message, type);
for (int i = 0; i < line; i++)
AddSingleLineHeight();
}
protected void AddSingleLineHeight()
{
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
m_DrawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected void AddHeight(float height)
{
m_Heights[m_KeyName] += height;
m_DrawRect.y += height;
}
protected void PropertyListField(SerializedProperty prop, string relativePropName, bool showOrder = true)
{
if (IngorePropertys.Contains(relativePropName)) return;
var height = m_Heights[m_KeyName];
var toggleKeyName = m_KeyName + relativePropName;
m_DataToggles[toggleKeyName] = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
prop.FindPropertyRelative(relativePropName),
m_DataToggles.ContainsKey(toggleKeyName) && m_DataToggles[toggleKeyName], showOrder, true);
m_Heights[m_KeyName] = height;
}
protected void PropertyField(SerializedProperty prop, string relativePropName)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyField(ref m_DrawRect, m_Heights, m_KeyName, prop, relativePropName))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMin(SerializedProperty prop, string relativePropName, float minValue)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFieldWithMinValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
relativePropName, minValue))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyFieldLimitMax(SerializedProperty prop, string relativePropName, float maxValue)
{
if (IngorePropertys.Contains(relativePropName)) return;
if (!ChartEditorHelper.PropertyFieldWithMaxValue(ref m_DrawRect, m_Heights, m_KeyName, prop,
relativePropName, maxValue))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativePropName);
}
}
protected void PropertyField(SerializedProperty prop, SerializedProperty relativeProp)
{
if (!ChartEditorHelper.PropertyField(ref m_DrawRect, m_Heights, m_KeyName, relativeProp))
{
Debug.LogError("PropertyField ERROR:" + prop.displayName + ", " + relativeProp);
}
}
protected void PropertyTwoFiled(SerializedProperty prop, string relativeListProp, string labelName = null)
{
PropertyTwoFiled(prop, prop.FindPropertyRelative(relativeListProp), labelName);
}
protected void PropertyTwoFiled(SerializedProperty prop, SerializedProperty relativeListProp,
string labelName = null)
{
if (string.IsNullOrEmpty(labelName))
{
labelName = relativeListProp.displayName;
}
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DefaultWidth, relativeListProp, labelName);
m_Heights[m_KeyName] += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected bool MakeFoldout(SerializedProperty prop, string relativePropName)
{
if (string.IsNullOrEmpty(relativePropName))
{
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, null);
}
else
{
var relativeProp = prop.FindPropertyRelative(relativePropName);
return ChartEditorHelper.MakeFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, relativeProp);
}
}
protected bool MakeComponentFoldout(SerializedProperty prop, string relativePropName, bool relativePropEnable,
params HeaderMenuInfo[] menus)
{
if (string.IsNullOrEmpty(relativePropName))
{
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, null, null, relativePropEnable, menus);
}
else
{
var relativeProp = prop.FindPropertyRelative(relativePropName);
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, relativeProp, null, relativePropEnable, menus);
}
}
protected bool MakeComponentFoldout(SerializedProperty prop, string relativePropName, string relativePropName2,
bool relativePropEnable, params HeaderMenuInfo[] menus)
{
if (string.IsNullOrEmpty(relativePropName))
{
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, null, null, relativePropEnable, menus);
}
else
{
var relativeProp = prop.FindPropertyRelative(relativePropName);
var relativeProp2 = prop.FindPropertyRelative(relativePropName2);
return ChartEditorHelper.MakeComponentFoldout(ref m_DrawRect, m_Heights, m_PropToggles, m_KeyName,
m_DisplayName, relativeProp, relativeProp2, relativePropEnable, menus);
}
}
protected virtual void DrawExtendeds(SerializedProperty prop) { }
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
var key = GetKeyName(prop);
if (m_Heights.ContainsKey(key)) return m_Heights[key] + GetExtendedHeight();
else return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
protected virtual float GetExtendedHeight()
{
return 0;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e5a04ce1f0a841b9b966a6d74de00e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(BorderStyle), true)]
public class BorderStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Border"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_RoundedCorner");
PropertyListField(prop, "m_CornerRadius", true);
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 47a460215ec5e4ec0bc7f8122a44302a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,26 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(CommentItem), true)]
public class CommentItemDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "CommentItem"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", "m_Content", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Content");
PropertyField(prop, "m_Location");
//PropertyField(prop, "m_MarkRect");
//PropertyField(prop, "m_MarkStyle");
PropertyField(prop, "m_LabelStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d485d6a729a1449cdb5032f380fba70f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(CommentMarkStyle), true)]
public class CommentMarkStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "MarkStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_LineStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d74ed458b24774b129611ed816b6b6cd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,160 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ComponentTheme), true)]
public class ComponentThemeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return ""; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFont");
#else
PropertyField(prop, "m_Font");
#endif
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_TextColor");
DrawExtendeds(prop);
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(BaseAxisTheme), true)]
public class BaseAxisThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "Axis"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineLength");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_SplitLineType");
PropertyField(prop, "m_SplitLineWidth");
PropertyField(prop, "m_SplitLineLength");
PropertyField(prop, "m_SplitLineColor");
PropertyField(prop, "m_TickWidth");
PropertyField(prop, "m_TickLength");
PropertyField(prop, "m_TickColor");
PropertyField(prop, "m_SplitAreaColors");
}
}
[CustomPropertyDrawer(typeof(AxisTheme), true)]
public class AxisThemeDrawer : BaseAxisThemeDrawer
{
public override string ClassName { get { return "Axis"; } }
}
[CustomPropertyDrawer(typeof(RadiusAxisTheme), true)]
public class RadiusAxisThemeDrawer : BaseAxisThemeDrawer
{
public override string ClassName { get { return "Radius Axis"; } }
public override List<string> IngorePropertys
{
get
{
return new List<string>
{
"m_TextBackgroundColor",
"m_LineLength",
"m_SplitLineLength",
};
}
}
}
[CustomPropertyDrawer(typeof(DataZoomTheme), true)]
public class DataZoomThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "DataZoom"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_DataLineWidth");
PropertyField(prop, "m_DataLineColor");
PropertyField(prop, "m_FillerColor");
PropertyField(prop, "m_DataAreaColor");
}
}
[CustomPropertyDrawer(typeof(LegendTheme), true)]
public class LegendThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "Legend"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_UnableColor");
}
}
[CustomPropertyDrawer(typeof(TooltipTheme), true)]
public class TooltipThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "Tooltip"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_AreaColor");
PropertyField(prop, "m_LabelTextColor");
PropertyField(prop, "m_LabelBackgroundColor");
}
}
[CustomPropertyDrawer(typeof(VisualMapTheme), true)]
public class VisualMapThemeDrawer : ComponentThemeDrawer
{
public override string ClassName { get { return "VisualMap"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
// PropertyField(prop, "m_BorderWidth");
// PropertyField(prop, "m_BorderColor");
// PropertyField(prop, "m_BackgroundColor");
}
}
[CustomPropertyDrawer(typeof(SerieTheme), true)]
public class SerieThemeDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Serie"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineSymbolSize");
PropertyField(prop, "m_ScatterSymbolSize");
PropertyField(prop, "m_CandlestickColor");
PropertyField(prop, "m_CandlestickColor0");
PropertyField(prop, "m_CandlestickBorderColor");
PropertyField(prop, "m_CandlestickBorderColor0");
PropertyField(prop, "m_CandlestickBorderWidth");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c7937a2a7addd42299e960c5cfb75e34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(DebugInfo), true)]
public class DebugInfoDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Debug"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", false))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_FoldSeries");
PropertyField(prop, "m_ShowDebugInfo");
PropertyField(prop, "m_ShowAllChartObject");
PropertyField(prop, "m_LabelStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99bd61acea264400fb4747b17a2731e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(IconStyle), true)]
public class IconStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "IconStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Layer");
PropertyField(prop, "m_Align");
PropertyField(prop, "m_Sprite");
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_AutoHideWhenLabelEmpty");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9cae26ad61d224d8a97d41bdc52ec0b7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ImageStyle), true)]
public class ImageStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ImageStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Sprite");
PropertyField(prop, "m_Type");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4649856b17dfd4f628eb975040fb791c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,40 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ItemStyle), true)]
public class ItemStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ItemStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", false))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Color0");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_ToColor2");
PropertyField(prop, "m_MarkColor");
PropertyField(prop, "m_BackgroundColor");
PropertyField(prop, "m_BackgroundWidth");
PropertyField(prop, "m_CenterColor");
PropertyField(prop, "m_CenterGap");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_BorderGap");
PropertyField(prop, "m_BorderColor");
PropertyField(prop, "m_BorderColor0");
PropertyField(prop, "m_BorderToColor");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_ItemMarker");
PropertyField(prop, "m_ItemFormatter");
PropertyField(prop, "m_NumericFormatter");
PropertyListField(prop, "m_CornerRadius", true);
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f40830a3b05574467ad0d8873c6c8790
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LabelLine), true)]
public class LabelLineDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LabelLine"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_LineType");
PropertyField(prop, "m_LineColor");
PropertyField(prop, "m_LineAngle");
PropertyField(prop, "m_LineWidth");
PropertyField(prop, "m_LineGap");
PropertyField(prop, "m_LineLength1");
PropertyField(prop, "m_LineLength2");
PropertyField(prop, "m_LineEndX");
PropertyField(prop, "m_StartSymbol");
PropertyField(prop, "m_EndSymbol");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 29a267a45c6e64454a982032947046c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,41 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LabelStyle), true)]
public class LabelStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Label"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_AutoOffset");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoRotate");
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Icon");
PropertyField(prop, "m_Background");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_TextPadding");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(EndLabelStyle), true)]
public class EndLabelStyleDrawer : LabelStyleDrawer
{
public override string ClassName { get { return "End Label"; } }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: abd47f4015a9840b9acae8efb21db7c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LevelStyle), true)]
public class LevelStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LevelStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyListField(prop, "m_Levels");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(Level), true)]
public class LevelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Level"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Depth", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Depth");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_UpperLabel");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_ItemStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a1ff119a53a44e5abe2ef6f57816aa6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,43 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ArrowStyle), true)]
public class ArrowDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Arrow"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Dent");
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(LineArrow), true)]
public class LineArrowStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LineArrow"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Position");
PropertyField(prop, "m_Arrow");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 817d27d232da94f6c9dab9e3d0c22631
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,93 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(BaseLine), true)]
public class BaseLineDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Line"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
DrawExtendeds(prop);
PropertyField(prop, "m_LineStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisLine), true)]
public class AxisLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "AxisLine"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_ShowArrow");
PropertyField(prop, "m_Arrow");
}
}
[CustomPropertyDrawer(typeof(AxisSplitLine), true)]
public class AxisSplitLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "SplitLine"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_ShowStartLine");
PropertyField(prop, "m_ShowEndLine");
PropertyField(prop, "m_ShowZLine");
}
}
[CustomPropertyDrawer(typeof(AxisMinorSplitLine), true)]
public class AxisMinorSplitLineDrawer : BaseLineDrawer
{
public override string ClassName { get { return "MinorSplitLine"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
//PropertyField(prop, "m_Distance");
//PropertyField(prop, "m_AutoColor");
}
}
[CustomPropertyDrawer(typeof(AxisTick), true)]
public class AxisTickDrawer : BaseLineDrawer
{
public override string ClassName { get { return "AxisTick"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_AlignWithLabel");
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_ShowStartTick");
PropertyField(prop, "m_ShowEndTick");
PropertyField(prop, "m_SplitNumber");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_AutoColor");
}
}
[CustomPropertyDrawer(typeof(AxisMinorTick), true)]
public class AxisMinorTickDrawer : BaseLineDrawer
{
public override string ClassName { get { return "MinorTick"; } }
protected override void DrawExtendeds(SerializedProperty prop)
{
base.DrawExtendeds(prop);
PropertyField(prop, "m_SplitNumber");
//PropertyField(prop, "m_AutoColor");
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e69f60c7d200439abcf3407c15f8c4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(LineStyle), true)]
public class LineStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "LineStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Type");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_ToColor");
PropertyField(prop, "m_ToColor2");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Length");
PropertyField(prop, "m_Opacity");
PropertyField(prop, "m_DashLength");
PropertyField(prop, "m_DotLength");
PropertyField(prop, "m_GapLength");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4a36d5076e1414d619b53d1ef998806f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Location), true)]
public class LocationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Location"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Align", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_Left");
PropertyField(prop, "m_Right");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 34092595791508d4b94b074a8788c388
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(MLValue), true)]
public class MLValueDrawer : BasePropertyDrawer
{
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
Rect drawRect = pos;
drawRect.height = EditorGUIUtility.singleLineHeight;
SerializedProperty m_Percent = prop.FindPropertyRelative("m_Type");
SerializedProperty m_Color = prop.FindPropertyRelative("m_Value");
ChartEditorHelper.MakeTwoField(ref drawRect, drawRect.width, m_Percent, m_Color, prop.displayName);
drawRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
}
public override float GetPropertyHeight(SerializedProperty prop, GUIContent label)
{
return 1 * EditorGUIUtility.singleLineHeight + 1 * EditorGUIUtility.standardVerticalSpacing;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 364b6129b88e14605b1a1454b7bf876b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(MarqueeStyle), true)]
public class MarqueeStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "MarqueeStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Apply");
PropertyField(prop, "m_RealRect");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_AreaStyle");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1a225478c2e14da3854aea28fb59882
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SerieSymbol), true)]
public class SerieSymbolDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
PropertyField(prop, "m_Type");
if (type == SymbolType.Custom)
{
AddHelpBox("Custom symbol only work in PictorialBar serie", MessageType.Warning);
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_Width");
// PropertyField(prop, "m_Height");
// PropertyField(prop, "m_Offset");
}
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_SizeType");
switch ((SymbolSizeType)prop.FindPropertyRelative("m_SizeType").enumValueIndex)
{
case SymbolSizeType.Custom:
PropertyField(prop, "m_Size");
break;
case SymbolSizeType.FromData:
PropertyField(prop, "m_DataIndex");
PropertyField(prop, "m_DataScale");
PropertyField(prop, "m_MinSize");
PropertyField(prop, "m_MaxSize");
break;
case SymbolSizeType.Function:
break;
}
PropertyField(prop, "m_StartIndex");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ForceShowLast");
PropertyField(prop, "m_Repeat");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a164822bc0fd4e5291f00c5a4ee86f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Settings), true)]
public class SettingsDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Settings"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", false, new HeaderMenuInfo("Reset", () =>
{
var chart = prop.serializedObject.targetObject as BaseChart;
chart.settings.Reset();
})))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_ReversePainter");
PropertyField(prop, "m_MaxPainter");
PropertyField(prop, "m_BasePainterMaterial");
PropertyField(prop, "m_SeriePainterMaterial");
PropertyField(prop, "m_UpperPainterMaterial");
PropertyField(prop, "m_TopPainterMaterial");
PropertyField(prop, "m_LineSmoothStyle");
PropertyField(prop, "m_LineSmoothness");
PropertyField(prop, "m_LineSegmentDistance");
PropertyField(prop, "m_CicleSmoothness");
PropertyField(prop, "m_AxisMaxSplitNumber");
PropertyField(prop, "m_LegendIconLineWidth");
PropertyListField(prop, "m_LegendIconCornerRadius", true);
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 70536a1ba3af245e7ad3b11e97682d8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,55 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(StateStyle), true)]
public class StateStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "StateStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
OnCustomGUI(prop);
PropertyField(prop, "m_Symbol");
PropertyField(prop, "m_ItemStyle");
PropertyField(prop, "m_Label");
PropertyField(prop, "m_LabelLine");
PropertyField(prop, "m_LineStyle");
PropertyField(prop, "m_AreaStyle");
--EditorGUI.indentLevel;
}
}
protected virtual void OnCustomGUI(SerializedProperty prop) { }
}
[CustomPropertyDrawer(typeof(EmphasisStyle), true)]
public class EmphasisStyleDrawer : StateStyleDrawer
{
public override string ClassName { get { return "EmphasisStyle"; } }
protected override void OnCustomGUI(SerializedProperty prop)
{
PropertyField(prop, "m_Scale");
PropertyField(prop, "m_Focus");
PropertyField(prop, "m_BlurScope");
}
}
[CustomPropertyDrawer(typeof(BlurStyle), true)]
public class BlurStyleDrawer : StateStyleDrawer
{
public override string ClassName { get { return "BlurStyle"; } }
}
[CustomPropertyDrawer(typeof(SelectStyle), true)]
public class SelectStyleDrawer : StateStyleDrawer
{
public override string ClassName { get { return "SelectStyle"; } }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3aad8ee99115742729ec5a963274fae0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(SymbolStyle), true)]
public class SymbolStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Symbol"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
var type = (SymbolType)prop.FindPropertyRelative("m_Type").enumValueIndex;
PropertyField(prop, "m_Type");
if (type == SymbolType.Custom)
{
AddHelpBox("Custom Symbol only work in PictorialBar serie", MessageType.Warning);
PropertyField(prop, "m_Image");
PropertyField(prop, "m_ImageType");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
}
PropertyField(prop, "m_Color");
PropertyField(prop, "m_Size");
PropertyField(prop, "m_Size2");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_BorderWidth");
PropertyField(prop, "m_EmptyColor");
PropertyField(prop, "m_Offset");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 72d557cf0b7134953b457ab973364520
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TextLimit), true)]
public class TextLimitDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "TextLimit"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Enable", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_MaxWidth");
PropertyField(prop, "m_Gap");
PropertyField(prop, "m_Suffix");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 842d3986d1c1747d8b0668649e8b1a0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(Padding), true)]
public class PaddingDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Padding"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Top");
PropertyField(prop, "m_Right");
PropertyField(prop, "m_Bottom");
PropertyField(prop, "m_Left");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(TextPadding), true)]
public class TextPaddingDrawer : PaddingDrawer
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 46cc25f4c9fc846938a06cf3b8fc75bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,43 @@
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TextStyle), true)]
public class TextStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "TextStyle"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFont");
#else
PropertyField(prop, "m_Font");
#endif
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_AutoColor");
PropertyField(prop, "m_Color");
PropertyField(prop, "m_FontSize");
PropertyField(prop, "m_LineSpacing");
PropertyField(prop, "m_Alignment");
PropertyField(prop, "m_AutoAlign");
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFontStyle");
PropertyField(prop, "m_TMPSpriteAsset");
#else
PropertyField(prop, "m_FontStyle");
PropertyField(prop, "m_AutoWrap");
#endif
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f14c425fb2bff44f2bf9ddb8d6ff1741
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,136 @@
using System.IO;
using UnityEditor;
using UnityEngine;
#if dUI_TextMeshPro
using TMPro;
#endif
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ThemeStyle), true)]
public class ThemeStyleDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Theme"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
var defaultWidth = pos.width;
var defaultX = pos.x;
var chart = prop.serializedObject.targetObject as BaseChart;
if (MakeComponentFoldout(prop, "m_Show", false, new HeaderMenuInfo("Reset|Reset to theme default color", () =>
{
chart.theme.sharedTheme.ResetTheme();
chart.RefreshAllComponent();
}), new HeaderMenuInfo("Export|Export theme to asset for a new theme", () =>
{
ExportThemeWindow.target = chart;
EditorWindow.GetWindow(typeof(ExportThemeWindow));
}), new HeaderMenuInfo("Sync color to custom|Sync shared theme color to custom color", () =>
{
chart.theme.SyncSharedThemeColorToCustom();
})))
{
++EditorGUI.indentLevel;
var chartNameList = XCThemeMgr.GetAllThemeNames();
var lastIndex = chartNameList.IndexOf(chart.theme.themeName);
var y = pos.y + EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
var selectedIndex = EditorGUI.Popup(new Rect(pos.x, y, pos.width, EditorGUIUtility.singleLineHeight),
"Shared Theme", lastIndex, chartNameList.ToArray());
AddSingleLineHeight();
if (lastIndex != selectedIndex)
{
XCThemeMgr.SwitchTheme(chart, chartNameList[selectedIndex]);
}
PropertyField(prop, "m_SharedTheme");
PropertyField(prop, "m_TransparentBackground");
PropertyField(prop, "m_EnableCustomTheme");
using(new EditorGUI.DisabledScope(!prop.FindPropertyRelative("m_EnableCustomTheme").boolValue))
{
PropertyField(prop, "m_CustomBackgroundColor");
PropertyField(prop, "m_CustomColorPalette");
}
--EditorGUI.indentLevel;
}
}
private void AddPropertyField(Rect pos, SerializedProperty prop, ref float y)
{
float height = EditorGUI.GetPropertyHeight(prop, new GUIContent(prop.displayName), true);
EditorGUI.PropertyField(new Rect(pos.x, y, pos.width, height), prop, true);
y += height + EditorGUIUtility.standardVerticalSpacing;
m_Heights[m_KeyName] += height + EditorGUIUtility.standardVerticalSpacing;
}
}
public class ExportThemeWindow : UnityEditor.EditorWindow
{
public static BaseChart target;
private static ExportThemeWindow window;
private string m_ChartName;
static void Init()
{
window = (ExportThemeWindow) EditorWindow.GetWindow(typeof(ExportThemeWindow), false, "Export Theme", true);
window.minSize = new Vector2(600, 50);
window.maxSize = new Vector2(600, 50);
window.Show();
}
void OnInspectorUpdate()
{
Repaint();
}
private void OnGUI()
{
if (target == null)
{
Close();
return;
}
GUILayout.Space(10);
GUILayout.Label("Input a new name for theme:");
m_ChartName = GUILayout.TextField(m_ChartName);
GUILayout.Space(10);
GUILayout.Label("Export path:");
if (string.IsNullOrEmpty(m_ChartName))
{
GUILayout.Label("Need input a new name.");
}
else
{
GUILayout.Label(XCThemeMgr.GetThemeAssetPath(m_ChartName));
}
GUILayout.Space(20);
if (GUILayout.Button("Export"))
{
if (string.IsNullOrEmpty(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:Need input a new name!"));
}
else if (XCThemeMgr.ContainsTheme(m_ChartName))
{
ShowNotification(new GUIContent("ERROR:The name you entered is already in use!"));
}
else if (IsAssetsExist(XCThemeMgr.GetThemeAssetPath(m_ChartName)))
{
ShowNotification(new GUIContent("ERROR:The asset is exist! \npath=" +
XCThemeMgr.GetThemeAssetPath(m_ChartName)));
}
else
{
XCThemeMgr.ExportTheme(target.theme.sharedTheme, m_ChartName);
ShowNotification(new GUIContent("SUCCESS:The theme is exported. \npath=" +
XCThemeMgr.GetThemeAssetPath(m_ChartName)));
}
}
}
private bool IsAssetsExist(string path)
{
return File.Exists(Application.dataPath + "/../" + path);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 704e7c2793bca4050821c6e0756c8316
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(TitleStyle), true)]
public class TitleStyleDrawer : LabelStyleDrawer
{
public override string ClassName { get { return "TitleStyle"; } }
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e451ee4c9f65a414784fd5fd9cad6ec1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[CustomPropertyDrawer(typeof(ViewControl), true)]
public class ViewControlDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "ViewControl"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Alpha");
PropertyField(prop, "m_Beta");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: faeb8611591ee4c038e88fdb5a67b5ae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f98ff753316eb48d58325ecd996f2a1f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,237 @@
using UnityEditor;
using UnityEngine;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(Axis))]
public class AxisEditor : MainComponentEditor<Axis>
{
public override void OnInspectorGUI()
{
var m_Type = baseProperty.FindPropertyRelative("m_Type");
var m_LogBase = baseProperty.FindPropertyRelative("m_LogBase");
var m_MinMaxType = baseProperty.FindPropertyRelative("m_MinMaxType");
var type = (Axis.AxisType)m_Type.enumValueIndex;
EditorGUI.indentLevel++;
if (component is ParallelAxis)
{
PropertyField("m_ParallelIndex");
}
else if (!(component is SingleAxis))
{
PropertyField("m_GridIndex");
PropertyField("m_PolarIndex");
}
PropertyField("m_Type");
PropertyField("m_Position");
PropertyField("m_Offset");
if (type == Axis.AxisType.Log)
{
PropertyField("m_LogBaseE");
EditorGUI.BeginChangeCheck();
PropertyField("m_LogBase");
if (m_LogBase.floatValue <= 0 || m_LogBase.floatValue == 1)
{
m_LogBase.floatValue = 10;
}
EditorGUI.EndChangeCheck();
}
if (type == Axis.AxisType.Value || type == Axis.AxisType.Time)
{
PropertyField("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("m_Min");
PropertyField("m_Max");
EditorGUI.indentLevel--;
break;
}
PropertyField("m_CeilRate");
if (type == Axis.AxisType.Value)
{
PropertyField("m_Inverse");
}
}
PropertyField("m_SplitNumber");
if (type == Axis.AxisType.Category)
{
PropertyField("m_MaxCache");
PropertyField("m_MinCategorySpacing");
PropertyField("m_BoundaryGap");
}
else
{
PropertyField("m_Interval");
}
DrawExtendeds();
if (type != Axis.AxisType.Category)
{
PropertyField("m_Animation");
}
PropertyField("m_AxisLine");
PropertyField("m_AxisName");
PropertyField("m_AxisTick");
PropertyField("m_AxisLabel");
PropertyField("m_SplitLine");
PropertyField("m_SplitArea");
PropertyField("m_IndicatorLabel");
if (type != Axis.AxisType.Category)
{
PropertyField("m_MinorTick");
PropertyField("m_MinorSplitLine");
}
PropertyListField("m_Icons", true);
if (type == Axis.AxisType.Category)
{
PropertyListField("m_Data", true, new HeaderMenuInfo("Import ECharts Axis Data", () =>
{
PraseExternalDataEditor.UpdateData(chart, null, component as Axis, false);
PraseExternalDataEditor.ShowWindow();
}));
}
EditorGUI.indentLevel--;
}
}
[ComponentEditor(typeof(XAxis))]
public class XAxisEditor : AxisEditor { }
[ComponentEditor(typeof(YAxis))]
public class YAxisEditor : AxisEditor { }
[ComponentEditor(typeof(XAxis3D))]
public class XAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(YAxis3D))]
public class YAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(ZAxis3D))]
public class ZAxis3DEditor : AxisEditor { }
[ComponentEditor(typeof(SingleAxis))]
public class SingleAxisEditor : AxisEditor
{
protected override void DrawExtendeds()
{
base.DrawExtendeds();
PropertyField("m_Orient");
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_Width");
PropertyField("m_Height");
}
}
[ComponentEditor(typeof(AngleAxis))]
public class AngleAxisEditor : AxisEditor
{
protected override void DrawExtendeds()
{
base.DrawExtendeds();
PropertyField("m_StartAngle");
PropertyField("m_Clockwise");
}
}
[ComponentEditor(typeof(RadiusAxis))]
public class RadiusAxisEditor : AxisEditor { }
[ComponentEditor(typeof(ParallelAxis))]
public class ParallelAxisEditor : AxisEditor { }
[CustomPropertyDrawer(typeof(AxisLabel), true)]
public class AxisLabelDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AxisLabel"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Inside");
PropertyField(prop, "m_Interval");
PropertyField(prop, "m_ShowAsPositiveNumber");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_ShowStartLabel");
PropertyField(prop, "m_ShowEndLabel");
PropertyField(prop, "m_Rotate");
PropertyField(prop, "m_Offset");
PropertyField(prop, "m_Distance");
PropertyField(prop, "m_Formatter");
PropertyField(prop, "m_NumericFormatter");
PropertyField(prop, "m_Width");
PropertyField(prop, "m_Height");
PropertyField(prop, "m_Icon");
PropertyField(prop, "m_Background");
PropertyField(prop, "m_TextStyle");
PropertyField(prop, "m_TextPadding");
PropertyField(prop, "m_TextLimit");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisName), true)]
public class AxisNameDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "AxisName"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Name");
PropertyField(prop, "m_OnZero");
PropertyField(prop, "m_LabelStyle");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisSplitArea), true)]
public class AxisSplitAreaDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "SplitArea"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_Color");
--EditorGUI.indentLevel;
}
}
}
[CustomPropertyDrawer(typeof(AxisAnimation), true)]
public class AxisAnimationDrawer : BasePropertyDrawer
{
public override string ClassName { get { return "Animation"; } }
public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label)
{
base.OnGUI(pos, prop, label);
if (MakeComponentFoldout(prop, "m_Show", true))
{
++EditorGUI.indentLevel;
PropertyField(prop, "m_UnscaledTime");
PropertyField(prop, "m_Duration");
--EditorGUI.indentLevel;
}
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2e6d7780afa9b49aa9081bf55d301955
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,21 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(Background))]
internal sealed class BackgroundEditor : MainComponentEditor<Background>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Image");
PropertyField("m_ImageType");
PropertyField("m_ImageColor");
PropertyField("m_AutoColor");
PropertyField("m_BorderStyle");
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 89d95a9a994ad4b4692832e9a548e9e4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,112 @@
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using XCharts.Runtime;
namespace XCharts.Editor
{
public class BaseGraphEditor : UnityEditor.Editor
{
class Styles
{
public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", "");
public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", "");
public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", "");
public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", "");
public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", "");
}
public BaseGraph m_BaseGraph;
public static T AddUIComponent<T>(string chartName) where T : BaseGraph
{
return XChartsEditor.AddGraph<T>(chartName);
}
protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>();
protected virtual void OnEnable()
{
m_Properties.Clear();
m_BaseGraph = (BaseGraph)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
PropertyField("m_Script");
OnStartInspectorGUI();
OnDebugInspectorGUI();
serializedObject.ApplyModifiedProperties();
}
protected virtual void OnStartInspectorGUI() { }
protected virtual void OnDebugInspectorGUI()
{
EditorGUILayout.Space();
OnDebugStartInspectorGUI();
OnDebugEndInspectorGUI();
}
protected virtual void OnDebugStartInspectorGUI() { }
protected virtual void OnDebugEndInspectorGUI() { }
protected void PropertyField(string name)
{
if (!m_Properties.ContainsKey(name))
{
var prop = serializedObject.FindProperty(name);
if (prop == null)
{
Debug.LogError("Property " + name + " not found!");
return;
}
m_Properties.Add(name, prop);
}
EditorGUILayout.PropertyField(m_Properties[name]);
}
protected void PropertyField(SerializedProperty property)
{
Assert.IsNotNull(property);
var title = ChartEditorHelper.GetContent(property.displayName);
PropertyField(property, title);
}
protected void PropertyField(SerializedProperty property, GUIContent title)
{
EditorGUILayout.PropertyField(property, title);
}
protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus)
{
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
var height = 0f;
var prop = FindProperty(relativePropName);
prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height,
prop, prop.isExpanded, showOrder, true, menus);
if (prop.isExpanded)
{
GUILayoutUtility.GetRect(1f, height - 17);
}
}
protected void PropertyTwoFiled(string relativePropName)
{
var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f);
var prop = FindProperty(relativePropName);
ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName);
}
protected SerializedProperty FindProperty(string path)
{
if (!m_Properties.ContainsKey(path))
{
m_Properties.Add(path, serializedObject.FindProperty(path));
}
return m_Properties[path];
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 88786092000154d359c1aa954ce664f0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,18 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(Comment))]
public class CommentEditor : MainComponentEditor<Comment>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_LabelStyle");
//PropertyField("m_MarkStyle");
PropertyListField("m_Items", true);
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2364066bf3174aa39b79020266ce72d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,65 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(DataZoom))]
public class DataZoomEditor : MainComponentEditor<DataZoom>
{
public override void OnInspectorGUI()
{
var m_SupportInside = baseProperty.FindPropertyRelative("m_SupportInside");
var m_SupportSlider = baseProperty.FindPropertyRelative("m_SupportSlider");
var m_SupportMarquee = baseProperty.FindPropertyRelative("m_SupportMarquee");
var m_Start = baseProperty.FindPropertyRelative("m_Start");
var m_End = baseProperty.FindPropertyRelative("m_End");
var m_MinShowNum = baseProperty.FindPropertyRelative("m_MinShowNum");
++EditorGUI.indentLevel;
PropertyField("m_Orient");
PropertyField("m_SupportInside");
if (m_SupportInside.boolValue)
{
PropertyField("m_SupportInsideScroll");
PropertyField("m_SupportInsideDrag");
}
PropertyField(m_SupportSlider);
PropertyField(m_SupportMarquee);
PropertyField("m_ZoomLock");
PropertyField("m_ScrollSensitivity");
PropertyField("m_RangeMode");
PropertyField(m_Start);
PropertyField(m_End);
PropertyField("m_StartLock");
PropertyField("m_EndLock");
PropertyField(m_MinShowNum);
if (m_Start.floatValue < 0) m_Start.floatValue = 0;
if (m_End.floatValue > 100) m_End.floatValue = 100;
if (m_MinShowNum.intValue < 0) m_MinShowNum.intValue = 0;
if (m_SupportSlider.boolValue)
{
PropertyField("m_ShowDataShadow");
PropertyField("m_ShowDetail");
PropertyField("m_BackgroundColor");
PropertyField("m_BorderWidth");
PropertyField("m_BorderColor");
PropertyField("m_FillerColor");
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_LineStyle");
PropertyField("m_AreaStyle");
PropertyField("m_LabelStyle");
PropertyListField("m_XAxisIndexs", true);
PropertyListField("m_YAxisIndexs", true);
}
else
{
PropertyListField("m_XAxisIndexs", true);
PropertyListField("m_YAxisIndexs", true);
}
PropertyField("m_MarqueeStyle");
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 06bc176df52bf4953b8d46254523d2ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord3D))]
public class GridCoord3DEditor : MainComponentEditor<GridCoord3D>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Bottom");
PropertyField("m_BoxWidth");
PropertyField("m_BoxHeight");
PropertyField("m_BoxDepth");
PropertyField("m_XYExchanged");
PropertyField("m_ShowBorder");
PropertyField("m_ViewControl");
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c9a4a8a30b1124c4e996e234d5717a07
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridCoord))]
public class GridCoordEditor : MainComponentEditor<GridCoord>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
var layoutIndex = baseProperty.FindPropertyRelative("m_LayoutIndex").intValue;
PropertyField("m_LayoutIndex");
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_BackgroundColor");
PropertyField("m_ShowBorder");
PropertyField("m_BorderWidth");
PropertyField("m_BorderColor");
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb28a0ae5edd34b63ae9cbce0986585b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(GridLayout))]
public class GridLayoutEditor : MainComponentEditor<GridLayout>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_Left");
PropertyField("m_Right");
PropertyField("m_Top");
PropertyField("m_Bottom");
PropertyField("m_Row");
PropertyField("m_Column");
PropertyField("m_Spacing");
PropertyField("m_Inverse");
--EditorGUI.indentLevel;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4288bf299494d43d497436ace4b7a5a3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
using UnityEditor;
using XCharts.Runtime;
namespace XCharts.Editor
{
[ComponentEditor(typeof(Legend))]
public class LegendEditor : MainComponentEditor<Legend>
{
public override void OnInspectorGUI()
{
++EditorGUI.indentLevel;
PropertyField("m_IconType");
PropertyField("m_ItemWidth");
PropertyField("m_ItemHeight");
PropertyField("m_ItemGap");
PropertyField("m_ItemAutoColor");
PropertyField("m_ItemOpacity");
PropertyField("m_SelectedMode");
PropertyField("m_Orient");
PropertyField("m_Location");
PropertyField("m_LabelStyle");
PropertyField("m_TextLimit");
PropertyField("m_Background");
PropertyField("m_Padding");
PropertyListField("m_Icons");
PropertyListField("m_Colors");
PropertyListField("m_Positions");
PropertyListField("m_Data");
--EditorGUI.indentLevel;
}
}
}

Some files were not shown because too many files have changed in this diff Show More