mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-24 01:40:06 +00:00
整理代码结构,支持Package Manager添加
This commit is contained in:
46
Demo/Runtime/Demo_PieChart.cs
Normal file
46
Demo/Runtime/Demo_PieChart.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
[RequireComponent(typeof(PieChart))]
|
||||
public class Demo_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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user