Example #1
0
        protected void testLua()
        {
            string path = "";
            TextRes textRes = null;
            //LuaState ls = new LuaState();
            LuaScriptMgr luaMgr = new LuaScriptMgr();
            path = string.Format("{0}{1}", Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathLuaScript], "UtilDebug.txt");
            textRes = Ctx.m_instance.m_texMgr.getAndSyncLoad<TextRes>(path);
            Ctx.m_instance.m_luaScriptMgr.lua.DoString(textRes.text);

            LuaFunction reflf = Ctx.m_instance.m_luaScriptMgr.lua.GetFunction("regPath");
            string luaPath = string.Format("{0}/{1}", UtilApi.getDataPath(), "Prefabs/Resources/LuaScript");
            UtilApi.normalPath(ref luaPath);
            object[] ret = reflf.Call(luaPath);

            luaPath = string.Format("{0}/{1}", UtilApi.getDataPath(), "Plugins/x86_64");
            reflf = Ctx.m_instance.m_luaScriptMgr.lua.GetFunction("regCPath");
            ret = reflf.Call(luaPath);

            //path = string.Format("{0}{1}", Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathLuaScript], "debugger.txt");
            //textRes = Ctx.m_instance.m_textResMgr.getAndSyncLoad<TextRes>(path);
            //ls.DoString(textRes.text);

            path = string.Format("{0}{1}", Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathLuaScript], "TestLua.txt");
            textRes = Ctx.m_instance.m_texMgr.getAndSyncLoad<TextRes>(path);
            Ctx.m_instance.m_luaScriptMgr.lua.DoString(textRes.text);

            LuaFunction lf = Ctx.m_instance.m_luaScriptMgr.lua.GetFunction("luaFunc");
            object[] r = lf.Call("2");
            string str = r[0].ToString();

            //LuaTable table = Ctx.m_instance.m_luaScriptMgr.lua.GetTable("mimeself");
            //object _obj = table["encode"];
            //int aaa = 10;
        }
Example #2
0
 // Use this for initialization
 void Start()
 {
     LuaScriptMgr luaMgr = new LuaScriptMgr();
     luaMgr.Start();
     LuaState l = luaMgr.lua;
     l.DoString(demoStr);
 }
Example #3
0
	//反射调用
	void Start () {
        //LuaState lua = new LuaState();
        //lua.DoString(script);
        LuaScriptMgr lua = new LuaScriptMgr();
        lua.Start();
        lua.DoString(script);
    }
Example #4
0
    IEnumerator SetupLua()
    {
        lua = new LuaScriptMgr();
        lua.Start();

        yield return null;
    }
Example #5
0
	// Use this for initialization
	void Start () {
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        mgr.DoString(script);

        LuaFunction f = mgr.GetLuaFunction("testDelegate");
        f.Call(gameObject);     //将自己对象传给lua
	}
Example #6
0
	void Start () 
    {
        if (!Util.CheckEnvironment()) return;

        luaMgr = new LuaScriptMgr();
        luaMgr.Start();   
        luaMgr.DoFile("System.Test");    
	}
	// Use this for initialization
	void Start () {
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        mgr.DoString(script);

        LuaFunction func = mgr.GetLuaFunction("TestClick");
        func.Call(button.gameObject);
	}
Example #8
0
 void Awake()
 {
     DontDestroyOnLoad(this.gameObject);
     luacache = new Dictionary<string, TextAsset>();
     lua = new Lua();
     _instance = this;
     LoadScript();
 }
	void Awake () 
    {
        lua  = new LuaScriptMgr();
        lua.Start();
        lua.DoString(script);        
        LuaFunction f = lua.GetLuaFunction("myFunc");
        f.Call();
        f.Release();
	}
Example #10
0
 // Use this for initialization
 void Start()
 {
     //        LuaState l = new LuaState();
     string str = "print('hello world 世界')";
     //        l.DoString(str);
     LuaScriptMgr l = new LuaScriptMgr();
     l.Start ();
     l.DoString (str);
 }
Example #11
0
	// Use this for initialization
	void Start () {
        //LuaState l = new LuaState();
        //LuaDLL.luaopen_socket_core(l.L);
        //l.DoFile("C:/Users/Administrator/Documents/New Unity Project/Assets/uLua/Lua/debugger.lua");

        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        mgr.DoFile("debugger");
	}
Example #12
0
 void Start()
 {
     LuaScriptMgr lua = new LuaScriptMgr();
     lua.Start();
     lua.DoString(script);
     LuaFunction f = lua.GetLuaFunction("TestArray");
     //转换一下类型,避免可变参数拆成多个参数传递
     f.Call((object)objs);
     f.Release();
 }
Example #13
0
    void Init()
    {
        //初始化顺序不能变
        downloadMgr = gameObject.AddComponent<DownloadManager>();
        bundleMgr = gameObject.AddComponent<BundleManager>();
        luaMgr = new LuaScriptMgr();
        LuaStatic.Load = Utils.LuaLoader;

        downloadMgr.Init();
        bundleMgr.Init();
        Utils.DoFile("Init");
    }
Example #14
0
    void OnDestroy()
    {
        if (onDestroyFn != null) onDestroyFn.Call();
        updateFn = null;
        if (lua != null) lua.Destroy();
        lua = null;
        _instance = null;
        if(net!=null)net.Dispose();
        net = null;
		if(ChatNet!=null)ChatNet.Dispose();
        ChatNet = null;
        luacache.Clear();
    }
Example #15
0
    void Start()
    {
        LuaScriptMgr lua = new LuaScriptMgr();
        lua.Start();
        lua.DoString(script);
        LuaFunction f = lua.GetLuaFunction("TestArray");
        //转换一下类型,避免可变参数拆成多个参数传递
        object[] rts = f.Call((object)objs);
        f.Release();

        for (int i = 0; i < objs.Length; i++)
        {
            Debug.Log(rts[i].ToString());
        }
    }
Example #16
0
    // Use this for initialization
    void Start() {
        LuaScriptMgr luaMgr = new LuaScriptMgr();
        luaMgr.Start();
        LuaState l = luaMgr.lua;
        l.DoString(source);

        //c# array to lua table
        LuaFunction f = l.GetFunction("luaFunc");
        object[] rs = f.Call(objs, objs.Length);
        f.Release();

        //lua table to c# array
        foreach (object de in rs) {
            Debug.Log(de.ToString());
        }
    }
Example #17
0
    //实际应用如Socket.Send(LuaStringBuffer lsb)函数(功能发送lsb.buffer) , 在lua中调用Socket.Send(pb_data)
    //读取协议 Socket.PeekMsgPacket() {return MsgPacket}; lua 中,取协议字节流 MsgPacket.data
    void Start()
    {
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        TestProtolWrap.Register(mgr.GetL());
        mgr.DoFile("3rd/pblua/person_pb.lua");
        mgr.DoString(script);

        LuaFunction func = mgr.GetLuaFunction("encoder");
        func.Call();
        func.Release();

        func = mgr.GetLuaFunction("decoder");
        func.Call();
        func.Release();
    }
	// Use this for initialization
	void Start () {
        LuaScriptMgr mgr = new LuaScriptMgr();
        
        mgr.DoString(script);

        // Get the function object
        func = mgr.GetLuaFunction("luaFunc");

        //有gc alloc
        object[] r = func.Call(123456);        
        print(r[0]);

        // no gc alloc
        int num = CallFunc();
        print(num);
	}
Example #19
0
    // Use this for initialization
    void Start()
    {
        LuaScriptMgr luaMgr = new LuaScriptMgr();
        LuaState l = luaMgr.lua;
        l.DoString(source);

        //c# array to lua table
        LuaFunction f = l.GetFunction("luaFunc");
        object[] rs = f.Call(objs, objs.Length);

        //lua table to c# array
        LuaTable table = rs[0] as LuaTable;
        foreach (DictionaryEntry de in table) {
            Debug.Log(de.Value);
        }
    }
Example #20
0
    //需要删除的转LuaFunction为委托,不需要删除的直接加或者等于即可
    void Start()
    {
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        mgr.DoString(script);
        TestEventListener listener = gameObject.AddComponent<TestEventListener>();         

        LuaFunction func = mgr.GetLuaFunction("AddDelegate");
        func.Call(listener);                
        listener.OnClick(gameObject);
        func.Release();

        Debug.Log("---------------------------------------------------------------------");        
        func = mgr.GetLuaFunction("RemoveDelegate");
        func.Call(listener);
        listener.OnClick(gameObject);
        func.Release();        
    }
Example #21
0
    //需要删除的转LuaFunction为委托,不需要删除的直接加或者等于即可
    void Start()
    {
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        TestEventListenerWrap.Register(mgr.GetL());
        mgr.DoString(script);
        GameObject go = new GameObject("TestGo");
        TestEventListener listener = (TestEventListener)go.AddComponent(typeof(TestEventListener));         

        LuaFunction func = mgr.GetLuaFunction("AddDelegate");
        func.Call(listener);                
        listener.OnClick(go);
        func.Release();
        Debug.Log("---------------------------------------------------------------------");        
        func = mgr.GetLuaFunction("RemoveDelegate");
        func.Call(listener);
        listener.OnClick(go);
        func.Release();        
    }
Example #22
0
    /// <summary>
    /// 调用Lua虚拟机,执行一个脚本文件
    /// </summary>
    void RunLuaFile(TextAsset luaFile)
    {
        if (luaFile == null || string.IsNullOrEmpty(luaFile.text))
            return;

        if (s_luaState == null) { 
            s_luaState = new LuaScriptMgr();
            s_luaState.Start();
        }
        object[] luaRet = s_luaState.DoString(luaFile.text);
        if (luaRet != null && luaRet.Length >= 1)
        {
            // 约定:第一个返回的Table对象作为Lua模块
            this.LuaModule = luaRet[0] as LuaTable;
        }
        else
        {
            Debug.LogError("Lua脚本没有返回Table对象:" + luaFile.name);
        }
    }
	// Use this for initialization
	void Start () {        
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        // Assign to global scope variables as if they're keys in a dictionary (they are really)
        LuaState l = mgr.lua;
        l.DoString(var);
        l["Objs2Spawn"] = 5;
        l.DoString(script);

        // Read from the global scope the same way
        print("Read from lua: " + l["var2read"].ToString());

        // Get the lua table as LuaTable object
        LuaTable particles = (LuaTable)l["particles"];

        // Typical foreach over values in table
        foreach( ParticleSystem ps in particles.Values )
        {
            ps.Play();
        }
	}
        /// <summary>
        /// 资源初始化结束
        /// </summary>
        public void OnResourceInited()
        {
            uluaManager = new LuaScriptMgr();
            uluaManager.Start();
            uluaManager.DoFile("logic/game");      //加载游戏
            uluaManager.DoFile("logic/network");   //加载网络
            ioo.networkManager.OnInit();    //初始化网络

            object[] panels = CallMethod("LuaScriptPanel");
            //---------------------Lua面板---------------------------
            foreach (object o in panels) {
                string name = o.ToString().Trim();
                if (string.IsNullOrEmpty(name)) continue;
                name += "Panel";    //添加

                uluaManager.DoFile("logic/" + name);
                Debug.LogWarning("LoadLua---->>>>" + name + ".lua");
            }
            //------------------------------------------------------------
            CallMethod("OnInitOK");   //初始化完成
        }
Example #25
0
    static int set_materials(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name materials");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index materials on a nil value");
            }
        }

        obj.materials = LuaScriptMgr.GetNetObject <Material[]>(L, 3);
        return(0);
    }
Example #26
0
    static int set_renderMode(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name renderMode");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index renderMode on a nil value");
            }
        }

        obj.renderMode = LuaScriptMgr.GetNetObject <LightRenderMode>(L, 3);
        return(0);
    }
Example #27
0
    static int set_consumables(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        SkillLevel obj = (SkillLevel)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name consumables");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index consumables on a nil value");
            }
        }

        obj.consumables = (List <SkillConsumable>)LuaScriptMgr.GetNetObject(L, 3, typeof(List <SkillConsumable>));
        return(0);
    }
Example #28
0
    static int get_isPartOfStaticBatch(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name isPartOfStaticBatch");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index isPartOfStaticBatch on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.isPartOfStaticBatch);
        return(1);
    }
Example #29
0
    static int set_lightmapTilingOffset(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name lightmapTilingOffset");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index lightmapTilingOffset on a nil value");
            }
        }

        obj.lightmapTilingOffset = LuaScriptMgr.GetVector4(L, 3);
        return(0);
    }
Example #30
0
    static int set_weight(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        SkillLevel obj = (SkillLevel)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name weight");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index weight on a nil value");
            }
        }

        obj.weight = (uint)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Example #31
0
    static int set_flare(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name flare");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index flare on a nil value");
            }
        }

        obj.flare = LuaScriptMgr.GetUnityObject <Flare>(L, 3);
        return(0);
    }
Example #32
0
    static int set_parameters(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        SkillLevel obj = (SkillLevel)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name parameters");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index parameters on a nil value");
            }
        }

        obj.parameters = (Dictionary <uint, SkillSpec>)LuaScriptMgr.GetNetObject(L, 3, typeof(Dictionary <uint, SkillSpec>));
        return(0);
    }
Example #33
0
    static int get_sortingLayerID(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name sortingLayerID");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index sortingLayerID on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.sortingLayerID);
        return(1);
    }
Example #34
0
    static int set_alreadyLightmapped(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name alreadyLightmapped");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index alreadyLightmapped on a nil value");
            }
        }

        obj.alreadyLightmapped = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
Example #35
0
    static int set_cullingMask(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name cullingMask");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index cullingMask on a nil value");
            }
        }

        obj.cullingMask = (int)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Example #36
0
    static int set_sortingOrder(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name sortingOrder");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index sortingOrder on a nil value");
            }
        }

        obj.sortingOrder = (int)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Example #37
0
    static int get_consumables(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        SkillLevel obj = (SkillLevel)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name consumables");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index consumables on a nil value");
            }
        }

        LuaScriptMgr.PushObject(L, obj.consumables);
        return(1);
    }
Example #38
0
    static int set_areaSize(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name areaSize");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index areaSize on a nil value");
            }
        }

        obj.areaSize = LuaScriptMgr.GetVector2(L, 3);
        return(0);
    }
Example #39
0
    static int get_color(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name color");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index color on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.color);
        return(1);
    }
Example #40
0
    static int get_frameRate(IntPtr L)
    {
        object        o   = LuaScriptMgr.GetLuaObject(L, 1);
        AnimationClip obj = (AnimationClip)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name frameRate");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index frameRate on a nil value");
            }
        }

        LuaScriptMgr.Push(L, obj.frameRate);
        return(1);
    }
Example #41
0
    static int set_localBounds(IntPtr L)
    {
        object        o   = LuaScriptMgr.GetLuaObject(L, 1);
        AnimationClip obj = (AnimationClip)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name localBounds");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index localBounds on a nil value");
            }
        }

        obj.localBounds = LuaScriptMgr.GetNetObject <Bounds>(L, 3);
        return(0);
    }
Example #42
0
    static int set_useLightProbes(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name useLightProbes");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index useLightProbes on a nil value");
            }
        }

        obj.useLightProbes = LuaScriptMgr.GetBoolean(L, 3);
        return(0);
    }
Example #43
0
    static int get_bounds(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name bounds");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index bounds on a nil value");
            }
        }

        LuaScriptMgr.PushValue(L, obj.bounds);
        return(1);
    }
Example #44
0
    static int set_lightProbeAnchor(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name lightProbeAnchor");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index lightProbeAnchor on a nil value");
            }
        }

        obj.lightProbeAnchor = LuaScriptMgr.GetNetObject <Transform>(L, 3);
        return(0);
    }
Example #45
0
    static int set_spotAngle(IntPtr L)
    {
        object o   = LuaScriptMgr.GetLuaObject(L, 1);
        Light  obj = (Light)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name spotAngle");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index spotAngle on a nil value");
            }
        }

        obj.spotAngle = (float)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Example #46
0
    static int get_localToWorldMatrix(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name localToWorldMatrix");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index localToWorldMatrix on a nil value");
            }
        }

        LuaScriptMgr.PushValue(L, obj.localToWorldMatrix);
        return(1);
    }
Example #47
0
    static int set_wrapMode(IntPtr L)
    {
        object        o   = LuaScriptMgr.GetLuaObject(L, 1);
        AnimationClip obj = (AnimationClip)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name wrapMode");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index wrapMode on a nil value");
            }
        }

        obj.wrapMode = LuaScriptMgr.GetNetObject <WrapMode>(L, 3);
        return(0);
    }
Example #48
0
    static int get_sharedMaterials(IntPtr L)
    {
        object   o   = LuaScriptMgr.GetLuaObject(L, 1);
        Renderer obj = (Renderer)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name sharedMaterials");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index sharedMaterials on a nil value");
            }
        }

        LuaScriptMgr.PushArray(L, obj.sharedMaterials);
        return(1);
    }
Example #49
0
    static int set_onDoubleClick(IntPtr L)
    {
        object          o   = LuaScriptMgr.GetLuaObject(L, 1);
        UIEventListener obj = (UIEventListener)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name onDoubleClick");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index onDoubleClick on a nil value");
            }
        }

        LuaTypes funcType = LuaDLL.lua_type(L, 3);

        if (funcType != LuaTypes.LUA_TFUNCTION)
        {
            obj.onDoubleClick = (UIEventListener.VoidDelegate)LuaScriptMgr.GetNetObject(L, 3, typeof(UIEventListener.VoidDelegate));
        }
        else
        {
            LuaFunction func = LuaScriptMgr.ToLuaFunction(L, 3);
            obj.onDoubleClick = (param0) =>
            {
                int top = func.BeginPCall();
                LuaScriptMgr.Push(L, param0);
                func.PCall(top, 1);
                func.EndPCall(top);
            };
        }
        return(0);
    }
Example #50
0
    static int set_parent(IntPtr L)
    {
        object     o   = LuaScriptMgr.GetLuaObject(L, 1);
        GameObject obj = (GameObject)o;

        if (obj == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name parent");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index parent on a nil value");
            }
        }

        if (LuaDLL.lua_isnil(L, 2))
        {
            Transform transform = GameObjectUtil.GetGameObjTransform(obj);
            transform.parent = null;

            //obj.transform.parent = null;
        }
        else
        {
            Transform  transform      = GameObjectUtil.GetGameObjTransform(obj);
            GameObject arg0           = (GameObject)LuaScriptMgr.GetUnityObject(L, 3, typeof(GameObject));
            Transform  transform_Arg0 = GameObjectUtil.GetGameObjTransform(arg0);

            transform.parent = arg0 != null ? transform_Arg0 : null;
            //obj.transform.parent = arg0 != null ? arg0.transform : null;
        }

        return(0);
    }
Example #51
0
    static int GetAudioClip(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 2)
        {
            WWW       obj  = (WWW)LuaScriptMgr.GetNetObjectSelf(L, 1, "WWW");
            bool      arg0 = LuaScriptMgr.GetBoolean(L, 2);
            AudioClip o    = obj.GetAudioClip(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 3)
        {
            WWW       obj  = (WWW)LuaScriptMgr.GetNetObjectSelf(L, 1, "WWW");
            bool      arg0 = LuaScriptMgr.GetBoolean(L, 2);
            bool      arg1 = LuaScriptMgr.GetBoolean(L, 3);
            AudioClip o    = obj.GetAudioClip(arg0, arg1);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 4)
        {
            WWW       obj  = (WWW)LuaScriptMgr.GetNetObjectSelf(L, 1, "WWW");
            bool      arg0 = LuaScriptMgr.GetBoolean(L, 2);
            bool      arg1 = LuaScriptMgr.GetBoolean(L, 3);
            AudioType arg2 = (AudioType)LuaScriptMgr.GetNetObject(L, 4, typeof(AudioType));
            AudioClip o    = obj.GetAudioClip(arg0, arg1, arg2);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: WWW.GetAudioClip");
        }

        return(0);
    }
    static int get_isFrontFacing(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name isFrontFacing");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index isFrontFacing on a nil value");
            }
        }

        WebCamDevice obj = (WebCamDevice)o;

        LuaScriptMgr.Push(L, obj.isFrontFacing);
        return(1);
    }
Example #53
0
    static int get_dampingRatio(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name dampingRatio");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index dampingRatio on a nil value");
            }
        }

        SpringJoint2D obj = (SpringJoint2D)o;

        LuaScriptMgr.Push(L, obj.dampingRatio);
        return(1);
    }
Example #54
0
    static int set_frequency(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaTypes types = LuaDLL.lua_type(L, 1);

            if (types == LuaTypes.LUA_TTABLE)
            {
                LuaDLL.luaL_error(L, "unknown member name frequency");
            }
            else
            {
                LuaDLL.luaL_error(L, "attempt to index frequency on a nil value");
            }
        }

        SpringJoint2D obj = (SpringJoint2D)o;

        obj.frequency = (float)LuaScriptMgr.GetNumber(L, 3);
        return(0);
    }
Example #55
0
 // Use this for initialization
 void Awake()
 {
     mgr = new LuaScriptMgr();
     luaCache = new Dictionary<string, LuaTable>();
     luaScript = FileHelper.ReadLuaScriptFile(Define.LuaScriptPathRoot + "/" + "main.lua");
     Debug.Log(luaScript);
     object[] ret = mgr.DoString(luaScript);
     LuaTable mainTable = ret[0] as LuaTable;
     awakeFun = mainTable.RawGetFunc("awake");
     startFun = mainTable.RawGetFunc("start");
     updateFun = mainTable.RawGetFunc("update");
     lateUpdateFun = mainTable.RawGetFunc("lateUpdate");
     LuaTable conf = mainTable.rawget("conf") as LuaTable;
     string[] confStr = conf.ToArray<string>();
     for (int i = 0; i < confStr.Length; i++)
     {
         Debug.Log(Define.LuaScriptPathRoot + "/" + confStr[i] + ".lua");
         luaScript = FileHelper.ReadLuaScriptFile(Define.LuaScriptPathRoot + "/" + confStr[i] + ".lua");
         LuaTable retTable = mgr.DoString(luaScript)[0] as LuaTable;
         luaCache.Add(confStr[i], retTable);
     }
         if (awakeFun != null)
             awakeFun.Call();
 }
Example #56
0
	void Start () 
    {
        luaMgr = new LuaScriptMgr();
        luaMgr.Start();   
        luaMgr.DoFile("System.Test");    
	}
Example #57
0
	// Use this for initialization
	void Start () {
        LuaScriptMgr mgr = new LuaScriptMgr();
        mgr.Start();
        mgr.lua.DoString(source);
	}
Example #58
0
 void Init()
 {
     DontDestroyOnLoad (gameObject);  //防止销毁自己
     uluaMgr = AppFacade.Instance.GetManager<LuaScriptMgr>(ManagerName.Lua);
     uluaMgr.Start();
 }
Example #59
0
	// Use this for initialization
	void Start () {
        luaMgr = new LuaScriptMgr();
        luaMgr.Start();
        luaMgr.DoFile("Logic.MyTest2");
        luaFunc = luaMgr.GetLuaFunction("Test2");
    }
Example #60
0
 //-----------------------------------------------------------------
 protected void OnDestroy()
 {
     ClearClick();
     umgr = null;
     Util.ClearMemory();
     Debug.Log("~" + name + " was destroy!");
 }