Ejemplo n.º 1
0
    //public void EditorPrepareLuaRes()
    //{
    //    ResManager.ResLoader.Init();
    //    LanguageConverter.Init();
    //}
    void Awake()
    {
#if UNITY_EDITOR
        var awaken = GlobalLua.L["___EDITOR_AWAKEN"].ConvertType <int>();
        if (awaken == 0)
        {
            GlobalLua.EditorCheckRunningState();
            GlobalLua.L["___EDITOR_AWAKEN"] = 1;

            //Init();
            //EditorPrepareLuaRes();

            //var l = GlobalLua.L.L;
            //l.pushcfunction(LuaHub.LuaFuncOnError); // err
            //l.GetGlobal("require"); // err require
            //l.PushString("init"); // err require "main"
            //if (l.pcall(1, 0, -3) == 0)
            //{
            //    l.pop(1);
            //}
            //else
            //{
            //    DynamicHelper.LogError(l.GetLua(-1));
            //    l.pop(2);
            //}
        }
#endif
        BindLua();
        LanguageConverter.IterateText(transform);
        _Awaken = true;
        if (_DestroyRegIndex > 0)
        {
            RemoveDestroyRegIndex(_DestroyRegIndex);
            _DestroyRegIndex = 0;
        }
        CallLuaFunc("awake"); // Notice! The awake will NOT be called for the runtime binded behaviours!
    }