Example #1
0
    void SkipHand()
    {
        switch (currentSeat.Seat_pos)
        {
        case RX_SEAT_POSITION.RX_SEAT_BOTTOM:
            currentSeat = left_seat;
            break;

        case RX_SEAT_POSITION.RX_SEAT_LEFT:
            currentSeat = right_seat;
            break;

        case RX_SEAT_POSITION.RX_SEAT_RIGHT:
            currentSeat = bottom_seat;
            break;

        default:
            break;
        }
        if (gameState == RX_GAME_STATE.QIANGDIZHU)
        {
            currentSeat.SetLabel(1, "������?");
            return;
        }
        currentSeat.SetLabel(1, "���ڳ���");
    }
Example #2
0
    void InitGame(RX_SeatInfo sender)
    {
        gameState   = RX_GAME_STATE.QIANGDIZHU;
        currentSeat = sender;
        passCount   = 0;

        //set labels
        SetRoll(currentSeat, RX_ROLE_TYPE.RX_ROLE_NORMAL);
        SetRoll(left_seat, RX_ROLE_TYPE.RX_ROLE_NORMAL);
        SetRoll(right_seat, RX_ROLE_TYPE.RX_ROLE_NORMAL);

        currentSeat.SetLabel(1, "������?");
        giveAHandButtonLabel.text = "������";
    }
Example #3
0
    public void Reshuffle()
    {
        list = RX_CardManager.DefaultManager.Reshuffle();

        #region Clear the existing cards on the screen
        List <UISprite> clearBottom = new List <UISprite>(bottom_pool.GetComponentsInChildren <UISprite>());
        List <UISprite> clearLeft   = new List <UISprite>(left_pool.GetComponentsInChildren <UISprite>());
        List <UISprite> clearAll    = new List <UISprite>(right_pool.GetComponentsInChildren <UISprite>());
        clearAll.AddRange(clearBottom);
        clearAll.AddRange(clearLeft);
        clearAll.RemoveAll((UISprite obj) => { return(obj.tag == "cbottom" ||
                                                      obj.tag == "cleft" || obj.tag == "cright"); });
        for (int i = 0; i < clearAll.Count; i++)
        {
            Destroy(clearAll[i].gameObject);
        }
        #endregion

        bottom_seat           = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_BOTTOM, this.bottom_pool);
        bottom_seat.Card_list = list.GetRange(0, 17);
        RX_CardManager.ClearPool();
        left_seat           = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_LEFT, this.left_pool);
        left_seat.Card_list = list.GetRange(17, 17);
        RX_CardManager.ClearPool();
        right_seat           = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_RIGHT, this.right_pool);
        right_seat.Card_list = list.GetRange(34, 17);
        RX_CardManager.ClearPool();

        foreach (KeyValuePair <RX_SEAT_POSITION, List <UISprite> > item in RX_CardManager.HandedSprites)
        {
            for (int i = 0; i < item.Value.Count; i++)
            {
                Destroy(item.Value[i]);
            }
        }

        prevCardSet = null;
    }
Example #4
0
    void InitReshuffleRPC(string pokerInfos)
    {
        #region Clear the existing cards on the screen
        List <UISprite> clearBottom = new List <UISprite>(bottom_pool.GetComponentsInChildren <UISprite>());
        List <UISprite> clearLeft   = new List <UISprite>(left_pool.GetComponentsInChildren <UISprite>());
        List <UISprite> clearAll    = new List <UISprite>(right_pool.GetComponentsInChildren <UISprite>());
        clearAll.AddRange(clearBottom);
        clearAll.AddRange(clearLeft);
        clearAll.RemoveAll((UISprite obj) =>
        {
            return(obj.tag == "cbottom" ||
                   obj.tag == "cleft" || obj.tag == "cright");
        });
        for (int i = 0; i < clearAll.Count; i++)
        {
            Destroy(clearAll[i].gameObject);
        }
        #endregion

        string[] pairs = pokerInfos.Split('|');

        //convert pokerInfo to cardList
        int[] cardsdInfo = new int[54];
        for (int i = 0; i < 54; i++)
        {
            cardsdInfo[i] = int.Parse(pairs[i].Split(':')[1]);
        }
        list = CreateCardList(cardsdInfo);

        //if current player is the 2nd player...
        if (pairs[17].Split(':')[0] == RX_UserManager.DefaultUser.user_name)
        {
            //generate cardInfo array,(killed userName)  -- me bottom
            labelBottom.text             = (pairs[17].Split(':')[0]);
            bottom_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_BOTTOM, this.bottom_pool);
            bottom_seat.Card_list        = list.GetRange(17, 17);
            bottom_seat.Seat_user        = pairs[17].Split(':')[0];
            bottom_seat.Handed_container = handed_bootom;
            RX_CardManager.ClearPool();

            //server -- right
            labelRight.text             = (pairs[0].Split(':')[0]);
            right_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_RIGHT, this.right_pool);
            right_seat.Card_list        = list.GetRange(0, 17);
            right_seat.Seat_user        = pairs[0].Split(':')[0];
            right_seat.Handed_container = handed_right;
            RX_CardManager.ClearPool();

            //3rd -- left
            labelLeft.text             = (pairs[34].Split(':')[0]);
            left_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_LEFT, this.left_pool);
            left_seat.Card_list        = list.GetRange(34, 17);
            left_seat.Seat_user        = pairs[34].Split(':')[0];
            left_seat.Handed_container = handed_left;
            RX_CardManager.ClearPool();

            //set diZhu....
            InitGame(right_seat);
        }

        //if current player is the 3nd player...
        if (pairs[34].Split(':')[0] == RX_UserManager.DefaultUser.user_name)
        {
            //generate cardInfo array,(killed userName)  -- me bottom
            labelBottom.text             = (pairs[34].Split(':')[0]);
            bottom_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_BOTTOM, this.bottom_pool);
            bottom_seat.Card_list        = list.GetRange(34, 17);
            bottom_seat.Seat_user        = pairs[34].Split(':')[0];
            bottom_seat.Handed_container = handed_bootom;
            RX_CardManager.ClearPool();

            //server -- left
            labelLeft.text             = (pairs[0].Split(':')[0]);
            left_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_LEFT, this.left_pool);
            left_seat.Card_list        = list.GetRange(0, 17);
            left_seat.Seat_user        = pairs[0].Split(':')[0];
            left_seat.Handed_container = handed_left;
            RX_CardManager.ClearPool();

            //3rd -- right
            labelRight.text             = (pairs[17].Split(':')[0]);
            right_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_RIGHT, this.right_pool);
            right_seat.Card_list        = list.GetRange(17, 17);
            right_seat.Seat_user        = pairs[17].Split(':')[0];
            right_seat.Handed_container = handed_right;
            RX_CardManager.ClearPool();

            //set diZhu....
            InitGame(left_seat);
        }

        //if current player is the server player...
        if (pairs[0].Split(':')[0] == RX_UserManager.DefaultUser.user_name)
        {
            //generate cardInfo array,(killed userName)  -- me bottom
            labelBottom.text             = (pairs[0].Split(':')[0]);
            bottom_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_BOTTOM, this.bottom_pool);
            bottom_seat.Card_list        = list.GetRange(0, 17);
            bottom_seat.Seat_user        = pairs[0].Split(':')[0];
            bottom_seat.Handed_container = handed_bootom;
            RX_CardManager.ClearPool();

            //server -- left
            labelLeft.text             = (pairs[17].Split(':')[0]);
            left_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_LEFT, this.left_pool);
            left_seat.Card_list        = list.GetRange(17, 17);
            left_seat.Seat_user        = pairs[17].Split(':')[0];
            left_seat.Handed_container = handed_left;
            RX_CardManager.ClearPool();

            //3rd -- right
            labelRight.text             = (pairs[34].Split(':')[0]);
            right_seat                  = new RX_SeatInfo(RX_SEAT_POSITION.RX_SEAT_RIGHT, this.right_pool);
            right_seat.Card_list        = list.GetRange(34, 17);
            right_seat.Seat_user        = pairs[34].Split(':')[0];
            right_seat.Handed_container = handed_right;
            RX_CardManager.ClearPool();

            //set diZhu....
            InitGame(bottom_seat);
        }

        //clear handed cards
        foreach (KeyValuePair <RX_SEAT_POSITION, List <UISprite> > item in RX_CardManager.HandedSprites)
        {
            for (int i = 0; i < item.Value.Count; i++)
            {
                Destroy(item.Value[i]);
            }
        }
        //new prevCardSet
        prevCardSet = null;
    }
Example #5
0
    void SetRoll(RX_SeatInfo seat, RX_ROLE_TYPE roll)
    {
        switch (roll)
        {
        case RX_ROLE_TYPE.RX_ROLE_DIZHU:
        {
            seat.SetLabel(0, "����");
            seat.SetLabel(1, "���ڳ���");
            //prevent player get DiZhu , press pass in the same round..
            passCount = 3;

            //set new pokerSprite (add the last 3 cards)..
            seat.Seat_label.transform.SetParent(giveAHandButtonLabel.transform);
            seat.Seat_container.transform.DestroyChildren();
            seat.Seat_label.transform.SetParent(seat.Seat_container.transform);
            List <RX_Card> temp = new List <RX_Card>(seat.Card_list);
            temp.AddRange(list.GetRange(51, 3));
            seat.Card_list = temp;

            seat.Seat_type = RX_ROLE_TYPE.RX_ROLE_DIZHU;
            //after set current DiZhu , we must set other two NongMing
            switch (seat.Seat_pos)
            {
            case RX_SEAT_POSITION.RX_SEAT_BOTTOM:
                SetRoll(right_seat, RX_ROLE_TYPE.RX_ROLE_NONGMIN);
                SetRoll(left_seat, RX_ROLE_TYPE.RX_ROLE_NONGMIN);
                break;

            case RX_SEAT_POSITION.RX_SEAT_LEFT:
                SetRoll(right_seat, RX_ROLE_TYPE.RX_ROLE_NONGMIN);
                SetRoll(bottom_seat, RX_ROLE_TYPE.RX_ROLE_NONGMIN);
                break;

            case RX_SEAT_POSITION.RX_SEAT_RIGHT:
                SetRoll(bottom_seat, RX_ROLE_TYPE.RX_ROLE_NONGMIN);
                SetRoll(left_seat, RX_ROLE_TYPE.RX_ROLE_NONGMIN);
                break;

            default:
                break;
            }
            break;
        }

        case RX_ROLE_TYPE.RX_ROLE_NONGMIN:
        {
            seat.SetLabel(0, "ũ��");
            seat.SetLabel(1, "����");
            seat.Seat_type = RX_ROLE_TYPE.RX_ROLE_DIZHU;
            break;
        }

        case RX_ROLE_TYPE.RX_ROLE_NORMAL:
        {
            seat.SetLabel(0, "����");
            seat.SetLabel(1, "�ȴ���");
            seat.Seat_type = RX_ROLE_TYPE.RX_ROLE_DIZHU;
            break;
        }

        default:
            break;
        }
    }