Beispiel #1
0
    public void btnGemu_login_proses()
    {
        bunyi_click();

        Debug.Log("Btn Gemu Login clicked Progress");
        InputField txtUsername = GameObject.Find("InputField_username").GetComponent <InputField> ();
        InputField txtPassword = GameObject.Find("InputField_password").GetComponent <InputField> ();

        Debug.Log("====> Login GEMU Masuk : " + txtUsername.text + " => " + txtPassword.text);


        //Text txtResultLogin = GameObject.Find("txtResultLogin").GetComponent<Text>();
        //txtResultLogin.text = "Please wait...";
        //StartCoroutine (login_API_send_JSON(txtUsername.text.ToString(), txtPassword.text.ToString()));
        Hashtable data = new Hashtable();

        data.Add("username", txtUsername.text);
        data.Add("password", txtPassword.text);
        data.Add("gameid", GameDataManager.instance.gameID.ToString());
        data.Add("ip", GameDataManager.instance.deviceIP);

        try
        {
            GemuAPI.Login(data);
        }
        catch (GemuAPI_Exception exc)
        {
            Debug.LogError(exc.Message);
        }
    }
Beispiel #2
0
 void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
Beispiel #3
0
	public void SendPlayResult(string sGameID, string sTiket, string sCoin, string sScore, string sGameLevel)
	{
		Hashtable data = new Hashtable();
		string sUsername = PlayerPrefs.GetString (PlayerPrefHandler.keyUserName);
		string sToken = PlayerPrefs.GetString (PlayerPrefHandler.keyToken);
		//int iCoin = PlayerPrefs.GetInt (PlayerPrefHandler.keyCoin);
		//int iTicket = PlayerPrefs.GetInt (PlayerPrefHandler.keyUserTiket);
		
		Debug.Log ("[GameDataManager] SendPlayResult username="******" token=" + sToken + " coin="+sCoin+" tiket="+sTiket);
		if (string.IsNullOrEmpty (sUsername) || string.IsNullOrEmpty (sToken))
			return;
		
		data.Add("username", sUsername);
		data.Add("token", sToken);
		data.Add("tiket", sTiket);
		data.Add("score", sScore);
		data.Add("coin", sCoin);
		data.Add("gameid", sGameID);
		data.Add("gamelevel", sGameLevel);
		
		try
		{
			GemuAPI.PlayResult(data);
		}
		catch(GemuAPI_Exception exc)
		{
			Debug.LogError(exc.Message);
		}
	}
Beispiel #4
0
    public override void OnShow()
    {
        bLogout = false;
        progress.gameObject.SetActive(true);
        uiScrollView.ResetPosition();
        textFullname.text = "";
        textMail.text     = "";
        textUsername.text = "";
        textCoin.text     = "";
        textTicket.text   = "";
        textReferal.text  = "";

        uiScrollView.gameObject.SetActive(false);
        uiScrollView.gameObject.SetActive(true);
        uiScrollView.ResetPosition();
        Hashtable data = new Hashtable();

        if (!string.IsNullOrEmpty(PlayerPrefs.GetString(PlayerPrefHandler.keyToken)))
        {
            data.Add("username", PlayerPrefs.GetString(PlayerPrefHandler.keyUserName));
            data.Add("token", PlayerPrefs.GetString(PlayerPrefHandler.keyToken));

            try
            {
                GemuAPI.GetUser(data);
            }
            catch (GemuAPI_Exception exc)
            {
                Debug.LogError(exc.Message);
            }
        }
    }
    public void OnLoginButton()
    {
        SoundManager.instance.PlayButton();

        if (string.IsNullOrEmpty(username.value))
        {
            dialogBox.Show("Info", "Username is empty", false, "", this.gameObject);
        }
        else if (string.IsNullOrEmpty(password.value))
        {
            dialogBox.Show("Info", "Password is empty", false, "", this.gameObject);
        }
        else
        {
            obProgress.gameObject.SetActive(true);
            ActivateColliders(this.Window, false);
            buttonBack.gameObject.GetComponent <Collider> ().enabled = true;
            Hashtable data = new Hashtable();
            data.Add("username", username.value);
            data.Add("password", password.value);
            data.Add("gameid", GameDataManager.instance.gameID.ToString());
            data.Add("ip", GameDataManager.instance.deviceIP);

            try {
                GemuAPI.Login(data);
            } catch (GemuAPI_Exception exc) {
                Debug.LogError(exc.Message);
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        //test register

/*
 *              Hashtable parameters = new Hashtable();
 *              parameters.Add("full_name", "Bawenang Test");
 *              parameters.Add("username", "bawetest");
 *              parameters.Add("password", "newPassword");
 *              parameters.Add("email", "*****@*****.**");
 *              parameters.Add("tiket", "0");
 *
 *              GemuAPI.Register(parameters);
 */

        //test login

        Hashtable parameters = new Hashtable();

        parameters.Add("username", "bawetest");
        parameters.Add("password", "newPassword");
        parameters.Add("gameid", "2000");
        parameters.Add("ip", "127.0.0.1");

        GemuAPI.Login(parameters);
    }
    public void OnClickRegister()
    {
        SoundManager.instance.PlayButton();
        string sError = "";

        if (username.value == "" ||
            mail.value == "" ||
            yourname.value == "" ||
            password.value == "" ||
            retypepassword.value == "")

        {
            sError = "Fill in all the required data.";
        }
        else if (username.value.Contains(" "))
        {
            sError = "Username may not contain spaces.";
        }
        else if (mail.value.Contains("@") == false ||
                 mail.value.Contains(".") == false
                 )
        {
            sError = "Email Address is not in the correct format.";
        }
        else if (password.value.Equals(retypepassword.text) == false
                 )
        {
            sError = "Retype your password.";
        }

        if (!string.IsNullOrEmpty(sError))
        {
            dialogBox.Show("Error", sError, false, "", this.gameObject);
        }
        else
        {
            ActivateColliders(this.Window, false);
            progress.gameObject.SetActive(true);
            buttonBack.gameObject.GetComponent <Collider>().enabled = true;
            Hashtable data = new Hashtable();
            data.Add("full_name", yourname.value);
            data.Add("email", mail.value);
            data.Add("username", username.value);
            data.Add("password", retypepassword.value);
            data.Add("tiket", "0");
            data.Add("ref_code", referal.value);

            try
            {
                GemuAPI.Register(data);
            }
            catch (GemuAPI_Exception exc)
            {
                Debug.LogError(exc.Message);
            }
        }
    }
Beispiel #8
0
    static void Instantiate()
    {
        if (instance == null)
        {
            GameObject go = new GameObject("GemuAPI");

            instance = go.AddComponent <GemuAPI>();
            instance.restifizerManager         = go.AddComponent <Restifizer.RestifizerManager>();
            instance.restifizerManager.baseUrl = baseUrl;
        }
    }
    public void OnClickGetPromo()
    {
        Hashtable data = new Hashtable();

        data.Add("username", PlayerPrefs.GetString(PlayerPrefHandler.keyUserName));
        data.Add("token", PlayerPrefs.GetString(PlayerPrefHandler.keyToken));
        data.Add("kdkupon", inputPromo.text);

        try
        {
            GemuAPI.Promo(data);
        }
        catch (GemuAPI_Exception exc)
        {
            Debug.LogError(exc.Message);
        }
    }
Beispiel #10
0
    public void OnClickGetPromo()
    {
        Debug.LogError("test");
        SoundManager.instance.PlayButton();

        Hashtable data = new Hashtable();

        data.Add("username", PlayerPrefs.GetString(PlayerPrefHandler.keyUserName));
        data.Add("token", PlayerPrefs.GetString(PlayerPrefHandler.keyToken));
        data.Add("kdkupon", inputPromo.value);

        try
        {
            GemuAPI.Promo(data);
        }
        catch (GemuAPI_Exception exc)
        {
            Debug.LogError(exc.Message);
        }
    }
Beispiel #11
0
    void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(this.gameObject);

            instance = this;

            restifizerManager = gameObject.GetComponent <Restifizer.RestifizerManager>();

            if (restifizerManager == null)
            {
                restifizerManager = gameObject.AddComponent <Restifizer.RestifizerManager>();
            }

            restifizerManager.baseUrl = baseUrl;
        }
        else
        {
            DestroyImmediate(this.gameObject);
        }
    }
    public void OnButtonYes()
    {
        buttonOk.gameObject.GetComponent <Collider>().enabled = false;
        progress.gameObject.SetActive(true);

        SoundManager.instance.PlayButton();

        Hashtable data = new Hashtable();

        data.Add("username", PlayerPrefs.GetString(PlayerPrefHandler.keyUserName));
        data.Add("token", PlayerPrefs.GetString(PlayerPrefHandler.keyToken));
        data.Add("rewardid", sKodeReward);

        try
        {
            GemuAPI.Redeem(data);
        }
        catch (GemuAPI_Exception exc)
        {
            Debug.LogError("error " + exc);
            OnButtonNo();
        }
    }
Beispiel #13
0
    public void OnButtonYes()
    {
        GUI_Dialog.ReleaseTopCanvas();


        Hashtable data = new Hashtable();

        data.Add("username", PlayerPrefs.GetString(PlayerPrefHandler.keyUserName));
        data.Add("token", PlayerPrefs.GetString(PlayerPrefHandler.keyToken));
        data.Add("rewardid", this.data.code.ToString());

        GemuAPI.OnRedeemResponse += OnRedeemResponse;
        try
        {
            Debug.LogError("Redeem reward");
            GemuAPI.Redeem(data);
        }
        catch (GemuAPI_Exception exc)
        {
            OnButtonNo();
        }
        this.gameObject.SetActive(false);
    }
 // Use this for initialization
 public override void OnStart()
 {
     GemuAPI.OnRewardResponse  += OnRewardResponse;
     GemuAPI.OnGetUserResponse += OnGetUserResponse;
     GemuAPI.Reward();
 }