예제 #1
0
    public IEnumerator RedeemReward2(string QuestID, string Obj, string reward)
    {
        string  url  = Link.url + "RedeemReward2";
        WWWForm form = new WWWForm();

        form.AddField("MY_ID", PlayerPrefs.GetString(Link.ID));
        form.AddField("AchievementID", QuestID);
        WWW www = new WWW(url, form);

        yield return(www);

        if (www.error == null)
        {
            var jsonString = JSON.Parse(www.text);
            int kode       = int.Parse(jsonString["code"]);
            if (kode == 1)
            {
                PlayerPrefs.SetString("Crystal", jsonString["data"]["crystal"]);
                Home.GetComponent <Home>().SoulStone.text = jsonString["data"]["crystal"];
                CrystalText.text = jsonString["data"]["crystal"];
                PlayerPrefs.SetString(Obj + QuestID, "FALSE");
                RedeemSucceed.transform.FindChild("Image").transform.FindChild("Text").GetComponent <Text>().text = " Reward Redeemed \nyou got " + reward;
                RedeemSucceed.SetActive(true);
                StartCoroutine(AchievementList());
            }
            else
            {
                Debug.Log("BackSound Jangkrink");
            }
        }
        Debug.Log(www.text);
    }
예제 #2
0
    public IEnumerator RedeemReward(string QuestID, string Obj, string reward)
    {
        string  url  = Link.url + "RedeemReward";
        WWWForm form = new WWWForm();

        form.AddField("MY_ID", PlayerPrefs.GetString(Link.ID));
        form.AddField("QuestID", QuestID);
        WWW www = new WWW(url, form);

        yield return(www);

        if (www.error == null)
        {
            var jsonString = JSON.Parse(www.text);
            int kode       = int.Parse(jsonString["code"]);
            if (kode == 1)
            {
                PlayerPrefs.SetString(Link.GOLD, jsonString["data"]["coin"]);
                Home.GetComponent <Home>().Coin.text     = jsonString["data"]["coin"];
                Home.GetComponent <Home>().CoinShop.text = jsonString["data"]["coin"];
                GoldText.text = jsonString["data"]["coin"];
                if (Obj == "Summon")
                {
                    PlayerPrefs.SetString("SummonMissionStats", "FALSE");
                }
                if (Obj == "Catch")
                {
                    PlayerPrefs.SetString("CatchMissionStats", "FALSE");
                }
                else
                {
                    PlayerPrefs.SetString("SoloMissionStats", "FALSE");
                }
                RedeemSucceed.transform.FindChild("Image").transform.FindChild("Text").GetComponent <Text>().text = " Reward Redeemed \nyou got " + reward;
                RedeemSucceed.SetActive(true);
                StartCoroutine(DQItemList());
            }
            else
            {
                Debug.Log("BackSound Jangkrink");
            }
        }
        Debug.Log(www.text);
    }