示例#1
0
    void PrintTest()
    {
        int speed = testLua.Global.Get <int>("speed1");
        // Debug.Log(speed);

        Person p = testLua.Global.Get <Person>("Person");
        // Debug.Log(p.name);
        // Debug.Log(p.age);

        Person_1 p1 = testLua.Global.Get <Person_1>("Person1");

        // Debug.Log(p1.name);
        p1.eat("org");


        Dictionary <string, object> dict = testLua.Global.Get <Dictionary <string, object> >("Person2");

        foreach (string key in dict.Keys)
        {
            print("key:" + key + "   value:" + dict[key]);
        }

        /* List<object> dic = testLua.Global.Get<List<object>>("Person2");
         * foreach (string key in dic) {
         *
         *
         * }*/

        Add add = testLua.Global.Get <Add>("add");
        int res1 = 0; int res2 = 0;
        int res = add(3, 4, out res1, out res2);

        Debug.Log(res);
        Debug.Log(res1);
    }
示例#2
0
    void Start()
    {
        //策略
        Person person = new Person(new AddFun());

        Debug.Log(person.GetResult());
        //策略和简单工厂结合
        Person_1 person_1 = new Person_1("+");

        Debug.Log(person_1.GetResult());
    }