void GeneratSDKObj()
    {
        LuaState lua = LuaInstance.instance.Get();

        lua.GetGlobal("GameDefine_IsNeedAddPlatformSDKObj");
        bool IsNeedAddPlatformSDKObj = lua.ToBoolean(-1);

        lua.Pop(1);
        if (IsNeedAddPlatformSDKObj)
        {
            GameObject PlatformSDKObj = GameObject.Find("PlatformSDKObj");
            if (PlatformSDKObj == null)
            {
                PlatformSDKObj = new GameObject("PlatformSDKObj");
                PlatformSDKObj.AddComponent <PlatformSDKController>();
                DontDestroyOnLoad(PlatformSDKObj);
            }
            else if (PlatformSDKObj.GetComponent <PlatformSDKController>() == null)
            {
                PlatformSDKObj.AddComponent <PlatformSDKController>();
            }
            PlatformSDKController controller = PlatformSDKObj.GetComponent <PlatformSDKController>();
            controller.InitSdk();
        }
    }
Example #2
0
    void Awake()
    {
        if (mSelf != null)
        {
            if (mSelf != this)
            {
                GameObject.Destroy(this);
                return;
            }
        }
        mSelf    = this;
        SDKState = new PlatformState();
        LuaState lua = LuaInstance.instance.Get();

        lua = LuaInstance.instance.Get();
        lua.GetGlobal("PlatformHandler");
        luaPlatformHanderRef = lua.L_Ref(LuaAPI.LUA_REGISTRYINDEX);
    }