namespace Guru { using System; public partial class GuruSDK { /// /// 回调参数类 /// public class Callbacks { /// /// APP 事件 /// public static class App { private static Action _onAppPaused; public static event Action OnAppPaused { add => _onAppPaused += value; remove => _onAppPaused -= value; } internal static void InvokeOnAppPaused(bool isPaused) { _onAppPaused?.Invoke(isPaused); } private static Action _onAppQuit; public static event Action OnAppQuit { add => _onAppQuit += value; remove => _onAppQuit -= value; } internal static void InvokeOnAppQuit() { _onAppQuit?.Invoke(); } } /// /// GDPR Consent /// public static class ConsentFlow { /// /// 当Consent启动结束后返回状态码 /// public static event Action OnConsentResult { add => _onConsentResult += value; remove => _onConsentResult -= value; } private static Action _onConsentResult; internal static void InvokeOnConsentResult(int code) { _onConsentResult?.Invoke(code); } /// /// ATT 状态返回 /// public static event Action OnAttResult { add => _onAttResult += value; remove => _onAttResult -= value; } private static Action _onAttResult; internal static void InvokeOnAttResultCallback(int code) { _onAttResult?.Invoke(code); } } /// /// 广告回调 /// public static class Ads { private static Action _onAdsInitComplete; public static event Action OnAdsInitComplete { add => _onAdsInitComplete += value; remove => _onAdsInitComplete -= value; } internal static void InvokeOnAdsInitComplete() { _onAdsInitComplete?.Invoke(); } //------------ BANNER ----------------- private static Action _onBannerADStartLoad; public static event Action OnBannerADStartLoad { add => _onBannerADStartLoad += value; remove => _onBannerADStartLoad -= value; } internal static void InvokeOnBannerADStartLoad(string adUnitId) { _onBannerADStartLoad?.Invoke(adUnitId); } private static Action _onBannerADLoaded; public static event Action OnBannerADLoaded { add => _onBannerADLoaded += value; remove => _onBannerADLoaded -= value; } internal static void InvokeOnBannerADLoaded() { _onBannerADLoaded?.Invoke(); } //------------ INTER ----------------- private static Action _onInterstitialADStartLoad; public static event Action OnInterstitialADStartLoad { add => _onInterstitialADStartLoad += value; remove => _onInterstitialADStartLoad -= value; } internal static void InvokeOnInterstitialADStartLoad(string adUnitId) { _onInterstitialADStartLoad?.Invoke(adUnitId); } private static Action _onInterstitialADLoaded; public static event Action OnInterstitialADLoaded { add => _onInterstitialADLoaded += value; remove => _onInterstitialADLoaded -= value; } internal static void InvokeOnInterstitialADLoaded() { _onInterstitialADLoaded?.Invoke(); } private static Action _onInterstitialADFailed; public static event Action OnInterstitialADFailed { add => _onInterstitialADFailed += value; remove => _onInterstitialADFailed -= value; } internal static void InvokeOnInterstitialADFailed() { _onInterstitialADFailed?.Invoke(); } private static Action _onInterstitialADClosed; public static event Action OnInterstitialADClosed { add => _onInterstitialADClosed += value; remove => _onInterstitialADClosed -= value; } internal static void InvokeOnInterstitialADClosed() { _onInterstitialADClosed?.Invoke(); } //------------ REWARD ----------------- private static Action _onRewardedADStartLoad; public static event Action OnRewardedADStartLoad { add => _onRewardedADStartLoad += value; remove => _onRewardedADStartLoad -= value; } internal static void InvokeOnRewardedADStartLoad(string adUnitId) { _onRewardedADStartLoad?.Invoke(adUnitId); } private static Action _onRewardedADLoaded; public static event Action OnRewardedADLoaded { add => _onRewardedADLoaded += value; remove => _onRewardedADLoaded -= value; } internal static void InvokeOnRewardedADLoaded() { _onRewardedADLoaded?.Invoke(); } private static Action _onRewardADClosed; public static event Action OnRewardedADClosed { add => _onRewardADClosed += value; remove => _onRewardADClosed -= value; } internal static void InvokeOnRewardADClosed() { _onRewardADClosed?.Invoke(); } private static Action _onRewardADFailed; public static event Action OnRewardADFailed { add => _onRewardADFailed += value; remove => _onRewardADFailed -= value; } internal static void InvokeOnRewardADFailed() { _onRewardADFailed?.Invoke(); } } /// /// 云控参数 /// public static class Remote { private static Action _onRemoteFetchComplete; public static event Action OnRemoteFetchComplete { add => _onRemoteFetchComplete += value; remove => _onRemoteFetchComplete -= value; } internal static void InvokeOnRemoteFetchComplete(bool success) { _onRemoteFetchComplete?.Invoke(success); } } /// /// 支付回调 /// public static class IAP { private static Action _onIAPInitStart; public static event Action OnIAPInitStart { add => _onIAPInitStart += value; remove => _onIAPInitStart -= value; } internal static void InvokeOnIAPInitStart() { _onIAPInitStart?.Invoke(); } private static Action _onIAPInitComplete; public static event Action OnIAPInitComplete { add => _onIAPInitComplete += value; remove => _onIAPInitComplete -= value; } internal static void InvokeOnIAPInitComplete(bool success) { _onIAPInitComplete?.Invoke(success); } private static Action _onPurchaseStart; public static event Action OnPurchaseStart { add => _onPurchaseStart += value; remove => _onPurchaseStart -= value; } internal static void InvokeOnPurchaseStart(string productId) { _onPurchaseStart?.Invoke(productId); } private static Action _onPurchaseEnd; public static event Action OnPurchaseEnd { add => _onPurchaseEnd += value; remove => _onPurchaseEnd -= value; } internal static void InvokeOnPurchaseEnd(string productId, bool success) { _onPurchaseEnd?.Invoke(productId, success); } private static Action _onPurchaseFailed; public static event Action OnPurchaseFailed { add => _onPurchaseFailed += value; remove => _onPurchaseFailed -= value; } internal static void InvokeOnPurchaseFailed(string productId, string error) { _onPurchaseFailed?.Invoke(productId, error); } private static Action _onIAPRestored; public static event Action OnIAPRestored { add => _onIAPRestored += value; remove => _onIAPRestored -= value; } internal static void InvokeOnIAPRestored(bool success, string productId) { _onIAPRestored?.Invoke(success, productId); } } public static class SDK { private static Action _onFirebaseReady; public static event Action OnFirebaseReady { add => _onFirebaseReady += value; remove => _onFirebaseReady -= value; } internal static void InvokeOnFirebaseReady(bool success) { _onFirebaseReady?.Invoke(success); } private static Action _onGuruServiceReady; public static event Action OnGuruServiceReady { add => _onGuruServiceReady += value; remove => _onGuruServiceReady -= value; } internal static void InvokeOnGuruServiceReady() { _onGuruServiceReady?.Invoke(); } private static Action _onDebuggerDisplayed; public static event Action OnDisplayDebugger { add => _onDebuggerDisplayed += value; remove => _onDebuggerDisplayed -= value; } internal static void InvokeOnDebuggerDisplayed(bool success) { _onDebuggerDisplayed?.Invoke(success); } private static Action _onUserAuthResult; public static event Action OnGuruUserAuthResult { add => _onUserAuthResult += value; remove => _onUserAuthResult -= value; } internal static void InvokeOnGuruUserAuthResult(bool success) { _onUserAuthResult?.Invoke(success); } private static Action _onFirebaseUserAuthResult; public static event Action OnFirebaseUserAuthResult { add => _onFirebaseUserAuthResult += value; remove => _onFirebaseUserAuthResult -= value; } internal static void InvokeOnFirebaseAuthResult(bool success) { _onFirebaseUserAuthResult?.Invoke(success); } // DeepLink 回调 private static Action _onDeeplinkCallback; public static event Action OnDeeplinkCallback { add => _onDeeplinkCallback += value; remove => _onDeeplinkCallback -= value; } internal static void InvokeDeeplinkCallback(string deeplink) { _onDeeplinkCallback?.Invoke(deeplink); } } } } }