Exemplo n.º 1
0
    void Awake()
    {
        LuaFileUtils file = new LuaFileUtils();

        file.beZip = true;
        LoadBundles();
    }
 // Use this for initialization
 void Awake()
 {
     loader = new LuaFileUtils();
     lua    = new LuaState();
     this.OpenLibs();
     lua.LuaSetTop(0);
     KBEngine.KBELuaUtil.SetCallLuaFunction(this.CallFunction);
     Bind();
 }
    public void Close()
    {
        loop.Destroy();
        loop = null;

        lua.Dispose();
        lua    = null;
        loader = null;
        KBEngine.KBELuaUtil.ClearCallLuaFunction();
    }
    void Awake()
    {
#if UNITY_5
        Application.logMessageReceived += ShowTips;
#else
        Application.RegisterLogCallback(ShowTips);
#endif
        LuaFileUtils file = new LuaFileUtils();
        file.beZip = true;
        StartCoroutine(LoadBundles());
    }
Exemplo n.º 5
0
 void Awake()
 {
     #if UNITY_5
     Application.logMessageReceived += ShowTips;
     #else
     Application.RegisterLogCallback(ShowTips);
     #endif
     LuaFileUtils file = new LuaFileUtils();
     file.beZip = true;
     StartCoroutine(LoadBundles());
 }
Exemplo n.º 6
0
    void Awake()
    {
        LuaFileUtils file = new LuaFileUtils();

        file.beZip = true;
#if UNITY_ANDROID && UNITY_EDITOR
        if (IntPtr.Size == 8)
        {
            throw new Exception("can't run this in unity5.x process for 64 bits, switch to pc platform, or run it in android mobile");
        }
#endif
        StartCoroutine(LoadBundles());
    }
Exemplo n.º 7
0
    private void Awake()
    {
        //初始化FileReader
        FileReader reader = FileReader.Instance;

        reader.InitPath();
        reader.PreLoadAssetBundle();

        //设置lua读取路径
        LuaFileUtils fileutils = new LuaFileUtils();

        fileutils.beZip = PackDefine.PACK_TEXT_FILE;
        if (PackDefine.PACK_TEXT_FILE)
        {
            var luaab = reader.GetAllPreLoadABByRoot("lua");
            foreach (var ab in luaab)
            {
                string abname = ab.abname;
                if (abname.EndsWith(PackDefine.AB_EXT))
                {
                    abname = abname.Substring(0, abname.Length - PackDefine.AB_EXT.Length);
                }
                fileutils.AddSearchBundle(abname, ab.ab);
            }
        }
        else
        {
            var pathes = FileReader.TXT_FILES["lua"];
            foreach (var path in pathes)
            {
                fileutils.AddSearchPath(path);
            }
        }

        //初始化AssetManager
        AssetManager assetMgr = AssetManager.Instance;

        //GameObject can = GameObject.Find("Canvas");
        //GameObject uistart = assetMgr.LoadPrefab("ui_prefab", "PanelHelloWorld");
        //GameObject.Instantiate<GameObject>(uistart, can.transform);

        //上面的设置完毕了,启动lua状态机
        lua = new LuaState();
        lua.Start();
        LuaBinder.Bind(lua);

        //lua入口文件
        lua.DoFile("Main.lua");
        Debug.Log("After dofile main.lua");
    }
Exemplo n.º 8
0
    public virtual void Dispose()
    {
        if (instance != null)
        {
            instance = null;
            searchPaths.Clear();

            foreach (KeyValuePair<string, AssetBundle> iter in zipMap)
            {
                iter.Value.Unload(true);
            }

            zipMap.Clear();
        }
    }
Exemplo n.º 9
0
    public virtual void Dispose()
    {
        if (instance != null)
        {
            instance = null;
            searchPaths.Clear();

            foreach (KeyValuePair <string, AssetBundle> iter in zipMap)
            {
                iter.Value.Unload(true);
            }

            zipMap.Clear();
        }
    }
Exemplo n.º 10
0
    private byte[] ReadDownLoadFile(string fileName)
    {
        string text = fileName;

        if (!Path.IsPathRooted(fileName))
        {
            string text2 = Application.get_persistentDataPath().Replace('\\', '/');
            text = string.Format("{0}/{1}/Lua/{2}", text2, LuaFileUtils.GetOSDir(), fileName);
        }
        if (File.Exists(text))
        {
            return(File.ReadAllBytes(text));
        }
        return(null);
    }
Exemplo n.º 11
0
    void Awake()
    {
#if UNITY_5 || UNITY_2017_1_OR_NEWER
        Application.logMessageReceived += ShowTips;
#else
        Application.RegisterLogCallback(ShowTips);
#endif
        LuaFileUtils file = new LuaFileUtils();
        file.beZip = true;
#if UNITY_ANDROID && UNITY_EDITOR
        if (IntPtr.Size == 8)
        {
            throw new Exception("can't run this in unity5.x process for 64 bits, switch to pc platform, or run it in android mobile");
        }
#endif
        StartCoroutine(LoadBundles());
    }
Exemplo n.º 12
0
        public LuaMultiState(LuaFileUtils luaFileUtils)
        {
#if !MULTI_STATE
            CLog.LogError("not define symbols MULTI_STATE!");
#endif
            this.luaFileUtils = luaFileUtils;
            if (mainState == null)
            {
                mainState = this;
            }

            LuaException.Init();
            L = LuaNewState();
            stateMap.Add(L, this);
            OpenToLuaLibs();
            ToLua.OpenLibs(L);
            OpenBaseLibs();
            LuaSetTop(0);
            InitLuaPath();
        }
Exemplo n.º 13
0
 public LuaFileUtils()
 {
     instance = this;    
 }
Exemplo n.º 14
0
 public LuaFileUtils()
 {
     instance = this;
 }
Exemplo n.º 15
0
 void Awake()
 {
     LuaFileUtils file = new LuaFileUtils();
     file.beZip = true;
     LoadBundles();
 }