Beispiel #1
0
        public async Task <AccountStatus> GetAccountStatus()
        {
            WithdrawManager wm         = new WithdrawManager();
            var             user_token = UserManager.Get.getCurrentSessionToken();

            return(await wm.accountVerificationStatus(user_token));
        }
Beispiel #2
0
        private async void Start()
        {
            controller = new WithdrawController();
            string token = UserManager.Get.getCurrentSessionToken();

            User user = null;

            user = await UserManager.Get.getUser();

            var accountStatus = await withdrawManager.accountVerificationStatus(token);

            balance.text = user.money_credit.ToString("N2") + CurrencyManager.CURRENT_CURRENCY;

            WithdrawButton.onClick.AddListener(() =>
            {
                SeembaAnalyticsManager.Get.SendWithdrawalEvent("Click On Withdrawal", AmountToWithdraw);
                CheckAndWithdraw();
            });

            Amount.onValueChanged.AddListener(delegate
            {
                if (string.IsNullOrEmpty(Amount.text))
                {
                    WithdrawButton.interactable = false;
                    TextEuro.text = "";
                }
                else
                {
                    TextEuro.text    = CurrencyManager.CURRENT_CURRENCY;
                    AmountToWithdraw = float.Parse(Amount.text);
                    if ((float.Parse(Amount.text, CultureInfo.InvariantCulture) > 0) &&
                        (float.Parse(Amount.text, CultureInfo.InvariantCulture) <= (float.Parse(UserManager.Get.GetCurrentMoneyCredit()))))
                    {
                        WithdrawButton.interactable = true;
                    }
                    else
                    {
                        WithdrawButton.interactable = false;
                    }
                }
            });
        }
        public async void InitProfile(User user)
        {
            PlayerId      = user._id;
            avatar.sprite = await UserManager.Get.getAvatar(user.avatar);

            username.text = user.username;
            string          token         = UserManager.Get.getCurrentSessionToken();
            string          userId        = UserManager.Get.getCurrentUserId();
            WithdrawManager wm            = new WithdrawManager();
            AccountStatus   accountStatus = null;

            if (PlayerId == userId)
            {
                accountStatus = await wm.accountVerificationStatus(token);
            }

            string Vectoires      = user.victories_count.ToString();
            string SerieVectoires = user.current_victories_count.ToString();

            Loading.SetActive(false);
            if (PlayerId != userId)
            {
                changeAvatar.interactable = false;
            }
            else
            {
                if (accountStatus.verification_status == WithdrawManager.ACCOUNT_VERIFICATION_STATUS_PENDING)
                {
                    pending.SetActive(true);
                }
                else if (accountStatus.verification_status == WithdrawManager.ACCOUNT_VERIFICATION_STATUS_VERIFIED)
                {
                    verified.SetActive(true);
                }
                else
                {
                    unverified.SetActive(true);
                }
            }
            username.text = user.username;
            try
            {
                if (user.money_credit > 0)
                {
                    pro.gameObject.SetActive(true);
                }
                else
                {
                    pro.gameObject.SetActive(false);
                }
            }
            catch (FormatException)
            {
                if (user.money_credit > 0)
                {
                    pro.gameObject.SetActive(true);
                }
                else
                {
                    pro.gameObject.SetActive(false);
                }
            }
            var mTexture = await UserManager.Get.GetFlagBytes(user.country_code);

            drapeau.sprite       = Sprite.Create(mTexture, new Rect(0f, 0f, mTexture.width, mTexture.height), Vector2.zero);
            nbGameWon.text       = Vectoires;
            nbGameWonInARow.text = SerieVectoires;
        }