Beispiel #1
0
    void GiveCoinToUserAfterWatchingAds()
    {
        int jmlCoinsNow = PlayerPrefs.GetInt(PlayerPrefHandler.keyCoin);

        jmlCoinsNow += 1;
        PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, jmlCoinsNow);
        GameManager.GEMUCOINS = jmlCoinsNow;
        if (CoinTimerHandler.instance)
        {
            CoinTimerHandler.instance.countCoin = jmlCoinsNow;
        }


        Gamestate_Gameplay gs = GameObject.FindGameObjectWithTag("Gamestate").GetComponent <Gamestate_Gameplay>();

        if (gs)
        {
            gs.RefreshAllInfo();
            gs.guiIngame.guiShop.RefreshInfo();
        }
        dialogBox.Show("Info", "You got 1 GemuGold.", false, "", this.gameObject);

        /*GameDataManager.instance.SendPlayResult(
        *       GameDataManager.instance.gameID.ToString(),"0",
        *       jmlCoinsNow.ToString(),
        *       GameManager.EXP.ToString(),
        *       GameManager.getLevelValue().ToString());*/
        GL1Connector.GetInstance().AddBalance(this.gameObject, "", "1", "", "ADS");
    }
    public void BuyEnergy()
    {
        Gamestate_Gameplay gs = GameObject.Find("Gamestate").GetComponent <Gamestate_Gameplay>();

        if (gs == null)
        {
            return;
        }

        int gemucoins = GameManager.GEMUCOINS;

        GameManager.FREECOINS += currentShopContent.Amount;
        if (GameManager.FREECOINS > GameManager.MAX_FREECOIN_FROM_TIMER)
        {
            GameManager.FREECOINS = GameManager.MAX_FREECOIN_FROM_TIMER;
        }
        PlayerPrefs.SetInt("freecoins", GameManager.FREECOINS);

        gemucoins -= (int)currentShopContent.Price;
        PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, gemucoins);
        GameManager.GEMUCOINS = gemucoins;

        guiIngame.RefreshFreeEnergyInfo();
        GL1Connector.GetInstance().DecBalance(this.gameObject, currentShopContent.Price.ToString(), "", "CMENERGY" + currentShopContent.Amount.ToString());

        RefreshInfo();

        gs.ShowDialogBox("Info", "You just bought " + currentShopContent.Amount + " Energy", false, "confirm", this.gameObject);
    }
Beispiel #3
0
    public void OnClickRedeem()
    {
        UIButton button = UIButton.current;

        if (button == null)
        {
            return;
        }

        if (button.transform.parent.gameObject.GetComponent <ButtonReward>())
        {
            currReward = button.transform.parent.gameObject.GetComponent <ButtonReward>();
        }

        if (currReward == null)
        {
            return;
        }
        Gamestate gs = GameObject.FindGameObjectWithTag("Gamestate").GetComponent <Gamestate> ();

        if (gs)
        {
            string url = "https://www.gemugemu.com/redeem.htm?token=" + GL1Connector.GetInstance().GetToken() + "&email=" + GL1Connector.GetInstance().GetCurrUser();
            Application.OpenURL(url);
            //gs.ShowDialogBox("Confirmation","Redeem "+currReward.tiket+" Ticket ?",true,"redeemreward",this.gameObject);
        }
    }
Beispiel #4
0
    public void OnConfirmRedeem()
    {
        if (currReward == null)
        {
            return;
        }

        GL1Connector.GetInstance().Redeem(this.gameObject, currReward.kode, this.gameObject);
        currReward = null;
    }
 public void OnGL1Done(JSONNode N)
 {
     if (GL1Connector.GetInstance().GetLastURL().Contains("promo"))
     {
         if (N["errcode"].ToString() == "\"0\"")
         {
             dialogBox.Show("Info", "Promo success", false, "", this.gameObject);
         }
         else
         {
             dialogBox.Show("Info", N["errdetail"], false, "", this.gameObject);
         }
     }
 }
Beispiel #6
0
    private void OnRatePopUpClose(AndroidDialogResult result)
    {
        switch (result)
        {
        case AndroidDialogResult.RATED:
            PlayerPrefs.SetInt(PlayerPrefHandler.keyRateUs, 1);
            buttonRateUs.gameObject.SetActive(false);
            int jmlCoinsNow = PlayerPrefs.GetInt(PlayerPrefHandler.keyCoin);
            jmlCoinsNow += 5;
            PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, jmlCoinsNow);

            GL1Connector.GetInstance().AddBalance(this.gameObject, "0", "5", "", "RATE");

            /*int jmlTiketNow = PlayerPrefs.GetInt(PlayerPrefHandler.keyUserTiket);
             * jmlTiketNow += 100;
             * PlayerPrefs.SetInt(PlayerPrefHandler.keyUserTiket, jmlTiketNow);*/

            if (CoinTimerHandler.instance)
            {
                CoinTimerHandler.instance.countCoin = jmlCoinsNow;
            }

            /*GameDataManager.instance.SendPlayResult(
            *       GameDataManager.instance.gameID.ToString(),"100",
            *       jmlCoinsNow.ToString(),
            *       GameManager.EXP.ToString(),
            *       GameManager.getLevelValue().ToString());*/

            Gamestate_Gameplay gs = GameObject.FindGameObjectWithTag("Gamestate").GetComponent <Gamestate_Gameplay>();
            if (gs)
            {
                gs.RefreshAllInfo();
                gs.guiIngame.guiShop.RefreshInfo();
            }

            dialogBox.Show("Info", "You got 5 GemuGold.", false, "", this.gameObject);

            break;

        case AndroidDialogResult.REMIND:
            break;

        case AndroidDialogResult.DECLINED:
            break;
        }

        //AN_PoupsProxy.showMessage("Result", result.ToString() + " button pressed");
    }
    public void ProcessBuyPowerup()
    {
        powerUpAch = true;
        Gamestate_Gameplay gs = GameObject.Find("Gamestate").GetComponent <Gamestate_Gameplay>();

        if (gs == null)
        {
            return;
        }

        int gemucoins = GameManager.GEMUCOINS;

        gemucoins -= (int)currentShopContent.Price;
        PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, gemucoins);
        GameManager.GEMUCOINS = gemucoins;

        int    iAmount = 0;
        string sKey    = currentShopContent.name + "_Amount";

        if (PlayerPrefs.HasKey(sKey))
        {
            iAmount = PlayerPrefs.GetInt(sKey);
        }

        Debug.LogError("[GUI_Shop] sKey=" + sKey + " amount=" + iAmount);
        iAmount += currentShopContent.Amount;
        PlayerPrefs.SetInt(sKey, iAmount);
        Debug.LogError("[GUI_Shop] sKey=" + sKey + " amount=" + iAmount);
        guiIngame.RefreshPowerUpsInfo();
        guiIngame.RefreshGemuCoinInfo();
        RefreshInfo();
        //gs.achievementManager.OnAchievementEvent(AchievementType.PowerPlay,1);

        gs.ShowDialogBox("Info", "You just bought 1 " + currentShopContent.Name + " Power-Up", false, "confirmAch", null);
//		if ( PlayerPrefs.HasKey(sKey) )
//		{
//			iAmount = PlayerPrefs.GetInt(sKey);
//			Debug.LogError("[GUI_Shop] sKey="+sKey+" amount="+iAmount);
//		}

        GL1Connector.GetInstance().DecBalance(null, currentShopContent.Price.ToString(), "", "CMPOWERUP" + currentShopContent.Price.ToString());
    }
 public void OnClickPromo()
 {
     GL1Connector.GetInstance().Promo(this.gameObject, inputKode.value);
 }
Beispiel #9
0
    public void OnGL1Done(JSONNode N)
    {
        if (GL1Connector.GetInstance().GetLastURL().Contains("reward"))
        {
            Debug.LogError("ProcessRewardList amount=" + N.Count);
            int indexReward = 0;
            foreach (JSONNode nChild in N.Childs)
            {
                Transform targetChild = null;
                for (int i = 0; i < scrollView.transform.childCount; i++)
                {
                    Transform child = scrollView.transform.GetChild(i);
                    //Debug.LogError("child.name="+child.name+" "+" kode="+nChild["kode"]);
                    if (child && child.name.Equals(nChild ["kode"]))
                    {
                        targetChild = child;
                        break;
                    }
                }

                if (targetChild == null)
                {
                    Debug.LogError("instantiate");
                    GameObject ob = (GameObject)Instantiate(prefabContent);
                    ob.name                    = nChild ["kode"];
                    targetChild                = ob.transform;
                    ob.transform.parent        = scrollView.transform;
                    ob.transform.localPosition = new Vector3(0, 230 - (indexReward * 230), 0);
                    ob.transform.localScale    = Vector3.one;

                    Transform trIcon = targetChild.Find("Icon");
                    if (trIcon)
                    {
                        UIButton buttonRedeem = trIcon.gameObject.GetComponent <UIButton> ();
                        if (buttonRedeem)
                        {
                            buttonRedeem.onClick.Add(new EventDelegate(this, "OnClickRedeem"));
                        }

                        WWW_Texture wwwTexture = trIcon.gameObject.GetComponent <WWW_Texture> ();
                        if (wwwTexture)
                        {
                            wwwTexture.StartDownloadImage(nChild ["gambar"]);
                        }
                    }

                    indexReward++;
                }

                if (targetChild)
                {
                    ButtonReward reward = targetChild.GetComponent <ButtonReward> ();
                    reward.nama   = nChild ["nama"];
                    reward.kode   = nChild ["kode"];
                    reward.des    = nChild ["des"];
                    reward.gambar = nChild ["gambar"];
                    reward.tiket  = int.Parse(nChild ["tiket"]);
                    GameManager.SetNGUILabel(targetChild.Find("Label Title"), nChild ["nama"]);
                    GameManager.SetNGUILabel(targetChild.Find("Label Desc"), nChild ["des"]);
                    GameManager.SetNGUILabel(targetChild.Find("Label Ticket Amount"), nChild ["tiket"]);
                }
            }
        }
        else if (GL1Connector.GetInstance().GetLastURL().Contains("redeem"))
        {
            if (N["errcode"].ToString() == "\"0\"")
            {
                guiDialogBox.Show("Info", "Redeem success", false, "", this.gameObject);
            }
            else
            {
                guiDialogBox.Show("Info", N["errdetail"], false, "", this.gameObject);
            }
        }
    }
Beispiel #10
0
 void Awake()
 {
     instance = this;
 }