static int Replace(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(GameObject)))
        {
            GameObject arg0 = (GameObject)LuaScriptMgr.GetLuaObject(L, 1);
            GameObject o    = WidgetPlaceholder.Replace(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else if (count == 1 && LuaScriptMgr.CheckTypes(L, 1, typeof(Transform)))
        {
            Transform  arg0 = (Transform)LuaScriptMgr.GetLuaObject(L, 1);
            GameObject o    = WidgetPlaceholder.Replace(arg0);
            LuaScriptMgr.Push(L, o);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: WidgetPlaceholder.Replace");
        }

        return(0);
    }
Example #2
0
    public static GameObject Replace(GameObject obj)
    {
        WidgetPlaceholder placeholder = obj.GetComponent <WidgetPlaceholder>();

        if (placeholder != null)
        {
            bool isActive = NGUITools.GetActive(obj);
            if (isActive)
            {
                placeholder.Replace();
            }
            else
            {
                NGUITools.SetActive(obj, true);
            }
            NGUITools.SetActive(placeholder.spawnedObj, isActive);
            return(placeholder.spawnedObj);
        }
        return(obj);
    }
    static int set_prefab(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        WidgetPlaceholder obj = (WidgetPlaceholder)o;

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

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

        obj.prefab = (GameObject)LuaScriptMgr.GetUnityObject(L, 3, typeof(GameObject));
        return(0);
    }
    static int get_spawnedObj(IntPtr L)
    {
        object            o   = LuaScriptMgr.GetLuaObject(L, 1);
        WidgetPlaceholder obj = (WidgetPlaceholder)o;

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

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

        LuaScriptMgr.Push(L, obj.spawnedObj);
        return(1);
    }