Example_Test.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using UnityEngine;
  2. #if INPUT_SYSTEM_ENABLED
  3. using Input = XCharts.Runtime.InputHelper;
  4. #endif
  5. using XCharts.Runtime;
  6. namespace XCharts.Example
  7. {
  8. [DisallowMultipleComponent]
  9. [ExecuteInEditMode]
  10. public class Example_Test : MonoBehaviour
  11. {
  12. BaseChart chart;
  13. void Awake()
  14. {
  15. chart = gameObject.GetComponent<BaseChart>();
  16. }
  17. void Update()
  18. {
  19. if (Input.GetKeyDown(KeyCode.Space))
  20. {
  21. AddData();
  22. }
  23. else if (Input.GetKeyDown(KeyCode.R))
  24. {
  25. chart.AnimationReset();
  26. chart.AnimationFadeIn();
  27. }
  28. else if (Input.GetKeyDown(KeyCode.U))
  29. {
  30. chart.UpdateData(0, 2, 99);
  31. }
  32. else if (Input.GetKeyDown(KeyCode.C))
  33. {
  34. chart.UpdateData(0, 2, 22);
  35. }
  36. }
  37. void AddData()
  38. {
  39. chart.AnimationReset();
  40. chart.AnimationFadeOut();
  41. }
  42. }
  43. }