Exemplo n.º 1
0
 public static void close(Lua.lua_State L)
 {
     Luna_LWF_LWF.Unregister(L);
     Luna_LWF_Button.Unregister(L);
     Luna_LWF_Movie.Unregister(L);
     Luna_LWF_Point.Unregister(L);
 }
Exemplo n.º 2
0
 public static void open(Lua.lua_State L)
 {
     Luna.dostring(L, "if __luna==nil then __luna={} end");
     Luna.dostring(L, "    if __luna.copyMethodsFrom==nil then\n        function __luna.copyMethodsFrom(methodsChild, methodsParent)\n            for k,v in pairs(methodsParent) do\n                if k~='__index' and k~='__newindex' and methodsChild[k]==nil then\n                    methodsChild[k]=v\n                end\n            end\n        end\n        function __luna.overwriteMethodsFrom(methodsChild, methodsParent)\n            for k,v in pairs(methodsParent) do\n                if k~='__index' and k~='__newindex' then\n                    if verbose then print('registering', k, methodsChild[k]) end\n                    methodsChild[k]=v\n                end\n            end\n        end\n    end\n    ");
     impl_LunaTraits_LWF_LWF.luna_init_hashmap();
     impl_LunaTraits_LWF_LWF.luna_init_write_hashmap();
     Luna_LWF_LWF.Register(L);
     Luna.dostring(L, "if not LWF then LWF={} end LWF.LWF=__luna.LWF_LWF");
     Luna.dostring(L, "                __luna.LWF_LWF.luna_class='.LWF'");
     impl_LunaTraits_LWF_Button.luna_init_hashmap();
     impl_LunaTraits_LWF_Button.luna_init_write_hashmap();
     Luna_LWF_Button.Register(L);
     Luna.dostring(L, "if not LWF then LWF={} end LWF.Button=__luna.LWF_Button");
     Luna.dostring(L, "                __luna.LWF_Button.luna_class='.Button'");
     impl_LunaTraits_LWF_Movie.luna_init_hashmap();
     impl_LunaTraits_LWF_Movie.luna_init_write_hashmap();
     Luna_LWF_Movie.Register(L);
     Luna.dostring(L, "if not LWF then LWF={} end LWF.Movie=__luna.LWF_Movie");
     Luna.dostring(L, "                __luna.LWF_Movie.luna_class='.Movie'");
     impl_LunaTraits_LWF_Point.luna_init_hashmap();
     impl_LunaTraits_LWF_Point.luna_init_write_hashmap();
     Luna_LWF_Point.Register(L);
     Luna.dostring(L, "if not LWF then LWF={} end LWF.Point=__luna.LWF_Point");
     Luna.dostring(L, "                __luna.LWF_Point.luna_class='.Point'");
 }
Exemplo n.º 3
0
    public static int _bind_gotoAndPlayMovie_overload_2(Lua.lua_State L)
    {
        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();
        string  label        = Lua.lua_tostring(L, 3).ToString();

        try {
            self.GotoAndPlayMovie(instanceName, label);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 4
0
    public static int _bind_gotoAndStopMovie_overload_1(Lua.lua_State L)
    {
        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();
        int     frameNo      = (int)Lua.lua_tonumber(L, 3);

        try {
            self.GotoAndStopMovie(instanceName, frameNo);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 5
0
 public static int _bind_getLWF(Lua.lua_State L)
 {
     if (Lua.lua_gettop(L) != 1 || Luna.get_uniqueid(L, 1) !=
         LunaTraits_LWF_Button.uniqueID)
     {
         Luna.printStack(L);
         Lua.luaL_error(L, "luna typecheck failed: LWF.Button.lwf");
     }
     LWF.Button a = Luna_LWF_Button.check(L, 1);
     Luna_LWF_LWF.push(L, a.lwf, false);
     return(1);
 }
Exemplo n.º 6
0
    public static int addButtonEventListener(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 3 ||
            Luna.get_uniqueid(L, 1) != LunaTraits_LWF_LWF.uniqueID ||
            Lua.lua_isstring(L, 2) == 0 || !Lua.lua_istable(L, 3))
        {
            Luna.printStack(L);
            Lua.luaL_error(L, "luna typecheck failed: LWF.addButtonEventListener");
        }

        LWF.LWF a = Luna_LWF_LWF.check(L, 1);
        return(a.AddButtonEventHandlerLua());
    }
Exemplo n.º 7
0
    public static int _bind_get_root(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 1 ||
            Luna.get_uniqueid(L, 1) != LunaTraits_LWF_LWF.uniqueID)
        {
            Luna.printStack(L);
            Lua.luaL_error(L, "luna typecheck failed: LWF.LWF._root");
        }

        LWF.LWF a = Luna_LWF_LWF.check(L, 1);
        Luna_LWF_Movie.push(L, a._root, false);
        return(1);
    }
Exemplo n.º 8
0
        public int AttachLWFLua(Movie movie)
        {
            if (luaState == null)
            {
                return(0);
            }

            Lua.lua_State l    = (Lua.lua_State)luaState;
            int           args = Lua.lua_gettop(l);
            string        attachName;
            string        path;
            int           attachDepth   = -1;
            bool          reorder       = false;
            string        texturePrefix = null;

            /* 1: LWF_Movie instance */
            /* 2: path:string */
            /* 3: attachName:string */
            /* 4: attachDepth:number (option) */
            /* 5: reorder:boolean (option) */
            /* 6: texturePrefix:string (option) */
            path       = Lua.lua_tostring(l, 2).ToString();
            attachName = Lua.lua_tostring(l, 3).ToString();
            if (args >= 4)
            {
                attachDepth = (int)Lua.lua_tonumber(l, 4);
            }
            if (args >= 5)
            {
                reorder = Lua.lua_toboolean(l, 5) != 0;
            }
            if (args >= 6)
            {
                texturePrefix = Lua.lua_tostring(l, 6).ToString();
            }

            LWF child = movie.AttachLWF(
                path, attachName, attachDepth, reorder, texturePrefix);

            if (child != null)
            {
                Luna_LWF_LWF.push(l, child, false);
                /* -1: LWF_LWF child */
            }
            else
            {
                Lua.lua_pushnil(l);
                /* -1: nil */
            }
            return(1);
        }
Exemplo n.º 9
0
 public static int _bind_getPointY(Lua.lua_State L)
 {
     if (Lua.lua_gettop(L) != 1 ||
         Luna.get_uniqueid(L, 1) != 7105034)
     {
         Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:getPointY(LWF.LWF self ...)");
     }
     LWF.LWF o = Luna_LWF_LWF.check(L, 1);
     try {
         float ret = getPointY(o);
         Lua.lua_pushnumber(L, ret);
     } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
     return(1);
 }
Exemplo n.º 10
0
    public static int _bind_setColorTransformMovie_overload_1(Lua.lua_State L)
    {
        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();
        float   vr           = (float)Lua.lua_tonumber(L, 3);
        float   vg           = (float)Lua.lua_tonumber(L, 4);
        float   vb           = (float)Lua.lua_tonumber(L, 5);
        float   va           = (float)Lua.lua_tonumber(L, 6);

        try {
            self.SetColorTransformMovie(instanceName, vr, vg, vb, va);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 11
0
    public static int _bind_clearButtonEventListener(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 2 ||
            Luna.get_uniqueid(L, 1) != 7105034 ||
            Lua.lua_isstring(L, 2) == 0)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:clearButtonEventListener(LWF.LWF self)");
        }

        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();

        try {
            self.ClearButtonEventHandler(instanceName);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 12
0
    public static int _bind_getText(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 2 ||
            Luna.get_uniqueid(L, 1) != 7105034 ||
            Lua.lua_isstring(L, 2) == 0)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:getText(LWF.LWF self)");
        }

        LWF.LWF self     = Luna_LWF_LWF.check(L, 1);
        string  textName = Lua.lua_tostring(L, 2).ToString();

        try {
            string ret = self.GetText(textName);
            Lua.lua_pushstring(L, ret);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(1);
    }
Exemplo n.º 13
0
    public static int _bind_setAlphaMovie(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 3 ||
            Luna.get_uniqueid(L, 1) != 7105034 ||
            Lua.lua_isstring(L, 2) == 0 ||
            Lua.lua_isnumber(L, 3) == 0)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:setAlphaMovie(LWF.LWF self)");
        }

        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();
        float   v            = (float)Lua.lua_tonumber(L, 3);

        try {
            self.SetAlphaMovie(instanceName, v);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 14
0
    public static int _bind_setVisibleMovie(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 3 ||
            Luna.get_uniqueid(L, 1) != 7105034 ||
            Lua.lua_isstring(L, 2) == 0 ||
            !Lua.lua_isboolean(L, 3))
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:setVisibleMovie(LWF.LWF self)");
        }

        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();
        bool    visible      = (Lua.lua_toboolean(L, 3) != 0);

        try {
            self.SetVisibleMovie(instanceName, visible);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 15
0
    public static int _bind_removeMovieEventListener(Lua.lua_State L)
    {
        if (Lua.lua_gettop(L) != 3 ||
            Luna.get_uniqueid(L, 1) != 7105034 ||
            Lua.lua_isstring(L, 2) == 0 ||
            Lua.lua_isnumber(L, 3) == 0)
        {
            Luna.printStack(L); Lua.luaL_error(L, "luna typecheck failed:removeMovieEventListener(LWF.LWF self)");
        }

        LWF.LWF self         = Luna_LWF_LWF.check(L, 1);
        string  instanceName = Lua.lua_tostring(L, 2).ToString();
        int     id           = (int)Lua.lua_tonumber(L, 3);

        try {
            self.RemoveMovieEventHandler(instanceName, id);
        } catch (Exception e) { Lua.luaL_error(L, new Lua.CharPtr(e.ToString())); }
        return(0);
    }
Exemplo n.º 16
0
        public void DestroyLua()
        {
            if (luaState == null)
            {
                return;
            }

            Lua.lua_State l = (Lua.lua_State)luaState;
            Lua.lua_getglobal(l, "LWF");
            /* -1: LWF */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Instances");
            /* -2: LWF */
            /* -1: LWF.Instances */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_pushnil(l);
            /* -2: LWF.Instances */
            /* -1: nil */
            Lua.lua_setfield(l, -2, instanceIdString);
            /* LWF.Instances.<instanceId> = nil */
            /* -1: LWF.Instances */
            Lua.lua_pop(l, 1);
            /* 0 */
            Luna_LWF_LWF.Destroy(l, this);
            LuaLWF.close(l);
        }
Exemplo n.º 17
0
        public void DestroyMovieLua(Movie movie)
        {
            if (luaState == null)
            {
                return;
            }

            Lua.lua_State l = (Lua.lua_State)luaState;
            Lua.lua_getglobal(l, "LWF");
            /* -1: LWF */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Script");
            /* -2: LWF */
            /* -1: LWF.Script */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Script */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, name);
            /* -2: LWF.Script */
            /* -1: LWF.Script.<name> */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Script.<name> */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Destroy");
            /* -2: LWF.Script.<name> */
            /* -1: LWF.Script.<name>.Destroy */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Script.<name>.Destroy */
            if (Lua.lua_isfunction(l, -1))
            {
                Luna_LWF_LWF.push(l, this, false);
                /* -2: LWF.Script.<name>.Destroy */
                /* -1: LWF instance */
                if (Lua.lua_pcall(l, 1, 0, 0) != 0)
                {
                    Lua.lua_pop(l, 1);
                }
                /* 0 */
            }
            Lua.lua_getglobal(l, "LWF");
            /* -1: LWF */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Instances");
            /* -2: LWF */
            /* -1: LWF.Instances */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, instanceIdString);
            /* -2: LWF.Instances */
            /* -1: LWF.Instances.<instanceId> */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances.<instanceId> */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_getfield(l, -1, "Movies");
            /* -2: LWF.Instances.<instanceId> */
            /* -1: LWF.Instances.<instanceId>.Movies */
            Lua.lua_remove(l, -2);
            /* -1: LWF.Instances.<instanceId>.Movies */
            if (!Lua.lua_istable(l, -1))
            {
                Lua.lua_pop(l, 1);
                /* 0 */
                return;
            }
            Lua.lua_pushnil(l);
            /* -2: LWF.Instances.<instanceId>.Movies */
            /* -1: nil */
            Lua.lua_setfield(l, -2, movie.iObjectId.ToString());
            /* LWF.Instances.<instanceId>.Movies.<iObjectId> = nil */
            /* -1: LWF.Instances.<instanceId>.Movies */
            Lua.lua_pop(l, 1);
            /* 0 */
            Luna_LWF_Movie.Destroy(l, movie);
            return;
        }