private IEnumerator DQItemList()
    {
        string  url  = Link.url + "DQuest";
        WWWForm form = new WWWForm();

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

        yield return(www);

        if (www.error == null)
        {
            Debug.Log(www.text);
            var jsonString = JSON.Parse(www.text);
            //PlayerPrefs.SetString (Link.FOR_CONVERTING, jsonString["ID_SHOP_SPECIAL"]);
            if (int.Parse(jsonString["code"]) == 1)
            {
                for (int x = 0; x < int.Parse(jsonString["count"]); x++)
                {
                    int lol    = 0;
                    var number = int.TryParse(jsonString["data"][x]["Quest_Done"], out lol);

                    if (number)
                    {
                        if (lol == 1)
                        {
                            string String = jsonString["data"][x]["Type"];
                            if (String == "Summon")
                            {
                                PlayerPrefs.SetString("SummonMissionStats", "FALSE");
                            }
                            if (String == "SingleMode")
                            {
                                PlayerPrefs.SetString("SoloMissionStats", "FALSE");
                            }
                            if (String == "Catch")
                            {
                                PlayerPrefs.SetString("CatchMissionStats", "FALSE");
                            }
                        }
                        else
                        {
                            string String = jsonString["data"][x]["Type"];
                            if (String == "Summon")
                            {
                                PlayerPrefs.SetString("SummonMissionStats", "TRUE");
                                PlayerPrefs.SetString("SummonMissionQD", jsonString["data"][x]["ID"]);
                            }
                            if (String == "SingleMode")
                            {
                                PlayerPrefs.SetString("SoloMissionStats", "TRUE");
                                PlayerPrefs.SetString("SoloMissionQD", jsonString["data"][x]["ID"]);
                            }
                            if (String == "Catch")
                            {
                                PlayerPrefs.SetString("CatchMissionStats", "TRUE");
                                PlayerPrefs.SetString("CatchMissionQD", jsonString["data"][x]["ID"]);
                            }
                        }
                        //     Debug.Log(PlayerPrefs.GetString("SoloMissionQD"));
                    }
                    else
                    {
                    }
                }
            }
            else
            {
                Debug.Log("NoMission");
            }
            yield return(new WaitForSeconds(1f));

            Application.LoadLevel(Link.Home);
            SceneManagerHelper.LoadMusic("Home");
        }
        else
        {
            Debug.Log(www.text);
            Debug.Log("NoMission");
        }
    }
    // The coroutine runs on its own at the same time as Update() and takes an integer indicating which scene to load.
    IEnumerator LoadNewScene()
    {
        // This line waits for 3 seconds before executing the next line in the coroutine.
        // This line is only necessary for this demo. The scenes are so simple that they load too fast to read the "Loading..." text.
        yield return(new WaitForSeconds(2));

        // Start an asynchronous operation to load the scene that was passed to the LoadNewScene coroutine.
        if (Application.loadedLevelName == "Opening")
        {
            if (PlayerPrefs.GetString(Link.STATUS_LOGIN) == "true")
            {
                if (PlayerPrefs.GetString(Link.LOGIN_BY) == "EMAIL")
                {
                    StartCoroutine(loginIEnumerator(PlayerPrefs.GetString(Link.EMAIL), PlayerPrefs.GetString(Link.PASSWORD), "EMAIL"));
                }
                else if (PlayerPrefs.GetString(Link.LOGIN_BY) == "FB")
                {
                    StartCoroutine(loginIEnumerator(PlayerPrefs.GetString(Link.EMAIL), PlayerPrefs.GetString(Link.PASSWORD), "FB"));
                }
                else if (PlayerPrefs.GetString(Link.LOGIN_BY) == "Google")
                {
                    StartCoroutine(loginIEnumerator(PlayerPrefs.GetString(Link.EMAIL), PlayerPrefs.GetString(Link.PASSWORD), "Google"));
                }
                yield return(new WaitForSeconds(2));
            }
            else
            {
                SceneManagerHelper.LoadMusic(scene);
                async = Application.LoadLevelAsync(scene);
            }
        }
        else
        {
            SceneManagerHelper.LoadMusic(scene);
            async = Application.LoadLevelAsync(scene);
        }
        //yield return async;

        // While the asynchronous operation to load the new scene is not yet complete, continue waiting until it's done.
        if (async != null)
        {
            async.allowSceneActivation = false;
            while (async.progress < 0.9f)
            {
                // Report progress etc.
                GambarLoad.gameObject.transform.FindChild("Image").GetComponent <Image> ().fillAmount = async.progress;
                progress = "Progress: " + async.progress.ToString();
                yield return(null);
            }
            // Show the UI button to actually start loaded level
            doneLoading = true;
            while (!allowLoading)
            {
                // Wait for allow button to be pushed.

                progress = "Progress: " + async.progress.ToString();
                GambarLoad.gameObject.transform.FindChild("Image").GetComponent <Image> ().fillAmount = 1;
                yield return(null);
            }
            // Allow the activation of the scene again.
            async.allowSceneActivation = true;
        }
    }
    private IEnumerator loginIEnumerator(string email, string pass, string login_by)
    {
        string  url  = Link.url + "login";
        WWWForm form = new WWWForm();

        form.AddField(Link.DEVICE_ID, device_id);
        form.AddField(Link.EMAIL, email);
        form.AddField(Link.PASSWORD, pass);
        form.AddField("Version", version);

        WWW www = new WWW(url, form);

        yield return(www);

        if (www.error == null)
        {
            var jsonString = JSON.Parse(www.text);
            Debug.Log(jsonString);
            PlayerPrefs.SetInt("informasiServer", int.Parse(jsonString["code"]));

            switch (PlayerPrefs.GetInt("informasiServer"))
            {
            case 1:
                async = Application.LoadLevelAsync("Home");
                SceneManagerHelper.LoadMusic("Home");
                if (int.Parse(jsonString["data"]["tfinish"]) == 0)
                {
                    PlayerPrefs.SetString("PLAY_TUTORIAL", "TRUE");
                }
                else
                {
                    //PlayerPrefs.DeleteKey ("Tutorialman");
                    PlayerPrefs.SetString("PLAY_TUTORIAL", "FALSE");
                }

                PlayerPrefs.SetString(Link.ID, jsonString["data"]["id"]);
                PlayerPrefs.SetString(Link.LOGIN_BY, login_by);
                PlayerPrefs.SetString(Link.STATUS_LOGIN, "true");
                PlayerPrefs.SetString(Link.EMAIL, jsonString["data"]["email"]);
                PlayerPrefs.SetString(Link.USER_NAME, jsonString["data"]["user_name"]);
                PlayerPrefs.SetString(Link.FULL_NAME, jsonString["data"]["full_name"]);
                PlayerPrefs.SetString(Link.AP, jsonString["data"]["ap"]);
                PlayerPrefs.SetString(Link.AR, jsonString["data"]["ar"]);
                PlayerPrefs.SetString(Link.PASSWORD, pass);
                PlayerPrefs.SetString(Link.DEVICE_ID, device_id);
                PlayerPrefs.SetString(Link.Stage, jsonString["data"]["Stage"]);
                PlayerPrefs.SetString(Link.IBURU, jsonString["data"]["iklan_buru"]);
                PlayerPrefs.SetString(Link.IGOLD, jsonString["data"]["iklan_gold"]);
                PlayerPrefs.SetString(Link.IENERGY, jsonString["data"]["iklan_energy"]);
                //
                PlayerPrefs.SetString("BonusEnergy", jsonString["data"]["BonusEnergy"]);
                //
                var energy = int.Parse(jsonString["data"]["energy"]) + int.Parse(jsonString["data"]["BonusEnergy"]);
                PlayerPrefs.SetString("EnergyCombo", energy.ToString());
                PlayerPrefs.SetString("curexp", jsonString["data"]["xpp"]);
                PlayerPrefs.SetString("tarexp", jsonString["data"]["targetexplevel"]);
                PlayerPrefs.SetString(Link.ENERGY, jsonString["data"]["energy"]);
                PlayerPrefs.SetString("MaxE", jsonString["data"]["MaxEnergy"]);
                PlayerPrefs.SetString("PlayerLevel", jsonString["data"]["PlayerLevel"]);
                PlayerPrefs.SetString(Link.GOLD, jsonString["data"]["coin"]);
                PlayerPrefs.SetString(Link.SOUL_STONE, jsonString["data"]["soulstone"]);

                PlayerPrefs.SetString(Link.COMMON, jsonString["data"]["common"]);
                PlayerPrefs.SetString(Link.RARE, jsonString["data"]["rare"]);
                PlayerPrefs.SetString(Link.LEGENDARY, jsonString["data"]["legendary"]);
                if (login_by != "FB")
                {
                    int hasil;
                    var hasilnya = int.TryParse(jsonString["data"]["image"], out hasil);
                    if (hasilnya)
                    {
                        PlayerPrefs.DeleteKey("Base64PictureProfile");
                    }
                    else
                    {
                        StartCoroutine(showAvatar());
                    }
                }
                StartCoroutine(DQItemList());
                //   StartCoroutine(AchievementList());

                break;

            case 2:
                //         StartCoroutine(AnimasiInformasiServer("Wrong Password"));
                break;

            case 3:
                //        StartCoroutine(AnimasiInformasiServer("Email Not Registered Yet. Please Register"));
                break;

            case 4:
                //       StartCoroutine(AnimasiInformasiServer("This User Already Login On Another Device"));
                break;

            case 5:
                //      StartCoroutine(AnimasiInformasiServer("Invalid Email Format"));
                break;

            case 6:
                //      StartCoroutine(AnimasiInformasiServer("Check Your Email for Verification"));
                break;

            case 71:
                async = Application.LoadLevelAsync(scene);

                //	StartCoroutine (AnimasiInformasiServer("Please Update to the newest version"));
                //				PlayerPrefs.DeleteKey(Link.LOGIN_BY);
                //				PlayerPrefs.DeleteKey(Link.STATUS_LOGIN);
                //Application.OpenURL(jsonString ["Url"]);
                break;

            default:
                async = Application.LoadLevelAsync(scene);

                //     StartCoroutine(AnimasiInformasiServer("Something Wrong. Try Again Later"));
                break;
            }
        }
        else
        {
            //       StartCoroutine(AnimasiInformasiServer("Something Wrong. Try Again Later"));
        }
    }