public void StartTest() { DebugPrint.p(" >>> TestBaseFunc <<< "); SubClass subClass = new SubClass(); subClass.Bar(); }
IEnumerator fun4() { DebugPrint.p(9); yield return(0); DebugPrint.p(12); }
public void StartTest() { DebugPrint.p(" >>> TestIEnumerator <<< "); DebugPrint.p(1); StartCoroutine("fun1"); DebugPrint.p(666); }
IEnumerator fun2() { DebugPrint.p(3); yield return(0); DebugPrint.p(4); }
IEnumerator fun3() { DebugPrint.p(6); yield return(0); DebugPrint.p(7); }
public void StartTest() { DebugPrint.p(" >>> TestDictionary <<< "); dic.Add("11", "22"); dic.Add("11", "33"); DebugPrint.p(dic["11"]); }
//本文原址:http://www.cnblogs.com/Interkey/p/3460566.html /// <summary> /// 获取所有FieldInfo的值 /// </summary> void GetTypeValue() { DebugPrint.p("Method: GetTypeValue"); FieldInfo[] fis = this.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance); foreach (FieldInfo fi in fis) { DebugPrint.p(fi.Name + " 的值为:" + fi.GetValue(this).ToString()); } }
public void DoTest() { if (script != null) { script.StartTest(); } else { DebugPrint.p(" !!! No Test Find !!! "); } }
IEnumerator fun1() { DebugPrint.p(2); yield return(fun2()); DebugPrint.p(5); yield return(StartCoroutine("fun3")); DebugPrint.p(8); StartCoroutine("fun4"); DebugPrint.p(10); fun5(); }
/// <summary> /// 设置字符串str对应的变量名的变量值 /// </summary> /// <param name="str"></param> void SetStrValue(string str) { DebugPrint.p("Method: SetStrValue"); //赋值前输出 DebugPrint.p(this.GetType().GetField(str, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this)); //进行赋值操作 this.GetType().GetField(str, BindingFlags.NonPublic | BindingFlags.Instance) .SetValue(this, "Hello Interkey~"); //赋值后输出 DebugPrint.p(this.GetType().GetField(str, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this)); }
/// <summary> /// 获取字符串str对应的变量名的变量值对应的变量值 /// </summary> /// <param name="str"></param> void GetStrValue(string str) { DebugPrint.p("Method: GetStrValue"); Type type = this.GetType(); //获取字符串str对应的变量名的变量值 DebugPrint.p(type.GetField(str, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this).ToString()); DebugPrint.p( type.GetField( type.GetField(str, BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this).ToString(), BindingFlags.NonPublic | BindingFlags.Instance).GetValue(this).ToString() ); }
public void StartTest() { DebugPrint.p(" >>> TestEnumCompare <<< "); var num1 = Foo.one; var num2 = Foo.one; var num3 = Foo.five; var num4 = Foo.three; DebugPrint.p(" == " + (num1 == num2)); DebugPrint.p(" > " + (num3 > num2)); DebugPrint.p(" < " + (num4 > num3)); DebugPrint.p(" compare == " + (num1.CompareTo(num2))); DebugPrint.p(" compare > " + (num3.CompareTo(num2))); DebugPrint.p(" compare < " + (num4.CompareTo(num3))); DebugPrint.p(" compareInt == " + (((int)num1).CompareTo((int)num2))); DebugPrint.p(" compareInt > " + (((int)num3).CompareTo((int)num2))); DebugPrint.p(" compareInt < " + (((int)num4).CompareTo((int)num3))); }
public void StartTest() { DebugPrint.p(" >>> TestDicTryGetValue <<< "); Dictionary <int, bool> a = new Dictionary <int, bool>(); a.Add(1, false); a.Add(2, false); a.Add(3, false); bool b = false; if (a.TryGetValue(2, out b)) { b = true; } DebugPrint.p(" >>> 2 <<< "); DebugPrint.p(a[2]); Dictionary <int, List <bool> > a2 = new Dictionary <int, List <bool> >(); a2.Add(1, new List <bool>() { false }); a2.Add(2, new List <bool>() { false }); a2.Add(3, new List <bool>() { false }); List <bool> b2 = null; if (a2.TryGetValue(2, out b2)) { b2[0] = true; } DebugPrint.p(a2[2][0]); }
void OnGUI() { Stopwatch sw = new Stopwatch(); if (GUILayout.Button("EmptyTest")) { sw.Start(); for (int i = 0; i < LoopTime; ++i) { EmptyTest(); } sw.Stop(); DebugPrint.p(" > EmptyTest < Time: " + sw.Elapsed.TotalSeconds); } if (GUILayout.Button("Test1")) { sw.Start(); for (int i = 0; i < LoopTime; ++i) { Test1(); } sw.Stop(); DebugPrint.p(" > Test1 < Time: " + sw.Elapsed.TotalSeconds); } if (GUILayout.Button("Test2")) { sw.Start(); for (int i = 0; i < LoopTime; ++i) { Test2(); } sw.Stop(); DebugPrint.p(" > Test2 < Time: " + sw.Elapsed.TotalSeconds); } if (GUILayout.Button("Quick Test")) { DebugPrint.p(">>>>>>>>>>> " + TestColor + ", " + Color.black + ", " + Color.clear + ", " + default(Color)); } }
public void StartTest() { DebugPrint.p(" >>> TestNewOutFor <<< "); List <int> itemIDs = new List <int>() { 1, 3, 5, 7, 9, 11 }; List <int> itemNums = new List <int>() { 2, 4, 6, 8, 10, 12 }; DebugPrint.p(" >>> test class <<< "); List <ItemData> datas = new List <ItemData>(); ItemData tmp = new ItemData(); for (int i = 0; i < itemIDs.Count; ++i) { tmp.ID = itemIDs[i]; tmp.num = itemNums[i]; datas.Add(tmp); } DebugPrint.p(" test list out " + datas.Count); DebugPrint.pl(datas.ToArray()); DebugPrint.p(" >>> test struct <<< "); List <ItemDataStruct> dataStructs = new List <ItemDataStruct>(); ItemDataStruct tmp2 = new ItemDataStruct(); for (int i = 0; i < itemIDs.Count; ++i) { tmp2.ID = itemIDs[i]; tmp2.num = itemNums[i]; dataStructs.Add(tmp2); } DebugPrint.p(" test list out " + dataStructs.Count); DebugPrint.pl(dataStructs.ToArray()); }
public void StartTest() { DebugPrint.p(" >>> TestPrintAnything <<< "); TimeSpan ts = new TimeSpan(0, 0, 0, 10000); DateTime time = DateTime.Now.ToLocalTime(); DebugPrint.p(time.ToString()); var foo = warplog(this.foo); foo(); string[] lst = new string[3]; DebugPrint.p(lst.Length); lst[1] = "1234"; lst[4] = "wxd"; foreach (var s in lst) { DebugPrint.p(s); } DebugPrint.p(lst.Length); }
public void Bar() { DebugPrint.p(" - bad base bar - 1"); Foo(); DebugPrint.p(" - bad base bar - 2"); }
public void OnClick() { DebugPrint.p("============== button click =============="); script.DoTest(); DebugPrint.p("============== test end =============="); }
public void StartTest() { DebugPrint.p(" >>> TestReflection <<< "); Program.Main(); }
public void foo(int bar = 3) { //int bar = 4; DebugPrint.p(" foo : " + bar); }
public virtual void Foo() { DebugPrint.p(" - base foo - "); }
public override void Foo() { DebugPrint.p(" - sub foo - 1"); base.Foo(); DebugPrint.p(" - sub foo - 2"); }
public void StartTest() { DebugPrint.p(" >>> TestInvoke <<< "); Invoke("foo", 1); }
public void StartTest() { int time = 1000; List <int> tmp = new List <int>(); DebugPrint.p(" >>> GetNumLength <<< "); Stopwatch sw = new Stopwatch(); DebugPrint.p(" > table < "); sw.Start(); for (int i = 0; i < time; ++i) { var l = Test(i); tmp.Add(l); DebugPrint.p(" => " + i + " : " + l); } sw.Stop(); DebugPrint.p(" > table < "); DebugPrint.p(" > table < Time: " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = GetLengthWithString(i + time); tmp.Add(l); } sw.Stop(); DebugPrint.p(" String Time: " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = GetLengthWithMath(i + time); tmp.Add(l); } sw.Stop(); DebugPrint.p(" Math Time: " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = GetLengthByFor(i + time); tmp.Add(l); } sw.Stop(); DebugPrint.p(" for power : " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = X2Math.GetIntLength2(i + time); tmp.Add(l); } sw.Stop(); DebugPrint.p(" X2 Time: " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = (int)Mathf.Pow(i % 10, i % 10); tmp.Add(l); } sw.Stop(); DebugPrint.p(" Math Pow: " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = FastPow(i % 10, i % 10); tmp.Add(l); } sw.Stop(); DebugPrint.p(" Fast Pow: " + sw.Elapsed.TotalSeconds); sw.Reset(); sw.Start(); for (int i = 0; i < time; ++i) { var l = FastPow2(i % 10, i % 10); tmp.Add(l); } sw.Stop(); DebugPrint.p(" Fast Pow 2: " + sw.Elapsed.TotalSeconds); DebugPrint.p(" -------------- > test print " + FastPow2(7, 6)); }
public override void Bar() { DebugPrint.p(" - sub bar - 1"); base.Bar(); DebugPrint.p(" - sub bar - 2"); }
public void Foo() { DebugPrint.p(" - bad base foo - "); }
public Action warplog(Action foo) { return(() => { DebugPrint.p("start log"); foo(); DebugPrint.p("end log"); }); }
public void Bar() { DebugPrint.p(" - bad sub bar - 1"); base.Bar(); DebugPrint.p(" - bad sub bar - 2"); }
void fun5() { DebugPrint.p(11); }
public void Foo() { DebugPrint.p(" - bad sub foo - 1"); base.Foo(); DebugPrint.p(" - bad sub foo - 2"); }