Exemplo n.º 1
0
	void OnGetUserResponse(Restifizer.RestifizerResponse response)
	{
		if (PlayerPrefs.GetString (PlayerPrefHandler.keyUserName) == "")
			return;

		if (response != null && response.Resource != null)
			return;

		Hashtable data = response.Resource;
		
		if ( data["errcode"].ToString() == "0")
		{
			Debug.Log("[GameDataManager] OnGetUserResponse Success");
			Hashtable userdata = (Hashtable)data["userdata"];

			int iCoin = (int)float.Parse(userdata["coin"].ToString());
			PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin,iCoin);

			int iTiket = (int) float.Parse(userdata["tiket"].ToString());
			PlayerPrefs.SetInt(PlayerPrefHandler.keyUserTiket,iTiket);

			coins = iCoin;
			tickets = iTiket;
			if ( CoinTimerHandler.instance )
				CoinTimerHandler.instance.countCoin = coins;

		}
		else
		{
			PlayerPrefs.SetString(PlayerPrefHandler.keyUserName,"");
			PlayerPrefs.SetString(PlayerPrefHandler.keyToken,"");
		}
	}
Exemplo n.º 2
0
 void OnRewardResponse(Restifizer.RestifizerResponse response)
 {
     /*
      * Hashtable data = response.Resource;
      * if (data == null)
      * {
      *      Debug.LogError("No data");
      *      return;
      * }
      */
 }
Exemplo n.º 3
0
    void OnPromoResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            //GameDataManager.instance.LoadData();
        }
        else
        {
            labelResult.text = data["errdetail"].ToString();
        }
    }
    void OnRewardResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            dialogBox.Show("Info", "Your ticket has been redeemed.", false, "", this.gameObject);
        }
        else
        {
            dialogBox.Show("Error", data["errdetail"].ToString(), false, "", this.gameObject);
        }
    }
/*
 *      public void OnRedeem()
 *      {
 *              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 )
 *              {
 *                      gs.ShowDialogBox("Confirmation","Redeem "+currReward.tiket+" Ticket ?",false,"redeemreward",this.gameObject);
 *              }
 *      }
 */
    void OnGetUserResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        //Debug.LogError ("success");
        if (data["errcode"].ToString() == "0")
        {
            Hashtable userdata = (Hashtable)data["userdata"];

            int iTiket = (int)float.Parse(userdata["tiket"].ToString());
            textTix.text = iTiket.ToString();
        }
    }
    void OnRegisterResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            dialogBox.Show("Info", "You have been registered. Please Verify your email before login.", false, "", this.gameObject);
            GUI_Dialog.ReleaseTopCanvas();
        }
        else
        {
            dialogBox.Show("Error", data["errdetail"].ToString(), false, "", this.gameObject);
        }
    }
Exemplo n.º 7
0
    void OnRedeemResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        Debug.LogError("Redeem response");
        if (data["errcode"].ToString() == "0")
        {
            sc_mainmenu_canvas_handler.Instance().ShowDialogBox("Redeem Success", false);
            //GameDataManager.instance.LoadData();
        }
        else
        {
            sc_mainmenu_canvas_handler.Instance().ShowDialogBox(data["errdetail"].ToString(), false);
        }
    }
Exemplo n.º 8
0
	void OnPlayResultResponse(Restifizer.RestifizerResponse response)
	{
		if ( response != null)
		{
		Hashtable data = response.Resource;
		
		if ( data["errcode"].ToString() == "0")
		{
			//Debug.LogError("[GameDataManager] OnPlayResultResponse success");
		}
		else
		{
			Debug.LogError("[GameDataManager] OnPlayResultResponse fail");
		}
		}
	}
Exemplo n.º 9
0
    void OnPromoResponse(Restifizer.RestifizerResponse response)
    {
        Debug.LogError("done");
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "\"0\"")
        {
            dialogBox.Show("Info", "Promo Code has been processed", false, "", this.gameObject);
            //GameDataManager.instance.LoadData();
            OnClickClose();
        }
        else
        {
            dialogBox.Show("Error", data["errdetail"].ToString(), false, "", this.gameObject);
        }
    }
Exemplo n.º 10
0
    void OnGetUserResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            Hashtable userdata = (Hashtable)data["userdata"];

            //txtTiketUser.text = userdata["tiket"].ToString();
        }
        else
        {
            PlayerPrefs.SetString(PlayerPrefHandler.keyUserName, "");
            PlayerPrefs.SetString(PlayerPrefHandler.keyToken, "");
        }
    }
    void OnRedeemResponse(Restifizer.RestifizerResponse response)
    {
        Debug.LogError("OnRedeemResponse");
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            OnButtonNo();
            //GameDataManager.instance.LoadData ();
            dialogBox.Show("Info", "Redeem success. Please check your email.", false, "", this.gameObject);
        }
        else
        {
            dialogBox.Show("Error", data["errdetail"].ToString(), false, "", this.gameObject);
        }
        buttonOk.gameObject.GetComponent <Collider>().enabled = true;
        progress.gameObject.SetActive(false);
    }
Exemplo n.º 12
0
    void OnGetUserResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            Hashtable userdata = (Hashtable)data["userdata"];

            inputUsername.text = PlayerPrefs.GetString(PlayerPrefHandler.keyUserName);
            inputEmail.text    = userdata["email"].ToString();
            inputCoin.text     = userdata["coin"].ToString();
            inputTicket.text   = userdata["tiket"].ToString();
        }
        else
        {
            PlayerPrefs.SetString(PlayerPrefHandler.keyUserName, "");
            PlayerPrefs.SetString(PlayerPrefHandler.keyToken, "");
        }
    }
    void OnLoginResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            Hashtable logindata = (Hashtable)data["logindata"];
            string    sUsername = logindata["username"].ToString();
            string    sToken    = logindata["token"].ToString();

            PlayerPrefs.SetString(PlayerPrefHandler.keyUserName, sUsername);
            PlayerPrefs.SetString(PlayerPrefHandler.keyToken, sToken);
            OnBackButton();
            //if ( GemuDialogBoxController.GetInstance() )
            dialogBox.Show("Info", "Welcome back, " + sUsername + ".", false, "", this.gameObject);
            //GameDataManager.instance.LoadData();
        }
        else
        {
            dialogBox.Show("Error", data["errdetail"].ToString(), false, "", this.gameObject);
        }
    }
Exemplo n.º 14
0
    void OnLoginResponse(Restifizer.RestifizerResponse response)
    {
        Hashtable data = response.Resource;

        if (data["errcode"].ToString() == "0")
        {
            Hashtable logindata = (Hashtable)data["logindata"];
            string    sUsername = logindata["username"].ToString();
            string    sToken    = logindata["token"].ToString();

            PlayerPrefs.SetString(PlayerPrefHandler.keyUserName, sUsername);
            PlayerPrefs.SetString(PlayerPrefHandler.keyToken, sToken);
            GUI_Dialog.ReleaseTopCanvas();
            GUI_Dialog.InsertStack(sc_mainmenu_canvas_handler.Instance().cvGemuData.gameObject);
            //GameDataManager.instance.LoadData();
        }
        else
        {
            //txtResultLogin.text = data["errdetail"].ToString();
            //txtResultLogin.gameObject.SetActive(true);
            sc_mainmenu_canvas_handler.Instance().ShowDialogBox(data["errdetail"].ToString(), false);
        }
    }
Exemplo n.º 15
0
    void OnGetUserResponse(Restifizer.RestifizerResponse response)
    {
        if (PlayerPrefs.GetString(PlayerPrefHandler.keyUserName) == "")
        {
            return;
        }

        if (progress.gameObject)
        {
            progress.gameObject.SetActive(false);
        }
        Hashtable data = response.Resource;

        Debug.LogError("Done");
        if (data["errcode"].ToString() == "0")
        {
            Hashtable userdata  = (Hashtable)data["userdata"];
            string    sFullname = userdata["full_name"].ToString();
            string    sEmail    = userdata["email"].ToString();
            string    sCoin     = userdata["coin"].ToString();
            string    sTiket    = userdata["tiket"].ToString();
            string    sReferal  = userdata["refcode"].ToString();

            textFullname.text = sFullname;
            textMail.text     = sEmail;
            textCoin.text     = sCoin;
            textTicket.text   = sTiket;
            textReferal.text  = sReferal;
            textUsername.text = PlayerPrefs.GetString(PlayerPrefHandler.keyUserName);
            PlayerPrefs.SetInt(PlayerPrefHandler.keyCoin, (int)float.Parse(sCoin));
            PlayerPrefs.SetInt(PlayerPrefHandler.keyUserTiket, (int)float.Parse(sTiket));
        }
        else
        {
            dialogBox.Show("Error", data["errdetail"].ToString(), false, "", this.gameObject);
        }
    }
Exemplo n.º 16
0
 void OnGetUserResponse(Restifizer.RestifizerResponse response)
 {
     LogResponse(response.Resource);
 }
Exemplo n.º 17
0
 void OnPlayResultResponse(Restifizer.RestifizerResponse response)
 {
     LogResponse(response.Resource);
 }
Exemplo n.º 18
0
 void OnLeaderboardResponse(Restifizer.RestifizerResponse response)
 {
     LogResponse(response.Resource);
 }
Exemplo n.º 19
0
 void OnRedeemResponse(Restifizer.RestifizerResponse response)
 {
     LogResponse(response.Resource);
 }
Exemplo n.º 20
0
 void OnPromoResponse(Restifizer.RestifizerResponse response)
 {
     LogResponse(response.Resource);
 }
    void OnRewardResponse(Restifizer.RestifizerResponse response)
    {
        ArrayList data = response.ResourceList;

        for (int i = 0; i < response.ResourceList.Count; i++)
        {
            Hashtable dataReward  = (Hashtable)response.ResourceList[i];
            Transform targetChild = null;
            if (scrollView)
            {
                for (int j = 0; j < scrollView.transform.childCount; j++)
                {
                    Transform child = scrollView.transform.GetChild(j);
                    //Debug.LogError("child.name="+child.name+" "+" kode="+nChild["kode"]);
                    if (child && child.name.Equals(dataReward["kode"]))
                    {
                        targetChild = child;
                        break;
                    }
                }
            }

            if (targetChild == null)
            {
                GameObject ob = Instantiate(prefabContent);

                ob.name     = dataReward["kode"].ToString();
                targetChild = ob.transform;
                ob.gameObject.SetActive(true);
                ob.transform.parent     = scrollView.transform;
                ob.transform.localScale = Vector3.one;
                ob.gameObject.SetActive(false);

                ButtonReward reward = targetChild.GetComponent <ButtonReward>();
                reward.nama   = dataReward["nama"].ToString();
                reward.kode   = dataReward["kode"].ToString();
                reward.des    = dataReward["des"].ToString();
                reward.gambar = dataReward["gambar"].ToString();
                reward.tiket  = int.Parse(dataReward["tiket"].ToString());
                targetChild.gameObject.SetActive(false);
                targetChild.gameObject.SetActive(true);

                UISprite sprite = ob.GetComponent <UISprite>();
                if (HorizontalAmount == 1)
                {
                    ob.transform.localPosition = new Vector3(-10, 100 - ((scrollView.transform.childCount - 1) * sprite.height), 0);
                }
                else if (HorizontalAmount == 2)
                {
                    if (i % HorizontalAmount == 0)
                    {
                        ob.transform.localPosition = new Vector3(-310, 80 - (int)(i / 2) * 400, 0);
                    }
                    else if (i % HorizontalAmount == 1)
                    {
                        ob.transform.localPosition = new Vector3(310, 80 - (int)(i / 2) * 400, 0);
                    }
                }

                UIButton buttonRedeem = ob.GetComponent <UIButton>();
                if (buttonRedeem)
                {
                    buttonRedeem.onClick.Add(new EventDelegate(this, "OnClickRedeem"));
                }

                Transform trIcon = ob.transform.Find("Icon");
                if (trIcon)
                {
                    WWW_Texture wwwTexture = trIcon.gameObject.GetComponent <WWW_Texture>();
                    wwwTexture.sender = ob;
                    if (wwwTexture)
                    {
                        wwwTexture.StartDownloadImage(dataReward["gambar"].ToString());
                    }
                }
            }
            if (targetChild)
            {
            }
        }
    }