public void InitData(UnoGamePlayData.Uno_FinishGame_Data _finishGameData)
 {
     if (_finishGameData == null)
     {
         return;
     }
     scoreBoardOptionPoolManager.ClearAllObjectsNow();
     for (int i = 0; i < _finishGameData.listPlayersData.Count; i++)
     {
         Uno_FinishGame_ScoreBoard_Option_Controller _option           = LeanPool.Spawn(scoreBoardOptionPrefab, Vector3.zero, Quaternion.identity, panelDetailContainer).GetComponent <Uno_FinishGame_ScoreBoard_Option_Controller>();
         UnoGamePlayData.Uno_PlayerPlayingData       _playerFinishData = Uno_GamePlay_Manager.instance.unoGamePlayData.listPlayerPlayingData[_finishGameData.listPlayersData[i].indexCircle];
         _option.InitData(_finishGameData.listPlayersData[i].isWin, _playerFinishData.userData.nameShowInGame, _finishGameData.goldWin, _finishGameData.listPlayersData[i].totalPoint);
         scoreBoardOptionPoolManager.AddObject(_option);
     }
 }
Пример #2
0
 public void InitData(UnoGamePlayData.Uno_FinishGame_Data _finishGameData, List <UnoGamePlayData.Uno_PlayerPlayingData> _listPlayerPlayingData)
 {
     if (_finishGameData == null || _listPlayerPlayingData == null || _listPlayerPlayingData.Count == 0)
     {
         return;
     }
     finishGameData = _finishGameData;
     if (listPlayerPlayingData == null)
     {
         listPlayerPlayingData = new List <UnoGamePlayData.Uno_PlayerPlayingData>();
     }
     else
     {
         listPlayerPlayingData.Clear();
     }
     for (int i = 0; i < _listPlayerPlayingData.Count; i++)
     {
         listPlayerPlayingData.Add(_listPlayerPlayingData[i]);
     }
 }
    public Coroutine Show(UnoGamePlayData.Uno_FinishGame_Data _finishGameData)
    {
        if (currentState == State.Show)
        {
            return(null);
        }
        currentState = State.Show;
        myCanvasGroup.blocksRaycasts = true;
        myText.transform.localScale  = Vector3.one * 0.5f;

        bool _isMePlayingAndWin = false;

        for (int i = 0; i < _finishGameData.listPlayersData.Count; i++)
        {
            if (_finishGameData.listPlayersData[i].isWin)
            {
                UnoGamePlayData.Uno_FinishGame_Data.Player_Data _playerFinish      = _finishGameData.listPlayersData[i];
                UnoGamePlayData.Uno_PlayerPlayingData           _playerPlayingData = Uno_GamePlay_Manager.instance.unoGamePlayData.listPlayerPlayingData[_playerFinish.indexCircle];
                if (_playerPlayingData.isMe &&
                    Uno_GamePlay_Manager.instance.unoGamePlayData.CheckIsPlaying(_playerPlayingData.userData.sessionId))
                {
                    _isMePlayingAndWin = true;
                }
            }
        }

        string _stResult = string.Empty;

        switch (_finishGameData.reasonFinish)
        {
        case UnoGamePlayData.Uno_FinishGame_Data.Reason.PlayerWin:
            if (_isMePlayingAndWin)
            {
                _stResult = MyLocalize.GetString("Uno/FinishGame_Reason_Victory");
            }
            else
            {
                _stResult = MyLocalize.GetString("Uno/FinishGame_Reason_Finish");
            }
            break;

        case UnoGamePlayData.Uno_FinishGame_Data.Reason.OnePlayerInTable:
            _stResult = MyLocalize.GetString("Uno/FinishGame_Reason_Finish");
            break;

        case UnoGamePlayData.Uno_FinishGame_Data.Reason.NoGlobalCards:
            _stResult = MyLocalize.GetString("Uno/FinishGame_Reason_NoGlobalCards");
            break;

        case UnoGamePlayData.Uno_FinishGame_Data.Reason.TimeOut:
            _stResult = MyLocalize.GetString("Uno/FinishGame_Reason_TimeOut");
            break;

        default:
            _stResult = MyLocalize.GetString("Uno/FinishGame_Reason_Finish");
            break;
        }
        myText.text = _stResult.ToUpper();

        if (tweenCanvasGroup != null)
        {
            LeanTween.cancel(tweenCanvasGroup.uniqueId);
            tweenCanvasGroup = null;
        }
        if (tweenMyText != null)
        {
            LeanTween.cancel(tweenMyText.uniqueId);
            tweenMyText = null;
        }
        if (actionShowOrHide != null)
        {
            StopCoroutine(actionShowOrHide);
            actionShowOrHide = null;
        }
        actionShowOrHide = DoActionShow();
        return(StartCoroutine(actionShowOrHide));
    }
Пример #4
0
    public IEnumerator DoActionShowGoldWinToPlayerAtFinishGame(UnoGamePlayData.Uno_FinishGame_Data _finishGameData, System.Action _onFinished)
    {
        double _totalBet = unoGamePlayData.totalBet * 0.95;

        panelTotalBet.SetBet((long)_totalBet);
        yield return(panelTotalBet.Show(false));

        yield return(null);

        List <IEnumerator>     _listActionShowEffGoldFly = new List <IEnumerator>();
        List <Uno_PlayerGroup> _tmpListPlayerGroup       = new List <Uno_PlayerGroup>();

        for (int i = 0; i < _finishGameData.listPlayersData.Count; i++)
        {
            UnoGamePlayData.Uno_FinishGame_Data.Player_Data _playerFinish = _finishGameData.listPlayersData[i];
            if (!_playerFinish.isWin)
            {
                continue;
            }
            UnoGamePlayData.Uno_PlayerPlayingData _playerPlayingData = unoGamePlayData.listPlayerPlayingData[_playerFinish.indexCircle];
            int             _indexChair  = _playerPlayingData.indexChair;
            Uno_PlayerGroup _playerGroup = Uno_GamePlay_Manager.instance.listPlayerGroup[_indexChair];
            _tmpListPlayerGroup.Add(_playerGroup);
            Vector2 _startPoint = panelTotalBet.imgIconChip.transform.position;
            Vector2 _endPoint   = _playerGroup.panelPlayerInfo.transform.position;

            _listActionShowEffGoldFly.Add(MyConstant.DoActionShowEffectGoldFly(goldPrefab, goldObjectPoolManager, sortingLayerManager.sortingLayerInfo_GoldObject
                                                                               , _startPoint, _endPoint, 10, 1f, 0.8f, () => {
                if (Uno_GamePlay_Manager.instance.CanPlayMusicAndSfx())
                {
                    MyAudioManager.instance.PlaySfx(GameInformation.instance.globalAudioInfo.sfx_Gold);
                }
            }));
        }
        CoroutineChain.Start
        .Parallel(_listActionShowEffGoldFly.ToArray());
        yield return(Yielders.Get(1.1f));

        panelTotalBet.SetBet(0, false);

        if (_tmpListPlayerGroup.Count > 0)
        {
            if (Uno_GamePlay_Manager.instance.CanPlayMusicAndSfx())
            {
                MyAudioManager.instance.PlaySfx(GameInformation.instance.globalAudioInfo.sfx_Gold);
            }
        }

        for (int i = 0; i < _tmpListPlayerGroup.Count; i++)
        {
            Vector3 _posStartPanelGoldBonus = _tmpListPlayerGroup[i].panelPlayerInfo.imgAvatar.transform.position;
            StartCoroutine(MyConstant.DoActionShowPopupWinGold(panelBonusGoldPrefab, effectPoolManager, Uno_GamePlay_Manager.instance.myCanvas.transform
                                                               , _posStartPanelGoldBonus, 0f, _finishGameData.goldWin));
            _tmpListPlayerGroup[i].panelPlayerInfo.RefreshGoldInfo();
        }
        if (myPanelUserInfo.currentState == PanelUserInfoInGameController.State.Show)
        {
            myPanelUserInfo.RefreshGoldInfo();
        }
        else
        {
            myPanelUserInfo.RefreshGoldInfo(true);
        }

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

        yield return(panelTotalBet.Hide(false));

        if (_onFinished != null)
        {
            _onFinished();
        }
    }