예제 #1
0
    void Test(params object[] args)
    {
        if (args.Length >= 3)
        {
            int sagatObjId   = (int)args[0];
            int protectObjId = (int)args[1];
            int attackObjId  = (int)args[2];
        }
        var t = gameObject.GetComponent <Transform>();

        gameObject.SetActive(true);
        var r = gameObject.renderer;

        gameObject.active = true;
        bool   v = true;
        string s = v.ToString();
        int    i = 123;
        string s = i.ToString();
        int    i = s.IndexOf('2');

        LuaConsole.Print(i);
        int  i     = m_TestString.Length;
        char c     = m_TestString[2];
        bool equal = m_TestString == s;
        var  a     = new int[] { 5, 4, 3, 2, 1 };
        int  ix    = System.Array.IndexOf(a, 3);
    }
예제 #2
0
        public ToyWorld(Map tmxDeserializedMap, StreamReader tileTable)
        {
            if (tileTable == null)
            {
                throw new ArgumentNullException("tileTable");
            }
            if (tmxDeserializedMap == null)
            {
                throw new ArgumentNullException("tmxDeserializedMap");
            }
            Contract.EndContractBlock();

            Size = new Vector2I(tmxDeserializedMap.Width, tmxDeserializedMap.Height);
            AutoupdateRegister = new AutoupdateRegister(100000);
            TilesetTable       = new TilesetTable(tmxDeserializedMap, tileTable);

            InitAtlas(tmxDeserializedMap);
            InitPhysics();
            TileDetectorRegister = new TileDetectorRegister(Atlas);
            RegisterSignals();

            m_consoleThread = new Thread(() =>
            {
                m_luaConsole = new LuaConsole(this, Atlas);
                m_luaConsole.ShowDialog();
            });
            m_consoleThread.Start();
        }
예제 #3
0
    public void parse(string a, string b)
    {
        var t = typeof(T);
        var k = typeof(K);

        LuaConsole.Print(a, b, t, k);
    }
예제 #4
0
 public Singleton()
 {
     if (ms_instance != null)
     {
         LuaConsole.Print("Cannot have two instances in singleton");
         return;
     }
     ms_instance = (T)(System.Object) this;
 }
예제 #5
0
파일: test.cs 프로젝트: summitn/Cs2Lua
    void Test(params object[] args)
    {
        if (args.Length >= 3)
        {
            int sagatObjId   = (int)args[0];
            int protectObjId = (int)args[1];
            int attackObjId  = (int)args[2];
        }
        var t = gameObject.GetComponent <Transform>();

        gameObject.SetActive(true);
        var r = gameObject.renderer;

        gameObject.active = true;
        bool   v = true;
        string s = v.ToString();
        int    i = 123;
        string s = i.ToString();
        int    i = s.IndexOf('2');

        LuaConsole.Print(i);
        int  i     = m_TestString.Length;
        char c     = m_TestString[2];
        bool equal = m_TestString == s;
        var  a     = new int[] { 5, 4, 3, 2, 1 };
        int  ix    = System.Array.IndexOf(a, 3);

        var f = (Action <int>)(vv => { LuaConsole.Print("test"); });

        f(123);

        bool isLoadingHeadIcon = false;

        using (new CUsingHelper(() => { isLoadingHeadIcon = true; }, () => { isLoadingHeadIcon = false; }))
        {
            LuaConsole.Print("test");
        }

        Dictionary <int, int> v1s = new Dictionary <int, int> {
            { 1, 2 }, { 3, 4 }, { 5, 6 }
        };
        Dictionary <int, int> v2s = new Dictionary <int, int> {
            { 1, 3 }, { 5, 4 }
        };
        var v0 = from v1 in v1s let v3 = v1.Value let v4 = v3.ToString().Split(' ') from vvvv in (from v2 in v2s select v2) where !string.IsNullOrEmpty(v1.ToString()) select v1.ToString();

        var v5 = from v1 in v1s join v2 in v2s on v1.Key equals v2.Key into ttt0 select new { v1 = v1, v2 = ttt0.Count() } into ttt group ttt by ttt.v2;

        foreach (var vv in v5)
        {
        }

        List <int> vs = new List <int> {
            3, 5, 9, 7, 6
        };
        var rs = from v in vs from vv in new[] { v, v + 1, v + 2, v + 3 } let v2 = v + 1 where v > 1 let v3 = v2 + 1 where v > 4 where v < 8 select new { v1 = v, v2 = v2, v3 = v3 };
    }
예제 #6
0
        public static void STest(T t, TT tt)
        {
            LuaConsole.Print("static", t, tt);
            Dictionary <T, TT> dict = new Dictionary <T, TT>();

            dict.Add(t, tt);
            LuaConsole.Print("dict count:", dict.Count);
            foo <T, TT> f = new foo <T, TT>();

            f.parse("abc", "def");
            Singleton <foo <T, TT> > .instance.parse("ghi", "jkl");
        }
예제 #7
0
파일: test.cs 프로젝트: zuojiashun/Cs2Lua
            public static void NormalMethod()
            {
                LuaConsole.Print(1, 2, 3, 4, 5);
                Foo f  = new Foo();
                Foo ff = new Foo();

                Action f1 = f.Test;

                f1();

                Action f2 = f.Test3;

                f2();

                Test3(f);

                var r = f + ff;

                f += ff;

                var rr = (Foo)123;

                var rrr = 123 as Foo;

                var obj = new GameObject("test test test");

                Test3(f, sizeof(double));

                var arr  = new int[] { 1, 2, 3, 4, sizeof(int) };
                var v    = arr[2];
                var dict = new Dictionary <int, int> {
                    { 1, 2 }, { 3, 4 }
                };
                var        v1   = dict?[1];
                List <int> list = null;
                var        l    = list?.Count;

                list?.Add(1);
                var v2 = list?[3] = 1;

                int[] arr2 = new int[] { 1, 2, 3, 4 };
                var   v3   = arr2?[2];

                arr2?[3] = 345;
                int a = 1, b = 2, c = 3;

                a = b = c++;
            }
예제 #8
0
            public void Handler()
            {
                var f = delegate() {
                    LuaConsole.Print(1, 2, 3);
                };

                Test(123);
                IntHandler t = Test;

                t(1);
                IntHandler t2 = this.Test;

                t2(2);
                IntHandler aa;

                aa = Test;
                TestDelegate(Test);
            }
예제 #9
0
        public void Test()
        {
            IRunnable <int> f = new Runnable();

            f.Test();
            int i = f[0];

            f[0]       = i;
            f.TestProp = i;
            i          = f.TestProp;
            Func <int, int>      pow  = v => v * v;
            Func <int, int, int> pow2 = (v1, v2) => v1 * v2;
            Action a = () => { i = i * i; LuaConsole.Print(i); };

            f.OnAction += a;
            f.OnAction -= a;
            float t = float.NegativeInfinity;

            t = float.NaN;
        }
예제 #10
0
파일: Test.cs 프로젝트: ssztangierski/sdk
        static void test_LuaConsole(String host, int port)
        {
            try {
                Client client = new Client(host, port);

                Console.WriteLine("Connected to " + host + ":" + port);

                String chunk =
                    "if not node.is_reading() then" +
                    "   node.close()" +
                    "   node.scan()" +
                    "   node.start()" +
                    " end" +
                    " if node.is_reading() then" +
                    "   print('Reading from ' .. node.num_reading() .. ' device(s)')" +
                    " else" +
                    "   print('Failed to start reading')" +
                    " end";

                LuaConsole.ResultType result =
                    LuaConsole.SendChunk(client, chunk);

                if (LuaConsole.ResultCode.Success == result.first)
                {
                    Console.WriteLine(result.second);
                }
                else if (LuaConsole.ResultCode.Continue == result.first)
                {
                    Console.WriteLine("incomplete Lua chunk: " + result.second);
                }
                else
                {
                    Console.WriteLine("command failed: " + result.second);
                }

                client.close();
                client = null;
            } catch (Exception e) {
                Console.WriteLine(e.ToString());
            }
        }
예제 #11
0
파일: test.cs 프로젝트: gaoxiaojun/Cs2Lua
    void Test(params object[] args)
    {
        if (args.Length >= 3)
        {
            int sagatObjId   = (int)args[0];
            int protectObjId = (int)args[1];
            int attackObjId  = (int)args[2];
        }
        var t = gameObject.GetComponent <Transform>();

        gameObject.SetActive(true);
        var r = gameObject.renderer;

        gameObject.active = true;
        bool   v = true;
        string s = v.ToString();
        int    i = 123;
        string s = i.ToString();
        int    i = s.IndexOf('2');

        LuaConsole.Print(i);
    }
예제 #12
0
 public void Test(int v)
 {
     LuaConsole.Print(v);
 }
예제 #13
0
            public void Test()
            {
                var F = Child2.Bar.s_Test;

                Child1.Foo f = new Child1.Foo(123);
                f.OnSimple = this.Handler;
                var ff = new Child1.Foo {
                    m_Test = 456, m_Test2 = 789
                };
                int a = 0, b = 0, c = 0;

                b = (c += (int)2);
                List <List <int> > list          = new List <List <int> > {
                    new List <int> {
                        1, 2
                    }, new List <int> {
                        3, 4, 5
                    }
                };

                list.Add(new List <int>()
                {
                    123, 456
                });
                var v = list[0];
                Dictionary <string, string> dict = new Dictionary <string, string> {
                    { "key1", "value1" }, { "key2", "value2" }
                };

                Test(dict);
                f.Test(1, ref b, out c, 3);
                LuaConsole.Print(b, c);
                int r = 0;

                r += f.Test2(1, 2, ref b, out c);
                LuaConsole.Print(r, b, c);
                int v0 = f.Test2(3, 4, ref b, out c);
                var v  = ff ?? f;

                var vv  = f?.m_Test;
                var vvv = f?.Test(123);

                v = f.Test2(3, 4, ref b, out c);
                LuaConsole.Print(v, b, c);
                while (a < 10 + 2)
                {
                    ++a;
                    if (a < 5 + 3)
                    {
                        continue;
                    }
                }
                do
                {
                    ++b;
                }while(b < 100);
                int[]     abc = new int[256];
                int[]     def = new int[] { 1, 2, 3, 4, 5 };
                int[][][] g0  = new int[3][][];
                int[, ,] h0 = new int[3, 5, 7];
                int[][] g = new int[][] { new int[] { 1, 2 }, new int[] { 3, 4 } };
                int[,] h = new int[, ] {
                    { 1, 2 }, { 3, 4 }
                };

                for (int i = 0; i < g0.Length; ++i)
                {
                    g0[i] = new int[3][];
                    if (1 < 2)
                    {
                        break;
                    }
                    if (2 < 3)
                    {
                        continue;
                    }
                    for (int j = 0; j < g0[i].Length; ++j)
                    {
                        g0[i][j] = new int[3];
                    }
                }

                for (int i = 0; i < h0.GetLength(0); ++i)
                {
                    for (int j = 0; j < h0.GetLength(1); ++j)
                    {
                        for (int k = 0; k < h0.GetLength(2); ++k)
                        {
                            h0[i, j, k] = i * j * k;
                        }
                    }
                }

                var hh = new[] { 5 + 2, 6, 7, 8 };

                Test(hh);

                switch (a)
                {
                case 1:
                case 3:
                    if (a == 1)
                    {
                        break;
                    }
                    break;

                case 4:
                default:
                    break;

                case 2:
                    break;
                }

                foreach (var i in def)
                {
                    s_Test += hh?[i];
                }
                Test(new[] { 1, 2, 3 });
                Test(new int[] { 1, 2, 3 });
                Test(new Dictionary <string, string> {
                    { "1", "2" }, { "3", "4" }
                });
            }
예제 #14
0
파일: test.cs 프로젝트: pandyer/Cs2Dsl
 void IRunnable0.Test()
 {
     LuaConsole.Print("test.");
 }
예제 #15
0
 public void Output()
 {
     LuaConsole.Print("Test3");
 }
예제 #16
0
 public void Test(T t, TT tt)
 {
     LuaConsole.Print(t, tt);
 }