优化内置的示例代码,Demo改名为Example

This commit is contained in:
monitor1394
2020-05-15 06:52:40 +08:00
parent 0b8c7a1b2c
commit e371e079f2
50 changed files with 175 additions and 174 deletions

View File

@@ -0,0 +1,46 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
[RequireComponent(typeof(PieChart))]
public class Example_PieChart : MonoBehaviour
{
private PieChart chart;
private float time;
private int count = 0;
private void Awake()
{
chart = transform.GetComponent<PieChart>();
chart.ClearData();
}
private void Update()
{
time += Time.deltaTime;
if (time > 1)
{
time = 0;
if (count < 5)
{
chart.AddData(0, Random.Range(10, 100), "time" + count);
}
else
{
int index = count % 5;
chart.UpdateData(0, Random.Range(10, 100), index);
}
count++;
}
}
}
}