Example #1
0
    public void Play(object[] _duel_params)
    {
        userId = userManager.getCurrentUserId();
        token  = userManager.getCurrentSessionToken();

        float  entry_fee = float.Parse(_duel_params[0].ToString(), CultureInfo.InvariantCulture.NumberFormat);
        float  gain      = float.Parse(_duel_params[1].ToString(), CultureInfo.InvariantCulture.NumberFormat);
        string gain_type = _duel_params[2].ToString();

        if (isCreditSuffisant(entry_fee, gain_type))
        {
            SearchingForPlayerPresenter.nbPlayer = "duel";
            ChallengeType = ChallengeManager.CHALLENGE_TYPE_1V1;

            //Needs Change
            EventsController.ChallengeType = ChallengeManager.CHALLENGE_TYPE_1V1;

            ChallengeManager.CurrentChallengeGain     = gain.ToString();
            ChallengeManager.CurrentChallengeGainType = gain_type.ToString();



            if (gain_type.Equals(ChallengeManager.CHALLENGE_WIN_TYPE_CASH))
            {
                StartCashChallenge(entry_fee, gain, gain_type);
            }
            else
            {
                StartBubblesChallenge(entry_fee, gain, gain_type);
            }
        }
        else
        {
            if (gain_type.Equals(ChallengeManager.CHALLENGE_WIN_TYPE_CASH))
            {
                ShowPopup(PopupsController.PopupType.INSUFFICIENT_BALANCE, PopupsText.getInstance().insufficient_balance());
            }
            else
            {
                ShowPopup(PopupsController.PopupType.INSUFFICIENT_BUBBLES, PopupsText.getInstance().insufficient_bubbles());
            }
        }
    }
    public void StartCashTournament(float entry_fee, float gain, string gain_type)
    {
        if (isDeveloperModeEnabled())
        {
            ShowPopup(PopupsController.PopupType.DEV_MODE, PopupsText.getInstance().dev_mode());
            return;
        }

        if (isProhibitedLocation(UserManager.CurrentCountryCode))
        {
            ShowPopup(PopupsController.PopupType.PROHIBITED_LOCATION, PopupsText.getInstance().prohibited_location());
            return;
        }

        if (isVPNEnabled())
        {
            ShowPopup(PopupsController.PopupType.VPN, PopupsText.getInstance().vpn());
            return;
        }

        JoinTournament(entry_fee, gain, gain_type);
    }