升级TKGSDK2.2.7,更新网赚功能获取接口

This commit is contained in:
yangjing 2022-09-26 17:00:57 +08:00
parent 5e7e9d3b31
commit c6063b7f8f
13 changed files with 86 additions and 79 deletions

View File

@ -73,7 +73,6 @@ public class GameLogic : MonoBehaviour
GameManager.Instance.EnemyGroupMgr = mEnemyGroupMgr;
GameManager.Instance.CurrentGameCam = mGameCam;
TKGSDKManager.Instance.LogEvent(Const.AdsEvent.LevelEnter, Const.AdsKey.Level, PlayerData.Instance.CurrentLevel.ToString());
int tStageID = ((PlayerData.Instance.CurrentLevel - 1) / 10) % GameConfig.Instance.SceneCount + 1;
Instantiate(ResourceManager.Instance.LoadRes<GameObject>(Const.Path.GetStage(tStageID)), mCtnStage);

View File

@ -203,26 +203,20 @@ public class PlayerData : StorageBase<PlayerData>
if (!GameConfig.Instance.IsDebug)
{
TKGSDKManager.Instance.SetUserSourceListener(OnUserSource);
List<Touka.FunctionType> tFuncs = new List<Touka.FunctionType>() { Touka.FunctionType.Function_wangz };
TKGSDKManager.Instance.SetFunctionSwitchListener(tFuncs, OnUserSource);
}
}
private void OnUserSource(bool pIsNatural, string pSource)
private void OnUserSource(Touka.FunctionType pFuncType, bool pOn)
{
mIsMMOUser = !pIsNatural;
mIsMMOUser = pOn;
Save();
Debug.Log("【ToukaGame】回调func:" + pFuncType + "result:" + pOn);
Debug.Log("Usersource is mmo :" + mIsMMOUser);
}
//private void OnUserSource(bool pIsNatural, string pSource, string pCampain)
//{
// mIsMMOUser = !pIsNatural && pCampain.Equals("wangz");
// Save();
// Debug.Log("Usersource is mmo :" + mIsMMOUser);
//}
#region card
public bool HasCard(string pCardID)
{

View File

@ -443,13 +443,7 @@ namespace Touka
{
TKGDebugger.LogDebug("[TKGSDKNative] Review");
#if UNITY_EDITOR
#if AppStore_GB
TKGDebugger.LogDebug("[TKGSDKNative] Review cannot be opened in editor, please open it in real machine");
#else
TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开评价页面,请在真机中打开");
#endif
return;
#endif
TKGNativeInterface.Instance.Review();
@ -462,13 +456,7 @@ namespace Touka
{
TKGDebugger.LogDebug("[TKGSDKNative] OpenPrivacyURL");
#if UNITY_EDITOR
#if AppStore_GB
TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
#else
TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
#endif
return;
#endif
TKGNativeInterface.Instance.OpenPrivacyURL();
@ -481,13 +469,7 @@ namespace Touka
{
TKGDebugger.LogDebug("[TKGSDKNative] OpenUserTermURL");
#if UNITY_EDITOR
#if AppStore_GB
TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
#else
TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
#endif
return;
#endif
TKGNativeInterface.Instance.OpenUserTermURL();
@ -500,13 +482,7 @@ namespace Touka
{
TKGDebugger.LogDebug("[TKGSDKNative] OpenPolicyPop");
#if UNITY_EDITOR
#if AppStore_GB
TKGDebugger.LogDebug("[TKGSDKNative] Web page cannot be opened in editor, please open it in real machine");
#else
TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开网页,请在真机中打开");
#endif
return;
#endif
TKGNativeInterface.Instance.OpenPolicyPop();
@ -519,13 +495,7 @@ namespace Touka
{
TKGDebugger.LogDebug("[TKGSDKNative] OpenMoreGame");
#if UNITY_EDITOR
#if AppStore_GB
TKGDebugger.LogDebug("[TKGSDKNative] App Store cannot be opened in editor, please open it in real machine");
#else
TKGDebugger.LogDebug("[TKGSDKNative] 编辑器中无法打开App Store请在真机中打开");
#endif
return;
#endif
TKGNativeInterface.Instance.OpenMoreGame();

View File

@ -118,6 +118,12 @@ public class TGiOSAdManager : MonoBehaviour
TKG_Share(_shareText);
}
// 获取渠道
public int getChannel()
{
return TKG_GetChannel();
}
// ads
public void RemoveAllAds()
@ -452,6 +458,9 @@ public class TGiOSAdManager : MonoBehaviour
[DllImport("__Internal")]
private static extern void TKG_Share(string text);
[DllImport("__Internal")]
private static extern int TKG_GetChannel();
[DllImport("__Internal")]
private static extern void TKG_InitSDK();

View File

@ -57,13 +57,20 @@ namespace Touka
/// </summary>
private static PlayerPrefPair[] ParseiOSConfigInner()
{
#if AppStore_GB
PlayerPrefPair[] configs = TKGLoadPlistConfig.GetToukaConfig(toukaconfigFile,toukaconfigPathGB);
#if USE_U8
return null;
#else
#if AppStore_GB
PlayerPrefPair[] configs = TKGLoadPlistConfig.GetToukaConfig(toukaconfigFile, toukaconfigPathGB);
#else
PlayerPrefPair[] configs = TKGLoadPlistConfig.GetToukaConfig(toukaconfigFile, toukaconfigPathCN);
#endif
#endif
ParseConfigsInner(configs);
return configs;
#endif
}
/// <summary>

View File

@ -19,7 +19,10 @@ namespace Touka
#if UNITY_IOS
ModifyURLTypes(path);
ModifyCode(path);
#if !USE_U8
ModifyBundle(path);
#endif
#endif
}
@ -35,28 +38,51 @@ namespace Touka
plist.root.SetBoolean("GADIsAdManagerApp", true);
#if !AppStore_GB
#if !USE_U8
#if !AppStore_GB
plist.root.SetString("GADApplicationIdentifier", TKGLoadConfig.GetConfigByKey(ConfigKeys.KEY_Admob_AppID, AppChannel.AppStore_CN));
plist.root.SetString("AppId", TKGLoadConfig.GetConfigByKey(ConfigKeys.KEY_TOUKA_SDK_APPID, AppChannel.AppStore_CN));
plist.root.SetString("AppKey", TKGLoadConfig.GetConfigByKey(ConfigKeys.KEY_TOUKA_SDK_APPKEY, AppChannel.AppStore_CN) );
plist.root.SetString("splashPlacement", TKGLoadConfig.GetConfigByKey(ConfigKeys.KEY_TOUKA_SDK_SPLASHID, AppChannel.AppStore_CN));
#else
#else
plist.root.SetString("GADApplicationIdentifier", TKGLoadConfig.GetConfigByKey(ConfigKeys.KEY_Admob_AppID, AppChannel.AppStore_GB));
plist.root.SetString("AppLovinSdkKey", TKGLoadConfig.GetConfigByKey(ConfigKeys.KEY_TOUKA_SDK_APPKEY, AppChannel.AppStore_GB));
#endif
#endif
plist.root.SetBoolean("ITSAppUsesNonExemptEncryption", false);
//NSAppTransportSecurity set yes
string pPath = Path.Combine(_path, "Info.plist");
if (File.Exists(plistPath))
{
PlistDocument doc = new PlistDocument();
doc.ReadFromFile(plistPath);
PlistElementDict rootDict = doc.root.AsDict();
Debug.Log("yangs" + rootDict["NSAppTransportSecurity"]);
if (rootDict != null)
{
if (rootDict["NSAppTransportSecurity"] != null)
{
PlistElementDict atf = plist.root["NSAppTransportSecurity"].AsDict();
atf.SetBoolean("NSAllowsArbitraryLoads", true);
}
#region iOS 14
doc.WriteToFile(plistPath);
}
}
else
{
}
#region iOS 14
//SKAdnetwork追加
PlistElementArray URLWhiteListArr2 = plist.root.CreateArray("SKAdNetworkItems");
@ -664,8 +690,8 @@ namespace Touka
string mainTarget = pbxProject.TargetGuidByName(targetName);
#endif
pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/Core/AnyThinkSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/Core/AnyThinkSDK.bundle", PBXSourceTree.Sdk));
//pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/CSJAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/CSJAdSDK.bundle", PBXSourceTree.Sdk));
pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", PBXSourceTree.Sdk));
pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/CSJAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/CSJAdSDK.bundle", PBXSourceTree.Sdk));
//pbxProject.AddFileToBuild(mainTarget, pbxProject.AddFile("Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", "Frameworks/Plugins/ToukaGames/Plugins/iOS/ToponSDK/pangle_China/BUAdSDK.bundle", PBXSourceTree.Sdk));
pbxProject.WriteToFile(projectPath);
#endif

View File

@ -16,15 +16,17 @@ public class ToukaAnalyticsBuildPostProcessor
if (buildTarget != BuildTarget.iOS) return;
#if UNITY_IOS
#if !USE_U8
copyConfigFile(path);
CopySplashImg(path);
#endif
SetTeamIdAutoSign(path);
ModifyFrameworks(path);
ModifyBuildSettings(path);
ModifyInfoPlist(path);
//AddLocalization(path);
CopySplashImg(path);
#endif
}
@ -81,9 +83,7 @@ public class ToukaAnalyticsBuildPostProcessor
fileGuidSqlite = proj.AddFile("usr/lib/libc++abi.tbd", "Libraries/libc++abi.tbd", PBXSourceTree.Sdk);
proj.AddFileToBuild(target, fileGuidSqlite);
// sdk config files
proj.AddFileToBuild(target, proj.AddFile("tkg_config.plist", "tkg_config.plist",PBXSourceTree.Source));
File.WriteAllText(projPath, proj.WriteToString());
#if UNITY_2019_3_OR_NEWER
string mainTarget = proj.GetUnityMainTargetGuid();
@ -91,6 +91,12 @@ public class ToukaAnalyticsBuildPostProcessor
string targetName = UnityEditor.iOS.Xcode.PBXProject.GetUnityTargetName();
string mainTarget = proj.TargetGuidByName(targetName);
#endif
#if !USE_U8
// sdk config files
proj.AddFileToBuild(target, proj.AddFile("tkg_config.plist", "tkg_config.plist",PBXSourceTree.Source));
File.WriteAllText(projPath, proj.WriteToString());
proj.AddFileToBuild(mainTarget, proj.AddFile("tkg_config.plist", "tkg_config.plist", PBXSourceTree.Source));
proj.WriteToFile(projPath);
@ -108,7 +114,7 @@ public class ToukaAnalyticsBuildPostProcessor
proj.WriteToFile(projPath);
#endif
#endif
#endif
}
@ -150,8 +156,8 @@ public class ToukaAnalyticsBuildPostProcessor
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
proj.SetBuildProperty(target, "GCC_C_LANGUAGE_STANDARD", "gnu99");
proj.SetBuildProperty(target, "GCC_ENABLE_OBJC_EXCEPTIONS","YES");
proj.SetBuildProperty(target, "EXCLUDED_ARCHS", "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))");
proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "NO");
proj.SetBuildProperty(target, "EXCLUDED_ARCHS", "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 EXCLUDED_ARCHS=$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT))");
File.WriteAllText(projPath, proj.WriteToString());
#endif
}
@ -173,7 +179,7 @@ public class ToukaAnalyticsBuildPostProcessor
var plistPath = Path.Combine(_path, "Info.plist");
var plist = new PlistDocument();
plist.ReadFromFile(plistPath);
#if !AppStore_GB
#if !AppStore_GB && !USE_U8
plist.root.SetString("NSLocationAlwaysUsageDescription", "为了更好的体验游戏");
plist.root.SetString("NSCameraUsageDescription", "为了更好的体验游戏");
plist.root.SetString("NSLocationWhenInUseUsageDescription", "为了更好的体验游戏");

View File

@ -26,7 +26,7 @@ namespace Touka
[MenuItem("ToukaGames/Settings For IOS CN", priority=1001)]
public static void SetIOSCNTOPONSeting()
{
#if UNITY_IOS
#if UNITY_IOS && !USE_U8
SetAPPSetting(AppChannel.AppStore_CN);
#endif
}
@ -42,7 +42,7 @@ namespace Touka
[MenuItem("ToukaGames/Settings For IOS GB", priority = 10001)]
public static void SetIOSUSSeting()
{
#if UNITY_IOS
#if UNITY_IOS && !USE_U8
SetAPPSetting(AppChannel.AppStore_GB);
#endif
}

View File

@ -11,7 +11,7 @@ namespace Touka
{
private static TKGNativeInterface _instance;
private string UnitySDKVersion = "2.2.6";
private string UnitySDKVersion = "2.2.7";
public static TKGNativeInterface Instance
{

View File

@ -225,7 +225,7 @@ namespace Touka
float tHeight = Mathf.Abs(tBottomRight.y - tTopLeft.y);
// x , y , width , height
// ((tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight)
SDKCall("showNative", pAdPos, tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight, pAdPos);
SDKCall("showNative", pAdPos, tTopLeft.x, Screen.height - tTopLeft.y, tWidth, tHeight);
#endif
}

View File

@ -26,11 +26,7 @@ namespace Touka
/// <returns></returns>
public override string GetChannel()
{
#if !AppStore_GB
return "AppStore_CN";
#else
return "AppStore_GB";
#endif
return TGiOSAdManager.Instance.getChannel().ToString();
}
/// <summary>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 123 KiB

View File

@ -29,12 +29,12 @@ MonoBehaviour:
referenceMode: 2
serializationDepthLimit: 64
assemblyNames:
- StompyRobot.SRDebugger
- Assembly-CSharp
- StompyRobot.SRF
- StompyRobot.SRDebugger
- Purchasing.Common
- StompyRobot.SRDebugger.Editor
- StompyRobot.SRF.Editor
- StompyRobot.SRDebugger.Editor
showAdvancedSettings: 0
addMgrToSceneAutomatically: 0
autoUpdateReferences: 1