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 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); } } }
IEnumerator Sending(WWW www) { yield return(www); if (www.error == null) { JSONNode data = JSONNode.Parse(www.text); string status = data ["gamedata"] ["status"]; string currGameVer = data["gamedata"]["version"]; string desc = ""; if (currGameVer != game_ver) { status = "2"; } switch (status) { case "0": desc = "Server is disabled. Please try again later"; break; case "1": Debug.Log("enabled"); break; case "2": desc = "Please update to the latest version"; break; case "3": desc = "Under maintenance. Please try again later"; break; } if (status != "1") { guiDialogBox.Show("Info", desc, false, "checkver" + status, this.gameObject); } } else { Debug.Log("WWW error! " + www.error); } }
public void ShowDialogBox(string sTitle, string sText, bool bCancel, string sExec, GameObject sender) { guiDialogBox.Show(sTitle, sText, bCancel, sExec, sender); guiDialogBox.PlayAudio(guiDialogBox.audioError); }
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); } } }