public void InitData(UserDataInGame _userData, bool _isWin, long _goldBonus, int _point)
    {
        data = _userData;

        if (_isWin)
        {
            imgStar.gameObject.SetActive(true);
            panelShadow.gameObject.SetActive(false);
            txtGoldBonus.text = "+" + MyConstant.GetMoneyString(_goldBonus, 9999);
            txtName.color     = Color.yellow;
            txtPoint.color    = Color.yellow;
        }
        else
        {
            imgStar.gameObject.SetActive(false);
            panelShadow.gameObject.SetActive(true);
            txtGoldBonus.text = string.Empty;
            txtName.color     = Color.white;
            txtPoint.color    = Color.white;
        }

        txtName.text  = MyConstant.ConvertString(data.nameShowInGame, maxLengthOfUserName);
        txtPoint.text = "" + MyConstant.GetMoneyString(_point);

        imgAvatar.texture = CoreGameManager.instance.gameInfomation.otherInfo.avatarDefault;
        data.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => {
            try{
                if (_avatar != null)
                {
                    imgAvatar.texture = _avatar;
                }
            }catch {}
        });
    }
 public override void ResetData()
 {
     if (data != null)
     {
         data = null;
     }
 }
Beispiel #3
0
    public void InitAsIncognito(UserDataInGame _data, string _txtNameShow = "")      // Init dưới dạng ẩn danh
    {
        myType = MyType.Incognito;
        if (data != null)
        {
            if (!data.IsEqual(_data))
            {
                if (actionLoadAvatar != null)
                {
                    StopCoroutine(actionLoadAvatar);
                    actionLoadAvatar = null;
                }
            }
        }
        data = _data;
        imgAvatar.texture = CoreGameManager.instance.gameInfomation.otherInfo.avatarIncognito;
        txtGold.text      = string.Empty;
        imgIconAcc.gameObject.SetActive(false);

        if (string.IsNullOrEmpty(_txtNameShow))
        {
            txtNameShow.text = MyLocalize.GetString("Global/Wating");
        }
        else
        {
            txtNameShow.text = _txtNameShow;
        }

        if (data != null)
        {
            actionLoadAvatar = data.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height, (_avatar) => {
                actionLoadAvatar = null;
            });
        }
    }
Beispiel #4
0
    public void InitData(UserDataInGame _data)
    {
        myType = MyType.Available;

        bool _canLoadAvatar = false;

        if (data == null)
        {
            data           = _data;
            _canLoadAvatar = true;
            RefreshGoldInfo(true);
        }
        else
        {
            if (!data.IsEqual(_data))
            {
                if (actionLoadAvatar != null)
                {
                    StopCoroutine(actionLoadAvatar);
                    actionLoadAvatar = null;
                }
                _canLoadAvatar = false;
                RefreshGoldInfo(true);
            }
            else
            {
                data           = _data;
                _canLoadAvatar = true;
                RefreshGoldInfo();
            }
        }

        Sprite _iconDatabaseID = data.GetIconDatabaseID();

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

        txtNameShow.text = MyConstant.ConvertString(data.nameShowInGame, 8);

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

                actionLoadAvatar = null;
            });
        }
    }
        public Uno_PlayerPlayingData(MessageReceiving _mess, List <short> _listSessionIdGlobalPlayer)
        {
            short _sessionId = _mess.readShort();

            indexChair = _mess.readByte();
            sbyte _numberCardInHand = _mess.readByte();

            sbyte _indexGlobal = (sbyte)_listSessionIdGlobalPlayer.IndexOf(_sessionId);

            userData = new UserDataInGame(_mess, _sessionId, _indexGlobal);
            if (_indexGlobal < 0)
            {
                                #if TEST
                Debug.Log(userData.nameShowInGame + " đã rời bàn trước đó");
                                #endif
            }
            if (_sessionId == DataManager.instance.userData.sessionId)
            {
                isMe = true;
            }
            else
            {
                isMe = false;
            }
            // Debug.LogError(userData.nameShowInGame + " _numberCardInHand : " + _numberCardInHand);
            ownCards = new List <sbyte>();
            for (int i = 0; i < _numberCardInHand; i++)
            {
                ownCards.Add(-1);
            }
        }
 public void InitData(UserDataInGame _userData)
 {
     panelPlayerInfo.InitData(_userData);
     panelPlayerInfo.SetShadow(false);
     panelPlayerInfo.Show();
     ClearAllCards();
     isInitialized = true;
 }
 public void InitAsIncognito(UserDataInGame _userData)
 {
     panelPlayerInfo.InitAsIncognito(_userData);
     panelPlayerInfo.SetShadow(true);
     panelPlayerInfo.Show();
     ClearAllCards();
     isInitialized = true;
 }
Beispiel #8
0
 public UserDataInGame CastToUserDataInGame()      // chỉ để đọc dữ liệu thôi chứ ko đè chồng dc
 {
     if (_userDataInGame == null)
     {
         _userDataInGame = new UserDataInGame();
     }
     _userDataInGame.InitData(this);
     return(_userDataInGame);
 }
 public void InitData(UserDataInGame _userData)
 {
     panelPlayerInfo.InitData(_userData);
     panelPlayerInfo.SetShadow(false);
     panelPlayerInfo.Show();
     myPanelStatus.Hide();
     myPanelBet.Hide();
     ownCardPoolManager.ClearAllObjectsNow();
     isInitialized = true;
 }
    public void RemovePLayerPlayGame(int sessionidplaer, int chairpos)
    {
        if (sessionidplaer == listUserPlayGame[chairpos].sessionId)
        {
#if TEST
            Debug.Log("remove" + sessionidplaer + "  " + chairpos);
#endif
            listUserPlayGame[chairpos] = new UserDataInGame();
        }
    }
Beispiel #11
0
 public override void ResetData()
 {
     if (data != null)
     {
         data = null;
     }
     if (cardPoolManager != null)
     {
         cardPoolManager.ClearAllObjectsNow();
     }
 }
Beispiel #12
0
    public void InitListOtherUserDataInGame(MessageReceiving _mess)
    {
        listOtherPlayerData = new List <UserDataInGame>();
        UserDataInGame _usedata   = null;
        sbyte          _maxViewer = _mess.readByte();

        for (int i = 0; i < (int)_maxViewer; i++)
        {
            sbyte _caseCheck = _mess.readByte(); //(nếu giá trị -1 thì không đọc data dưới --> tiếp tục vòng for)
            if (_caseCheck >= 0)
            {
                short _sessionId = _mess.readShort();
                _usedata = new UserDataInGame(_mess, _sessionId, (sbyte)i);
                BOL_ShowPlayer_Manager.instance.InitUserInroom(_usedata);
                if (_usedata.sessionId != DataManager.instance.userData.sessionId)
                {
                    listOtherPlayerData.Add(_usedata);
                }
                else
                {
                    DataManager.instance.userData.CastToUserDataInGame().index = (sbyte)i;
                    AchievementDetail _achievementDetail = DataManager.instance.achievementData.GetAchievementDetail(IMiniGameInfo.Type.BattleOfLegend);
                    if (_achievementDetail != null)
                    {
                        _achievementDetail.countWin  = _usedata.win;
                        _achievementDetail.countDraw = _usedata.tie;
                        _achievementDetail.countLose = _usedata.lose;
                        // Debug.Log(_usedata.win + " - " + _usedata.tie + " - " + _usedata.lose);
                    }
                    else
                    {
                        Debug.LogError(">>> _achievementDetail is null");
                    }
                }
            }
            else
            {
                _usedata = new UserDataInGame();
                listOtherPlayerData.Add(_usedata);
            }
            //Debug.LogError(_usedata.sessionId + " - " + DataManager.instance.userData.sessionId);
        }

        sbyte numberChairs = _mess.readByte();

        for (int i = 0; i < numberChairs; i++)
        {
            sbyte checkCase = _mess.readByte();
            if (checkCase >= 0)
            {
                short sessionIds = _mess.readShort();
            }
        }
    }
Beispiel #13
0
 public bool IsEqual(UserDataInGame _other)
 {
     if (_other == null)
     {
         return(false);
     }
     if (sessionId == _other.sessionId)
     {
         return(true);
     }
     return(false);
 }
    public void RefreshUIButtonSitDown()
    {
        if (pokerGamePlayData.CheckIsPlaying(DataManager.instance.userData.sessionId) ||
            pokerGamePlayData.listSessionIdOnChair.Contains(DataManager.instance.userData.sessionId))
        {
            for (int i = 0; i < Poker_GamePlay_Manager.instance.listPlayerGroup.Count; i++)
            {
                Poker_GamePlay_Manager.instance.listPlayerGroup[i].HideButtonSitDown();
            }
            HideMyPanelUserInfo();
            return;
        }

        ShowMyPanelUserInfo();

        List <int> _listIndexChairPlaying = new List <int>();

        for (int i = 0; i < pokerGamePlayData.listPlayerPlayingData.Count; i++)
        {
            int _indexChair = pokerGamePlayData.listPlayerPlayingData[i].indexChair;
            Poker_GamePlay_Manager.instance.listPlayerGroup[_indexChair].HideButtonSitDown();
            _listIndexChairPlaying.Add(_indexChair);
        }
        List <int> _listIndexChairWaiting = new List <int>();

        for (int i = 0; i < pokerGamePlayData.numberChairs; i++)
        {
            if (!_listIndexChairPlaying.Contains(i))
            {
                _listIndexChairWaiting.Add(i);
            }
        }
        Poker_PlayerGroup _playerGroup = null;

        for (int i = 0; i < _listIndexChairWaiting.Count; i++)
        {
            int   _indexChair = _listIndexChairWaiting[i];
            short _sessionId  = pokerGamePlayData.listSessionIdOnChair[_indexChair];
            _playerGroup = Poker_GamePlay_Manager.instance.listPlayerGroup[_indexChair];
            UserDataInGame _userData = pokerGamePlayData.GetUserDataInGameFromListGlobal(_sessionId);
            if (_userData == null)
            {
                _playerGroup.ShowButtonSitDown();
            }
            else
            {
                _playerGroup.HideButtonSitDown();
            }
        }
    }
    public void InitListOtherUserDataInGame(MessageReceiving _mess)
    {
        listGlobalPlayerData      = new List <UserDataInGame>();
        listSessionIdGlobalPlayer = new List <short>();
        UserDataInGame _userdata  = null;
        sbyte          _maxViewer = _mess.readByte();

        for (int i = 0; i < (int)_maxViewer; i++)
        {
            sbyte _caseCheck = _mess.readByte();             //(nếu giá trị -1 thì không đọc data dưới --> tiếp tục vòng for)
            if (_caseCheck != -1)
            {
                short _sessionId = _mess.readShort();
                _userdata = new UserDataInGame(_mess, _sessionId, (sbyte)i);
                if (CheckIfIsMe(_userdata.sessionId))
                {
                    int _countWin  = _userdata.win;
                    int _countTie  = _userdata.tie;
                    int _countLose = _userdata.lose;
                    _userdata       = DataManager.instance.userData.CastToUserDataInGame();
                    _userdata.index = (sbyte)i;
                    _userdata.win   = _countWin;
                    _userdata.tie   = _countTie;
                    _userdata.lose  = _countLose;
                    AchievementDetail _achievementDetail = DataManager.instance.achievementData.GetAchievementDetail(IMiniGameInfo.Type.Uno);
                    if (_achievementDetail != null)
                    {
                        _achievementDetail.countWin  = _userdata.win;
                        _achievementDetail.countDraw = _userdata.tie;
                        _achievementDetail.countLose = _userdata.lose;
                        // Debug.Log(_usedata.win + " - " + _usedata.tie + " - " + _usedata.lose);
                    }
                    else
                    {
                        Debug.LogError(">>> _achievementDetail is null");
                    }
                }
                listGlobalPlayerData.Add(_userdata);
                listSessionIdGlobalPlayer.Add(_sessionId);
            }
            else
            {
                _userdata = new UserDataInGame();
                listGlobalPlayerData.Add(_userdata);
                listSessionIdGlobalPlayer.Add(-1);
            }
            // Debug.LogError(_usedata.sessionId + " - " + DataManager.instance.userData.sessionId);
        }
    }
        public SubGame_PlayerChat_Data(MessageReceiving _mess)
        {
            databaseid = (UserData.DatabaseType)_mess.readByte();
            userid     = _mess.readLong();
            avatarid   = _mess.readByte();
            nameShow   = _mess.readString();
            fbId       = -1;
            if (databaseid == UserData.DatabaseType.DATABASEID_FACEBOOK)
            {
                fbId = _mess.readLong();
            }
            contentChat = _mess.readString();

            userData = new UserDataInGame(databaseid, userid, fbId, avatarid, nameShow);
        }
Beispiel #17
0
 public void InitData(UserDataInGame _userData, string _chatConntent, System.Action <MySimplePoolObjectController> _onSelfDestruction)
 {
     txtUserName.text = MyConstant.ConvertString(_userData.nameShowInGame, maxLengthOfUserName);
     _userData.LoadAvatar(this, imgAvatar.rectTransform.rect.width, imgAvatar.rectTransform.rect.height,
                          (_avatar) =>
     {
         try{
             if (_avatar != null)
             {
                 imgAvatar.texture = _avatar;
             }
         }catch {}
     });
     txtContent.text    = _chatConntent;
     tmpTxtContent.text = _chatConntent;
     onSelfDestruction  = _onSelfDestruction;
 }
Beispiel #18
0
    public void AddMessage(UserDataInGame _userData, string _strMess)
    {
        if (listData == null)
        {
            listData = new List <ChatDetail>();
        }
        if (listPanelChatDetail == null)
        {
            listPanelChatDetail = new List <PanelChatDetailController>();
        }

        ChatDetail _tmpChatDetail = new ChatDetail(_userData, _strMess);

        if (_userData.IsEqual(DataManager.instance.userData.userId, DataManager.instance.userData.databaseId))
        {
            _tmpChatDetail.isMe = true;
        }
        else if (_userData.sessionId == DataManager.instance.userData.sessionId)
        {
            _tmpChatDetail.isMe = true;
        }

        listData.Insert(0, _tmpChatDetail);

        if (listData.Count > maxChatContent && listData.Count > 0)
        {
            listData.RemoveAt(listData.Count - 1);
        }

        if (currentState == State.Show)
        {
            if (listPanelChatDetail.Count > maxChatContent && listPanelChatDetail.Count > 0)
            {
                listPanelChatDetail[listPanelChatDetail.Count - 1].SelfDestruction();
            }
            AddPanelDetail(_tmpChatDetail);
        }
        else
        {
            if (onHasNewMessage != null)
            {
                onHasNewMessage();
            }
        }
    }
Beispiel #19
0
    public void SetUpUserJoinGame(MessageReceiving _mess)
    {
        short _sessionId    = _mess.readShort();
        sbyte _viewerId     = _mess.readByte();
        sbyte _myIndexChair = DataManager.instance.userData.CastToUserDataInGame().index;

        if (_viewerId == _myIndexChair)
        {
#if TEST
            Debug.LogError(">>> Chỗ này tao đang ngồi: " + _viewerId);
#endif
        }
        else if (_viewerId > _myIndexChair)
        {
            _viewerId--;
        }
        UserDataInGame _usedata = new UserDataInGame(_mess, _sessionId, _viewerId);
        if (listOtherPlayerData[_viewerId].sessionId >= 0)
        {
#if TEST
            Debug.LogError(">>> Chỗ này đã có người rồi: " + _viewerId);
#endif
            return;
        }
        if (_usedata.sessionId != DataManager.instance.userData.sessionId)
        {
            listOtherPlayerData[_viewerId] = _usedata;
#if TEST
            Debug.Log(">>> Có người chơi " + listOtherPlayerData[_viewerId].nameShowInGame + " vào bàn tại vị trí " + _viewerId);
#endif
            if (BOL_ShowPlayer_Manager.ins != null)
            {
                BOL_ShowPlayer_Manager.instance.InitUserInroom(_usedata);
            }
#if TEST
            PopupManager.Instance.CreateToast(_usedata.nameShowInGame + " is join game");
#endif
        }
        else
        {
#if TEST
            Debug.LogError(">>> Trả session ID tào lao: " + _sessionId);
#endif
        }
    }
Beispiel #20
0
    IEnumerator DoActionJoinBan()
    {
        UserDataInGame _userData = DataManager.instance.userData.CastToUserDataInGame();

        yield return(null);

        Uno_PlayerGroup _myPlayerGroup = null;

        for (int i = 0; i < uno_GamePlay_Manager.listPlayerGroup.Count; i++)
        {
            _myPlayerGroup = uno_GamePlay_Manager.listPlayerGroup[i];
            if (!_myPlayerGroup.isInitialized)
            {
                _myPlayerGroup.InitData(_userData);
                LeanTween.scale(_myPlayerGroup.panelPlayerInfo.gameObject, Vector3.one * uno_GamePlay_Manager.UIManager.listPlaceHolderPanelPlayerInfo_Wating[_myPlayerGroup.realIndex].ratioScale, 0.2f)
                .setEase(LeanTweenType.easeOutBack);
                yield return(Yielders.Get(0.2f));
            }
        }
    }
Beispiel #21
0
    public void Init(UserDataInGame _data, System.Action _onClose = null)
    {
        data = _data;

        Sprite _iconDatabaseID = data.GetIconDatabaseID();

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

        txtNameShow.text = MyConstant.ConvertString(data.nameShowInGame, maxLengthOfUserName);
        txtGold.text     = MyConstant.GetMoneyString(data.gold, 999999999);

        txtAchievement_Win.text  = MyConstant.GetMoneyString(data.win);
        txtAchievement_Tie.text  = MyConstant.GetMoneyString(data.tie);
        txtAchievement_Lose.text = MyConstant.GetMoneyString(data.lose);

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

        onClose = _onClose;
        CoreGameManager.instance.RegisterNewCallbackPressBackKey(Close);

        Show();
    }
Beispiel #22
0
    public PopupPlayerInfoController CreatePopupPlayerInfo(UserDataInGame _userDataInGame)
    {
        if (myCanvas.worldCamera == null && CoreGameManager.instance.currentSceneManager != null)
        {
            myCanvas.worldCamera = CoreGameManager.instance.currentSceneManager.cameraForConsumableScreen.mainCamera;
        }
        else
        {
            myCanvas.worldCamera = Camera.main;
        }

        myCanvasGroup.alpha          = 1f;
        myCanvasGroup.blocksRaycasts = true;

        PopupPlayerInfoController _tmpPopup = LeanPool.Spawn(popupPlayerInfoPrefab, Vector3.zero, Quaternion.identity, pool.transform).GetComponent <PopupPlayerInfoController>();

        _tmpPopup.Init(_userDataInGame, () => {
            RemovePopupActive(_tmpPopup);
        });
        MyAudioManager.instance.PlaySfx(PopupManager.Instance.myInfoAudio.sfx_Popup);
        AddPopupActive(_tmpPopup);

        return(_tmpPopup);
    }
Beispiel #23
0
    public void SetUpUserLeftGame(MessageReceiving _mess)
    {
        short _sessionId = _mess.readShort();

        for (int i = 0; i < listOtherPlayerData.Count; i++)
        {
            if (listOtherPlayerData[i].IsEqual(_sessionId))
            {
#if TEST
                Debug.Log(">>> Có người chơi " + listOtherPlayerData[i].nameShowInGame + " thoát bàn tại vị trí " + i);
#endif
                if (BOL_ShowPlayer_Manager.ins != null)
                {
                    for (int j = 0; j < BOL_ShowPlayer_Manager.instance.listUserIngame.Count; j++)
                    {
                        if (_sessionId == BOL_ShowPlayer_Manager.instance.listUserIngame[j].sessionId)
                        {
                            BOL_ShowPlayer_Manager.instance.listUserIngame[j] = new UserDataInGame();
                            break;
                        }
                    }
                }
                else
                {
#if TEST
                    Debug.Log("BOL_ShowPlayer_Manager.ins = null");
#endif
                }
                listOtherPlayerData[i] = new UserDataInGame();
                return;
            }
        }
#if TEST
        Debug.LogError(">>> Không tìm thấy session ID: " + _sessionId);
#endif
    }
Beispiel #24
0
    IEnumerator DoActionInitData(UserDataInGame _userData, bool _isWin, long _goldBonus, int _point, List <sbyte> _cardValue)
    {
        data = _userData;

        if (cardPoolManager == null)
        {
            cardPoolManager = new MySimplePoolManager();
        }

        if (_isWin)
        {
            imgStar.color = Color.white;
            panelShadow.gameObject.SetActive(false);
            txtGoldBonus.text  = "+" + MyConstant.GetMoneyString(_goldBonus, 9999);
            txtGoldBonus.color = Color.yellow;
            txtName.color      = Color.yellow;
            txtPoint.color     = Color.yellow;
        }
        else
        {
            imgStar.color = Color.gray;
            panelShadow.gameObject.SetActive(true);
            txtGoldBonus.text  = "-" + MyConstant.GetMoneyString(_goldBonus, 9999);
            txtGoldBonus.color = Color.red;
            txtName.color      = Color.white;
            txtPoint.color     = Color.white;
        }

        txtName.text  = MyConstant.ConvertString(data.nameShowInGame, maxLengthOfUserName);
        txtPoint.text = "" + MyConstant.GetMoneyString(_point);

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

        int _totalCards = _cardValue.Count;

        if (_totalCards > 20)
        {
            _totalCards = 20;
        }
        List <CardHolderController> _tmpListCardHolder = new List <CardHolderController>();

        for (int i = 0; i < _totalCards; i++)
        {
            CardHolderController _cardHolder = LeanPool.Spawn(cardHolderPrefab, Vector3.zero, Quaternion.identity, panelCardHolderContainer).GetComponent <CardHolderController>();
            _tmpListCardHolder.Add(_cardHolder);
        }
        yield return(Yielders.EndOfFrame);

        for (int i = 0; i < _totalCards; i++)
        {
            CardUnoInfo _cardInfo = null;
            if (Uno_GamePlay_Manager.instance.unoGamePlayData.IsWildCardColor(_cardValue[i]))
            {
                _cardInfo = Uno_GamePlay_Manager.instance.GetCardInfo(CardUnoInfo.CardType._Special_WildColor);
            }
            else if (Uno_GamePlay_Manager.instance.unoGamePlayData.IsWildCardDraw(_cardValue[i]))
            {
                _cardInfo = Uno_GamePlay_Manager.instance.GetCardInfo(CardUnoInfo.CardType._Special_Draw4Cards);
            }
            else
            {
                _cardInfo = Uno_GamePlay_Manager.instance.GetCardInfo(_cardValue[i]);
            }
            if (_cardInfo == null)
            {
                                #if TEST
                Debug.LogError(">>> Không tìm thấy cardInfo (0): " + _cardValue[i]);
                                #endif
            }
            PanelCardUnoDetailController _card = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, panelCardContainer).GetComponent <PanelCardUnoDetailController>();
            cardPoolManager.AddObject(_card);
            _card.transform.position = _tmpListCardHolder[i].transform.position;
            _card.transform.rotation = _tmpListCardHolder[i].transform.rotation;
            _card.ShowNow(_cardInfo, (int)_cardValue[i]);
            _card.ResizeAgain(Uno_GamePlay_Manager.instance.UIManager.sizeCardDefault.x, Uno_GamePlay_Manager.instance.UIManager.sizeCardDefault.y);
            _card.transform.localScale = Vector3.one * _tmpListCardHolder[i].ratioScale;
        }

        for (int i = 0; i < _tmpListCardHolder.Count; i++)
        {
            _tmpListCardHolder[i].SelfDestruction();
        }
        _tmpListCardHolder.Clear();
    }
Beispiel #25
0
    public override void ResetData()

    {
        base.ResetData();
        data = null;
    }
    void RefreshAllPlayerGroupUINow()
    {
        if (unoGamePlayData.currentGameState == UnoGamePlayData.GameState.STATUS_WAIT_FOR_PLAYER)
        {
            for (int i = 0; i < unoGamePlayData.listSessionIdOnChair.Count; i++)
            {
                if (unoGamePlayData.listSessionIdOnChair[i] < 0)                 // ghế trống
                {
                    continue;
                }
                for (int j = 0; j < unoGamePlayData.listGlobalPlayerData.Count; j++)
                {
                    if (unoGamePlayData.listSessionIdOnChair[i] == unoGamePlayData.listGlobalPlayerData[j].sessionId)
                    {
                        Uno_GamePlay_Manager.instance.listPlayerGroup[i].InitData(unoGamePlayData.listGlobalPlayerData[j]);
                        Uno_GamePlay_Manager.instance.listPlayerGroup[i].panelPlayerInfo.transform.localScale = Vector3.one * listPlaceHolderPanelPlayerInfo_Wating[i].ratioScale;
                        break;
                    }
                }
            }
            MoveAllToPosWaiting();
        }
        else
        {
            List <int> _listIndexChairPlaying = new List <int>();
            for (int i = 0; i < unoGamePlayData.listPlayerPlayingData.Count; i++)
            {
                _listIndexChairPlaying.Add(unoGamePlayData.listPlayerPlayingData[i].indexChair);
                int _indexChair = unoGamePlayData.listPlayerPlayingData[i].indexChair;

                Uno_PlayerGroup _playerGroup = Uno_GamePlay_Manager.instance.listPlayerGroup[_indexChair];
                _playerGroup.InitData(unoGamePlayData.listPlayerPlayingData[i].userData);
                if (_playerGroup.isMe)
                {
                                        #if TEST
                    Debug.LogError(">>> Bug logic (0)");
                                        #endif
                    _playerGroup.panelPlayerInfo.transform.localScale = Vector3.one * placeHolderMyPanelInfo_Playing.ratioScale;
                }
                else
                {
                    _playerGroup.panelPlayerInfo.transform.localScale = Vector3.one * listPlaceHolderPanelPlayerInfo_Playing[_playerGroup.viewIndex].ratioScale;
                }

                for (int j = 0; j < unoGamePlayData.listPlayerPlayingData[i].ownCards.Count; j++)
                {
                    DealPlayerCard(_playerGroup, unoGamePlayData.listPlayerPlayingData[i].ownCards[j], 0f, null);
                }
            }
            MoveAllToPosPlaying();

            // --- hiện các thông tin người chơi đang chờ --- //
            List <int> _listIndexChairWaiting = new List <int>();
            for (int i = 0; i < unoGamePlayData.numberChairs; i++)
            {
                if (!_listIndexChairPlaying.Contains(i))
                {
                    _listIndexChairWaiting.Add(i);
                }
            }
            for (int i = 0; i < _listIndexChairWaiting.Count; i++)
            {
                int            _indexChair = _listIndexChairWaiting[i];
                short          _sessionId  = unoGamePlayData.listSessionIdOnChair[_indexChair];
                UserDataInGame _userData   = unoGamePlayData.GetUserDataInGameFromListGlobal(_sessionId);
                if (_userData == null)
                {
                    continue;
                }
                Uno_PlayerGroup _playerGroup = Uno_GamePlay_Manager.instance.listPlayerGroup[_indexChair];
                _playerGroup.InitAsIncognito(_userData);
                LeanTween.scale(_playerGroup.panelPlayerInfo.gameObject, Vector3.one * listPlaceHolderPanelPlayerInfo_Wating[_playerGroup.realIndex].ratioScale, 0.2f)
                .setEase(LeanTweenType.easeOutBack);
            }
        }
    }
Beispiel #27
0
    public UserDataInGame ShallowCopy()
    {
        UserDataInGame other = (UserDataInGame)this.MemberwiseClone();

        return(other);
    }
 public PlayerJoinGame_Data(MessageReceiving _mess)
 {
     sessionId = _mess.readShort();
     viewerId  = _mess.readByte();
     userData  = new UserDataInGame(_mess, sessionId, viewerId);
 }
    void RefreshAllPlayerGroupUINow()
    {
        if (pokerGamePlayData.currentGameState == PokerGamePlayData.GameState.STATUS_WAIT_FOR_PLAYER)
        {
            for (int i = 0; i < pokerGamePlayData.listSessionIdOnChair.Count; i++)
            {
                if (pokerGamePlayData.listSessionIdOnChair[i] < 0)                 // ghế trống
                {
                    continue;
                }
                for (int j = 0; j < pokerGamePlayData.listGlobalPlayerData.Count; j++)
                {
                    if (pokerGamePlayData.listSessionIdOnChair[i] == pokerGamePlayData.listGlobalPlayerData[j].sessionId)
                    {
                        Poker_GamePlay_Manager.instance.listPlayerGroup[i].InitData(pokerGamePlayData.listGlobalPlayerData[j]);
                        break;
                    }
                }
            }
        }
        else           // đang chơi thì hiện thông tin người chơi và chia bài cho họ
        {
            List <int> _listIndexChairPlaying = new List <int>();
            Vector3    _pos = Vector3.zero;
            Quaternion _rot = Quaternion.identity;
            PanelCardDetailController _card = null;
            for (int i = 0; i < pokerGamePlayData.listPlayerPlayingData.Count; i++)
            {
                _listIndexChairPlaying.Add(pokerGamePlayData.listPlayerPlayingData[i].indexChair);
                int _indexChair = pokerGamePlayData.listPlayerPlayingData[i].indexChair;

                Poker_PlayerGroup _playerGroup = Poker_GamePlay_Manager.instance.listPlayerGroup[_indexChair];
                _playerGroup.InitData(pokerGamePlayData.listPlayerPlayingData[i].userData);
                _playerGroup.ShowPlayerState(pokerGamePlayData.listPlayerPlayingData[i].currentState, true);
                if (pokerGamePlayData.listPlayerPlayingData[i].turnBet > 0)
                {
                    _playerGroup.myPanelBet.SetBet(pokerGamePlayData.listPlayerPlayingData[i].turnBet, true);
                    _playerGroup.myPanelBet.Show();
                }

                if (pokerGamePlayData.listPlayerPlayingData[i].currentState != PokerGamePlayData.Poker_PlayerPlayingData.State.STATEPOKER_FOLD)
                {
                    for (int j = 0; j < _playerGroup.cardCoverHoldersCatched.Count; j++)
                    {
                        _pos = _playerGroup.cardCoverHoldersCatched[j].position;
                        _rot = _playerGroup.cardCoverHoldersCatched[j].rotation;

                        _card = LeanPool.Spawn(cardPrefab, Vector3.zero, Quaternion.identity, Poker_GamePlay_Manager.instance.panelCardContainer).GetComponent <PanelCardDetailController>();
                        _card.transform.position = _pos;
                        _card.transform.rotation = _rot;
                        _card.ResizeAgain(Poker_GamePlay_Manager.instance.sizeCard.x, Poker_GamePlay_Manager.instance.sizeCard.y);
                        _playerGroup.ownCardPoolManager.AddObject(_card);
                    }
                }

                if (i == 0)
                {
                    panelRoleSmallBlind.gameObject.SetActive(true);
                    panelRoleSmallBlind.position = _playerGroup.myPanelBet.imgIconChip.transform.position;
                }
                else if (i == 1)
                {
                    panelRoleBigBlind.gameObject.SetActive(true);
                    panelRoleBigBlind.position = _playerGroup.myPanelBet.imgIconChip.transform.position;
                }
            }
            // --- hiện các thông tin người chơi đang chờ --- //
            List <int> _listIndexChairWaiting = new List <int>();
            for (int i = 0; i < pokerGamePlayData.numberChairs; i++)
            {
                if (!_listIndexChairPlaying.Contains(i))
                {
                    _listIndexChairWaiting.Add(i);
                }
            }
            for (int i = 0; i < _listIndexChairWaiting.Count; i++)
            {
                int            _indexChair = _listIndexChairWaiting[i];
                short          _sessionId  = pokerGamePlayData.listSessionIdOnChair[_indexChair];
                UserDataInGame _userData   = pokerGamePlayData.GetUserDataInGameFromListGlobal(_sessionId);
                if (_userData == null)
                {
                    continue;
                }

                Poker_PlayerGroup _playerGroup = Poker_GamePlay_Manager.instance.listPlayerGroup[_indexChair];
                _playerGroup.InitAsIncognito(_userData);
            }
        }
    }
Beispiel #30
0
 public ChatDetail(UserDataInGame _userData, string _strMess)
 {
     userData = _userData;
     strMess  = _strMess;
 }