Пример #1
0
    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
    }
Пример #2
0
 void UpdateButton()
 {
     if (TGSDK.CouldShowAd(TZ_TGSDK.doubleID))
     {
         doublegold.interactable = true;
     }
     else
     {
         doublegold.interactable = false;
     }
 }
Пример #3
0
 //显示广告
 public void ShowAds()
 {
     if (TGSDK.CouldShowAd(_adsID))
     {
         TGSDK.ShowAd(_adsID);
     }
     else
     {
         _NoNet.GetComponent <Text>().text = "Please check your network.";
         _NoNet.SetActive(true);
     }
 }
Пример #4
0
 void Start()
 {
     AutoPopOffline();
     if (TGSDK.CouldShowAd(TZ_TGSDK.doubleID))
     {
         offlineDouble.interactable = true;
     }
     else
     {
         offlineDouble.interactable = false;
     }
 }
Пример #5
0
    public void ShowAd()
    {
        string sceneid = scenes[sceneIndex];

        if (TGSDK.CouldShowAd(sceneid))
        {
            TGSDK.ShowAd(sceneid);
        }
        else
        {
            Log("Scene " + sceneid + " could not to show");
        }
    }
Пример #6
0
 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);
     }
 }
Пример #7
0
    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");
        }
    }
Пример #8
0
    /// <summary>
    /// 当在充值界面点击了广告
    /// </summary>
    public void OnClickShowAds()
    {
        //广告成功加载
        if (TGSDK.CouldShowAd(_adsID))
        {
            TGSDK.ShowAd(_adsID);
        }

        //广告没被加载
        else
        {
            _NoNet.SetActive(true);
        }
    }
Пример #9
0
 //看广告免费得钻石
 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);
     }
 }
Пример #10
0
 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);
     }
 }
Пример #11
0
    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;
    }
Пример #12
0
    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);
                    }
                };
            }
        }
    }
Пример #13
0
    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");
        }
    }
Пример #14
0
 //先看广告再转转盘
 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);
     }
 }
Пример #15
0
 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();
     }
 }
Пример #16
0
 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;
         };
     }
 }
Пример #17
0
    public void ShowAd()
    {
        string sceneid = sceneId.text;

        if (TGSDK.CouldShowAd(sceneid))
        {
            string cpImagePath = TGSDK.GetCPImagePath(sceneid);
            if (null != cpImagePath)
            {
                Log("cpImagePath : " + cpImagePath);
                TGSDK.ShowCPView(sceneid);
                TGSDK.ReportCPClose(sceneid);
            }
            TGSDK.ShowAd(sceneid);
        }
        else
        {
            Log("Scene " + sceneid + " could not to show");
        }
    }
Пример #18
0
    private bool ShowAd(AdType adtp)
    {
        int i = (int)adtp;

        if (scenes != null && i < scenes.Length)
        {
            string sceneid = scenes[i];
            if (TGSDK.CouldShowAd(sceneid))
            {
                TGSDK.ShowAd(sceneid);
                return(true);
            }
            else
            {
                Log("Scene " + sceneid + " could not to show");
                return(false);
            }
        }
        return(false);
    }
Пример #19
0
 public void OnDoubleBtn()
 {
     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(plane.goldClaim * 2);
                 plane.skill.UpdateText();
                 gameObject.SetActive(false);
                 plane.ReGame();
             }
         };
         TGSDK.AdRewardSuccessCallback = (string obj) => {
             reward = true;
         };
     }
 }
Пример #20
0
        //广告进行展示
        static public void ShowAd(MyAdType myAdType, AdCallBack successCallBack, AdCallBack failCallBack, AdCallBack adRewardFailCallBack)
        {
            // 传入当前广告的播放回调
            TGController.adSuccessCallBack    = successCallBack;
            TGController.adFailureCallBack    = failCallBack;
            TGController.adRewardFailCallBack = adRewardFailCallBack;

            isRewardVedioSuccuss  = false;
            isRewardVedioComplete = false;

            string sceneId = "";

            switch (myAdType)
            {
            case MyAdType.CPAd:
                sceneId = cpAdId;
                break;

            case MyAdType.RewardedVideoAd:
                sceneId = rewardedVideoId;
                break;
            }

            Debug.Log(TGSDK.CouldShowAd(sceneId));

            // 如果可以播放广告,则播放广告
            if (TGSDK.CouldShowAd(sceneId))
            {
                currentAdType = myAdType;
                TGSDK.ShowAd(sceneId);
            }
            else
            {
                if (failCallBack != null)
                {
                    failCallBack(myAdType);
                }
                Debug.Log(sceneId);
            }
        }
Пример #21
0
 public void ShowPauseAd(bool show)
 {
     if (scenes != null && scenes.Length > 0)
     {
         string sceneid = scenes[1];
         if (show)
         {
             if (TGSDK.CouldShowAd(sceneid))
             {
                 TGSDK.ShowAd(sceneid);
             }
             else
             {
                 Log("Scene " + sceneid + " could not to show");
             }
         }
         else
         {
             TGSDK.CloseBanner(sceneid);
         }
     }
 }
Пример #22
0
    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;
                }
                if (MessageBox.Messagebox != null)
                {
                    return;
                }
                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);

                    if (TGSDK.CouldShowAd(TGSDKManager.doubleID))
                    {
                        TGSDK.ShowAd(TGSDKManager.doubleID);
                    }


                    doubleTrans.DOScale(1, 2).OnComplete(() => {
                        GameObject adPop = Instantiate((GameObject)Resources.Load("ADPopBG"), GameObject.Find("Canvas").transform);

                        int gold = PlayerPrefs.GetInt("gold", 0) + (int)(min * PlayerPrefs.GetInt("valueOffline", 40) * 2 * (1 + goldMutiple));


                        Button btn = adPop.transform.Find("sure").GetComponent <Button>();
                        adPop.transform.Find("content").GetComponent <Text>().text = "$" + ((gold - PlayerPrefs.GetInt("gold", 0)) / (2 * (1 + goldMutiple))).ToString();
                        btn.onClick.AddListener(() => {
                            OnMessageBoxBtn(gold);
                            PlayerPrefs.SetInt("quitGame", 0);
                            ProgressManager.Instance.GameWin();
                        });

//						int gold = PlayerPrefs.GetInt ("gold", 0) + (int)(min * PlayerPrefs.GetInt ("valueOffline", 40)*2*(1+goldMutiple));
//						OnMessageBoxBtn(gold);
//						PlayerPrefs.SetInt ("quitGame", 0);
                    });
                };
            }
        }
    }
Пример #23
0
    // Update is called once per frame
    void FixedUpdate()
    {
        if (playerRig.gravityScale != gravityScale)
        {
            playerRig.gravityScale = gravityScale;
        }
        if (ProgressManager.Instance.isRunning)
        {
            if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
            {
                if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved)
                {
                    if (Input.GetTouch(0).deltaPosition.x > 0)
                    {
                        transform.rotation = Quaternion.Euler(0, 0, 0);
                    }
                    if (Input.GetTouch(0).deltaPosition.x < 0)
                    {
                        transform.rotation = Quaternion.Euler(0, 180, 0);
                    }
                    transform.Translate(new Vector3(Input.GetTouch(0).deltaPosition.x *moveSpeed *Time.deltaTime, 0, 0), Space.World);
                }
            }
            else
            {
                if (Input.GetKey(KeyCode.A))
                {
                    transform.rotation = Quaternion.Euler(0, 180, 0);
                    transform.Translate(new Vector3(-moveSpeed * Time.deltaTime, 0, 0), Space.World);
                }
                else if (Input.GetKey(KeyCode.D))
                {
                    transform.rotation = Quaternion.Euler(0, 0, 0);
                    transform.Translate(new Vector3(moveSpeed * Time.deltaTime, 0, 0), Space.World);
                }
            }
            progressSlider.value = transform.position.y;
        }
        if (isSettle)
        {
            if (PlayerPrefs.GetInt("golden_net", 0) == 1)
            {
                HidePopUI(false);
            }
            else
            {
                HidePopUI(true);
            }
            time += Time.deltaTime;
            if (time > settleTime)
            {
                if (fishIndex < settleCount)
                {
                    Transform fish = netParent.GetChild(fishIndex);
                    Settlement(fish, 0.3f);
                    if (PlayerPrefs.GetInt(fish.name.Split(new char[] { '(' }) [0], 0) == 0)
                    {
                        PlayerPrefs.SetInt("illNew", 1);
                    }
                    PlayerPrefs.SetInt(fish.name.Split(new char[] { '(' }) [0], 1);
                    ScoreGenerate(fish);
                }
                else if (fishIndex == settleCount)
                {
                    Transform fish = netParent.GetChild(fishIndex);
                    fish.DOScale(1, 0.3f).OnComplete(() => {
                        fish.GetComponent <SpriteRenderer> ().DOFade(0f, 0.3f);
                        if (fish.childCount > 0)
                        {
                            Destroy(fish.GetChild(0).gameObject);
                        }
                        isSettle = false;

                        GameObject popBG      = (GameObject)Resources.Load("PopBG");
                        Transform doubleTrans = popBG.transform.Find("double");

                        if (PlayerPrefs.GetInt("double", 0) >= 2)
                        {
                            //doubleTrans.DOPunchRotation(new Vector3(100,100,100),1,10,1);
                            //MessageBox.Messagebox.transform.Find("double").DOPunchRotation(new Vector3(1,1,1),1,10,1);
                            int levelIndex = PlayerPrefs.GetInt("Level", 1);
                            if (levelIndex == 1)
                            {
                                doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️3";
                            }
                            if (levelIndex == 2)
                            {
                                doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️4";
                            }
                            if (levelIndex == 3)
                            {
                                doubleTrans.GetComponentInChildren <Text>().text = "Bonus✖️️5";
                            }
                        }
                        //UpdateGoldMutiple ();

                        if (!TGSDK.CouldShowAd(TGSDKManager.doubleID))
                        {
                            doubleTrans.GetComponent <Button> ().interactable = false;
                        }
                        else
                        {
                            doubleTrans.GetComponent <Button> ().interactable = true;
                        }

                        MessageBox.Show("You Earend", "$" + UIManager.UnitChange(goldSum));
                        if (PlayerPrefs.GetInt("double", 0) >= 2)
                        {
                            Transform doubleTrans1 = GameObject.FindGameObjectWithTag("PopBG").transform.Find("double");
                            if (doubleTrans != null)
                            {
                                doubleTrans1.DOPunchRotation(new Vector3(0, 0, 5), 1, 5, 1).SetLoops(100);
                            }
                        }
                        MessageBox.confim = () => {
                            int gold = PlayerPrefs.GetInt("gold", 0) + goldSum * goldMultiple;
                            PlayerPrefs.SetInt("gold", gold);
                            Upgrading.Instance.CheckGold();
                            UpgradingOffline.Instance.CheckGold();
                            ProgressManager.Instance.GameWin();
                            PlayerPrefs.SetInt("double", PlayerPrefs.GetInt("double", 0) + 1);
                        };
                        MessageBox.doubleR = () => {
                            //GameObject popBG = (GameObject)Resources.Load("PopBG");
                            //Transform doubleTrans = popBG.transform.Find("double");
                            string doubleName = doubleTrans.GetComponentInChildren <Text>().text;
                            int gold          = 0;
                            goldSum          *= goldMultiple;
                            if (doubleName == "Bonus✖️️3")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 3;
                            }
                            else if (doubleName == "Bonus✖️️4")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 4;
                            }
                            else if (doubleName == "Bonus✖️️5")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 5;
                            }
                            else if (doubleName == "Bonus✖️️2")
                            {
                                gold = PlayerPrefs.GetInt("gold", 0) + goldSum * 2;
                            }

                            PlayerPrefs.SetInt("gold", gold);
                            Upgrading.Instance.CheckGold();
                            UpgradingOffline.Instance.CheckGold();
                            ProgressManager.Instance.GameWin();
                            PlayerPrefs.SetInt("double", 0);
                            if (TGSDK.CouldShowAd(TGSDKManager.tripleID))
                            {
                                TGSDK.ShowAd(TGSDKManager.tripleID);
                            }
                        };
                    });

                    if (PlayerPrefs.GetInt(fish.name.Split(new char[] { '(' }) [0], 0) == 0)
                    {
                        PlayerPrefs.SetInt("illNew", 1);
                    }
                    PlayerPrefs.SetInt(fish.name.Split(new char[] { '(' }) [0], 1);
                    ScoreGenerate(fish);
                    PlayerPrefs.SetInt("accumulation", PlayerPrefs.GetInt("accumulation", 0) + (int)(goldSum * 0.6f));
                }
                MultiHaptic.HapticLight();
                fishIndex++;
                time = 0;
            }
        }
    }