mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 01:40:06 +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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Window/AddSerieEditor.cs.meta
Normal file
11
Editor/Window/AddSerieEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 450c3b4decd234f1894f1a8fd1161af8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
108
Editor/Window/CheckVersionEditor.cs
Normal file
108
Editor/Window/CheckVersionEditor.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
/************************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 - 2021 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/************************************************/
|
||||
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class CheckVersionEditor : EditorWindow
|
||||
{
|
||||
private Vector2 scrollPos;
|
||||
private static CheckVersionEditor window;
|
||||
|
||||
[MenuItem("XCharts/Upgrade Check")]
|
||||
public static void ShowWindow()
|
||||
{
|
||||
window = GetWindow<CheckVersionEditor>();
|
||||
window.titleContent = new GUIContent("XCharts Upgrade Check");
|
||||
window.minSize = new Vector2(550, window.minSize.y);
|
||||
window.Show();
|
||||
XChartsMgr.Instance.CheckVersion();
|
||||
}
|
||||
|
||||
void OnInspectorUpdate()
|
||||
{
|
||||
Repaint();
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
var mgr = XChartsMgr.Instance;
|
||||
GUILayout.Label("");
|
||||
GUILayout.Label("The current version: " + mgr.nowVersion);
|
||||
if (mgr.needUpdate && !mgr.isCheck)
|
||||
{
|
||||
GUILayout.Label("The latest version: " + mgr.newVersion);
|
||||
GUILayout.Label("");
|
||||
if (mgr.isCheck) GUILayout.Label("check ...");
|
||||
else if (mgr.isNetworkError) GUILayout.Label("check failed: " + mgr.networkError);
|
||||
else
|
||||
{
|
||||
GUILayout.Label("There is a new version to upgrade!");
|
||||
}
|
||||
|
||||
GUILayout.Label("");
|
||||
if (!string.IsNullOrEmpty(mgr.desc))
|
||||
{
|
||||
GUILayout.Label(mgr.desc);
|
||||
}
|
||||
if (GUILayout.Button("Github Homepage"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
|
||||
}
|
||||
if (GUILayout.Button("Star Support"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/stargazers");
|
||||
}
|
||||
if (GUILayout.Button("Issues"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/issues");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(mgr.changeLog))
|
||||
{
|
||||
scrollPos = GUILayout.BeginScrollView(scrollPos);
|
||||
GUILayout.TextArea(mgr.changeLog);
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mgr.isCheck) GUILayout.Label("The latest version: checking ...");
|
||||
else if (mgr.isNetworkError) GUILayout.Label("check failed: " + mgr.networkError);
|
||||
else GUILayout.Label("The latest version: " + mgr.newVersion);
|
||||
|
||||
GUILayout.Label("");
|
||||
if (!mgr.isNetworkError && !mgr.needUpdate && !mgr.isCheck)
|
||||
{
|
||||
GUILayout.Label("It is the latest version!");
|
||||
}
|
||||
GUILayout.Label("");
|
||||
if (!string.IsNullOrEmpty(mgr.desc))
|
||||
{
|
||||
GUILayout.Label(mgr.desc);
|
||||
}
|
||||
if (GUILayout.Button("Github Homepage"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts");
|
||||
}
|
||||
if (GUILayout.Button("Star Support"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/stargazers");
|
||||
}
|
||||
if (GUILayout.Button("Issues"))
|
||||
{
|
||||
Application.OpenURL("https://github.com/monitor1394/unity-ugui-XCharts/issues");
|
||||
}
|
||||
if (mgr.isNetworkError && GUILayout.Button("Check Again"))
|
||||
{
|
||||
XChartsMgr.Instance.CheckVersion();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Editor/Window/CheckVersionEditor.cs.meta
Normal file
11
Editor/Window/CheckVersionEditor.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2a04cd68c07645d9bb4234680c5200a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user