From f522757923b9ca97c409686df632535c3383846a Mon Sep 17 00:00:00 2001 From: chenxi Date: Wed, 14 Jun 2023 19:11:34 +0800 Subject: [PATCH] adjust sdk --- .../Adjust/Editor/AdjustCustomEditor.cs | 3 +- Assets/ThirdParty/Adjust/Unity/Adjust.cs | 10 ++++- Assets/XLua/Gen/com_adjust_sdk_AdjustWrap.cs | 45 ++++++++++++++++--- Assets/scenes/enter_scene.unity | 5 ++- 4 files changed, 51 insertions(+), 12 deletions(-) diff --git a/Assets/ThirdParty/Adjust/Editor/AdjustCustomEditor.cs b/Assets/ThirdParty/Adjust/Editor/AdjustCustomEditor.cs index fef6bd159..3a320e5c8 100644 --- a/Assets/ThirdParty/Adjust/Editor/AdjustCustomEditor.cs +++ b/Assets/ThirdParty/Adjust/Editor/AdjustCustomEditor.cs @@ -31,7 +31,8 @@ namespace com.adjust.sdk EditorGUILayout.Space(); EditorGUILayout.LabelField("MULTIPLATFORM SETTINGS:", darkerCyanTextFieldStyles); EditorGUI.indentLevel += 1; - adjust.appToken = EditorGUILayout.TextField("App Token", adjust.appToken); + adjust.androidAppToken = EditorGUILayout.TextField("Android App Token", adjust.androidAppToken); + adjust.iosAppToken = EditorGUILayout.TextField("IOS App Token", adjust.iosAppToken); adjust.environment = (AdjustEnvironment)EditorGUILayout.EnumPopup("Environment", adjust.environment); adjust.logLevel = (AdjustLogLevel)EditorGUILayout.EnumPopup("Log Level", adjust.logLevel); adjust.urlStrategy = (AdjustUrlStrategy)EditorGUILayout.EnumPopup("URL Strategy", adjust.urlStrategy); diff --git a/Assets/ThirdParty/Adjust/Unity/Adjust.cs b/Assets/ThirdParty/Adjust/Unity/Adjust.cs index 9c04b3e21..6913cc104 100644 --- a/Assets/ThirdParty/Adjust/Unity/Adjust.cs +++ b/Assets/ThirdParty/Adjust/Unity/Adjust.cs @@ -17,7 +17,9 @@ namespace com.adjust.sdk [HideInInspector] public bool startManually = true; [HideInInspector] - public string appToken; + public string androidAppToken; + [HideInInspector] + public string iosAppToken; [HideInInspector] public AdjustEnvironment environment = AdjustEnvironment.Sandbox; [HideInInspector] @@ -109,7 +111,11 @@ namespace com.adjust.sdk if (!this.startManually) { - AdjustConfig adjustConfig = new AdjustConfig(this.appToken, this.environment, (this.logLevel == AdjustLogLevel.Suppress)); + #if UNITY_IOS && !UNITY_EDITOR + AdjustConfig adjustConfig = new AdjustConfig(this.iosAppToken, this.environment, (this.logLevel == AdjustLogLevel.Suppress)); + #else + AdjustConfig adjustConfig = new AdjustConfig(this.androidAppToken, this.environment, (this.logLevel == AdjustLogLevel.Suppress)); + #endif adjustConfig.setLogLevel(this.logLevel); adjustConfig.setSendInBackground(this.sendInBackground); adjustConfig.setEventBufferingEnabled(this.eventBuffering); diff --git a/Assets/XLua/Gen/com_adjust_sdk_AdjustWrap.cs b/Assets/XLua/Gen/com_adjust_sdk_AdjustWrap.cs index f0496bb8f..bdb7e92dd 100644 --- a/Assets/XLua/Gen/com_adjust_sdk_AdjustWrap.cs +++ b/Assets/XLua/Gen/com_adjust_sdk_AdjustWrap.cs @@ -21,12 +21,13 @@ namespace XLua.CSObjectWrap { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); System.Type type = typeof(com.adjust.sdk.Adjust); - Utils.BeginObjectRegister(type, L, translator, 0, 0, 25, 25); + Utils.BeginObjectRegister(type, L, translator, 0, 0, 26, 26); Utils.RegisterFunc(L, Utils.GETTER_IDX, "startManually", _g_get_startManually); - Utils.RegisterFunc(L, Utils.GETTER_IDX, "appToken", _g_get_appToken); + Utils.RegisterFunc(L, Utils.GETTER_IDX, "androidAppToken", _g_get_androidAppToken); + Utils.RegisterFunc(L, Utils.GETTER_IDX, "iosAppToken", _g_get_iosAppToken); Utils.RegisterFunc(L, Utils.GETTER_IDX, "environment", _g_get_environment); Utils.RegisterFunc(L, Utils.GETTER_IDX, "logLevel", _g_get_logLevel); Utils.RegisterFunc(L, Utils.GETTER_IDX, "eventBuffering", _g_get_eventBuffering); @@ -52,7 +53,8 @@ namespace XLua.CSObjectWrap Utils.RegisterFunc(L, Utils.GETTER_IDX, "skAdNetworkHandling", _g_get_skAdNetworkHandling); Utils.RegisterFunc(L, Utils.SETTER_IDX, "startManually", _s_set_startManually); - Utils.RegisterFunc(L, Utils.SETTER_IDX, "appToken", _s_set_appToken); + Utils.RegisterFunc(L, Utils.SETTER_IDX, "androidAppToken", _s_set_androidAppToken); + Utils.RegisterFunc(L, Utils.SETTER_IDX, "iosAppToken", _s_set_iosAppToken); Utils.RegisterFunc(L, Utils.SETTER_IDX, "environment", _s_set_environment); Utils.RegisterFunc(L, Utils.SETTER_IDX, "logLevel", _s_set_logLevel); Utils.RegisterFunc(L, Utils.SETTER_IDX, "eventBuffering", _s_set_eventBuffering); @@ -1091,13 +1093,27 @@ namespace XLua.CSObjectWrap } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] - static int _g_get_appToken(RealStatePtr L) + static int _g_get_androidAppToken(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); com.adjust.sdk.Adjust gen_to_be_invoked = (com.adjust.sdk.Adjust)translator.FastGetCSObj(L, 1); - LuaAPI.lua_pushstring(L, gen_to_be_invoked.appToken); + LuaAPI.lua_pushstring(L, gen_to_be_invoked.androidAppToken); + } catch(System.Exception gen_e) { + return LuaAPI.luaL_error(L, "c# exception:" + gen_e); + } + return 1; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _g_get_iosAppToken(RealStatePtr L) + { + try { + ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); + + com.adjust.sdk.Adjust gen_to_be_invoked = (com.adjust.sdk.Adjust)translator.FastGetCSObj(L, 1); + LuaAPI.lua_pushstring(L, gen_to_be_invoked.iosAppToken); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); } @@ -1444,13 +1460,28 @@ namespace XLua.CSObjectWrap } [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] - static int _s_set_appToken(RealStatePtr L) + static int _s_set_androidAppToken(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); com.adjust.sdk.Adjust gen_to_be_invoked = (com.adjust.sdk.Adjust)translator.FastGetCSObj(L, 1); - gen_to_be_invoked.appToken = LuaAPI.lua_tostring(L, 2); + gen_to_be_invoked.androidAppToken = LuaAPI.lua_tostring(L, 2); + + } catch(System.Exception gen_e) { + return LuaAPI.luaL_error(L, "c# exception:" + gen_e); + } + return 0; + } + + [MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] + static int _s_set_iosAppToken(RealStatePtr L) + { + try { + ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); + + com.adjust.sdk.Adjust gen_to_be_invoked = (com.adjust.sdk.Adjust)translator.FastGetCSObj(L, 1); + gen_to_be_invoked.iosAppToken = LuaAPI.lua_tostring(L, 2); } catch(System.Exception gen_e) { return LuaAPI.luaL_error(L, "c# exception:" + gen_e); diff --git a/Assets/scenes/enter_scene.unity b/Assets/scenes/enter_scene.unity index e94eb7468..2d48284fa 100644 --- a/Assets/scenes/enter_scene.unity +++ b/Assets/scenes/enter_scene.unity @@ -210,7 +210,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: startManually: 0 - appToken: asezin7bs3r4 + androidAppToken: 68zm6p28yglc + iosAppToken: asezin7bs3r4 environment: 1 logLevel: 3 eventBuffering: 0 @@ -461,7 +462,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2a2ec6ba1ee8b48749524f015ed572a6, type: 3} m_Name: m_EditorClassIdentifier: - devKey: XHsvoUhhNvMamKMSEvrew3 + devKey: HsaU4uaFpWe6QuK9px6Uz4 iosDevKey: R4qWrbCEhSQRBgeQVvGHQ9 appID: 6450101181 UWPAppID: