[M] sync from n3

This commit is contained in:
2024-08-22 18:04:52 +08:00
parent 1a0af9d725
commit da367097c8
8 changed files with 91 additions and 30 deletions

View File

@@ -13,7 +13,7 @@ MonoBehaviour:
m_Name: AppLovinSettings m_Name: AppLovinSettings
m_EditorClassIdentifier: m_EditorClassIdentifier:
qualityServiceEnabled: 1 qualityServiceEnabled: 1
sdkKey: OmDRO8whS_xJT0fChdR0d_v0wqSKGaEhzs6W8SKO-Lspt2WA_ZpCmlTTHBVTEEDMET5hw4vN9SmtK5x4_eEHsR sdkKey: rW51GKWqpT99uzHaOQH36OihVd51teKXIfDdTnAzXH70rsTUMSQuyMb7SqmEZzq2qN4B1sFZZPPdlHTOhxQPIC
setAttributionReportEndpoint: 0 setAttributionReportEndpoint: 0
addApsSkAdNetworkIds: 0 addApsSkAdNetworkIds: 0
customGradleVersionUrl: customGradleVersionUrl:

View File

@@ -169,14 +169,29 @@ public class SDKTest : MonoBehaviour
public void OnGaBtn() public void OnGaBtn()
{ {
Debug.LogError("Ga ask"); //Debug.LogError("Ga ask");
using (var e = GAEvent.TackEvent("idcheckdone")) //using (var e = GAEvent.TackEvent("idcheckdone"))
{ //{
e.AddContent("test ga", true); //e.AddContent("test ga", true);
} //}
} }
const string AD_ID = "427b872c314ad1f3"; /*
Android AD ID
c6c49a100de8496c
05c86d0f2be7b55b
7cf556b464448b7b
b6c56eb121b10c98
iOS AD ID
24414b2f75660ea4
86409c4730a1d9bb
ec3c8fd688cdb5e2
eb68f93a08156e04
*/
const string AD_ID = "24414b2f75660ea4";
public void OnAppMaxBtn() public void OnAppMaxBtn()
{ {
@@ -250,14 +265,14 @@ public class SDKTest : MonoBehaviour
{ {
string msg = $"[AD LOG]Rewarded ad received reward. ID: {adUnitId}. Type: {reward}. Amount: {reward.Amount}"; string msg = $"[AD LOG]Rewarded ad received reward. ID: {adUnitId}. Type: {reward}. Amount: {reward.Amount}";
_messageTxt.text = msg; _messageTxt.text = msg;
Debug.Log(msg); Debug.Log($"[AD LOG]Rewarded ad received reward \n {reward.ToString()} \n {adInfo.ToString()}");
} }
private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{ {
string msg = $"[AD LOG]Rewarded ad revenue paid. ID: {adUnitId}."; string msg = $"[AD LOG]Rewarded ad revenue paid. ID: {adUnitId}.";
_messageTxt.text = msg; _messageTxt.text = msg;
Debug.Log(msg); Debug.Log($"[AD LOG]Rewarded ad revenue paid \n {adInfo.ToString()}");
} }

View File

@@ -41,9 +41,15 @@ namespace tysdk.editor
private static void XcodeOverwriteFiles(string projPath, PBXProject proj) private static void XcodeOverwriteFiles(string projPath, PBXProject proj)
{ {
var mainAppPath = Path.Combine(projPath, "Classes", "Preprocessor.h");
var mainContent = File.ReadAllText(mainAppPath); string mainAppPath = Path.Combine(projPath, "MainApp", "main.mm");
var newContent = mainContent.Replace("#define UNITY_USES_REMOTE_NOTIFICATIONS 0", "#define UNITY_USES_REMOTE_NOTIFICATIONS 1"); string mainContent = File.ReadAllText(mainAppPath);
string newContent = mainContent.Replace("#include <UnityFramework/UnityFramework.h>", @"#include ""../UnityFramework/UnityFramework.h""");
File.WriteAllText(mainAppPath, newContent);
mainAppPath = Path.Combine(projPath, "Classes", "Preprocessor.h");
mainContent = File.ReadAllText(mainAppPath);
newContent = mainContent.Replace("#define UNITY_USES_REMOTE_NOTIFICATIONS 0", "#define UNITY_USES_REMOTE_NOTIFICATIONS 1");
File.WriteAllText(mainAppPath, newContent); File.WriteAllText(mainAppPath, newContent);
} }

View File

@@ -12,11 +12,21 @@ namespace tysdk
{ {
public class AccountInfo public class AccountInfo
{ {
#if UNITY_ANDROID
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){
{EAccoutType.hwGoogle.ToString(), EAccoutType.hwGoogle},
{EAccoutType.hwFacebook.ToString(), EAccoutType.hwFacebook},
{"tyGuest", EAccoutType.hwGuest}
};
#else
private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){ private static Dictionary<string, EAccoutType> accoutTypeMap = new Dictionary<string, EAccoutType>(){
{"google", EAccoutType.hwGoogle}, {"google", EAccoutType.hwGoogle},
{"fb", EAccoutType.hwFacebook}, {"fb", EAccoutType.hwFacebook},
{"tyGuest", EAccoutType.hwGuest} {"tyGuest", EAccoutType.hwGuest}
}; };
#endif
public int userId; public int userId;
public string token; public string token;
@@ -128,7 +138,7 @@ namespace tysdk
=================================================*/ =================================================*/
public bool IsLoggedIn => _accountInfo != null; public static bool IsLoggedIn => _accountInfo != null;
public void Logout() public void Logout()
{ {
@@ -180,7 +190,7 @@ namespace tysdk
public async Task<LoginInfo> LoginByToken() public async Task<LoginInfo> LoginByToken()
{ {
var accoutInfo = AccountInfo.GetSavedAccoutInfo(); var accoutInfo = AccountInfo.GetSavedAccoutInfo();
if(accoutInfo == null) new LoginInfo(); if(accoutInfo == null) return new LoginInfo();
var taskSource = new TaskCompletionSource<LoginInfo>(); var taskSource = new TaskCompletionSource<LoginInfo>();
callbacks.Add("LoginResult", (ITYSdkCallback callback) => callbacks.Add("LoginResult", (ITYSdkCallback callback) =>

View File

@@ -1,5 +1,3 @@
using System;
using Newtonsoft.Json.Linq;
using UnityEngine; using UnityEngine;
namespace tysdk namespace tysdk
@@ -38,14 +36,15 @@ namespace tysdk
GA_ABTest = 10, //abtest相关事件 GA_ABTest = 10, //abtest相关事件
} }
/*
public class GAEvent : IDisposable public class GAEvent : IDisposable
{ {
private GATrackType eventType; private GATrackType eventType;
private string eventName; private string eventName;
bool AFSend = true; bool AFSend = true;
public static string ABTestValue = "0";
private JObject content = new JObject(); private JObject content = new JObject();
public static Dictionary<string, string> extraContent = new Dictionary<string, string>();
public GAEvent(GATrackType eventType, string eventName, bool AFSend = true) public GAEvent(GATrackType eventType, string eventName, bool AFSend = true)
{ {
@@ -57,8 +56,7 @@ namespace tysdk
public GAEvent AddContent(string key, string value) public GAEvent AddContent(string key, string value)
{ {
content[key] = value; content[key] = value;
return this; return this; }
}
public GAEvent AddContent(string key, int value) public GAEvent AddContent(string key, int value)
{ {
@@ -78,11 +76,40 @@ namespace tysdk
return this; return this;
} }
public GAEvent AddContent(string key, JToken value)
{
content[key] = value;
return this;
}
public void Dispose() public void Dispose()
{ {
content["ABTestValue"] = ABTestValue; foreach (var item in extraContent)
TYSdkFacade.Instance.EventTrack((int)eventType, eventName, content.ToString()); {
content[item.Key] = item.Value;
}
string msg = content.ToString();
if (msg == String.Empty) return;
if (AFSend)
{
SendAfEvent(eventType,eventName,msg);
}
TYSdkFacade.Instance.EventTrack((int)eventType, eventName, msg);
content.RemoveAll();
} }
private void SendAfEvent(GATrackType type,string eventName,string logMessage)
{
Dictionary<string, string> eventValues = new Dictionary<string, string>();
eventValues.Add("GA_TYPE", type.ToString());
eventValues.Add(eventName, logMessage);
AppsFlyer.sendEvent(AFInAppEvents.GA, eventValues);
}
*/
/* /*
*GA_TRACK默认类型 *GA_TRACK默认类型
@@ -98,6 +125,7 @@ namespace tysdk
*GA_PROFILE设置用户特征 *GA_PROFILE设置用户特征
*/ */
//TOD SDK //TOD SDK
/*
public static GAEvent TackEvent(string eventName, bool afSend = true) public static GAEvent TackEvent(string eventName, bool afSend = true)
{ {
return new GAEvent(GATrackType.GA_TRACK, eventName, afSend); return new GAEvent(GATrackType.GA_TRACK, eventName, afSend);
@@ -128,4 +156,5 @@ namespace tysdk
return new GAEvent(GATrackType.GA_LOGIN, eventName, afSend); return new GAEvent(GATrackType.GA_LOGIN, eventName, afSend);
} }
} }
} */
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -58,10 +58,11 @@ namespace tysdk
return new SKUDetail() { return new SKUDetail() {
price = x["price"].ToString(), price = x["price"].ToString(),
productId = x["productId"].ToString(), productId = x["productId"].ToString(),
LocaleCurrencyCode = x["LocaleCurrencyCode"].ToString(), price_currency_code = x["LocaleCurrencyCode"].ToString(),
localeCurrencySymbol = x["localeCurrencySymbol"].ToString(), localeCurrencySymbol = x["localeCurrencySymbol"].ToString(),
localizedDescription = x["localizedDescription"].ToString(), localizedDescription = x["localizedDescription"].ToString(),
title = x["localizedTitle"].ToString() title = x["localizedTitle"].ToString(),
ProdKey = x["productIdentifier"].ToString()
}; };
}).ToList(); }).ToList();
products = prodList; products = prodList;
@@ -90,13 +91,14 @@ namespace tysdk
public string ProdPriceStr => price; public string ProdPriceStr => price;
public float ProdPrice => float.Parse(price_amount_micros) / 1000000; public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
public string ProdID => ourProductId; public string ProdID => ourProductId;
public string ProdKey => productId;
} }
#elif UNITY_IOS #elif UNITY_IOS
public class SKUDetail public class SKUDetail
{ {
public string price; public string price;
public string productId; public string productId;
public string LocaleCurrencyCode; public string price_currency_code;
public string localeCurrencySymbol; public string localeCurrencySymbol;
public string localizedDescription; public string localizedDescription;
public string title; public string title;
@@ -105,6 +107,7 @@ namespace tysdk
public string ProdPriceStr => price; public string ProdPriceStr => price;
public float ProdPrice => float.Parse(price); public float ProdPrice => float.Parse(price);
public string ProdID => productId; public string ProdID => productId;
public string ProdKey;
public override string ToString() public override string ToString()
{ {

View File

@@ -1,9 +1,7 @@
{ {
"name": "tysdk", "name": "tysdk",
"rootNamespace": "tysdk", "rootNamespace": "tysdk",
"references": [ "references": [],
"GUID:2a37df438292d4903b4e5159c5de3bf9"
],
"includePlatforms": [], "includePlatforms": [],
"excludePlatforms": [], "excludePlatforms": [],
"allowUnsafeCode": false, "allowUnsafeCode": false,

View File

@@ -261,7 +261,7 @@ PlayerSettings:
AndroidTargetDevices: 0 AndroidTargetDevices: 0
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
AndroidKeystoreName: '{inproject}: keystore/bamboogame.keystore' AndroidKeystoreName: /Users/tech/workspace/n3-world/client/Client/KeyStore/bamboogame.keystore
AndroidKeyaliasName: fishing AndroidKeyaliasName: fishing
AndroidEnableArmv9SecurityFeatures: 0 AndroidEnableArmv9SecurityFeatures: 0
AndroidBuildApkPerCpuArchitecture: 0 AndroidBuildApkPerCpuArchitecture: 0