Esempio n. 1
0
        private static async Task FillOutServerRecipientActivities(ServerRecipientActivitiesFlow flow,
                                                                   ServerRecipientActivitiesModel serverRecipientActivities,
                                                                   ITurnContext turnContext)
        {
            string input = turnContext.Activity.Text?.Trim();
            string message;

            switch (flow.LastQuestionAsked)
            {
            case ServerRecipientActivitiesFlow.Question.None:
                await SuggestionActions.SendIntSuggestionsActionsAsync(turnContext, CancellationToken.None,
                                                                       "ASSESSMENT \n" +
                                                                       "Non Face To Face Assessment / Develop Plan", new List <int>() { 0, 1 }, true);

                flow.LastQuestionAsked = ServerRecipientActivitiesFlow.Question.NonFTFAssessment;
                break;

            case ServerRecipientActivitiesFlow.Question.NonFTFAssessment:
                if (ValidateStringResponse(input, out string NonFTFResponse, out message, 0, 1))
                {
                    serverRecipientActivities.Assessment.NonFTFAssessment = NonFTFResponse;
                    await SuggestionActions.SendIntSuggestionsActionsAsync(turnContext, CancellationToken.None,
                                                                           "Face To Face Assessment", new List <int>() { 0, 1 }, true);

                    flow.LastQuestionAsked = ServerRecipientActivitiesFlow.Question.FTFAssessment;
                    break;
                }
                else
                {
                    await turnContext.SendActivityAsync(message ?? "I'm sorry, I didn't understand that.");

                    break;
                }
    public void ToggleSuggestionButton(bool isShow, bool isCheckAvailable = false, int callAmount = 0, float availableBalance = 0)
    {
        suggestionButtonParent.SetActive(isShow);

        if (isShow)
        {
            if (callAmount <= 0)
            {
                isCheckAvailable = true;
            }

            for (int i = 0; i < suggestionButtons.Length; i++)
            {
                suggestionButtons[i].SetActive(true);
                suggestionButtonsActiveImage[i].SetActive(false);
            }

            if (isCheckAvailable)
            {
                suggestionButtons[(int)SuggestionActions.Call].SetActive(false);
                suggestionButtons[(int)SuggestionActions.Check].SetActive(true);
            }
            else
            {
                availableCallAmount = callAmount;
                if (callAmount < availableBalance)
                {
                    suggestionButtons[(int)SuggestionActions.Call].SetActive(true);
                    suggestionButtons[(int)SuggestionActions.Check].SetActive(false);
                    suggestionCallText.text = "" + callAmount;
                }
                else
                {
                    for (int i = 0; i < suggestionButtons.Length; i++)
                    {
                        suggestionButtons[i].SetActive(false);
                        suggestionButtonsActiveImage[i].SetActive(false);
                    }

                    suggestionButtons[(int)SuggestionActions.Fold].SetActive(true);
                }
            }


            if (selectedSuggestionButton == SuggestionActions.Call && callAmount != suggestionCallAmount)
            {
                selectedSuggestionButton = SuggestionActions.Null;
            }
            else if (selectedSuggestionButton != SuggestionActions.Null && suggestionButtons[(int)selectedSuggestionButton].activeInHierarchy)
            {
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(true);
            }
            else
            {
                selectedSuggestionButton = SuggestionActions.Null;
            }
        }
    }
Esempio n. 3
0
    private void SwitchTurn(PlayerScript playerScript, bool isCheckAvailable)
    {
        SoundManager.instance.PlaySound(SoundType.TurnSwitch);

        for (int i = 0; i < onlinePlayersScript.Length; i++)
        {
            onlinePlayersScript[i].ResetTurn();
        }


        currentPlayer = playerScript;
        if (currentPlayer.IsMe())
        {
            InGameUiManager.instance.ToggleSuggestionButton(false);

            SuggestionActions selectedSuggestionAction = InGameUiManager.instance.GetSelectedSuggestionAction();
            InGameUiManager.instance.ResetSuggetionAction();

            if (selectedSuggestionAction != SuggestionActions.Null)
            {
                switch (selectedSuggestionAction)
                {
                case SuggestionActions.Call:
                case SuggestionActions.Call_Any:
                {
                    int callAmount = GetLastBetAmount() - (int)GetMyPlayerObject().GetPlayerData().totalBet;

                    if (callAmount < GetMyPlayerObject().GetPlayerData().balance)
                    {
                        OnPlayerActionCompleted(PlayerAction.Call, callAmount, "Call");
                    }
                    else
                    {
                        InGameUiManager.instance.ToggleActionButton(true, currentPlayer, isCheckAvailable, LAST_BET_AMOUNT);
                    }
                }
                break;

                case SuggestionActions.Check:
                {
                    OnPlayerActionCompleted(PlayerAction.Check, 0, "Check");
                }
                break;

                case SuggestionActions.Fold:
                {
                    OnPlayerActionCompleted(PlayerAction.Fold, 0, "Fold");
                }
                break;

                default:
                {
                    Debug.LogError("Unhandled suggetion type found = " + selectedSuggestionAction);
                }
                break;
                }
            }
            else
            {
                InGameUiManager.instance.ToggleActionButton(true, currentPlayer, isCheckAvailable, LAST_BET_AMOUNT);
            }
        }
        else
        {
            InGameUiManager.instance.ToggleActionButton(false);

            if (!GetMyPlayerObject().GetPlayerData().isFold)
            {
                int callAmount = GetLastBetAmount() - (int)GetMyPlayerObject().GetPlayerData().totalBet;
                InGameUiManager.instance.ToggleSuggestionButton(true, isCheckAvailable, callAmount, GetMyPlayerObject().GetPlayerData().balance);
            }
        }
    }
 public void ResetSuggetionAction()
 {
     selectedSuggestionButton = SuggestionActions.Null;
 }
    public void OnClickOnButton(string eventName)
    {
        SoundManager.instance.PlaySound(SoundType.Click);

        switch (eventName)
        {
        case "store":
        {
            ShowScreen(InGameScreens.InGameShop);
        }
        break;


        case "menu":
        {
            ShowScreen(InGameScreens.Menu);
        }
        break;

        case "missions":
        {
            ShowScreen(InGameScreens.Missions);
        }
        break;

        case "emojiScreen":
        {
            ShowScreen(InGameScreens.EmojiScreen);
        }
        break;

        case "fold":
        {
            InGameManager.instance.OnPlayerActionCompleted(PlayerAction.Fold, 0, "Fold");
        }
        break;

        case "call":
        {
            InGameManager.instance.OnPlayerActionCompleted(PlayerAction.Call, (int)availableCallAmount, "Call");
        }
        break;


        case "check":
        {
            InGameManager.instance.OnPlayerActionCompleted(PlayerAction.Check, 0, "Check");
        }
        break;


        case "raiseOpen":
        {
            PlayerScript player = InGameManager.instance.GetMyPlayerObject();

            if (player != null)
            {
                ToggleRaisePopUp(true, availableCallAmount + 1, player.GetPlayerData().balance, InGameManager.instance.GetPotAmount());
            }
            else
            {
#if ERROR_LOG
                Debug.LogError("Null Reference exception found playerObject is null in InGameUiManager.RaiseOpen");
#endif
            }
        }
        break;


        case "raiseClose":
        {
            ToggleRaisePopUp(false);
        }
        break;


        case "raiseDone":
        {
            if (sliderText.text == "All In")
            {
                PlayerScript player = InGameManager.instance.GetMyPlayerObject();

                if (player != null)
                {
                    InGameManager.instance.OnPlayerActionCompleted(PlayerAction.Raise, (int)player.GetPlayerData().balance, "AllIn");
                }
                else
                {
#if ERROR_LOG
                    Debug.LogError("Null Reference exception found playerObject is null in InGameUiManager.RaiseOpen");
#endif
                }
            }
            else
            {
                InGameManager.instance.OnPlayerActionCompleted(PlayerAction.Raise, (int)selectedRaiseAmount, "Raise");
            }
        }
        break;

        case "pot":
        {
            if (useRaisePotWise)         // PotWise Calculation
            {
                slider.value = InGameManager.instance.GetPotAmount();
                OnSliderValueChange();
            }
            else         // Call Amount wise calculation
            {
                slider.value = availableCallAmount * 4;
                OnSliderValueChange();
            }
        }
        break;

        case "halfPot":
        {
            if (useRaisePotWise)         // PotWise Calculation
            {
                slider.value = (InGameManager.instance.GetPotAmount() / 2f);
                OnSliderValueChange();
            }
            else         // Call Amount wise calculation
            {
                slider.value = availableCallAmount * 3f;
                OnSliderValueChange();
            }
        }
        break;

        case "thirdPot":
        {
            if (useRaisePotWise)         // PotWise Calculation
            {
                slider.value = ((InGameManager.instance.GetPotAmount() * 2f) / 3f);
                OnSliderValueChange();
            }
            else         // Call Amount wise calculation
            {
                slider.value = availableCallAmount * 2f;
                OnSliderValueChange();
            }
        }
        break;


        case "sCall":
        {
            if (selectedSuggestionButton == SuggestionActions.Call)
            {
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(false);
                selectedSuggestionButton = SuggestionActions.Null;
            }
            else
            {
                for (int i = 0; i < suggestionButtonsActiveImage.Length; i++)
                {
                    suggestionButtonsActiveImage[i].gameObject.SetActive(false);
                }

                suggestionCallAmount     = (int)availableCallAmount;
                selectedSuggestionButton = SuggestionActions.Call;

                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(true);
            }
        }
        break;


        case "sCallAny":
        {
            if (selectedSuggestionButton == SuggestionActions.Call_Any)
            {
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(false);
                selectedSuggestionButton = SuggestionActions.Null;
            }
            else
            {
                for (int i = 0; i < suggestionButtonsActiveImage.Length; i++)
                {
                    suggestionButtonsActiveImage[i].gameObject.SetActive(false);
                }

                selectedSuggestionButton = SuggestionActions.Call_Any;
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(true);
            }
        }
        break;

        case "sCheck":
        {
            if (selectedSuggestionButton == SuggestionActions.Check)
            {
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(false);
                selectedSuggestionButton = SuggestionActions.Null;
            }
            else
            {
                for (int i = 0; i < suggestionButtonsActiveImage.Length; i++)
                {
                    suggestionButtonsActiveImage[i].gameObject.SetActive(false);
                }

                selectedSuggestionButton = SuggestionActions.Check;
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(true);
            }
        }
        break;

        case "sFold":
        {
            if (selectedSuggestionButton == SuggestionActions.Fold)
            {
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(false);
                selectedSuggestionButton = SuggestionActions.Null;
            }
            else
            {
                for (int i = 0; i < suggestionButtonsActiveImage.Length; i++)
                {
                    suggestionButtonsActiveImage[i].gameObject.SetActive(false);
                }

                selectedSuggestionButton = SuggestionActions.Fold;
                suggestionButtonsActiveImage[(int)selectedSuggestionButton].SetActive(true);
            }
        }
        break;


        case "handHistory":
        {
            ShowScreen(InGameScreens.HandHistory);
        }
        break;

        case "realTimeResult":
        {
            ShowScreen(InGameScreens.RealTimeResult);
        }
        break;

        case "pointEarnopen":
        {
            ShowScreen(InGameScreens.PointEarnMsg);
        }
        break;

        case "chat":
        {
            if (SocketController.instance.GetSocketState() == SocketState.Game_Running)
            {
                ShowScreen(InGameScreens.Chat);
            }
            else
            {
                // NativeFunctionalityIntegration.SharedInstance.showToastMessage("Please wait for game");
            }
        }
        break;

        default:
#if ERROR_LOG
            Debug.LogError("unhdnled eventName found in InGameUiManager = " + eventName);
#endif
            break;
        }
    }