コード例 #1
0
    public void RefreshData(bool _hasNewTurn)
    {
        if (pokerGamePlayData == null || dataPlaying == null ||
            pokerGamePlayData.currentGameState == PokerGamePlayData.GameState.STATUS_WAIT_FOR_PLAYER ||
            dataPlaying.currentState == PokerGamePlayData.Poker_PlayerPlayingData.State.STATEPOKER_FOLD)
        {
            return;
        }
        if (dataPlaying.ownCards == null || dataPlaying.ownCards.Count != 2 || dataPlaying.ownCards[0] < 0 || dataPlaying.ownCards[1] < 0 || pokerGamePlayData.globalCards == null)
        {
            return;
        }

        if (_hasNewTurn && pokerGamePlayData.globalCards.Count >= 3)
        {
            PokerGamePlayData.GetPercentTypeCard(dataPlaying.ownCards, pokerGamePlayData.globalCards, (_percent) => {
                if (listOptions.Count != _percent.Length)
                {
                                        #if TEST
                    Debug.LogError("BUG Logic!");
                                        #endif
                }
                else
                {
                    for (int i = 0; i < _percent.Length; i++)
                    {
                        valueCardRanking[i] = _percent[i];
                        listOptions[i].InitData(_percent[i]);
                    }
                }
            });
        }
    }
コード例 #2
0
 public void CheckBai()
 {
     PokerGamePlayData.CheckResultCard(ownCards, globalCards, (_typeCard, _cardHightLight) => {
         string _tmp = "";
         for (int i = 0; i < _cardHightLight.Count; i++)
         {
             ICardInfo _info = GetCardInfo(_cardHightLight[i]);
             _tmp           += _info.cardType + "|";
         }
         Debug.Log(">>> Type Card: " + _typeCard.ToString() + " : " + _tmp);
     });
 }
コード例 #3
0
    public void GetPercentTypeCard()
    {
        long _xxx = MyConstant.currentTimeMilliseconds;

        PokerGamePlayData.GetPercentTypeCard(ownCards, globalCards, (_percent) => {
            string _tmp = "";
            for (int i = 0; i < _percent.Length; i++)
            {
                _tmp += ((PokerGamePlayData.TypeCardResult)i + 1).ToString() + ": " + _percent[i] + "% |";
            }
            Debug.Log(">>> Get Percent Type Card: " + _tmp);
            Debug.Log("Time elapsed: " + (MyConstant.currentTimeMilliseconds - _xxx));
        });
    }
コード例 #4
0
    public void InitData(PokerGamePlayData.Poker_PlayerPlayingData _data, bool _showPanelHighlight)
    {
        data = _data;
        bool   _showPanelShadow = false;
        string _status          = string.Empty;

        if (data.typeCardResult != PokerGamePlayData.TypeCardResult.UNKNOWN)
        {
            _status = PokerGamePlayData.GetStringTypeCardResult(data.typeCardResult);
        }
        else if (data.currentState == PokerGamePlayData.Poker_PlayerPlayingData.State.STATEPOKER_FOLD)
        {
            _status          = "FOLD";
            _showPanelShadow = true;
        }

        Sprite _iconDatabaseID = _data.userData.GetIconDatabaseID();

        if (_iconDatabaseID != null)
        {
            imgIconAcc.gameObject.SetActive(true);
            imgIconAcc.sprite = _iconDatabaseID;
        }
        else
        {
            imgIconAcc.gameObject.SetActive(false);
        }

        txtNameShow.text = MyConstant.ConvertString(_data.userData.nameShowInGame, 15);
        if (data.goldWinOrReturn > 0)
        {
            txtGoldWin.text = "+" + MyConstant.GetMoneyString(data.goldWinOrReturn, 9999);
        }
        else
        {
            txtGoldWin.text = string.Empty;
        }

        txtStatus.text = _status;
        if (_showPanelShadow)
        {
            txtStatus.color = colorTxtStatus_Fold;
        }
        else
        {
            txtStatus.color = colorTxtStatus_Normal;

            ICardInfo _cardInfo = null;
            for (int i = 0; i < data.ownCards.Count; i++)
            {
                if (data.ownCards[i] < 0)
                {
                    continue;
                }
                _cardInfo = Poker_GamePlay_Manager.instance.GetCardInfo(data.ownCards[i]);
                if (_cardInfo == null)
                {
                    Debug.LogError(">>> cardInfo is null : " + i + " - " + data.ownCards[i]);
                    continue;
                }
                ownCards[i].ShowNow(_cardInfo);
                ownCards[i].ResizeAgain();
            }
            for (int i = 0; i < data.highLightCardsResult.Count; i++)
            {
                if (data.highLightCardsResult[i] < 0)
                {
                    continue;
                }
                _cardInfo = Poker_GamePlay_Manager.instance.GetCardInfo(data.highLightCardsResult[i]);
                if (_cardInfo == null)
                {
                    Debug.LogError(">>> cardInfo is null : " + i + " - " + data.highLightCardsResult[i]);
                    continue;
                }
                highlightCards[i].ShowNow(_cardInfo);
                highlightCards[i].ResizeAgain();
            }
        }

        data.userData.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => {
            try{
                if (_avatar != null)
                {
                    imgAvatar.texture = _avatar;
                }
            }catch {}
        });

        panelShadow.gameObject.SetActive(_showPanelShadow);
        if (_showPanelHighlight)
        {
            imgBg.sprite = bg_Highlight;
            txtWinner.gameObject.SetActive(true);
        }
        else
        {
            imgBg.sprite = bg_Normal;
            txtWinner.gameObject.SetActive(false);
        }
    }
コード例 #5
0
    IEnumerator DoActionSpin()
    {
        List <IEnumerator> _listAction = new List <IEnumerator>();

        for (int i = 0; i < numCol; i++)
        {
            if (myState == State.NewRound || listCanvasGroupButtonHold[i].interactable)
            {
                _listAction.Add(DoActionTweenCol(listCol[i], i, 10 + i * 4, 50 + i * 8));
            }
        }

        if (_listAction.Count <= 0)
        {
            Debug.LogError(">>> _listAction.Count = 0");
            yield break;
        }
        yield return(CoroutineChain.Start
                     .Parallel(_listAction.ToArray()));

        // --- Show Effect Type Card Result --- //
        LeanTween.cancel(txtCardResult.gameObject);
        Color _c = txtCardResult.color;

        _c.a = 0;
        txtCardResult.color = _c;
        txtCardResult.transform.localScale = Vector3.one * 0.6f;

        List <sbyte> _cardResultValue = new List <sbyte>();

        for (int i = 0; i < resultIndexCards.Count; i++)
        {
            _cardResultValue.Add((sbyte)listCardDetail[resultIndexCards[i]].cardId);
        }
        PokerGamePlayData.TypeCardResult _typeCardResult = videoPokerGamePlayData.GetTypeCardResult(_cardResultValue);
        txtCardResult.text = PokerGamePlayData.GetStringTypeCardResult(_typeCardResult);

        bool  _isFinished = false;
        float _timeShowEffectCardResult = 0.2f;

        LeanTween.alphaText(txtCardResult.rectTransform, 1f, _timeShowEffectCardResult).setEase(LeanTweenType.easeOutBack).setOnComplete(() => {
            _isFinished = true;
        });
        LeanTween.scale(txtCardResult.gameObject, Vector3.one, _timeShowEffectCardResult).setEase(LeanTweenType.easeOutBack);
        yield return(new WaitUntil(() => _isFinished));

        yield return(Yielders.Get(1f));

        _isFinished = false;
        LeanTween.alphaText(txtCardResult.rectTransform, 0f, 0.2f).setEase(LeanTweenType.easeInBack).setOnComplete(() => {
            _isFinished = true;
        });
        LeanTween.scale(txtCardResult.gameObject, Vector3.zero, _timeShowEffectCardResult).setEase(LeanTweenType.easeInBack);
        yield return(new WaitUntil(() => _isFinished));

        // ----------------------------------------- //

        if (myState == State.NewRound)
        {
            for (int i = 0; i < listCanvasGroupButtonHold.Count; i++)
            {
                listCanvasGroupButtonHold[i].interactable = true;
            }
        }
        else
        {
            for (int i = 0; i < listCanvasGroupButtonHold.Count; i++)
            {
                listCanvasGroupButtonHold[i].interactable = false;
            }
            for (int i = 0; i < listTextHeld.Count; i++)
            {
                LeanTween.cancel(listTextHeld[i].gameObject);
                LeanTween.alphaCanvas(listTextHeld[i], 0f, 0.1f).setEase(LeanTweenType.easeInBack);
                LeanTween.scale(listTextHeld[i].gameObject, Vector3.zero, 0.1f).setEase(LeanTweenType.easeInBack);
            }
            myState = State.NewRound;
        }
        for (int i = 0; i < listCanvasGroupButtonUnHold.Count; i++)
        {
            listCanvasGroupButtonUnHold[i].blocksRaycasts = false;
        }
        isFirstSpin = false;
        actionSpin  = null;
    }