[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_EditorClassIdentifier:
qualityServiceEnabled: 1
sdkKey: OmDRO8whS_xJT0fChdR0d_v0wqSKGaEhzs6W8SKO-Lspt2WA_ZpCmlTTHBVTEEDMET5hw4vN9SmtK5x4_eEHsR
sdkKey: rW51GKWqpT99uzHaOQH36OihVd51teKXIfDdTnAzXH70rsTUMSQuyMb7SqmEZzq2qN4B1sFZZPPdlHTOhxQPIC
setAttributionReportEndpoint: 0
addApsSkAdNetworkIds: 0
customGradleVersionUrl:

View File

@@ -169,14 +169,29 @@ public class SDKTest : MonoBehaviour
public void OnGaBtn()
{
Debug.LogError("Ga ask");
using (var e = GAEvent.TackEvent("idcheckdone"))
{
e.AddContent("test ga", true);
}
//Debug.LogError("Ga ask");
//using (var e = GAEvent.TackEvent("idcheckdone"))
//{
//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()
{
@@ -250,14 +265,14 @@ public class SDKTest : MonoBehaviour
{
string msg = $"[AD LOG]Rewarded ad received reward. ID: {adUnitId}. Type: {reward}. Amount: {reward.Amount}";
_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)
{
string msg = $"[AD LOG]Rewarded ad revenue paid. ID: {adUnitId}.";
_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)
{
var mainAppPath = Path.Combine(projPath, "Classes", "Preprocessor.h");
var mainContent = File.ReadAllText(mainAppPath);
var newContent = mainContent.Replace("#define UNITY_USES_REMOTE_NOTIFICATIONS 0", "#define UNITY_USES_REMOTE_NOTIFICATIONS 1");
string mainAppPath = Path.Combine(projPath, "MainApp", "main.mm");
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);
}

View File

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

View File

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

View File

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

View File

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

View File

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