提交项目

This commit is contained in:
2026-05-28 15:23:36 +08:00
commit 3cfc77d12b
5726 changed files with 554351 additions and 0 deletions
@@ -0,0 +1,397 @@
//
//
// using System.Collections;
// using UnityEngine;
// using AppsFlyerSDK;
// using System.Collections.Generic;
// using ZooMatch;
// using Unity.Advertisement.IosSupport;
// using System;
// using DG.Tweening;
//
// namespace IgnoreOPS
// {
//
//
// internal class AppsFlyerObjectScript1 : MonoBehaviour, IAppsFlyerConversionData
// {
// public string appID = null;
// public bool is_init = false;
//
// public Coroutine m_Coroutine;
// void Start()
// {
// AddListener();
// AppsFlyer.setIsDebug(true);
// #if UNITY_IOS && !UNITY_EDITOR
// appID = "6745081004";
// m_Coroutine = CrazyAsyKit.StartCoroutine(loopWaitInitAf());
//
// #endif
//
//
// #if UNITY_EDITOR
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// #endif
// }
// private void AddListener()
// {
// NetworkDispatcher.Instance.AddListener(NetworkMsg.NotNetwork, RequestLogin);
// }
//
// private void RemoveListener()
// {
// NetworkDispatcher.Instance.RemoveListener(NetworkMsg.NotNetwork, RequestLogin);
// }
// void RequestLogin(object obj = null)
// {
// if (GameHelper.IsConnect())
// {
// GameDispatcher.Instance.Dispatch(GameMsg.Network_reconnection);
// }
//
// CrazyAsyKit.StopCoroutine(m_Coroutine);
//
// m_Coroutine = CrazyAsyKit.StartCoroutine(loopWaitInitAf());
// }
//
// void OnDestroy() {
// RemoveListener();
// }
//
// public IEnumerator loopWaitInitAf()
// {
// // Debug.Log($"barry !GameHelper.IsConnect()==== {!GameHelper.IsConnect()}");
//
// #if !FlowerPowerRelease
// GameHelper.ShowTips($"is link network{GameHelper.IsConnect()}");
// #endif
// if (!GameHelper.IsConnect())
// {
// Action action = () =>
// {
// DOVirtual.DelayedCall(0.5f, ()=>
// {
// // NetworkDispatcher.Instance.Dispatch(NetworkMsg.NotNetwork);
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// });
// };
// UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open,action);
// yield return null;
// }
//
// var reqData = new RespLoginFunnelData
// {
// type = "afSend",
// payload = ""
// };
// NetworkKit.PostFunnelLogin(reqData);
//
// float a = 0;
// if (ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
// ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
// {
// ATTrackingStatusBinding.RequestAuthorizationTracking();
// }
//
//
// while ((ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
// ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED) && (a < 5.0f))
// {
// a += 0.5f;
// yield return new WaitForSeconds(0.5f);
// }
//
// AppsFlyer.initSDK("MoPyHQ7ZLXpqouczgQkNdU", appID, this);
// AppsFlyer.startSDK();
// AppsFlyer.AFLog("8888888888888888888", ATTrackingStatusBinding.GetAuthorizationTrackingStatus().ToString());
// //yield return new WaitForSeconds(0.5f);
//
// }
//
// public void onConversionDataSuccess(string conversionData)
// {
// if (is_init) return;
// is_init = true;
// AppsFlyer.AFLog("onConversionDataSuccess", conversionData);
// Debug.Log("hunxiao0000000000000000000000-1");
// var conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
// var json = SerializeUtil.ToJsonIndented(conversionDataDictionary);
// // Debug.Log("hunxiao0000000000000000000000-2");
// SuperApplication.Instance.attribution =
// conversionDataDictionary.TryGetValue("af_status", out var afStatus)
// ? afStatus.ToString().ToLower()
// : "organic";
//
// // Debug.Log("hunxiao0000000000000000000000");
// // if (GameHelper.IsConnect())
// // {
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// // }
//
// var reqData = new RespLoginFunnelData
// {
// type = "afRecv",
// payload = "success"
// };
// NetworkKit.PostFunnelLogin(reqData);
// }
//
// public void onConversionDataFail(string error)
// {
// if (is_init) return;
// is_init = true;
// AppsFlyer.AFLog("onConversionDataFail", error);
// Debug.Log("hunxiao0000000000000000000000-2");
// // if (GameHelper.IsConnect())
// // {
// NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// // }
//
// var reqData = new RespLoginFunnelData
// {
// type = "afRecv",
// payload = "fail"
// };
// NetworkKit.PostFunnelLogin(reqData);
// }
//
// public void onAppOpenAttribution(string attributionData)
// {
// AppsFlyer.AFLog("onAppOpenAttribution", attributionData);
// Dictionary<string, object> attributionDataDictionary =
// AppsFlyer.CallbackStringToDictionary(attributionData);
// }
//
// public void onAppOpenAttributionFailure(string error)
// {
// AppsFlyer.AFLog("onAppOpenAttributionFailure", error);
// }
// }
// }
//
// // using System.Collections;
// // using UnityEngine;
// // using System.Collections.Generic;
// // using Unity.Advertisement.IosSupport;
// // using ZooMatch;
// // using System;
// // using DG.Tweening;
// // using Unity.VisualScripting;
// // namespace IgnoreOPS
// // {
// //
// // public class AppsFlyerObjectScript1 : MonoBehaviour
// // {
// // public string appID = null;
// // public bool is_init = false;
// //
// // public Coroutine m_Coroutine;
// // void Start()
// // {
// //
// // AddListener();
// //
// // // AppsFlyer.setIsDebug(true);
// // #if UNITY_IOS && !UNITY_EDITOR
// // appID = "6739028047";
// // m_Coroutine = CrazyAsyKit.StartCoroutine(loopWaitInitAf());
// // CrazyAsyKit.StartCoroutine(loopCheckAdjustState());
// // // NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// //
// // #endif
// //
// // #if UNITY_EDITOR || UNITY_ANDROID
// // NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// // #endif
// //
// // }
// // private void AddListener()
// // {
// // NetworkDispatcher.Instance.AddListener(NetworkMsg.NotNetwork, RequestLogin);
// // }
// //
// // private void RemoveListener()
// // {
// // NetworkDispatcher.Instance.RemoveListener(NetworkMsg.NotNetwork, RequestLogin);
// // }
// // void RequestLogin(object obj = null)
// // {
// // if (GameHelper.IsConnect())
// // {
// // GameDispatcher.Instance.Dispatch(GameMsg.Network_reconnection);
// // }
// //
// // CrazyAsyKit.StopCoroutine(m_Coroutine);
// //
// // m_Coroutine = CrazyAsyKit.StartCoroutine(loopWaitInitAf());
// // }
// // void OnDestroy()
// // {
// // RemoveListener();
// // }
// //
// // IEnumerator loopWaitInitAf()
// // {
// // if (!GameHelper.IsConnect())
// // {
// // Action action = () =>
// // {
// // DOVirtual.DelayedCall(0.5f, () =>
// // {
// // NetworkDispatcher.Instance.Dispatch(NetworkMsg.NotNetwork);
// // });
// // };
// // UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.TipsViewUI_Open, action);
// // yield return null;
// // }
// //
// //
// // sendEventToServer("afSend");
// // float a = 0;
// // #if !UNITY_EDITOR && UNITY_IOS
// //
// // if (ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
// // ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
// // {
// // ATTrackingStatusBinding.RequestAuthorizationTracking();
// // }
// //
// //
// // while ((ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
// // ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)&& (a < 5.0f))
// // {
// // a += 0.5f;
// // yield return new WaitForSeconds(0.5f);
// // }
// //
// // #endif
// //
// // AdjustConfig adjustConfig = new AdjustConfig(
// // "g1s03vcg43y8",
// // AdjustEnvironment.Production,
// // (AdjustLogLevel.Verbose == AdjustLogLevel.Suppress));
// // adjustConfig.LogLevel = AdjustLogLevel.Verbose;
// // adjustConfig.IsSendingInBackgroundEnabled = false;
// // adjustConfig.IsDeferredDeeplinkOpeningEnabled = true;
// // adjustConfig.DefaultTracker = "Default";
// // // TODO: URL strategy
// // adjustConfig.IsCoppaComplianceEnabled = false;
// // adjustConfig.IsCostDataInAttributionEnabled = true;
// // adjustConfig.IsPreinstallTrackingEnabled = false;
// // adjustConfig.PreinstallFilePath = "";
// // adjustConfig.IsAdServicesEnabled = true;
// // adjustConfig.IsIdfaReadingEnabled = true;
// // adjustConfig.IsLinkMeEnabled = false;
// // adjustConfig.IsSkanAttributionEnabled = true;
// // adjustConfig.SessionSuccessDelegate += SuccessDelegate;
// // adjustConfig.SessionFailureDelegate += (a) =>
// // {
// // ///sendEventToServer("afRecv", "fail");
// // };
// // //adjustConfig.AttributionChangedDelegate += SuccessDelegate;
// // a = 0;
// // Adjust.InitSdk(adjustConfig);
// // while (SaveData.GetSaveobject().attribution == "null" && (a < 5.0f))
// // {
// // a += 0.5f;
// // yield return new WaitForSeconds(0.5f);
// // }
// // NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// // sendEventToServer("afRecv", "success");
// // // AppsFlyer.initSDK("eVgvrvwfbFeuRrC69EpX6j", appID, this);
// // // AppsFlyer.startSDK();
// // //AppsFlyer.AFLog("8888888888888888888", ATTrackingStatusBinding.GetAuthorizationTrackingStatus().ToString());
// // //yield return new WaitForSeconds(0.5f);
// //
// // }
// // void SuccessDelegate(AdjustSessionSuccess AdjustSessionSuccess)
// // {//adjust成功回调,每个设备只会触发第一次
// // Debug.Log("[Adjust]----" + "成功回调");
// // Adjust.GetAttribution(attribution =>
// // {
// // SuperApplication.Instance.attribution = attribution.Network;
// // SaveData.GetSaveobject().attribution = attribution.Network;
// // SaveData.saveDataFunc();
// //
// // });
// // Adjust.GetAdid((adid) =>
// // {
// // Debug.Log(adid + "+++++++++++++++++++++++++++++");
// // PlayerPrefs.SetString("adjust_adid", adid);
// //
// // });
// //
// // }
// //
// // IEnumerator loopCheckAdjustState()
// // {
// //
// //
// //
// // #if !UNITY_EDITOR && UNITY_IOS
// //
// //
// // Adjust.IsEnabled(isEnabled =>
// // {
// // Debug.Log("[Adjust]----启用" + isEnabled);
// //
// // });
// //
// // yield return new WaitForSeconds(0.1f);
// //
// //
// // #else
// // yield return null;
// // #endif
// //
// //
// // }
// // // public void onConversionDataSuccess(string conversionData)
// // // {
// // // if (is_init) return;
// // // is_init = true;
// // // AppsFlyer.AFLog("onConversionDataSuccess", conversionData);
// // // var conversionDataDictionary = AppsFlyer.CallbackStringToDictionary(conversionData);
// // // var json = SerializeUtil.ToJsonIndented(conversionDataDictionary);
// //
// // // SuperApplication.Instance.attribution =
// // // conversionDataDictionary.TryGetValue("af_status", out var afStatus)
// // // ? afStatus.ToString().ToLower()
// // // : "organic";
// // // NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// // // sendEventToServer("afRecv","success");
// // // }
// //
// // // public void onConversionDataFail(string error)
// // // {
// // // if (is_init) return;
// // // is_init = true;
// // // AppsFlyer.AFLog("onConversionDataFail", error);
// // // NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
// // // sendEventToServer("afRecv","fail");
// // // }
// //
// // private void sendEventToServer(string _type, string _payload = "")
// // {
// // var reqData = new RespLoginFunnelData
// // {
// // type = _type,
// // payload = _payload
// // };
// // NetworkKit.PostFunnelLogin(reqData);
// // }
// //
// // // public void onAppOpenAttribution(string attributionData)
// // // {
// // // AppsFlyer.AFLog("onAppOpenAttribution", attributionData);
// // // Dictionary<string, object> attributionDataDictionary =
// // // AppsFlyer.CallbackStringToDictionary(attributionData);
// // // }
// //
// // // public void onAppOpenAttributionFailure(string error)
// // // {
// // // AppsFlyer.AFLog("onAppOpenAttributionFailure", error);
// // // }
// // }
// // }
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e7069d4622d7c4f4bbc84bcdfd341f10
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+462
View File
@@ -0,0 +1,462 @@
using System;
using System.Collections;
using System.Collections.Generic;
using RGKT2NIYSDK;
// using AppsFlyerSDK;
// using AppsFlyerSDK;
using UnityEngine;
using UnityEngine.Events;
namespace ZooMatch
{
public class MaxADKit
{
public static string SDKKey =
"N79bseJJqX7mlVAcld9x4vkF6mm8a6pZaJhzMauN934y1f5KIDr2QVDrRhuJFgtL9POreELZVuwUTs9dAdZiSp";
public static string interstitialADUnitID = "83d1339b89e7e791";
public static string rewardedADUnitID = "f7fbcf0b6c8d02b2";
private const float RevenueThreshold = 0f;
public static Dictionary<string, string> adCallbackInfo;
public static void Init()
{
#if !UNITY_EDITOR
//注册 ab事件,0或1,0为自然量版本,1为激励版本
RGKT2NIYSDKUtility.Instance.RegistIosParam(i =>
{
SuperApplication.Instance.attribution = i == 0 ? "organic" : "non-organic";
// SuperApplication.Instance.attribution = "non-organic";
Debug.Log($"ios ab param: {i} attribution: {SuperApplication.Instance.attribution}");
NetworkDispatcher.Instance.Dispatch(NetworkMsg.Login);
});
void GameConfig(bool result, string config)
{
Debug.Log($"************** game config result: {config}, result: {result}");
}
RGKT2NIYSDKUtility.Instance.Init(null,null,GameConfig);
#endif
// MaxSdkCallbacks.OnSdkInitializedEvent += sdkConfiguration =>
// {
// InitializeRewardedAds();
// InitializeInterstitialAds();
// };
//
//
// MaxSdk.SetSdkKey(SDKKey);
//
// // var loginModel = GameHelper.GetLoginModel();
// // user_id = loginModel.uid.ToString();
// // MaxSdk.SetUserId(loginModel.uid.ToString());
// // MaxSdk.SetIsAgeRestrictedUser(false);
// MaxSdk.SetHasUserConsent(true);
// MaxSdk.SetDoNotSell(false);
//
// MaxSdk.InitializeSdk();
//
// // MaxSdk.ShowMediationDebugger();
// #if !UNITY_EDITOR
// MBridgeSDKManager.initialize("368295", "fc0155e8f6e8bda23b06d22414379609");
// #endif
adCallbackInfo = new Dictionary<string, string>();
}
public static void SetUserID(string userID)
{
user_id = userID;
MaxSdk.SetUserId(user_id);
}
#region 广
public static bool CheckInter()
{
var isReady = RGKT2NIYSDKUtility.Instance.IsInterReady();
return isReady;
}
public static UnityAction<bool> onInterstitialAdCompleted = null;
public static void ShowInterstitial(string placement = "DefaultInterstitial",
UnityAction<bool> onCompleted = null)
{
if (CheckInter())
{
Debug.Log($"插屏广告已经准备好,播放");
RGKT2NIYSDKUtility.Instance.ShowInter(placement, (() =>
{
onCompleted?.Invoke(true);
}));
}
else
{
Debug.Log($"插屏广告未准备好");
onCompleted?.Invoke(false);
}
// if (MaxSdk.IsInterstitialReady(interstitialADUnitID))
// {
// Debug.Log($"广告已经准备好,播放");
// MaxSdk.ShowInterstitial(interstitialADUnitID, placement);
// onInterstitialAdCompleted = onCompleted;
//
// }
// else
// {
// Debug.Log($"广告未准备好,不播放");
//
// onCompleted?.Invoke(false);
// }
}
static int retryAttemptInterstitial;
public static void InitializeInterstitialAds()
{
MaxSdkCallbacks.Interstitial.OnAdLoadedEvent += OnInterstitialLoadedEvent;
MaxSdkCallbacks.Interstitial.OnAdLoadFailedEvent += OnInterstitialLoadFailedEvent;
MaxSdkCallbacks.Interstitial.OnAdDisplayedEvent += OnInterstitialDisplayedEvent;
MaxSdkCallbacks.Interstitial.OnAdClickedEvent += OnInterstitialClickedEvent;
MaxSdkCallbacks.Interstitial.OnAdHiddenEvent += OnInterstitialHiddenEvent;
MaxSdkCallbacks.Interstitial.OnAdDisplayFailedEvent += OnInterstitialAdFailedToDisplayEvent;
MaxSdkCallbacks.Interstitial.OnAdRevenuePaidEvent += OnInterstitialAdRevenueEvent;
LoadInterstitial();
}
private static void LoadInterstitial()
{
MaxSdk.LoadInterstitial(interstitialADUnitID);
}
private static void OnInterstitialLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
retryAttemptInterstitial = 0;
NetworkKit.BuriedPoint(BuriedPointEvent.video_type, BuriedPointEvent.Interstitial_videos_fill_number, 1);
}
private static void OnInterstitialLoadFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
{
retryAttemptInterstitial++;
double retryDelay = Math.Pow(2, Math.Min(6, retryAttemptInterstitial));
CrazyAsyKit.StartAction("LoadInterstitial", LoadInterstitial, (float)retryDelay);
}
private static void OnInterstitialDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
}
private static void OnInterstitialAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo,
MaxSdkBase.AdInfo adInfo)
{
LoadInterstitial();
}
private static void OnInterstitialClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
}
private static void OnInterstitialHiddenEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
LoadInterstitial();
onInterstitialAdCompleted?.Invoke(true);
onInterstitialAdCompleted = null;
}
#endregion
#region 广
private static bool CheckReward()
{
var isReady = RGKT2NIYSDKUtility.Instance.IsVideoReady();
return isReady;
}
private static UnityAction<bool> onVideoAdCompleted = null;
private static string _placement = "";
private static Coroutine _waitForVideoAd = null;
public static void ShowVideo(string placement = "DefaultVideo", UnityAction<bool> onCompleted = null)
{
// onVideoAdCompleted = onCompleted;
// _placement = placement;
#if UNITY_EDITOR
onVideoAdCompleted?.Invoke(true);
#else
NetworkKit.BuriedPoint(BuriedPointEvent.video_behavior,BuriedPointEvent.watch_ad_people,1);
NetworkKit.BuriedPoint(BuriedPointEvent.video_type,BuriedPointEvent.Rewarded_videos_trigger_number,1);
if (CheckReward())
{
Debug.Log($"激励广告已经准备好, 播放");
RGKT2NIYSDKUtility.Instance.ShowRewardVideo(placement, b =>
{
Debug.Log($"reward video result: {b}");
onCompleted?.Invoke(b);
}, () =>
{
Debug.Log("激励广告关闭");
});
}
else
{
Debug.Log($"广告未准备好");
onCompleted?.Invoke(false);
}
// if (MaxSdk.IsRewardedAdReady(rewardedADUnitID))
// {
// MaxSdk.ShowRewardedAd(rewardedADUnitID, _placement);
// }
// else
// {
// if (_waitForVideoAd != null)
// {
// CrazyAsyKit.StopCoroutine(_waitForVideoAd);
// }
// _waitForVideoAd = CrazyAsyKit.StartCoroutine(WaitForVideoAd());
// }
#endif
}
private static IEnumerator WaitForVideoAd()
{
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Open);
var count = 0;
var result = false;
while (count < 6)
{
if (MaxSdk.IsRewardedAdReady(rewardedADUnitID))
{
result = true;
MaxSdk.ShowRewardedAd(rewardedADUnitID, _placement);
break;
}
count++;
yield return new WaitForSeconds(0.5f);
}
if (!result)
{
onVideoAdCompleted?.Invoke(result);
}
UICtrlDispatcher.Instance.Dispatch(UICtrlMsg.PayloadingUI_Close);
_waitForVideoAd = null;
}
static int retryAttempt;
public static void InitializeRewardedAds()
{
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;
MaxSdkCallbacks.Rewarded.OnAdRevenuePaidEvent += OnRewardedAdRevenueEvent;
LoadRewardedAd();
}
private static void LoadRewardedAd()
{
MaxSdk.LoadRewardedAd(rewardedADUnitID);
}
private static void OnInterstitialAdRevenueEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
// #if !ZooMatchRelease
// Debug.Log("OnInterstitialAdRevenueEvent: " + adInfo.Revenue);
// GameHelper.AdOverRevenueEvent(2, 0.1f);
// #endif
OnAdRevenuePaidEvent(adUnitId, adInfo, 2);
}
private static void OnRewardedAdRevenueEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
// #if !ZooMatchRelease
// Debug.Log("OnInterstitialAdRevenueEvent: " + adInfo.Revenue);
// GameHelper.AdOverRevenueEvent(1, 0.1f);
// #endif
OnAdRevenuePaidEvent(adUnitId, adInfo, 1);
}
public static string user_id = "";
private static void OnAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo, int adType)
{
//string countryCode = MaxSdk.GetSdkConfiguration().CountryCode; // "US" for the United States, etc - Note: Do not confuse this with currency code which is "USD"
// //string networkName = adInfo.NetworkName; // Display name of the network that showed the ad
// // string adUnitIdentifier = adInfo.AdUnitIdentifier; // The MAX Ad Unit ID
// //string placement = adInfo.Placement; // The placement this ad's postbacks are tied to
if (adInfo.Revenue > 0)
{
GameHelper.AdOverRevenueEvent(adType,(float)adInfo.Revenue);
var revenue = adInfo.Revenue;
//adjust上传广告收益时,不判断是否大于0.1,只要大于0都上传
// AdjustEvent adjustEvent = new AdjustEvent("nytwjm");
// adjustEvent.SetRevenue(revenue, "USD");
// Adjust.TrackEvent(adjustEvent);
}
SaveData.GetSaveobject().watchRewardAD_value += adInfo.Revenue;
SaveData.GetSaveobject().watchRewardADnumbers++;
SaveData.saveDataFunc();
// if (SaveData.GetSaveobject().watchRewardADnumbers == 1)
// {
// AdjustEvent adjustEvent = new AdjustEvent("96ny5o");
// adjustEvent.SetRevenue(SaveData.GetSaveobject().watchRewardAD_value, "USD");
// Adjust.TrackEvent(adjustEvent);
// }
// else if (SaveData.GetSaveobject().watchRewardADnumbers == 5)
// {
// AdjustEvent adjustEvent = new AdjustEvent("5zai0n");
// adjustEvent.SetRevenue(SaveData.GetSaveobject().watchRewardAD_value, "USD");
// Adjust.TrackEvent(adjustEvent);
// }
// else if (SaveData.GetSaveobject().watchRewardADnumbers == 10)
// {
// AdjustEvent adjustEvent = new AdjustEvent("9510hf");
// adjustEvent.SetRevenue(SaveData.GetSaveobject().watchRewardAD_value, "USD");
// Adjust.TrackEvent(adjustEvent);
// }
// int highSend;
// if (!PlayerPrefs.HasKey($"sendHighRevenue_{user_id}"))
// {
// highSend = 0; // 如果不存在,则初始化为 0
// }
// else
// {
// highSend = PlayerPrefs.GetInt($"sendHighRevenue_{user_id}", 0); // 从 PlayerPrefs 中获取
// }
// // 判断是否需要发送高收入事件
// // Debug.Log($"highSend=====: {highSend}");
// if (highSend == 0)
// {
// float limitNum = GameHelper.GetCommonModel().afSendLimit;
// var totalNum = Convert.ToDouble(PlayerPrefs.GetString($"adRevenueTotal_{user_id}", "0"));
// totalNum += adInfo.Revenue;
// // Debug.Log($"totalNum=====: {totalNum} {limitNum}");
// if (totalNum >= limitNum)
// {
// GameHelper.sendHighRevenueToAF(); // 发送高收入事件
// PlayerPrefs.SetInt($"sendHighRevenue_{user_id}", 1); // 标记已发送
// }
// else
// {
// PlayerPrefs.SetString($"adRevenueTotal_{user_id}", totalNum.ToString());
// }
// }
/*
ATTRIBUTION_PLATFORM_APPSFLYER = "AppsFlyer";
ATTRIBUTION_PLATFORM_ADJUST = "Adjust";
ATTRIBUTION_PLATFORM_TENJIN = "Tenjin";
ATTRIBUTION_PLATFORM_SINGULAR = "Singular";
ATTRIBUTION_PLATFORM_KOCHAVA = "Kochava";
ATTRIBUTION_PLATFORM_BRANCH = "Branch";
ATTRIBUTION_PLATFORM_REYUN = "Reyun";
ATTRIBUTION_PLATFORM_SOLAR_ENGINE = "SolarEngine";
...
...
*/
//这里需要改成自己的归因平台名称,这里以Adjust为例,"userid"替换为归因平台UID
MBridgeRevenueParamsEntity mBridgeRevenueParamsEntity = new MBridgeRevenueParamsEntity(MBridgeRevenueParamsEntity.ATTRIBUTION_PLATFORM_ADJUST, PlayerPrefs.GetString("adjust_adid", "default"));
///MaxSdkBase.AdInfo类型的adInfo
mBridgeRevenueParamsEntity.SetMaxAdInfo(adInfo);
MBridgeRevenueManager.Track(mBridgeRevenueParamsEntity);
}
private static void OnRewardedAdLoadedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
retryAttempt = 0;
NetworkKit.BuriedPoint(BuriedPointEvent.AD_event, $"{BuriedPointEvent.AdLoadCode}Succeed", 1, false);
}
private static void OnRewardedAdLoadFailedEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo)
{
retryAttempt++;
double retryDelay = Math.Pow(2, Math.Min(3, retryAttempt));
NetworkKit.BuriedPoint(BuriedPointEvent.AD_event, $"{BuriedPointEvent.AdLoadCode}{errorInfo.Code}", 1, false);
CrazyAsyKit.StartAction("LoadRewardedAd", LoadRewardedAd, (float)retryDelay);
}
private static void OnRewardedAdDisplayedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
NetworkKit.BuriedPoint(BuriedPointEvent.AD_event, $"{BuriedPointEvent.ADShowCode}Succeed", 1, false);
}
private static void OnRewardedAdFailedToDisplayEvent(string adUnitId, MaxSdkBase.ErrorInfo errorInfo,
MaxSdkBase.AdInfo adInfo)
{
NetworkKit.BuriedPoint(BuriedPointEvent.AD_event, $"{BuriedPointEvent.ADShowCode}{errorInfo.Code}", 1, false);
LoadRewardedAd();
}
private static void OnRewardedAdClickedEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
}
private static void OnRewardedAdHiddenEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
Debug.Log("RewardedAdHiddenEvent---0");
LoadRewardedAd();
if (_hasReceivedReward && onVideoAdCompleted != null)
{
onVideoAdCompleted?.Invoke(true);
}
onVideoAdCompleted = null;
_hasReceivedReward = false;
Debug.Log("RewardedAdHiddenEvent---1-" + GameHelper.IsGiftSwitch() + " remove:" + SaveData.GetSaveobject().is_get_removead + " rewardinsertion:" +GameHelper.GetCommonModel().rewardinsertion );
if (GameHelper.IsGiftSwitch() && !SaveData.GetSaveobject().is_get_removead && (UnityEngine.Random.Range(0, 100) < GameHelper.GetCommonModel().rewardinsertion))
{
Debug.Log("RewardedAdHiddenEvent---2-");
NetworkKit.BuriedPoint(BuriedPointEvent.Apple_pay_event, BuriedPointEvent.afterRewardAdShow, 1);
GameHelper.ShowInterstitial("AfterReward");
}
}
private static bool _hasReceivedReward = false;
private static void OnRewardedAdReceivedRewardEvent(string adUnitId, MaxSdk.Reward reward,
MaxSdkBase.AdInfo adInfo)
{
_hasReceivedReward = true;
}
private static void OnRewardedAdRevenuePaidEvent(string adUnitId, MaxSdkBase.AdInfo adInfo)
{
}
#endregion
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d3991d0dfc5a46ddbb4a020f0c5e0abf
timeCreated: 1704883729