using System; using System.Collections; using System.Collections.Generic; using Newtonsoft.Json; using ZrZYFo6bYXYM71YyLSDK; using UnityEngine; using UnityEngine.UI; using Random = UnityEngine.Random; public class ZrZYFo6bYXYM71YyLSDKDemo : MonoBehaviour { public void ShowReward() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.ShowRewardVideo("TAG", b => { Debug.LogError($"reward result = {b}"); },(() => { Debug.LogError($"reward close!!!"); })); } public void ShowInter() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.ShowInter("TAG", () => { Debug.LogError("inter hide"); }); } public void ShowAdmobInter() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.ShowAdmobInter("TAG", () => { Debug.LogError("inter hide"); }); } public void ShowSplash() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.ShowSplash(); } public void CheckReward(Image btnImg) { var isReady = ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.IsVideoReady(); btnImg.color = isReady ? Color.green : Color.white; Debug.Log($"Reward : {isReady}"); } public void CheckInter(Image btnImg) { var isReady = ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.IsInterReady(); btnImg.color = isReady ? Color.green : Color.white; Debug.Log($"Inter : {isReady}"); } public void CheckSplash(Image btnImg) { var isReady = ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.IsSplashReady(); btnImg.color = isReady ? Color.green : Color.white; Debug.Log($"Splash : {isReady}"); } public void Track() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.Track("test", new Dictionary() { {"evt1", "1"}, {"evt2", "2"}, {"evt3", "3"}, {"evt4", "4"}, {"evt5", "5"}, {"evt6", "6"}, {"evt7", "7"}, {"evt8", "8"}, {"evt9", "9"}, }); } public void GetCountryCode() { var code = ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.GetCountryCode(); Debug.Log($"country : {code}"); } public void ShowH5() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.H5.ShowH5((() => { Debug.Log("H5 close"); }), () => { Debug.Log($"H5 show failed!"); }); } public void ShowH5(RectTransform rectTransform) { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.H5.ShowH5(rectTransform); } public void HideH5() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.H5.HideH5(); } public void CheckShowH5(Image btnImg) { var show = ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.H5.IsShowH5(); btnImg.color = show ? Color.green : Color.red; Debug.Log($"CheckShowH5 : {show}"); } private int _level = 1; public void TrackLevel() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.TrackLevelUp(_level); if (Random.Range(0, 100) < 50) { _level++; } } private string withDrawSceneId = ""; public void GetWithDrawConfigs() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.GetWithDrawConfigs(((b, s) => { Debug.Log($"GetWithDrawConfigs result : {b}, data : {s}"); if (b) { var cfgs = JsonConvert.DeserializeObject>(s); int idx = 0; foreach (WithDrawConfig config in cfgs) { Debug.Log($"index = {idx}, {config.ToString()}"); if (idx == 0) withDrawSceneId = config.SecneId; idx++; } } })); } private int payIndex = 0; public void CreateWithDrawOrder() { string taxNo = ""; string payAccount = "tom@gmail.com"; string accountType = "E"; PaymentTypeCode payCode = PaymentTypeCode.GOPAY; //GOPAY DANA 收款账号需要为电话号码 if (payIndex == 1 || payIndex == 0) { payCode = payIndex == 1 ? PaymentTypeCode.DANA : payCode; payAccount = "0881234567890"; accountType = "P"; } if (payIndex == 2) { // PIX 需要填写税号 payCode = PaymentTypeCode.PIX; taxNo = "99999999999"; } if (payIndex == 3) payCode = PaymentTypeCode.MERCADOPAGO; ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.CreateWithDrawOrder(withDrawSceneId, payCode, payAccount, accountType, "testName", taxNo, b => { Debug.Log($"CreateWithDrawOrder result : {b}"); }); payIndex++; payIndex = payIndex > 3 ? 0 : payIndex; } public void GetWithDrawOrders() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.GetWithDrawOrders(((b, s) => { Debug.Log($"GetWithDrawOrders result : {b}, data : {s}"); if (b) { var cfgs = JsonConvert.DeserializeObject>(s); int idx = 0; foreach (WithDrawOrder config in cfgs) { Debug.Log($"index = {idx}, {config.ToString()}"); idx++; } } })); } // Start is called before the first frame update void Start() { Init(); Invoke("ShowSplash", 5); } // Update is called once per frame void Update() { } private void Init() { ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.RegistIosParam((i => { Debug.Log($"ios ab param : {i}"); })); void GameConfig(bool result, string config) { Debug.Log($"************* game config result : {result}, config : {config}"); } ZrZYFo6bYXYM71YyLSDKCONTROLLER.Instance.Init(null, "app_config", GameConfig); } public static string GetSdkVersion() { return ZrZYFo6bYXYM71YyLSDKCONTROLLER.SdkVersion; } }