Пример #1
0
    void StartLua(bool onlyRead)
    {
        InstanceGlobalUpdate();
        if (!IsInit)
        {
            if (onlyRead)
            {
#if UNITY_ANDROID
                ResLoader.InitStreamingAssetsPath(PluginTool.SharedInstance().PersisitentDataPath + "temp");
                ResLoader.InitSmallData();
#elif UNITY_IPHONE //|| UNITY_STANDALONE_WIN || UNITY_EDTOR
                UnityEngine.iOS.Device.SetNoBackupFlag(PluginTool.SharedInstance().PersisitentDataPath);
                ResLoader.InitStreamingAssetsPath(Application.streamingAssetsPath);
                ResLoader.Init();
#endif
            }
            else
            {
                IsInit = true;
                ResLoader.InitData();
                ResLoader.Init();
            }


            LuaInstance.instance.Init(true);
            //IsInit = true;
        }

        if (GlobalUpdate.Instance.gameObject.GetComponent <LogSystem>() == null)
        {
            GlobalUpdate.Instance.gameObject.AddComponent <LogSystem>();
            LogSystem.ReInit(PluginTool.SharedInstance().GetClientVersion());
        }

        LuaState lua = LuaInstance.instance.Get();
        lua.L_DoString(platformCfg);
        GameObject updateUI = NGUITools.AddChildByPath("Update/UpdateControl", null);
        mupdateBehaviour = updateUI.GetComponent <LuaBehaviour>();
        lua.RawGetI(LuaAPI.LUA_REGISTRYINDEX, mupdateBehaviour.Object_ref);
        lua.NewClassUserData(this);
        lua.SetField(-2, "UpdateCtr");
    }
Пример #2
0
    //Init engine setting


    //Init Lua
    void Start()
    {
        if (GlobalUpdate.Instance.gameObject.GetComponent <LogSystem>() == null)
        {
            GlobalUpdate.Instance.gameObject.AddComponent <LogSystem>();
            LogSystem.ReInit(PluginTool.SharedInstance().GetClientVersion());
        }
        GeneratSDKObj();
        GameObject loginUI = NGUITools.AddChildByPath("Login/LoginUIRoot", UIParent);

        mLoginLuaBehav = loginUI.GetComponent <LuaBehaviour>();
        LuaState lua = LuaInstance.instance.Get();

        lua.RawGetI(LuaAPI.LUA_REGISTRYINDEX, mLoginLuaBehav.Object_ref);
        lua.NewClassUserData(this);
        lua.SetField(-2, "ClientInitCtr");
        lua.Pop(1);
        GameObject GameCoreUpdatePrefab = (GameObject)ResLoader.Load("UI/Prefab/NewSceneMustHave/GameCoreUpdate", typeof(GameObject));

        Instantiate(GameCoreUpdatePrefab);

        //init game logic after lua finish init and show the UI
        InitGameLogic();
    }