summaryrefslogtreecommitdiff
path: root/Assets/Test/08_Button/UI08TestButton.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Test/08_Button/UI08TestButton.cs')
-rw-r--r--Assets/Test/08_Button/UI08TestButton.cs114
1 files changed, 114 insertions, 0 deletions
diff --git a/Assets/Test/08_Button/UI08TestButton.cs b/Assets/Test/08_Button/UI08TestButton.cs
new file mode 100644
index 0000000..9e86710
--- /dev/null
+++ b/Assets/Test/08_Button/UI08TestButton.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using MEC;
+
+class WaitForSeconds : IEnumerator
+{
+ float m_Duration;
+ float m_Current;
+
+ public WaitForSeconds(float second)
+ {
+ m_Duration = second;
+ m_Current = 0;
+ }
+
+ public object Current
+ {
+ get
+ {
+ return null;
+ }
+ }
+
+ public bool MoveNext()
+ {
+ m_Current += Time.deltaTime;
+ return m_Current < m_Duration;
+ }
+
+ public void Reset()
+ {
+ //Debug.Log("Reset");
+ m_Current = 0;
+ }
+}
+
+public class UI08TestButton : MonoBehaviour {
+
+ IEnumerator m_Itor;
+
+ // Use this for initialization
+ void Start () {
+ Consumer();
+ m_Itor = Speak();
+ m_Itor.MoveNext();
+ List<int> a = new List<int> { 1,2,3};
+ IEnumerator ia = a.GetEnumerator();
+ Debug.Log("132");
+ //Timing.RunCoroutine();
+ //StartCoroutine(Speak2());
+ }
+
+ // Update is called once per frame
+ void Update ()
+ {
+ IEnumerator wait = m_Itor.Current as IEnumerator;
+ //if (wait != null)
+ //{
+ // if (!wait.MoveNext())
+ // {
+ m_Itor.MoveNext();
+ // }
+ //}
+ }
+
+ public void Onclickbutton()
+ {
+ Debug.Log("Onclickbutton");
+ }
+
+ public IEnumerator Speak()
+ {
+ Debug.Log("Speak 1");
+ yield return new UnityEngine.WaitForSeconds(3);
+ int a = 10;
+ int b = 30;
+ int c = 40;
+ Debug.Log("Speak 2" + a + b + c);
+ yield return new UnityEngine.WaitForSeconds(3);
+ Debug.Log("Speak 3");
+ yield return new UnityEngine.WaitForSeconds(3);
+ }
+
+ public IEnumerator Speak2()
+ {
+ Debug.Log("Speak 1");
+ yield return new WaitForSeconds(3);
+ Debug.Log("Speak 2");
+ yield return new WaitForSeconds(3);
+ Debug.Log("Speak 3");
+ yield return new WaitForSeconds(3);
+ }
+
+ public void Consumer()
+ {
+ foreach (int i in Integers())
+ {
+ Debug.Log(i.ToString());
+ }
+ }
+
+ public IEnumerable<int> Integers()
+ {
+ yield return 1;
+ yield return 2;
+ yield return 4;
+ yield return 8;
+ yield return 16;
+ yield return 16777216;
+ }
+
+}