Exemple #1
0
 void Instance_onPlayerListChanged(ResponsePlayerListChanged data)
 {
     if (PokerObserver.Game.ListPlayer.Count <= 1)
     {
         ResetCountdown();
     }
 }
    void Instance_onPlayerListChanged(ResponsePlayerListChanged data)
    {
        if (PokerObserver.Game.IsMainPlayer(data.player.userName))
        {
            switch (data.GetActionState())
            {
            case PokerPlayerChangeAction.playerAdded:
                SetEnableButtonType(EButtonType.InGame);
                break;

            case PokerPlayerChangeAction.waitingPlayerAdded:
                SetEnableButtonType(EButtonType.OutGame);
                break;
            }
        }
    }
Exemple #3
0
    void Instance_onPlayerListChanged(ResponsePlayerListChanged dataPlayer)
    {
        PokerPlayerChangeAction state = dataPlayer.GetActionState();

        if (state == PokerPlayerChangeAction.playerAdded)
        {
            if (PokerObserver.Game.IsMainPlayer(dataPlayer.player.userName))
            {
                PuSound.Instance.Play(SoundType.Sit_Down);
            }

            SetPositionAvatarPlayer(dataPlayer.player.userName);
        }
        else if ((state == PokerPlayerChangeAction.playerRemoved || state == PokerPlayerChangeAction.playerQuitGame) &&
                 dictPlayerObject.ContainsKey(dataPlayer.player.userName))
        {
            PokerPlayerUI playerUI = GetPlayerUI(dataPlayer.player.userName);

            if (PokerObserver.Game.IsMainPlayer(dataPlayer.player.userName))
            {
                PuSound.Instance.Play(SoundType.StandUp);
            }

            if (PokerObserver.Game.Dealer == dataPlayer.player.userName)
            {
                objectDealer.SetActive(false);
            }

            DestroyCardObject(playerUI.cardOnHands);

            if (dictReJoinGame.ContainsKey(dataPlayer.player.userName))
            {
                GameObject.Destroy(dictReJoinGame[dataPlayer.player.userName]);
                dictReJoinGame.Remove(dataPlayer.player.userName);
            }
            else
            {
                //GameObject.Destroy(playerUI);
                NGUITools.SetActive(playerUI.gameObject, false);
                listPlayerQuit.Add(playerUI);
                playerUI.PlayerOutGame();
                //dictPlayerObject.Remove(dataPlayer.player.userName);
            }
        }

        UpdatePositionPlayers(dataPlayer.player.userName);
    }
Exemple #4
0
    void Instance_onPlayerListChanged(ResponsePlayerListChanged data)
    {
        if (PokerObserver.Game.IsMainPlayer(data.player.userName))
        {
            switch (data.GetActionState())
            {
            case PokerPlayerChangeAction.playerQuitGame:
            case PokerPlayerChangeAction.playerRemoved:
            case PokerPlayerChangeAction.waitingPlayerAdded:
                wasBuyChip = false;
                break;

            case PokerPlayerChangeAction.playerAdded:
                wasBuyChip = true;
                if (onPlayerSitdown != null)
                {
                    onPlayerSitdown(!wasBuyChip);
                }
                break;
            }
            SetActiveButton(!wasBuyChip);
        }
    }
    void Instance_onPlayerListChanged(ResponsePlayerListChanged dataPlayer)
    {
        PokerPlayerChangeAction state = dataPlayer.GetActionState();
        if(state == PokerPlayerChangeAction.playerAdded)
        {
            if (PokerObserver.Game.IsMainPlayer(dataPlayer.player.userName))
                PuSound.Instance.Play(SoundType.Sit_Down);

            SetPositionAvatarPlayer(dataPlayer.player.userName);
        }
        else if ((state == PokerPlayerChangeAction.playerRemoved || state == PokerPlayerChangeAction.playerQuitGame)
            && dictPlayerObject.ContainsKey(dataPlayer.player.userName))
        {
            if (PokerObserver.Game.IsMainPlayer(dataPlayer.player.userName))
                PuSound.Instance.Play(SoundType.StandUp);

            if(PokerObserver.Game.Dealer == dataPlayer.player.userName)
                objectDealer.SetActive(false);

            DestroyCardObject(dictPlayerObject[dataPlayer.player.userName].GetComponent<PokerPlayerUI>().cardOnHands);
            GameObject.Destroy(dictPlayerObject[dataPlayer.player.userName]);
            dictPlayerObject.Remove(dataPlayer.player.userName);
        }

        UpdatePositionPlayers(dataPlayer.player.userName);
    }
 void Instance_onPlayerListChanged(ResponsePlayerListChanged data)
 {
     if (PokerObserver.Game.IsMainPlayer(data.player.userName))
     {
         switch (data.GetActionState())
         {
             case PokerPlayerChangeAction.playerAdded:
                 SetEnableButtonType(EButtonType.InGame);
                 break;
             case PokerPlayerChangeAction.waitingPlayerAdded:
                 SetEnableButtonType(EButtonType.OutGame);
                 break;
         }
     }
 }
 void Instance_onPlayerListChanged(ResponsePlayerListChanged data)
 {
     if (PokerObserver.Game.ListPlayer.Count <= 1)
         ResetCountdown();
 }
    void Instance_onPlayerListChanged(ResponsePlayerListChanged dataPlayer)
    {
        PokerPlayerChangeAction state = dataPlayer.GetActionState();
        if(state == PokerPlayerChangeAction.playerAdded)
        {
            if (PokerObserver.Game.IsMainPlayer(dataPlayer.player.userName))
                PuSound.Instance.Play(SoundType.Sit_Down);

            SetPositionAvatarPlayer(dataPlayer.player.userName);
        }
        else if ((state == PokerPlayerChangeAction.playerRemoved || state == PokerPlayerChangeAction.playerQuitGame)
            && dictPlayerObject.ContainsKey(dataPlayer.player.userName))
        {
            PokerPlayerUI playerUI = GetPlayerUI(dataPlayer.player.userName);

            if (PokerObserver.Game.IsMainPlayer(dataPlayer.player.userName))
                PuSound.Instance.Play(SoundType.StandUp);

            if(PokerObserver.Game.Dealer == dataPlayer.player.userName)
                objectDealer.SetActive(false);

            DestroyCardObject(playerUI.cardOnHands);

            if (dictReJoinGame.ContainsKey(dataPlayer.player.userName))
            {
                GameObject.Destroy(dictReJoinGame[dataPlayer.player.userName]);
                dictReJoinGame.Remove(dataPlayer.player.userName);
            }
            else
            {
                //GameObject.Destroy(playerUI);
                NGUITools.SetActive(playerUI.gameObject, false);
                listPlayerQuit.Add(playerUI);
                playerUI.PlayerOutGame();
                //dictPlayerObject.Remove(dataPlayer.player.userName);
            }
        }

        UpdatePositionPlayers(dataPlayer.player.userName);
    }
Exemple #9
0
    void EventDispatcher_onGameEvent(string command, object data)
    {
        //Logger.Log(ELogColor.YELLOW, "**** Client handled: " + command + " - " + DateTime.Now.ToString("hh:mm:ss"));

        if (data is ResponseUpdateGame)
        {
            ResponseUpdateGame dataGame = (ResponseUpdateGame)data;
            if (dataUpdateGameChange != null)
            {
                dataUpdateGameChange(dataGame);
            }
        }
        else if (data is ResponsePlayerListChanged)
        {
            ResponsePlayerListChanged dataPlayerChange = (ResponsePlayerListChanged)data;
            if (onPlayerListChanged != null)
            {
                onPlayerListChanged(dataPlayerChange);
            }
        }
        else if (data is ResponseUpdateHand && onEventUpdateHand != null)
        {
            onEventUpdateHand((ResponseUpdateHand)data);
        }
        else if (data is ResponseUpdateTurnChange)
        {
            ResponseUpdateTurnChange dataTurn = (ResponseUpdateTurnChange)data;

            if (onTurnChange != null)
            {
                onTurnChange(dataTurn);
            }
        }
        else if (data is ResponseFinishGame && onFinishGame != null)
        {
            onFinishGame((ResponseFinishGame)data);
        }
        else if (data is ResponseWaitingDealCard && onNewRound != null)
        {
            onNewRound((ResponseWaitingDealCard)data);
        }
        else if (data is ResponseUpdateRoomMaster && onUpdateRoomMaster != null)
        {
            onUpdateRoomMaster((ResponseUpdateRoomMaster)data);
        }
        else if (data is ResponseUpdatePot)
        {
            if (onUpdatePot != null)
            {
                onUpdatePot((ResponseUpdatePot)data);
            }
        }
        else if (data is ResponseUpdateUserInfo)
        {
            ResponseUpdateUserInfo dataUserInfo = (ResponseUpdateUserInfo)data;

            if (onUpdateUserInfo != null)
            {
                onUpdateUserInfo(dataUserInfo);
            }
        }
        else if (data is ResponseError && onEncounterError != null)
        {
            onEncounterError((ResponseError)data);
        }
    }
Exemple #10
0
    void Instance_onPlayerListChanged(ResponsePlayerListChanged data)
    {
        if (PokerObserver.Game.IsMainPlayer(data.player.userName))
        {
            switch (data.GetActionState())
            {
                case PokerPlayerChangeAction.playerQuitGame:
                case PokerPlayerChangeAction.playerRemoved:
                case PokerPlayerChangeAction.waitingPlayerAdded:
                    wasBuyChip = false;
                    break;
                case PokerPlayerChangeAction.playerAdded:
                    wasBuyChip = true;
                    if (onPlayerSitdown != null)
                        onPlayerSitdown(!wasBuyChip);
                    break;

            }
            SetActiveButton(!wasBuyChip);
        }
    }