mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 17:00:08 +00:00
XCharts 2.0
This commit is contained in:
56
Editor/Window/AddSerieEditor.cs
Normal file
56
Editor/Window/AddSerieEditor.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
/************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/************************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class AddSerieEditor : EditorWindow
|
||||
{
|
||||
public static BaseChart chart;
|
||||
private static AddSerieEditor window;
|
||||
private SerieType serieType;
|
||||
private string serieName;
|
||||
|
||||
public static void ShowWindow()
|
||||
{
|
||||
window = GetWindow<AddSerieEditor>();
|
||||
window.titleContent = new GUIContent("Add Serie");
|
||||
window.minSize = new Vector2(350, window.minSize.y);
|
||||
window.Focus();
|
||||
window.Show();
|
||||
}
|
||||
|
||||
void OnInspectorUpdate()
|
||||
{
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (chart == null)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
var iconRect = new Rect(5, 10, position.width - 10, EditorGUIUtility.singleLineHeight);
|
||||
serieType = (SerieType)EditorGUI.EnumPopup(iconRect, "Serie Type", serieType);
|
||||
iconRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
serieName = "serie" + (chart.series.Count + 1);
|
||||
serieName = EditorGUI.TextField(iconRect, "Serie Name", serieName);
|
||||
iconRect.y += EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing;
|
||||
GUILayout.Space(iconRect.y + 5);
|
||||
if (GUILayout.Button("Add"))
|
||||
{
|
||||
SerieTemplate.AddDefaultSerie(chart, serieType, serieName);
|
||||
chart.RefreshAllComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user