Пример #1
0
    private Window CreateWindow(WindowMetaInfo metaInfo)
    {
        var path = metaInfo.WindowResourcePath;

        var prefab = ResMgr.Load <GameObject>(path);

        var winObj = GameObject.Instantiate(prefab);

        var tr = winObj.transform;

        tr.SetParent(_windowRootTr);

        var win = winObj.GetComponent(metaInfo.WindowType) as Window;

        if (win == null)
        {
            Debug.Log(string.Format("cannot get WindowComponent:{0} from window object:{1}", metaInfo.WindowType, path));

            win = winObj.AddComponent(metaInfo.WindowType) as Window;

            if (win == null)
            {
                Debug.LogError("cannot add WindowComponent to gameobject:" + metaInfo.WindowType);
            }
        }

        return(win);
    }
Пример #2
0
        static int LoadObject_Lua(IntPtr L)
        {
            var obj = ResMgr.Load(Api.lua_tostring(L, 1));

            if (obj == null)
            {
                return(0);
            }
            lua.Lua.PushObjectInternal(L, obj);
            return(1);
        }
Пример #3
0
        static int Load_Lua(IntPtr L)
        {
            var obj = ResMgr.Load(Api.lua_tostring(L, 1), (System.Type)lua.Lua.ObjectAtInternal(L, 2));

            if (obj == null)
            {
                return(0);
            }
            lua.Lua.PushObjectInternal(L, obj);
            return(1);
        }
Пример #4
0
        static int LoadTexture2D_Lua(IntPtr L)
        {
            var tex = ResMgr.Load <Texture2D>(Api.lua_tostring(L, 1));

            if (tex == null)
            {
                return(0);
            }
            lua.Lua.PushObjectInternal(L, tex);
            return(1);
        }
Пример #5
0
        static int LoadSprite_Lua(IntPtr L)
        {
            var sprite = ResMgr.Load <Sprite>(Api.lua_tostring(L, 1));

            if (sprite == null)
            {
                return(0);
            }
            lua.Lua.PushObjectInternal(L, sprite);
            return(1);
        }