/// <summary> /// 初始化广告 /// </summary> private void InitialAds() { TGSDK.Initialize(); TGSDK.PreloadAd(); TGSDK.AdRewardSuccessCallback = OnAdRewardSuccess; TGSDK.AdRewardFailedCallback = OnAdRewardFailed; }
void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else { Debug.Log("Already have AdScript."); Destroy(gameObject); return; } TGSDK.SetDebugModel(true); TGSDK.SDKInitFinishedCallback = (string msg) => { TGSDK.TagPayingUser(TGPayingUser.TGMediumPaymentUser, "CNY", 0, 0); Log("TGSDK finished : " + msg); Debug.Log("TGSDK GetUserGDPRConsentStatus = " + TGSDK.GetUserGDPRConsentStatus()); TGSDK.SetUserGDPRConsentStatus("yes"); Debug.Log("TGSDK GetIsAgeRestrictedUser = "******"no"); float bannerHeight = (float)(Screen.height) * 0.123f; TGSDK.SetBannerConfig("OSL4KTuf4BoLhG0y0yF", "TGBannerNormal", 0, Display.main.systemHeight - bannerHeight, Display.main.systemWidth, bannerHeight, 30); //TGSDK.SetBannerConfig("banner1", "TGBannerNormal", 0, Display.main.systemHeight - 2 * bannerHeight, Display.main.systemWidth, bannerHeight, 30); //TGSDK.SetBannerConfig("banner2", "TGBannerNormal", 0, Display.main.systemHeight - 3 * bannerHeight, Display.main.systemWidth, bannerHeight, 30); }; #if UNITY_IOS && !UNITY_EDITOR TGSDK.Initialize("hP7287256x5z1572E5n7"); #elif UNITY_ANDROID && !UNITY_EDITOR TGSDK.Initialize("2I064Z57Ha35k123CpX3"); //59t5rJH783hEQ3Jd7Zqr #endif Invoke("PreloadAd", 0.5f); }
public void PlayReviveAD(System.Action <string> action, System.Action <string> closeaction) { #if UNITY_EDITOR action(""); closeaction(""); return; #endif #if TGSDK int noad = PlayerPrefs.GetInt("noad", 0); if (noad == 1) { action(""); closeaction(""); return; } if (TGSDK.CouldShowAd(ADSCENEID_REVIVE)) { TGSDK.ShowAd(ADSCENEID_REVIVE); } TGSDK.PreloadAd(); isAdLoaded = false; TGSDK.AdRewardSuccessCallback = action; TGSDK.AdCloseCallback = closeaction; #endif }
public void PreloadAd() { TGSDK.PreloadAdSuccessCallback = (string msg) => { Log("PreloadAdSuccessCallback : " + msg); scenes = Regex.Split(msg, ",", RegexOptions.IgnoreCase); sceneNames = new string[scenes.Length]; for (int i = 0; i < scenes.Length; i++) { string scene = scenes[i]; string sceneName = TGSDK.GetSceneNameById(scene); sceneNames[i] = sceneName + "(" + scene.Substring(0, 4) + ")"; } RefreshSceneId(); }; TGSDK.PreloadAdFailedCallback = (string msg) => { Log("PreloadAdFailedCallback : " + msg); }; TGSDK.CPAdLoadedCallback = (string msg) => { Log("CPAdLoadedCallback : " + msg); }; TGSDK.VideoAdLoadedCallback = (string msg) => { Log("VideoAdLoadedCallback : " + msg); }; TGSDK.AdShowSuccessCallback = (string msg) => { Log("AdShowSuccessCallback : " + msg); }; TGSDK.AdShowFailedCallback = (string msg) => { Log("AdShowFailedCallback : " + msg); }; TGSDK.AdCompleteCallback = (string msg) => { Log("AdCompleteCallback : " + msg); }; TGSDK.AdCloseCallback = (string msg) => { Log("AdCloseCallback : " + msg); }; TGSDK.AdClickCallback = (string msg) => { Log("AdClickCallback : " + msg); }; TGSDK.AdRewardSuccessCallback = (string msg) => { Log("AdRewardSuccessCallback 0 : " + msg); }; TGSDK.AdRewardFailedCallback = (string msg) => { Log("AdRewardFailedCallback : " + msg); }; TGSDK.BannerLoadedCallback = (string scene, string ad) => { Log("BannerLoadedCallback : " + scene + ", " + ad); }; TGSDK.BannerFailedCallback = (string scene, string ad, string err) => { Log("BannerFailedCallback : " + scene + ", " + ad + ", " + err); }; TGSDK.BannerClickCallback = (string scene, string ad) => { Log("BannerClickCallback : " + scene + ", " + ad); }; TGSDK.BannerCloseCallback = (string scene, string ad) => { Log("BannerCloseCallback : " + scene + ", " + ad); }; TGSDK.PreloadAd(); }
void Awake() { TGSDK.Initialize("590d8Nf94oTc30109Ga1"); TGSDK.PreloadAd(); TGSDK.PreloadAdFailedCallback = (string obj) => { TGSDK.PreloadAd(); }; }
public void PreloadAd() { TGSDK.PreloadAdSuccessCallback = (string msg) => { Log("PreloadAdSuccessCallback : " + msg); scenes = Regex.Split(msg, ",", RegexOptions.IgnoreCase); foreach (string scene in scenes) { Log(string.Format("TGSDK Scene [{0}] Parameter [intParam] = {1}", scene, TGSDK.GetIntParameterFromAdScene(scene, "intParam", -44) )); Log(string.Format("TGSDK Scene [{0}] Parameter [floatParam] = {1}", scene, TGSDK.GetFloatParameterFromAdScene(scene, "floatParam", -44.44f) )); Log(string.Format("TGSDK Scene [{0}] Parameter [stringParam] = {1}", scene, TGSDK.GetStringParameterFromAdScene(scene, "stringParam", "NONE") )); Log(string.Format("TGSDK Scene [{0}] Parameter [imageParam] = {1}", scene, TGSDK.GetStringParameterFromAdScene(scene, "imageParam") )); } RefreshSceneId(); }; TGSDK.PreloadAdFailedCallback = (string msg) => { Log("PreloadAdFailedCallback : " + msg); }; TGSDK.CPAdLoadedCallback = (string msg) => { Log("CPAdLoadedCallback : " + msg); }; TGSDK.VideoAdLoadedCallback = (string msg) => { Log("VideoAdLoadedCallback : " + msg); }; TGSDK.AdShowSuccessCallback = (string msg) => { Log("AdShowSuccessCallback : " + msg); }; TGSDK.AdShowFailedCallback = (string msg) => { Log("AdShowFailedCallback : " + msg); }; TGSDK.AdCompleteCallback = (string msg) => { Log("AdCompleteCallback : " + msg); }; TGSDK.AdCloseCallback = (string msg) => { Log("AdCloseCallback : " + msg); }; TGSDK.AdClickCallback = (string msg) => { Log("AdClickCallback : " + msg); }; TGSDK.AdRewardSuccessCallback = (string msg) => { Log("AdRewardSuccessCallback : " + msg); }; TGSDK.AdRewardFailedCallback = (string msg) => { Log("AdRewardFailedCallback : " + msg); }; TGSDK.PreloadAd(); }
void Awake() { instance = this; TGSDK.Initialize(appID); TGSDK.PreloadAd(); TGSDK.PreloadAdFailedCallback = (string obj) => { TGSDK.PreloadAd(); }; }
void Awake() { TGSDK.SetDebugModel(true); TGSDK.SDKInitFinishedCallback = SDKInitFinishedCallback; #if UNITY_IOS && !UNITY_EDITOR TGSDK.Initialize("hP7287256x5z1572E5n7"); #elif UNITY_ANDROID && !UNITY_EDITOR TGSDK.Initialize("59t5rJH783hEQ3Jd7Zqr"); #endif }
// Use this for initialization public void ADManagerInit() { #if UNITY_EDITOR isAdLoaded = true; #endif TGSDK.Initialize(ADAPPID); TGSDK.PreloadAd(); // 视频类广告已准备好 TGSDK.VideoAdLoadedCallback = OnVideoAdLoaded; }
void UpdateButton() { if (TGSDK.CouldShowAd(TZ_TGSDK.doubleID)) { doublegold.interactable = true; } else { doublegold.interactable = false; } }
//显示广告 public void ShowAds() { if (TGSDK.CouldShowAd(_adsID)) { TGSDK.ShowAd(_adsID); } else { _NoNet.GetComponent <Text>().text = "Please check your network."; _NoNet.SetActive(true); } }
void PreloadAdSuccessCallback(string msg) { Debug.Log("PreloadAdSuccessCallback : " + msg); scenes = Regex.Split(msg, ",", RegexOptions.IgnoreCase); sceneNames = new string[scenes.Length]; for (int i = 0; i < scenes.Length; i++) { string scene = scenes[i]; string sceneName = TGSDK.GetSceneNameById(scene); sceneNames[i] = sceneName + "(" + scene.Substring(0, 4) + ")"; } }
void Start() { AutoPopOffline(); if (TGSDK.CouldShowAd(TZ_TGSDK.doubleID)) { offlineDouble.interactable = true; } else { offlineDouble.interactable = false; } }
void Awake() { TGSDK.SetDebugModel(true); TGSDK.SDKInitFinishedCallback = (string msg) => { TGSDK.TagPayingUser(TGPayingUser.TGMediumPaymentUser, "CNY", 0, 0); Log("TGSDK finished : " + msg); }; #if UNITY_IOS && !UNITY_EDITOR TGSDK.Initialize("hP7287256x5z1572E5n7"); #elif UNITY_ANDROID && !UNITY_EDITOR TGSDK.Initialize("59t5rJH783hEQ3Jd7Zqr"); #endif }
public void ShowAd() { string sceneid = scenes[sceneIndex]; if (TGSDK.CouldShowAd(sceneid)) { TGSDK.ShowAd(sceneid); } else { Log("Scene " + sceneid + " could not to show"); } }
public void ShowAD(int sceneIndex) { this.sceneIndex = sceneIndex; string sceneid = scenes[sceneIndex]; if (TGSDK.CouldShowAd(sceneid)) { TGSDK.ShowAd(sceneid); } else { Debug.Log("Scene " + sceneid + " could not to show"); } }
void SDKInitFinishedCallback(string msg) { TGSDK.TagPayingUser(TGPayingUser.TGMediumPaymentUser, "CNY", 0, 0); Debug.Log("TGSDK GetUserGDPRConsentStatus = " + TGSDK.GetUserGDPRConsentStatus()); TGSDK.SetUserGDPRConsentStatus("yes"); Debug.Log("TGSDK GetIsAgeRestrictedUser = "******"no"); float bannerHeight = (float)(Screen.height) * 0.123f; TGSDK.SetBannerConfig("banner0", "TGBannerNormal", 0, Display.main.systemHeight - bannerHeight, Display.main.systemWidth, bannerHeight, 30); TGSDK.SetBannerConfig("banner1", "TGBannerNormal", 0, Display.main.systemHeight - 2 * bannerHeight, Display.main.systemWidth, bannerHeight, 30); TGSDK.SetBannerConfig("banner2", "TGBannerNormal", 0, Display.main.systemHeight - 3 * bannerHeight, Display.main.systemWidth, bannerHeight, 30); PreloadAd(); }
/// <summary> /// 当在充值界面点击了广告 /// </summary> public void OnClickShowAds() { //广告成功加载 if (TGSDK.CouldShowAd(_adsID)) { TGSDK.ShowAd(_adsID); } //广告没被加载 else { _NoNet.SetActive(true); } }
public void OnFreeReGameBtn() { if (TGSDK.CouldShowAd(TGSDKManager.resetLevelID)) { TGSDK.ShowAd(TGSDKManager.resetLevelID); TGSDK.AdCloseCallback = (string obj) => { gameStartScript.ChangeLevel(); }; } else { TipPop.GenerateTip("no ads", 0.5f); } }
public void PlayGameOverAD() { int noad = PlayerPrefs.GetInt("noad", 0); if (noad == 1) { return; } if (TGSDK.CouldShowAd(ADSCENEID_GAMEOVER)) { TGSDK.ShowAd(ADSCENEID_GAMEOVER); } TGSDK.PreloadAd(); isAdLoaded = false; }
private void Awake() { TGSDK.Initialize(); TGSDK.PreloadAd(); TGSDK.AdRewardSuccessCallback = OnAdRewardSuccess; TGSDK.AdRewardFailedCallback = OnAdRewardFailed; Instance = this; CreatePlayer(); _player = GameObject.FindGameObjectWithTag(_Data._tagPlayer); _playerCollider = _player.GetComponent <CapsuleCollider>(); _playerMovement = _player.GetComponent <PlayerMovement>(); InitialPlayer(); }
public void OnFreeMissionBtn() { if (TGSDK.CouldShowAd(TGSDKManager.resetDailyID)) { TGSDK.ShowAd(TGSDKManager.resetDailyID); TGSDK.AdCloseCallback = (string obj) => { PlayerPrefs.SetInt("freeMission", 1); UpdateMission(); }; } else { TipPop.GenerateTip("no ads", 1f); } }
//看广告免费得钻石 public void OnFreeBtn() { if (TGSDK.CouldShowAd(TGSDKManager.freeDiamondId)) { TGSDK.ShowAd(TGSDKManager.freeDiamondId); TGSDK.AdCloseCallback = (string obj) => { Diamond.Instance.GetDiamond(25); MoneyManager.Instance.UpdateDiamond(); }; } else { TipPop.GenerateTip("no ads", 0.5f); } }
public void UpdateGold() { if (messageCount == 0) { int min = OfflineTime(); if (min > 0) { float goldMutiple = 1; if (PlayerPrefs.GetInt("fishingpass", 0) == 1) { goldMutiple = 0.2f; } VipReward(); GameObject popBG = (GameObject)Resources.Load("PopBG"); Transform doubleTrans = popBG.transform.Find("double"); doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️2"; if (!TGSDK.CouldShowAd(TGSDKManager.doubleID)) { doubleTrans.GetComponent <Button> ().interactable = false; } else { doubleTrans.GetComponent <Button> ().interactable = true; } MessageBox.Show("OFFLINE", "$" + UIManager.UnitChange(min * PlayerPrefs.GetInt("valueOffline", 40))); PlayerPrefs.SetInt("offlineOnClick", 1); messageCount++; MessageBox.confim = () => { TGSDK.ReportAdRejected(TGSDKManager.doubleID); int gold = PlayerPrefs.GetInt("gold", 0) + (int)(min * PlayerPrefs.GetInt("valueOffline", 40) * (1 + goldMutiple)); OnMessageBoxBtn(gold); PlayerPrefs.SetInt("quitGame", 0); }; MessageBox.doubleR = () => { TGSDK.ShowAdScene(TGSDKManager.doubleID); int gold = PlayerPrefs.GetInt("gold", 0) + (int)(min * PlayerPrefs.GetInt("valueOffline", 40) * 2 * (1 + goldMutiple)); OnMessageBoxBtn(gold); PlayerPrefs.SetInt("quitGame", 0); if (TGSDK.CouldShowAd(TGSDKManager.doubleID)) { TGSDK.ShowAd(TGSDKManager.doubleID); } }; } } }
void Awake() { // 开启Debug模式 TGSDK.SetDebugModel(true); // 宏判断里初始化TGSDK #if UNITY_IOS && !UNITY_EDITOR // 猫宅日记苹果版AppID TGSDK.Initialize("1z525lf2gLH88790fQNZ"); #elif UNITY_ANDROID && !UNITY_EDITOR // 猫宅日记安卓版AppID TGSDK.Initialize("Hg6513A4774EnEf53KTy"); #endif // 预加载广告 TGSDK.PreloadAd(); }
public void ShowAd() { string sceneid = scenes[sceneIndex]; if (TGSDK.CouldShowAd(sceneid)) { TGSDK.ShowAd(sceneid); TGSDK.AdRewardSuccessCallback = (string msg) => { Log("AdRewardSuccessCallback 1 : " + msg); }; } else { Log("Scene " + sceneid + " could not to show"); } }
//先看广告再转转盘 public void OnTurnBtn() { if (PlayerPrefs.GetInt("TurnHomeFinish", 0) == 1) { return; } if (TGSDK.CouldShowAd(TGSDKManager.turnID)) { TGSDK.ShowAd(TGSDKManager.turnID); TGSDK.AdCloseCallback = (string obj) => { turnTable.SetActive(true); }; } else { TipPop.GenerateTip("no ads", 1); } }
public void OnDoubleBtn() { if (TGSDK.CouldShowAd(TGSDKManager.doubleID)) { TGSDK.ShowAd(TGSDKManager.doubleID); TGSDK.AdCloseCallback = (string obj) => { FlyGold.Instance.GenerateGoldNoColl(20, player.position); Gold.Instance.GetGold(passGold); MoneyManager.Instance.UpdateGold(); Time.timeScale = 1; }; } else { TipPop.GenerateTip("no ads", 1f); OnExitBtn(); } }
void Awake() { TGSDK.SetDebugModel(true); TGSDK.SDKInitFinishedCallback = (string msg) => { TGSDK.TagPayingUser(TGPayingUser.TGMediumPaymentUser, "CNY", 0, 0); Log("TGSDK finished : " + msg); Debug.Log("TGSDK GetUserGDPRConsentStatus = " + TGSDK.GetUserGDPRConsentStatus()); TGSDK.SetUserGDPRConsentStatus("yes"); Debug.Log("TGSDK GetIsAgeRestrictedUser = "******"no"); float bannerHeight = (float)(Screen.height) * 0.123f; TGSDK.SetBannerConfig("banner0", "TGBannerNormal", 0, Display.main.systemHeight - bannerHeight, Display.main.systemWidth, bannerHeight, 30); TGSDK.SetBannerConfig("banner1", "TGBannerNormal", 0, Display.main.systemHeight - 2 * bannerHeight, Display.main.systemWidth, bannerHeight, 30); TGSDK.SetBannerConfig("banner2", "TGBannerNormal", 0, Display.main.systemHeight - 3 * bannerHeight, Display.main.systemWidth, bannerHeight, 30); }; TGSDK.Initialize("060SM9304Y92ck861isE"); }
public void GetDoubleOfflineReward() { if (TGSDK.CouldShowAd(TZ_TGSDK.doubleID)) { bool reward = false; TGSDK.ShowAd(TZ_TGSDK.doubleID); TGSDK.AdCloseCallback = (string obj) => { if (reward) { FlyDiamond.Instance.SettleFinish(); Gold.Instance.GetGold(offlineGoldInt * 2); PlaneController.Instance.skill.UpdateText(); offlineGO.SetActive(false); } }; TGSDK.AdRewardSuccessCallback = (string obj) => { reward = true; }; } }