Beispiel #1
0
    /// <summary>
    /// Raises the login response received event.
    /// </summary>
    /// <param name="www">Www.</param>
    private void OnLoginResponseReceived(WWW www)
    {
        UIManager.Instance.loader.gameObject.SetActive(false);
        debugString += "\n" + www.text;
        if (www.error != null)
        {
            DebugLog.LogError(www.error);
            UIManager.Instance.loginPanel.txtError.text = "<color=yellow>Something went wrong.</color>";
            DebugLog.Log(www.text);
            JSON_Object errorObj = new JSON_Object(www.text);
            if (errorObj.has("messages"))
            {
                JSONArray arr = errorObj.getJSONArray("messages");
                if (arr.Count() > 0)
                {
                    UIManager.Instance.loginPanel.txtError.text = "<color=yellow>" + arr.getString(0) + "</color>";
                }
            }

            return;
        }

        DebugLog.LogWarning(www.text);

        JSON_Object obj = new JSON_Object(www.text);

        if (obj.getString("status").Equals(APIConstants.STATUS_AUTHORIZED))
        {
            API_LoginPlayerInfo loggedInPlayerInfo = new API_LoginPlayerInfo(www.text);
            LoginScript.loggedInPlayer = loggedInPlayerInfo;

//			GetProfileImage (loggedInPlayerInfo.avtar);
            APIConstants.PLAYER_TOKEN = loggedInPlayerInfo.token;

//			UIManager.Instance.loginPanel.gameObject.SetActive (false);
            UIManager.Instance.lobbyPanel.gameObject.SetActive(true);

            GetPlayerInfo();

            StartUpdatingLoginStatus();
        }
        else
        {
            UIManager.Instance.loginPanel.txtError.text = "<color=red>Something went wrong.</color>";
        }
    }
Beispiel #2
0
    /// <summary>
    /// Initializes a new instance of the <see cref="API_PlayerInfo"/> class.
    /// </summary>
    /// <param name="playerInfo">Player info.</param>
    public API_LoginPlayerInfo(string playerInfo)
    {
        Debug.Log("Login player info : " + playerInfo);
        API_LoginPlayerInfo playerInfoObj = JsonUtility.FromJson <API_LoginPlayerInfo> (playerInfo);
        JSON_Object         loginResponse = new JSON_Object(playerInfo);

        token         = playerInfoObj.token;
        id            = playerInfoObj.id;
        name          = playerInfoObj.name;
        firstname     = playerInfoObj.firstname;
        lastname      = playerInfoObj.lastname;
        email         = playerInfoObj.email;
        balance_cash  = double.Parse(loginResponse.getString("balance_cash"));
        balance_chips = double.Parse(loginResponse.getString("balance_chips"));
        date_of_birth = playerInfoObj.date_of_birth;
        gender        = playerInfoObj.gender;
        avtar         = playerInfoObj.avtar;
        daily_limit   = playerInfoObj.daily_limit;
    }
Beispiel #3
0
    /// <summary>
    /// Raises the player info response received event.
    /// </summary>
    /// <param name="www">Www.</param>
    private void OnPlayerInfoResponseReceived(WWW www)
    {
        debugString += "\n" + www.text;
        if (www.error != null)
        {
            DebugLog.Log(www.error);
            DebugLog.LogWarning(www.error);
            return;
        }
//		DebugLog.Log ("CD <<OnPlayerInfoResponseReceived>> "+www.text);
        DebugLog.LogWarning(www.text);

        API_LoginPlayerInfo loggedInPlayerInfo = new API_LoginPlayerInfo(www.text);

        LoginScript.loggedInPlayer = loggedInPlayerInfo;

        LobbyPanel lobbyPanel = UIManager.Instance.lobbyPanel;

        if (lobbyPanel.availableMoneyType.Contains("Play Money"))
        {
            lobbyPanel.txtPlayerTotalPlayChips.text = "Total Play Chips: <color=" + APIConstants.HEX_COLOR_YELLOW + ">" + Utility.GetCommaSeperatedAmount(LoginScript.loggedInPlayer.balance_chips) + "</color>     ";
        }
        else
        {
            lobbyPanel.txtPlayerTotalPlayChips.text = "";
        }

        if (lobbyPanel.availableMoneyType.Contains("Real Money"))
        {
            lobbyPanel.txtPlayerTotalRealMoney.text = "Total Real Money: <color=" + APIConstants.HEX_COLOR_YELLOW + ">" + Utility.GetCommaSeperatedAmount(LoginScript.loggedInPlayer.balance_cash, true) + "</color>";
        }
        else
        {
            lobbyPanel.txtPlayerTotalRealMoney.text = "";
        }
    }