Merge branch 'main' of 192.168.9.102:tysdk-intergration

# Conflicts:
#	sdk-intergration/Assets/Scripts/SDKTest.cs
#	sdk-intergration/Packages/tysdk/Runtime/TYSdkFacade_Pay.cs
#	sdk-intergration/Packages/tysdk/Runtime/TYSdkModel.cs
This commit is contained in:
LYP
2024-08-09 11:48:57 +08:00
18 changed files with 556 additions and 21 deletions

View File

@@ -31,7 +31,12 @@ public class SDKTest : MonoBehaviour
void Start()
{
//UnityBridgeFunc.UnityResetServerUrl("http://128-hwsfsdk-sdk-test01.qijihdhk.com ");
//===============================================================================
//====================== Test Server ===========================
UnityBridgeFunc.UnityResetServerUrl("http://128-hwsfsdk-sdk-test01.qijihdhk.com");
//====================== Test Server ===========================
//===============================================================================
//
_InitBtn.onClick.AddListener(Init);
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));
@@ -46,7 +51,8 @@ public class SDKTest : MonoBehaviour
void Init()
{
TYSdkFacade.Instance.Init();
MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) => {
MaxSdkCallbacks.OnSdkInitializedEvent += (MaxSdkBase.SdkConfiguration sdkConfiguration) =>
{
Debug.Log($"[MaxSdk::OnSdkInitializedEvent] Init:{sdkConfiguration.IsSuccessfullyInitialized}");
};
MaxSdk.InitializeSdk();
@@ -54,12 +60,27 @@ public class SDKTest : MonoBehaviour
AppsFlyer.setIsDebug(true);
#if UNITY_IOS
AppsFlyer.initSDK("rSySeWtvKabfbPZE7Lmx7C","6505145935");
AppsFlyer.initSDK("rSySeWtvKabfbPZE7Lmx7C", "6505145935");
#elif UNITY_ANDROID
AppsFlyer.initSDK("rSySeWtvKabfbPZE7Lmx7C", null);
#endif
AppsFlyer.startSDK();
//AppsFlyerAdRevenue.start();
// AppsFlyerAdRevenue.start();
}
int retryAttempt;
public void InitializeRewardedAds()
{
// Attach callback
MaxSdkCallbacks.Rewarded.OnAdLoadedEvent += OnRewardedAdLoadedEvent;
MaxSdkCallbacks.Rewarded.OnAdLoadFailedEvent += OnRewardedAdLoadFailedEvent;
MaxSdkCallbacks.Rewarded.OnAdDisplayedEvent += OnRewardedAdDisplayedEvent;
MaxSdkCallbacks.Rewarded.OnAdClickedEvent += OnRewardedAdClickedEvent;
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnRewardedAdRevenuePaidEvent;
MaxSdkCallbacks.Rewarded.OnAdHiddenEvent += OnRewardedAdHiddenEvent;
MaxSdkCallbacks.Rewarded.OnAdDisplayFailedEvent += OnRewardedAdFailedToDisplayEvent;
MaxSdkCallbacks.Rewarded.OnAdReceivedRewardEvent += OnRewardedAdReceivedRewardEvent;
}
private async void OnLogin(EAccoutType accoutType)
@@ -68,7 +89,7 @@ public class SDKTest : MonoBehaviour
Debug.LogError($"[AggSdk::OnLogin] accoutType : {accoutType}");
var info = await TYSdkFacade.Instance.Login(accoutType);
_messageTxt.text = $"Login: {info.isSuccess}";
if(info.isSuccess)
if (info.isSuccess)
{
_messageTxt.text += $"\n{info.msg}";
_messageTxt.text += $"\n{TYSdkFacade.Instance.TYAccountInfo.token}";
@@ -79,7 +100,7 @@ public class SDKTest : MonoBehaviour
{
TYSdkFacade.Instance.Logout();
}
public async void OnPayTestBtn()
{
string prodId = "comarkgameft1chooseone0199";
@@ -87,15 +108,15 @@ public class SDKTest : MonoBehaviour
string prodPrice = "2,616";
string prodName = "test:₩2,616";
int count = 1;
Debug.LogError($"[AggSdk::Pay] prodId : {prodId} prodPrice : {prodPrice} prodName : {prodName} ");
PaymentInfo payResult = await TYSdkFacade.Instance.Pay(prodId, prodPrice, prodName, count, pType);
}
public async void OnPayListBtn()
{
ProductListInfo result = await TYSdkFacade.Instance.ThirdExtend();
ProductListInfo result = await TYSdkFacade.Instance.GetSKUList();
if (result.code == 0)
{
Debug.LogError("products count:::" + result.products.Count);
@@ -106,19 +127,80 @@ public class SDKTest : MonoBehaviour
}
}
public void OnGaBtn()
{
Debug.LogError("Ga ask");
using ( var e = GAEvent.TackEvent("idcheckdone") )
using (var e = GAEvent.TackEvent("idcheckdone"))
{
e.AddContent("test ga", true);
}
}
const string AD_ID = "427b872c314ad1f3";
public void OnAppMaxBtn()
{
MaxSdk.ShowRewardedAd("4cea568d96f9c9d3");
if (MaxSdk.IsRewardedAdReady(AD_ID))
{
MaxSdk.ShowRewardedAd(AD_ID);
}
else
{
_messageTxt.text = "AD Not Ready, Load now";
LoadAd();
}
}
private void LoadAd()
{
MaxSdk.LoadRewardedAd("427b872c314ad1f3");
}
private void OnRewardedAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
_messageTxt.text = $"Rewarded ad loaded. ID: {adInfo.AdUnitIdentifier}";
retryAttempt = 0;
}
private void OnRewardedAdLoadFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
{
// Rewarded ad failed to load
// AppLovin recommends that you retry with exponentially higher delays, up to a maximum delay (in this case 64 seconds).
retryAttempt++;
double retryDelay = Math.Pow(2, Math.Min(6, retryAttempt));
_messageTxt.text = $"Rewarded ad failed to load. ID: {adUnitId}. Reason: {errorInfo.Message}. Attempt: {retryAttempt}. Delay: {retryDelay}s.";
Invoke("LoadAd", (float)retryDelay);
}
private void OnRewardedAdDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
private void OnRewardedAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo, MaxSdkBase.AdInfo adInfo)
{
// Rewarded ad failed to display. AppLovin recommends that you load the next ad.
_messageTxt.text = $"Rewarded ad failed to display. ID: {adUnitId}. Reason: {errorInfo.Message}";
LoadAd();
}
private void OnRewardedAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo) { }
private void OnRewardedAdHiddenEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
// Rewarded ad is hidden. Pre-load the next ad
_messageTxt.text = $"Rewarded ad hidden. ID: {adUnitId}.";
LoadAd();
}
private void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward, MaxSdkBase.AdInfo adInfo)
{
_messageTxt.text = $"Rewarded ad received reward. ID: {adUnitId}. Type: {reward}. Amount: {reward.Amount}";
}
private void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
_messageTxt.text = $"Rewarded ad revenue paid. ID: {adUnitId}.";
}
/*