397 lines
14 KiB
C#
397 lines
14 KiB
C#
//
|
||
//
|
||
// 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);
|
||
// // // }
|
||
// // }
|
||
// // } |