TimeTexter.cs 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // $Id: TimeTexter.cs 207 2015-04-21 12:56:50Z dirk $
  3. //
  4. // Virtence VFont package
  5. // Copyright 2014 .. 2015 by Virtence GmbH
  6. // http://www.virtence.com
  7. //
  8. //
  9. //
  10. using UnityEngine;
  11. using System.Collections;
  12. namespace Virtence.VText.Demo {
  13. /// <summary>
  14. /// handle the vtext objects which shows the current time.
  15. /// </summary>
  16. public class TimeTexter : MonoBehaviour {
  17. private VTextInterface vti;
  18. private string timeString = "";
  19. // Use this for initialization
  20. void Start () {
  21. vti = GetComponent<VTextInterface>();
  22. }
  23. // Update is called once per frame
  24. void LateUpdate () {
  25. Loom.QueueOnMainThread(() => {
  26. if (null != vti)
  27. {
  28. string tString = System.DateTime.Now.ToLongTimeString();
  29. if (tString != timeString)
  30. {
  31. timeString = tString;
  32. vti.RenderText = timeString;
  33. }
  34. }
  35. });
  36. }
  37. }
  38. }