Esempio n. 1
0
    /// <summary>
    /// 正常游戏下设置排行
    /// </summary>
    /// <param name="proto"></param>
    public void SetUI(GP_ROOM_GAMEOVER proto)
    {
        seatList = new List <SeatEntity>();
        for (int i = 0; i < proto.room.seatListCount(); i++)
        {
            GP_SEAT op_seat = proto.room.getSeatList(i);
            if (op_seat.playerId == 0)
            {
                continue;
            }
            SeatEntity seat = new SeatEntity();
            seat.PlayerId  = op_seat.playerId; //玩家ID
            seat.Nickname  = op_seat.nickname; //玩家名字
            seat.Pos       = op_seat.pos;
            seat.Avatar    = op_seat.avatar;   //玩家头像
            seat.Gender    = op_seat.gender;   //玩家性别
            seat.Gold      = op_seat.gold;     //底分
            seat.Pos       = op_seat.pos;      //座位位置
            seat.pokerList = new List <Poker>();
            for (int j = 0; j < op_seat.maxPokerListCount(); j++)
            {
                GP_POKER op_Poker = op_seat.getMaxPokerList(j);
                seat.pokerList.Add(new Poker()
                {
                    Index = op_Poker.index, //索引
                    Type  = op_Poker.type,  //花色
                    Size  = op_Poker.size,  //大小
                });
            }
            seatList.Add(seat);
        }
        SeatSort(seatList);
#if IS_CHUANTONGPAIJIU
        LoadRanking(seatList);
#else
        SetResult(seatList);
#endif
    }
Esempio n. 2
0
 /// <summary>
 /// 发实牌
 /// </summary>
 internal void ValidDealProxy(GP_ROOM_VALIDDEAL proto)
 {
     if (CurrentRoom.roomPlay == EnumPlay.BigPaiJiu)
     {
         CurrentRoom.roomStatus = ROOM_STATUS.GROUPPOKER;
     }
     if (CurrentRoom.roomPlay == EnumPlay.SmallPaiJiu)
     {
         CurrentRoom.roomStatus = ROOM_STATUS.CUOPAI;
     }
     for (int i = 0; i < proto.seatListCount(); i++)
     {
         SeatEntity seat = GetSeatBySeatId(proto.getSeatList(i).pos);
         seat.seatStatus = SEAT_STATUS.GROUP;
         if (seat == PlayerSeat)
         {
             seat.groupTime = proto.unixtime;
             if (seat.pokerList.Count != 0)
             {
                 seat.pokerList.Clear();
             }
             for (int j = 0; j < proto.getSeatList(i).pokerListCount(); ++j)
             {
                 GP_POKER protoPoker = proto.getSeatList(i).getPokerList(j);
                 seat.pokerList.Add(new Poker()
                 {
                     Index = protoPoker.index, //索引
                     Type  = protoPoker.type,  //花色
                     Size  = protoPoker.size,  //大小
                 });
             }
             TransferData data = new TransferData();
             data.SetValue("Seat", seat);
             data.SetValue("Room", CurrentRoom);
             SendNotification(ConstantGuPaiJiu.GroupValidPoker, data);
         }
     }
 }
Esempio n. 3
0
 /// <summary>
 /// 实例化组合实牌
 /// </summary>
 /// <param name="seat"></param>
 private void InstantiationPoker(SeatEntity seat, Transform[] pokerPointArry, bool IsBool = false)
 {
     for (int i = 0; i < seat.pokerList.Count; i++)
     {
         pokerList.Add(seat.pokerList[i].Type);
         GuPaiJiuPrefabManager.Instance.LoadPoker(seat.Index, seat.pokerList[i].Type, (GameObject go) =>
         {
             go.transform.SetParent(pokerPointArry[i]);
             go.transform.localPosition = Vector3.zero;
             //go.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
             go.transform.localScale = Vector3.one;
             go.name          = seat.pokerList[i].Type.ToString();
             go.transform.tag = "poker";
             go.GetComponent <GuPaiJiuCtrl>().enabled = true;
             if (IsBool)
             {
                 go.GetComponent <GuPaiJiuCtrl>().isBool = true;
             }
             go.GetComponent <GuPaiJiuCtrl>().onComplete = ConfirmPoker;
             IndexObjDic.Add(seat.pokerList[i].Index, go);
         });
     }
 }
Esempio n. 4
0
    private void StartCutPoker1(TransferData data)
    {
        GameObject go   = data.GetValue <GameObject>("Obj");
        SeatEntity seat = GetIsBanke();

        if (seat != null)
        {
            GuPaiJiuSeatCtrl currSeatCrtl = GetSeatCtrlBySeatPos(seat.Index);
            if (curRoomStatus == ROOM_STATUS.CUTPOKER && isPlayCutPokerAni && !isCutPokerBig)
            {
                for (int i = 0; i < currSeatCrtl.pokerWall.Count; i++)
                {
                    if (go == currSeatCrtl.pokerWall[i])
                    {
                        int index = go.transform.GetSiblingIndex();
                        Debug.Log(index + "          ······ ·······     切牌顿数");
                        GuPaiJiuGameCtrl.Instance.OnGuPaiJiuClientSendCutPokerInfo(index / 2);
                        break;
                    }
                }
            }
        }
    }
Esempio n. 5
0
    /// <summary>
    /// 通知坐庄
    /// </summary>
    internal void InfoRebankerProxy(GP_ROOM_INFORMBANKER proto)
    {
        SeatEntity seat = GetSeatBySeatId(proto.pos);

        if (seat == null)
        {
            return;
        }
        CurrentRoom.roomStatus = ROOM_STATUS.READY;
        for (int i = 0; i < CurrentRoom.seatList.Count; i++)
        {
            if (seat.Pos == CurrentRoom.seatList[i].Pos)
            {
                CurrentRoom.seatList[i].IsBanker = true;
            }
            else
            {
                CurrentRoom.seatList[i].IsBanker = false;
            }
            CurrentRoom.seatList[i].seatStatus = SEAT_STATUS.READY;
            SendGameSeatInfoChangeNotify(CurrentRoom.seatList[i]);
        }
    }
Esempio n. 6
0
    /// <summary>
    /// 加载房间后 加载已有窗口
    /// </summary>
    /// <param name="obj"></param>
    private void SetEnterRoomView(object[] obj)
    {
        //加载等待解散 或 是否同意解散
        RoomEntity room       = RoomJuYouProxy.Instance.CurrentRoom;
        SeatEntity playerSeat = RoomJuYouProxy.Instance.PlayerSeat;


        switch (room.roomStatus)
        {
        //结算状态
        case ROOM_STATUS.SETTLE:
            ClientSendRefuseNextGame(null);

            break;

        case ROOM_STATUS.DISMISS:

            bool isOperate = false;
            for (int i = 0; i < room.OperatePosList.Count; i++)
            {
                if (room.OperatePosList[i] == playerSeat.Pos)
                {
                    isOperate = true;
                }
            }
            if (isOperate)
            {
                UIViewManager.Instance.ShowMessage("提示", "等待解散结果", MessageViewType.None);
            }
            else
            {
                UIViewManager.Instance.ShowMessage("提示", "有人发起解散房间,是否同意", MessageViewType.OkAndCancel, ClientSendAgreeDisbandRoom, ClientSendRefuseDisbandRoom, 10f, AutoClickType.Cancel);
            }

            break;
        }
    }
Esempio n. 7
0
    /// <summary>
    /// 断线重连和创建房间用
    /// </summary>
    private void OnSeatInfoChanged(TransferData data)
    {
        SeatEntity  seat       = data.GetValue <SeatEntity>("Seat");
        ROOM_STATUS roomStatus = data.GetValue <ROOM_STATUS>("RoomStatus");
        bool        IsPlayer   = data.GetValue <bool>("IsPlayer");

#if IS_BAODINGQIPAI
        if (seat.IsBanker)
        {
            ZhuangScore           = seat.firstPour;
            m_betSlider.maxValue += seat.firstPour;
        }
#else
        if (seat.IsBanker)
        {
            ZhuangScore = seat.firstPour;
        }
#endif

        if (IsPlayer)
        {
            SetPourScore(seat, roomStatus);
        }
    }
Esempio n. 8
0
    /// <summary>
    /// 隐藏加注按钮
    /// </summary>
    public void HidFen(TransferData data)
    {
        SeatEntity seat = data.GetValue <SeatEntity>("Seat");

        if (seat == null)
        {
            return;
        }
        if (seat == RoomZhaJHProxy.Instance.PlayerSeat)
        {
            float fen        = data.GetValue <float>("Fen");
            int   totalRound = data.GetValue <int>("totalRound");
            float jZF        = RoomZhaJHProxy.Instance.CurrentRoom.roomSettingId != RoomMode.Senior || (RoomZhaJHProxy.Instance.CurrentRoom.roomSettingId == RoomMode.Senior && RoomZhaJHProxy.Instance.CurrentRoom.scores == 2) ? 20 : 10;
            if (fen == jZF)
            {
                RoomZhaJHProxy.Instance.CurrentRoom.jiazhuScroc = false;
                m_jiaZhuHui.gameObject.SetActive(true);
            }
            else
            {
                if (fen == 50)
                {
                    m_jiaZhuHui.gameObject.SetActive(true);
                }
                else if (fen == 100)
                {
                    m_jiaZhuHui.gameObject.SetActive(true);
                    m_xuePinHui.gameObject.SetActive(true);
                }
                else
                {
                    m_jiaZhuHui.gameObject.SetActive(false);
                }
            }
        }
    }
Esempio n. 9
0
    /// <summary>
    /// 设置座位牌
    /// </summary>
    /// <param name="data"></param>
    private void OnSeatInfoChanged(TransferData data)
    {
        SeatEntity seat     = data.GetValue <SeatEntity>("Seat");
        RoomEntity room     = data.GetValue <RoomEntity>("Room");
        bool       isPlayer = data.GetValue <bool>("IsPlayer");

        if (m_nSeatIndex == seat.Index)
        {
            if (room.roomStatus != ROOM_STATUS.IDLE && room.roomStatus != ROOM_STATUS.READY && room.roomStatus != ROOM_STATUS.GRABBANKER && room.roomStatus != ROOM_STATUS.GRABBANKERDONE)
            {
                if (seat.IsBanker)
                {
                    LoadDealEmptyPoker(room.RemainPokerNum);
                }
                if (room.roomStatus == ROOM_STATUS.CHECK)
                {
                    if (seat.drawPokerList.Count == 0)
                    {
                        SeatCtrlBreak(seat);
                    }
                    else
                    {
                        SeatCtrlBreak(seat, true);
                    }
                }
                else if (room.roomStatus == ROOM_STATUS.GROUPPOKER)
                {
                    //SeatCtrlBreak(seat);
                }
                else
                {
                    SeatCtrlBreak(seat);
                }
            }
        }
    }
Esempio n. 10
0
    private void LookShufflingPoker(SeatEntity seat)
    {
        if (seat.pokerList.Count != 0)
        {
            if (this.gameObject.activeSelf)
            {
                for (int z = 0; z < pokerMounts.Length; z++)
                {
                    for (int k = 0; k < pokerMounts[z].transform.childCount; k++)
                    {
                        Destroy(pokerMounts[z].transform.GetChild(k).gameObject);
                    }
                }
            }

            m_pokerMount.GetComponent <GridLayoutGroup>().spacing = new Vector2(-140, 0);

            pokerMoun1 = pokerMounts[1].transform.GetChild(0).transform.localPosition;
            pokerMoun2 = pokerMounts[2].transform.GetChild(0).transform.localPosition;
            pokerMoun0 = pokerMounts[0].transform.GetChild(0).transform.localPosition;

            //pokerMounts[1].transform.GetChild(0).transform.localPosition = pokerMounts[0].transform.localPosition;
            //pokerMounts[2].transform.GetChild(0).transform.localPosition = pokerMounts[0].transform.localPosition;
            seat.pokerList = RandomSortList(seat.pokerList);
            storageSeat    = seat;
            for (int i = 0; i < seat.pokerList.Count; i++)
            {
                //seat.pokerList.Sort(delegate(Poker a,Poker b) { return (new System.Random()).Next(0, 3); });
                GameObject go = ZJHPrefabManager.Instance.LoadPoker(seat.pokerList[i], null, "normalpoker");
                go.transform.SetParent(pokerMounts[i].transform);
                go.transform.localPosition = Vector3.zero;
                go.transform.localScale    = new Vector3(0.8f, 0.8f, 0.8f);
            }
            StartCoroutine("AutomaticOpenPoker");
        }
    }
Esempio n. 11
0
    //把加注分数按钮变成灰色的
    public void HidFen(TransferData data)
    {
        SeatEntity seat = data.GetValue <SeatEntity>("Seat");

        if (seat == RoomZhaJHProxy.Instance.PlayerSeat)
        {
            float fen = data.GetValue <float>("Fen");

            if (fen == 0)
            {
                if (m_liangHui != null)
                {
                    m_liangHui.gameObject.SetActive(false);
                }
                if (m_wuHui != null)
                {
                    m_wuHui.gameObject.SetActive(false);
                }
                if (m_shiHui != null)
                {
                    m_shiHui.gameObject.SetActive(false);
                }
                if (m_wuShiHui != null)
                {
                    m_wuShiHui.gameObject.SetActive(false);
                }
            }
            for (int i = 0; i <= fen; i++)
            {
                switch (i)
                {
                case 2:
                    if (m_liangHui != null)
                    {
                        m_liangHui.gameObject.SetActive(true);
                    }
                    break;

                case 5:
                    if (m_wuHui != null)
                    {
                        m_wuHui.gameObject.SetActive(true);
                    }
                    break;

                case 10:
                    if (m_shiHui != null)
                    {
                        m_shiHui.gameObject.SetActive(true);
                    }
                    break;

                case 50:
                    if (m_wuShiHui != null)
                    {
                        m_wuShiHui.gameObject.SetActive(true);
                    }
                    break;
                }
            }
        }
    }
Esempio n. 12
0
 /// <summary>
 /// 结算后通过此方法开始报牌音乐
 /// </summary>
 public List <string> PlayMusic(SeatEntity seat)
 {
     //StartCoroutine(PlayMusicTor(seat));
     return(MusicList);
 }
Esempio n. 13
0
 /// <summary>
 /// 加载牌
 /// </summary>
 /// <param name="seat"></param>
 /// <param name="poker"></param>
 /// <param name="handContainer"></param>
 /// <param name="isV3"></param>
 /// <param name="isPoker"></param>
 private void LoadPoker(int index, int pokerType, Transform handContainer, int dun, bool isV3 = false, bool isPoker = true, SeatEntity seat = null)
 {
     GuPaiJiuPrefabManager.Instance.LoadPoker(index, pokerType, (GameObject go) =>
     {
         go.transform.SetParent(handContainer);
         go.transform.localPosition = Vector3.zero;
         go.transform.localScale    = new Vector3(0.45f, 0.45f, 0.45f);
         go.name = pokerType.ToString();
         if (seat != null || pokerType == 0)
         {
             go.AddComponent <EventTriggerListener>().onClick += (GameObject go1) =>
             {
                 GuPaiJiuGameCtrl.Instance.GuPaiJiuClisentSendDrawPoker(seat, dun / 2);
             };
         }
     }, isV3, isPoker);
 }
Esempio n. 14
0
 public void SetCtrlJieSuanPoker(SeatEntity seat, ROOM_STATUS roomStatus)
 {
     StartCoroutine(SetCtrlJieSuanTor(seat, roomStatus));
 }
Esempio n. 15
0
    private void TheCardAnimation(TransferData data)
    {
        VSMask.SetActive(true);
        VSMask.GetComponent <UIZhaJHDoTweenVS>().DoTweenPlay();
        SeatEntity seat        = data.GetValue <SeatEntity>("Seat");
        SeatEntity discardSeat = data.GetValue <SeatEntity>("DiscardSeat");

        if (m_nSeatIndex == seat.Index)
        {
            a = m_pokerMount.transform.position;
            b = m_pokerMount.transform.localScale;
            this.gameObject.transform.SetSiblingIndex(this.gameObject.transform.parent.childCount - 1);//如果是当前 Item 就把对象移到父物体的最后位置
            this.m_zhuangtai.enabled = false;
            ///把比牌的两个人的座位存到 List 中,
            /// 判断当前这个座位是不是 List 中的第一位,如果是第一位将牌移到A点
            /// 否则移动到B点
            if (seat.pos == RoomZhaJHProxy.Instance.posList[0])
            {
                ///VsTran 为 A点
                if (seat.Index == 0)
                {
                    m_pokerMount.transform.DOScale(new Vector3(0.9f, 0.9f, 0.9f), 0.2f);
                    m_pokerMount.GetComponent <GridLayoutGroup>().spacing = new Vector2(-50, 0);
                    Tween magnify1 = m_pokerMount.transform.DOMove(VsTran.transform.position, 0.8f).OnComplete(() =>
                    {
                        if (display != null && display.isActiveAndEnabled)
                        {
                            display.enabled = false;
                            isDisplay       = true;
                        }
                        StartCoroutine(VSMaskIEnumer(seat, discardSeat));
                    });
                }
                else
                {
                    m_pokerMount.transform.DOScale(new Vector3(0.9f, 0.9f, 0.9f), 0.2f);
                    Tween magnify1 = m_pokerMount.transform.DOMove(VsTran.transform.position, 0.8f).OnComplete(() =>
                    {
                        if (display != null && display.isActiveAndEnabled)
                        {
                            display.enabled = false;
                            isDisplay       = true;
                        }
                        StartCoroutine(VSMaskIEnumer(seat, discardSeat));
                    });
                }
            }
            else
            {
                if (seat.Index == 0)
                {
                    m_pokerMount.transform.DOScale(new Vector3(0.9f, 0.9f, 0.9f), 0.2f);
                    m_pokerMount.GetComponent <GridLayoutGroup>().spacing = new Vector2(-50, 0);
                    Tween magnify1 = m_pokerMount.transform.DOMove(VsTran1.transform.position, 0.8f).OnComplete(() =>
                    {
                        if (display != null && display.isActiveAndEnabled)
                        {
                            display.enabled = false;
                            isDisplay       = true;
                        }
                        StartCoroutine(VSMaskIEnumer(seat, discardSeat));
                    });
                }
                else
                {
                    ///VsTran1 为 B点
                    m_pokerMount.transform.DOScale(new Vector3(0.9f, 0.9f, 0.9f), 0.2f);
                    Tweener magnify1 = m_pokerMount.transform.DOMove(VsTran1.transform.position, 0.8f).OnComplete(() =>
                    {
                        if (display != null && display.isActiveAndEnabled)
                        {
                            display.enabled = false;
                            isDisplay       = true;
                        }
                        StartCoroutine(VSMaskIEnumer(seat, discardSeat));
                    });
                }
            }
        }
    }
Esempio n. 16
0
    /// <summary>
    /// 设置下注筹码框的显示
    /// </summary>
    /// <param name="seat"></param>
#if IS_BAODINGQIPAI
    private void SetChipFrame(SeatEntity seat)
    {
        m_ChipFrame1.SetActive(seat.seatStatus == SEAT_STATUS.POUR && !seat.IsBanker);
        SetBetSlider(seat);
    }
Esempio n. 17
0
        public List <SeatEntity> InToOneSeat(int conferenceID, string seatList, string selfUri, string selfName, string selfIP)
        {
            lock (objInToOneSeat)
            {
                //座位信息集合
                List <SeatEntity> settingList = null;
                try
                {
                    if (conferenceID != 0)
                    {
                        //座位加载人
                        SeatEntity settingAddEntity = null;
                        //座位信息
                        if (!dicSeatEntity.ContainsKey(conferenceID))
                        {
                            //座位信息集合
                            settingList = new List <SeatEntity>();

                            //分割获取座位IP集
                            string[] settingIpList = seatList.Split(new char[] { '*' });

                            //加载位置信息
                            for (int i = 0; i < settingIpList.Count(); i++)
                            {
                                //创建一个座位实体
                                SeatEntity settingEntity = new ConferenceWebCommon.EntityHelper.ConferenceMatrix.SeatEntity();
                                //设置座位IP
                                settingEntity.SettingIP = settingIpList[i];
                                //设置座位序列号
                                settingEntity.SettingNummber = i + 1;
                                //添加座位实体
                                settingList.Add(settingEntity);

                                //设置当前用户名称
                                if (selfIP.Equals(settingIpList[i]))
                                {
                                    settingEntity.UserName     = selfName;
                                    settingAddEntity           = settingEntity;
                                    settingAddEntity.SharerUri = selfUri;
                                }
                            }
                            //针对会议的座位信息
                            dicSeatEntity.Add(conferenceID, settingList);
                        }
                        else
                        {
                            List <SeatEntity> sList = dicSeatEntity[conferenceID];
                            //加载位置信息
                            for (int i = 0; i < sList.Count(); i++)
                            {
                                //设置当前用户名称
                                if (selfIP.Equals(sList[i].SettingIP))
                                {
                                    settingAddEntity           = sList[i];
                                    settingAddEntity.SharerUri = selfUri;
                                    sList[i].UserName          = selfName;
                                    break;
                                }
                            }
                            //获取当前会议的座位信息
                            settingList = dicSeatEntity[conferenceID];
                        }

                        //实时同步(发送信息给客户端)
                        this.InformClient(conferenceID, settingAddEntity);
                    }
                }
                catch (Exception ex)
                {
                    LogManage.WriteLog(this.GetType(), ex);
                }
                finally
                {
                }
                return(settingList);
            }
        }
Esempio n. 18
0
    public void BtnShow(TransferData data)
    {
        SeatEntity seat = data.GetValue <SeatEntity>("Seat");

        if (seat == RoomZhaJHProxy.Instance.PlayerSeat)
        {
            int   totalRound = data.GetValue <int>("totalRound");
            float fen        = data.GetValue <float>("Fen");
            Debug.Log(fen + "                                 下注分数11111");
            Fen = fen;
            int round = seat.seatRound;
            if (round == 0)
            {
                round = 1;
            }
            if (round <= RoomZhaJHProxy.Instance.SureWheelNumber)
            {
                m_kanPaiHui.gameObject.SetActive(true);
                m_biPaiHui.gameObject.SetActive(true);
                if (seat.pokerStatus == ENUM_POKER_STATUS.POSITIVE)
                {
                    genScero.text = (fen * 2).ToString();
                    bpScero.text  = (fen * 2).ToString();
                }
                else
                {
                    genScero.text = fen.ToString();
                    bpScero.text  = fen.ToString();
                }
            }
            else
            {
                if (seat.pokerStatus == ENUM_POKER_STATUS.POSITIVE)
                {
                    genScero.text = (fen * 2).ToString();
                    bpScero.text  = (fen * 2).ToString();
                    m_kanPaiHui.gameObject.SetActive(true);
                }
                else
                {
                    genScero.text = fen.ToString();
                    bpScero.text  = fen.ToString();
                    m_kanPaiHui.gameObject.SetActive(false);
                }
                if (JudgeLow(seat, fen) && RoomZhaJHProxy.Instance.CurrentRoom.roomSettingId == RoomMode.Senior)
                {
                    m_biPaiHui.gameObject.SetActive(true);
                }
                else
                {
                    m_biPaiHui.gameObject.SetActive(false);
                }
            }
            if (seat.isLowScore)
            {
                m_qiPaiHui.gameObject.SetActive(true);
            }
            else
            {
                m_qiPaiHui.gameObject.SetActive(false);
            }

            if ((totalRound - round) < 2 && RoomZhaJHProxy.Instance.isShopping == 1 && RoomZhaJHProxy.Instance.CurrentRoom.roomSettingId != RoomMode.Senior)
            {
                m_xuePinHui.gameObject.SetActive(false);
            }
            else
            {
                m_xuePinHui.gameObject.SetActive(true);
            }
            m_genZhuHui.gameObject.SetActive(false);
        }
        else
        {
            BtnQP(null);
        }
    }
Esempio n. 19
0
    /// <summary>
    /// 摸牌
    /// </summary>
    /// <param name="fromSeatIndex">从哪摸</param>
    /// <param name="toSeatPos">摸到哪</param>
    /// <param name="poker">摸啥牌</param>
    /// <returns></returns>
    public MaJiangCtrl DrawMaJiang(int toSeatPos, Poker poker, bool isPlayer, bool isLast, bool isSort)
    {
        if (isPlayer && poker.color == 0)
        {
            AppDebug.ThrowError("生成了一张空牌 1:" + poker.ToLog());
        }
        MaJiangCtrl majiang = null;

        if (isLast)
        {
#if IS_LEPING
            MaJiangCtrl temp = m_ListWall[34];
            if (m_LuckPoker != null)
            {
                m_LuckPoker.transform.SetParent(temp.transform.parent);
                m_LuckPoker.transform.position         = temp.transform.position;
                m_LuckPoker.transform.localEulerAngles = temp.transform.localEulerAngles + new Vector3(0f, 0f, 180f);
                m_LuckPoker.transform.localScale       = temp.transform.localScale;
            }
            m_ListWall.Remove(temp);
            m_ListWallInverse.Remove(temp);
            DespawnMaJiang(temp);
            majiang = m_ListWall[34];
#elif IS_TAILAI
            majiang = m_ListWallInverse[12];
#else
            majiang = m_ListWallInverse[0];
#endif
        }
        else
        {
            majiang = m_ListWall[0];
        }
        m_ListWall.Remove(majiang);
        m_ListWallInverse.Remove(majiang);
        MaJiangCtrl ctrl = SpawnMaJiang(toSeatPos, poker, ((isPlayer && RoomMaJiangProxy.Instance.CurrentRoom.isReplay) ? "PlayerHand" : "Hand"));
        ctrl.transform.SetParent(majiang.transform.parent);
        ctrl.transform.position = majiang.transform.position;
        ctrl.transform.rotation = majiang.transform.rotation;
        DespawnMaJiang(majiang);
        if (!m_DicHand.ContainsKey(toSeatPos))
        {
            m_DicHand.Add(toSeatPos, new List <MaJiangCtrl>());
        }

        m_DicHand[toSeatPos].Add(ctrl);

        SeatEntity seat = RoomMaJiangProxy.Instance.GetSeatBySeatId(toSeatPos);
        if (seat != null)
        {
            if (seat.LackColor != 0)
            {
                if (ctrl.Poker.color == seat.LackColor)
                {
                    ctrl.isGray = true;
                }
            }
        }

        if (isSort)
        {
            Sort(m_DicHand[toSeatPos], RoomMaJiangProxy.Instance.GetSeatBySeatId(toSeatPos).UniversalList);
        }

        if (isPlayer && (ctrl.Poker == null || ctrl.Poker.color == 0))
        {
            AppDebug.ThrowError("生成了一张空牌 2:" + poker.ToLog());
        }
        return(ctrl);
    }
Esempio n. 20
0
 public void SetUI(SeatEntity seat)
 {
     m_SeatPos = seat.pos;
     SetPlayerInfo(seat);
 }
Esempio n. 21
0
    }                                                       //目前运营商


    #region 初始化房间数据
    internal void InitRoom(GP_ROOM_CREATE proto)
    {
        CurrentRoom = new RoomEntity()
        {
            roomId         = proto.room.roomId,         //房间ID
            currentLoop    = proto.room.loop,           //局数
            maxLoop        = proto.room.maxLoop,        //总局数
            roomStatus     = proto.room.status,         //房间状态
            FirstDice      = proto.room.firstDice,      //第一个骰子
            SecondDice     = proto.room.secondDice,     //第二个骰子
            FirstGivePos   = proto.room.firstGivePos,   //首发牌座位号
            TotalPokerNum  = proto.room.totalPokerNum,  //房间牌的总数量
            RemainPokerNum = proto.room.remainPokerNum, //房间剩余牌的数量
            PanBase        = proto.room.panBase,        //锅底
            IsAddPanBase   = proto.room.isAddPanBase,   //是否加锅底
            dealSecond     = proto.room.dealTime,       //每局第几次
            fzName         = proto.room.ownerNickName,
            //PlayerID = 111,
            isGrabBankerNum = 0,//抢庄的人数
        };
        CurrentRoom.roomPokerList = new List <Poker>();
        for (int i = 0; i < proto.room.historyPokerListCount(); i++)
        {
            GP_POKER protoPoker = proto.room.getHistoryPokerList(i);
            CurrentRoom.roomPokerList.Add(new Poker()
            {
                Index = protoPoker.index, //索引
                Type  = protoPoker.type,  //花色
                Size  = protoPoker.size,  //大小
            });
        }
        CurrentRoom.Config.Clear();
        Debug.Log(proto.room.settingIdCount() + "                   Stting长度");
        for (int i = 0; i < proto.room.settingIdCount(); ++i)
        {
            cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(proto.room.getSettingId(i));
            if (settingEntity != null)
            {
                CurrentRoom.Config.Add(settingEntity);

                if (settingEntity.tags.Equals("isGuiZi"))
                {
                    CurrentRoom.enumGuiZi = (EnumGuiZi)settingEntity.value;
                }
                if (settingEntity.tags.Equals("isTianJiuWang"))
                {
                    CurrentRoom.enumTianJiuWang = (EnumTianJiuWang)settingEntity.value;
                }
                if (settingEntity.tags.Equals("isDiJiuWang"))
                {
                    CurrentRoom.enumDiJiuWang = (EnumDiJiuWang)settingEntity.value;
                }
                if (settingEntity.tags.Equals("banker"))
                {
                    CurrentRoom.roomMode = (RoomEntity.RoomMode)settingEntity.value;
                }
                if (settingEntity.tags.Equals("pourModel"))
                {
                    CurrentRoom.betModel = (RoomEntity.BetModel)settingEntity.value;
                    if (settingEntity.value == 1)
                    {
                        isBet = true;
                    }
                    else
                    {
                        isBet = false;
                    }
                }
                if (settingEntity.tags.Equals("limit"))
                {
                    CurrentRoom.scoreLimit = settingEntity.value;
                }
                if (settingEntity.tags.Equals("defaultScore"))
                {
                    CurrentRoom.guDScore = settingEntity.value;
                }
                if (settingEntity.tags.Equals("isBig"))
                {
                    CurrentRoom.roomPlay = (EnumPlay)settingEntity.value;
                }
            }
        }
        CurrentRoom.seatList = new List <SeatEntity>();
        for (int i = 0; i < proto.room.seatListCount(); i++)
        {
            GP_SEAT    op_seat = proto.room.getSeatList(i);
            SeatEntity seat    = new SeatEntity();
            seat.PlayerId    = op_seat.playerId;       //玩家ID
            seat.Nickname    = op_seat.nickname;       //玩家名字
            seat.Avatar      = op_seat.avatar;         //玩家头像
            seat.Gender      = op_seat.gender;         //玩家性别
            seat.Gold        = op_seat.gold;           //底分
            seat.Pos         = op_seat.pos;            //座位位置
            seat.seatStatus  = op_seat.status;         ////座位状态
            seat.IsBanker    = op_seat.isBanker;       //是否是庄家
            seat.isDismiss   = op_seat.isDismiss;      //是否同意解散房间
            seat.isWin       = op_seat.isWin;          //是否是赢家
            seat.eamings     = op_seat.earnings;       //本次收益
            seat.loopEamings = op_seat.loopEarnings;   //每局收益
            seat.IP          = op_seat.ipAddr;         //IP
            seat.Longitude   = op_seat.longitude;      //经度
            seat.Latitude    = op_seat.latitude;       //维度
            seat.IsFocus     = !op_seat.isAfk;         //是否在线
            seat.firstPour   = op_seat.getPourList(0); //一道
            seat.secondPour  = op_seat.getPourList(1); //二道
            seat.threePour   = op_seat.getPourList(2); //三道
            seat.pokerList   = new List <Poker>();
            for (int j = 0; j < op_seat.pokerListCount(); ++j)
            {
                GP_POKER protoPoker = op_seat.getPokerList(i);
                seat.pokerList.Add(new Poker()
                {
                    Index = protoPoker.index, //索引
                    Type  = protoPoker.type,  //花色
                    Size  = protoPoker.size,  //大小
                });
            }
            CurrentRoom.seatList.Add(seat);
        }
        CalculateSeatIndexOne();  //普通场计算座位 Index
    }
Esempio n. 22
0
 private void SetChipFrame(SeatEntity seat)
 {
     m_ChipFrame.SetActive(seat.seatStatus == SEAT_STATUS.POUR && !seat.IsBanker);
     ClosToggle();//把所有的 Toggle 设置成 false
 }
Esempio n. 23
0
    ///// <summary>
    ///// 当前游戏状态
    ///// </summary>
    //public MahjongGameState CurrentState;


    ///// <summary>
    ///// 游戏规则
    ///// </summary>
    //public MahjongRule Rule;


    #endregion


    #region 初始化房间信息  构建房间
    /// <summary>
    /// 初始化房间信息  构建房间
    /// </summary>
    /// <param name="proto"></param>
    public void InitRoom(ROOM_INFO proto)
    {
        CurrentRoom = new RoomEntity()
        {
            currentLoop = proto.loop,

            roomId = proto.roomId,

            Status  = proto.room_status,
            maxLoop = proto.maxLoop,

            //matchId = protoRoom.matchId,//比赛场
        };


        CurrentRoom.Config.Clear();
        //for (int i = 0; i < proto.settingIdCount(); ++i)
        //{
        //    cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(proto.getSettingId(i));
        //    if (settingEntity != null)
        //    {
        //        CurrentRoom.Config.Add(settingEntity);
        //    }
        //}
        CurrentRoom.SeatList = new List <SeatEntity>();
        for (int i = 0; i < proto.seatinfoCount(); ++i)
        {
            SEAT_INFO op_seat = proto.getSeatinfo(i);

            SeatEntity seat = new SeatEntity();
            seat.Pos = op_seat.pos;

            seat.PlayerId = op_seat.playerId;
            seat.Gender   = op_seat.gender;
            seat.Gold     = op_seat.gold;
            seat.Nickname = op_seat.nickname;
            seat.Avatar   = op_seat.avatar;
            //seat.IP = op_seat.ipaddr;
            seat.Status = op_seat.seat_status;
            Debug.Log(seat.Status);

            for (int j = 0; j < op_seat.pockerInfoCount(); ++j)
            {
                POCKER_INFO protoPoker = op_seat.getPockerInfo(j);
                seat.PokerList.Add(new Poker(protoPoker.index, protoPoker.color, protoPoker.size));
            }

            seat.SetSeat(op_seat);
            CurrentRoom.SeatList.Add(seat);

            //            for (int j = 0; j < op_seat.desktopCount(); ++j)
            //            {

            //                OP_POKER protoPoker = op_seat.getDesktop(j);
            //                seat.DeskTopPoker.Add(new Poker(protoPoker.index, protoPoker.color, protoPoker.size, protoPoker.pos));
            //            }
            //            for (int j = 0; j < op_seat.usePokerGroupCount(); ++j)
            //            {
            //                OP_POKER_GROUP protoPoker = op_seat.getUsePokerGroup(j);
            //                List<Poker> lst = new List<Poker>();
            //                for (int k = 0; k < protoPoker.pokerCount(); ++k)
            //                {
            //                    OP_POKER op_poker = protoPoker.getPoker(k);
            //                    Poker poker = new Poker(op_poker.index, op_poker.color, op_poker.size, op_poker.pos);
            //                    lst.Add(poker);
            //                }
            //                if (protoPoker.typeId != ENUM_POKER_TYPE.POKER_TYPE_GANG)
            //                {
            //                    MahJongHelper.SimpleSort(lst);
            //                }
            //#if IS_DAZHONG || IS_WUANJUN
            //                if ((OperatorType)protoPoker.typeId == OperatorType.Chi)//吃的牌放中间
            //                {
            //                    for (int k = 0; k < lst.Count; ++k)
            //                    {
            //                        if (lst[k].pos != seat.Pos)
            //                        {
            //                            Poker poker = lst[k];
            //                            lst.Remove(poker);
            //                            lst.Insert(1, poker);
            //                        }
            //                    }
            //                }

            //                if ((OperatorType)protoPoker.typeId == OperatorType.Peng || (OperatorType)protoPoker.typeId == OperatorType.Gang)
            //                {
            //                    for (int k = 0; k < lst.Count; ++k)
            //                    {
            //                        if (lst[k].pos != op_seat.pos)
            //                        {
            //                            Poker poker = lst[k];
            //                            lst.Remove(poker);
            //                            if (Mathf.Abs(poker.pos - op_seat.pos) == 2)
            //                            {
            //                                lst.Insert(1, poker);
            //                                break;
            //                            }
            //                            if (poker.pos - op_seat.pos == 1 || poker.pos - op_seat.pos == -3)
            //                            {
            //                                lst.Insert(2, poker);
            //                                break;
            //                            }
            //                            if (poker.pos - op_seat.pos == -1 || poker.pos - op_seat.pos == 3)
            //                            {
            //                                lst.Insert(0, poker);
            //                                break;
            //                            }
            //                        }
            //                    }
            //                }
            //#endif
            //                PokerCombinationEntity combination = new PokerCombinationEntity((OperatorType)protoPoker.typeId, (int)protoPoker.subTypeId, lst);

            //                seat.UsedPokerList.Add(combination);
        }
        //            for (int j = 0; j < op_seat.universalCount(); ++j)
        //            {
        //                OP_POKER op_poker = op_seat.getUniversal(j);
        //                seat.UniversalList.Add(new Poker(op_poker.index, op_poker.color, op_poker.size, op_poker.pos));
        //            }
        //            seat.PokerAmount = op_seat.pokerAmount;
        //            seat.IsBanker = op_seat.isBanker;
        //            seat.IsTrustee = op_seat.isTrustee;
        //            seat.IsWaiver = op_seat.isWaiver;
        //            for (int j = 0; j < op_seat.keepPokerGroupCount(); ++j)
        //            {
        //                OP_POKER_GROUP op_poker_group = op_seat.getKeepPokerGroup(j);
        //                List<Poker> lstPoker = new List<Poker>();
        //                for (int k = 0; k < op_poker_group.pokerCount(); ++k)
        //                {
        //                    OP_POKER op_poker = op_poker_group.getPoker(k);
        //                    lstPoker.Add(new Poker(op_poker.index, op_poker.color, op_poker.size, op_poker.pos));
        //                }
        //                seat.HoldPoker.Add(lstPoker);
        //            }
        //            for (int j = 0; j < op_seat.dingPokerGroupCount(); ++j)
        //            {
        //                OP_POKER_GROUP op_poker_group = op_seat.getDingPokerGroup(j);
        //                List<Poker> lstPoker = new List<Poker>();
        //                for (int k = 0; k < op_poker_group.pokerCount(); ++k)
        //                {
        //                    OP_POKER op_poker = op_poker_group.getPoker(k);
        //                    lstPoker.Add(new Poker(op_poker.index, op_poker.color, op_poker.size, op_poker.pos));
        //                }
        //                seat.DingJiangPoker.AddRange(lstPoker);
        //            }
        //            seat.Direction = op_seat.wind;
        //            if (proto.seatCount() == 2 && seat.Direction == 2)
        //            {
        //                seat.Direction = 3;
        //            }
        //            CurrentRoom.SeatList.Add(seat);
        //        }

        //        if (CurrentRoom.SeatList.Count == 2)
        //        {
        //            for (int i = 0; i < CurrentRoom.SeatList.Count; ++i)
        //            {
        //                for (int j = 0; j < CurrentRoom.SeatList[i].UsedPokerList.Count; ++j)
        //                {
        //                    for (int k = 0; k < CurrentRoom.SeatList[i].UsedPokerList[j].PokerCount; ++k)
        //                    {
        //                        if (CurrentRoom.SeatList[i].UsedPokerList[j].PokerList[k].pos == 2)
        //                        {
        //                            CurrentRoom.SeatList[i].UsedPokerList[j].PokerList[k].pos = 3;
        //                        }
        //                    }
        //                }
        //            }
        //        }

        //        CurrentRoom.FirstDice = new DiceEntity()
        //        {
        //            diceA = proto.diceFirstA,
        //            diceB = proto.diceFirstB,
        //            seatPos = proto.diceFirst,
        //        };
        //        CurrentRoom.SecondDice = new DiceEntity()
        //        {
        //            diceA = proto.diceSecondA,
        //            diceB = proto.diceSecondB,
        //            seatPos = proto.diceSecond,
        //        };

        //        int askLeng = proto.askPokerGroupCount();
        //        if (askLeng > 0)
        //        {
        //            AskPokerGroup = new List<OP_POKER_GROUP>();
        //            for (int i = 0; i < askLeng; ++i)
        //            {
        //                AskPokerGroup.Add(proto.getAskPokerGroup(i));
        //            }
        //        }
        //        else
        //        {
        //            AskPokerGroup = null;
        //        }
        //        cfg_settingDBModel.Instance.SetSetting(new List<int>(proto.getSettingIdList()));

        //        CalculateSeatIndex();

        //        InitConfig();

        //        if (currentOperatorPos == 0)
        //        {
        //            currentOperatorPos = CurrentRoom.BankerPos;
        //        }

        //        for (int i = 0; i < CurrentRoom.SeatList.Count; ++i)
        //        {
        //            SeatEntity seat = CurrentRoom.SeatList[i];
        //            for (int j = 0; j < CurrentRoom.SeatList.Count; ++j)
        //            {
        //                for (int k = 0; k < CurrentRoom.SeatList[j].UsedPokerList.Count; ++k)
        //                {
        //                    for (int l = 0; l < CurrentRoom.SeatList[j].UsedPokerList[k].PokerList.Count; ++l)
        //                    {
        //                        if (CurrentRoom.SeatList[j].UsedPokerList[k].PokerList[l].pos == seat.Pos && MahJongHelper.HasPoker(CurrentRoom.SeatList[j].UsedPokerList[k].PokerList[l], seat.UniversalList))
        //                        {
        //                            seat.isPlayedUniversal = true;
        //                            break;
        //                        }
        //                    }
        //                    if (seat.isPlayedUniversal) break;
        //                }
        //                if (seat.isPlayedUniversal) break;
        //                for (int k = 0; k < CurrentRoom.SeatList[j].DeskTopPoker.Count; ++k)
        //                {
        //                    if (CurrentRoom.SeatList[j].DeskTopPoker[k].pos == seat.Pos && MahJongHelper.HasPoker(CurrentRoom.SeatList[j].DeskTopPoker[k], seat.UniversalList))
        //                    {
        //                        seat.isPlayedUniversal = true;
        //                        break;
        //                    }
        //                }
        //                if (seat.isPlayedUniversal) break;
        //                for (int k = 0; k < CurrentRoom.SeatList[j].PokerList.Count; ++k)
        //                {
        //                    if (CurrentRoom.SeatList[j].PokerList[k].pos == seat.Pos && MahJongHelper.HasPoker(CurrentRoom.SeatList[j].PokerList[k], seat.UniversalList))
        //                    {
        //                        seat.isPlayedUniversal = true;
        //                        break;
        //                    }
        //                }
        //                if (seat.isPlayedUniversal) break;
        //            }
        //        }

        //        for (int i = 0; i < CurrentRoom.Config.Count; ++i)
        //        {
        //            if (CurrentRoom.Config[i].tags.Equals("handTotal"))
        //            {
        //                CurrentRoom.PokerTotalPerPlayer = CurrentRoom.Config[i].value;
        //                break;
        //            }
        //        }

        //        SetCurrentOperator(currentOperatorPos, true);
    }
Esempio n. 24
0
 /// <summary>
 /// 设置下注 Slider
 /// </summary>
 private void SetBetSlider(SeatEntity seat)
 {
     m_betSlider.value    = 0;
     m_betSlider.maxValue = ZhuangScore - seat.firstPour - seat.secondPour - seat.threePour;
     m_betSlider.onValueChanged.AddListener(BetSlider);
 }
Esempio n. 25
0
 public static SeatModel MapSeat(SeatEntity e)
 {
     return(new SeatModel {
         Aisle = e.Aisle, Row = e.Row
     });
 }
Esempio n. 26
0
    /// <summary>
    /// 每次结算
    /// </summary>
    internal void SettleProxy(GP_ROOM_SETTLE proto)
    {
        CurrentRoom.roomStatus = ROOM_STATUS.SETTLE;
        //if (CurrentRoom.roomPokerList.Count != 0) CurrentRoom.roomPokerList.Clear();
        List <SeatEntity> seatList  = new List <SeatEntity>();
        List <SeatEntity> seatList1 = new List <SeatEntity>();
        TransferData      data      = new TransferData();

        for (int i = 0; i < proto.room.seatListCount(); i++)
        {
            GP_SEAT    op_seat = proto.room.getSeatList(i);
            SeatEntity seat    = GetSeatBySeatId(proto.room.getSeatList(i).pos);
            if (seat.pokerList.Count != 0)
            {
                seat.pokerList.Clear();
            }
            seat.seatStatus = SEAT_STATUS.SETTLE;
            if (seat.drawPokerList != null)
            {
                seat.drawPokerList.Clear();//清空是否翻牌集合
            }
            seat.isCuoPai   = 0;
            seat.firstPour  = 0;
            seat.secondPour = 0;
            seat.threePour  = 0;
            seat.Gold      += proto.room.getSeatList(i).earnings;
            seat.eamings    = proto.room.getSeatList(i).earnings;
            if (seat.IsBanker)
            {
                seat.firstPour = op_seat.getPourList(0);
            }
            for (int j = 0; j < op_seat.pokerListCount(); ++j)
            {
                GP_POKER protoPoker = op_seat.getPokerList(j);
                seat.pokerList.Add(new Poker()
                {
                    Index = protoPoker.index, //索引
                    Type  = protoPoker.type,  //花色
                    Size  = protoPoker.size,  //大小
                });
                CurrentRoom.roomPokerList.Add(new Poker()
                {
                    Index = protoPoker.index, //索引
                    Type  = protoPoker.type,  //花色
                    Size  = protoPoker.size,  //大小
                });
            }
            seatList.Add(seat);
            data.SetValue("Room", CurrentRoom);
            data.SetValue("RoomStatus", CurrentRoom.roomStatus);
            data.SetValue("Seat", seat);
            data.SetValue("PlayerSeat", PlayerSeat);
            data.SetValue("IsPlayer", seat == PlayerSeat);
#if IS_CHUANTONGPAIJIU
            if (seat != PlayerSeat)
            {
                SendNotification(ConstantGuPaiJiu.GroupEnd, data);      //实例化其他人的牌
            }
            SendNotification(ConstantGuPaiJiu.OnGuPaiSetBetPour, data); //重新设置庄家下注分数
            SendNotification(ConstantGuPaiJiu.SetSeatGold, data);       //设置玩家的金币
#endif

            SendNotification(ConstantGuPaiJiu.EndIamge, data);//隐藏组合完成的图片
        }
        data.SetValue("SeatList", seatList);
#if IS_BAODINGQIPAI
        SendNotification(ConstantGuPaiJiu.GroupEndJieSuan, data);
#endif
        SendNotification(ConstantGuPaiJiu.CloseDrawPoker, data);  //关闭翻牌倒计时和全开按钮
#if IS_CHUANTONGPAIJIU
        SendNotification(ConstantGuPaiJiu.LoadSmallResult, data); //小结算界面
        SendNotification(ConstantGuPaiJiu.PlayMusic, data);       //播放音乐
#endif
    }
Esempio n. 27
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            var c1 = new CityEntity {
                Id = 1, Name = "Kyiv"
            };
            var c2 = new CityEntity {
                Id = 2, Name = "Lviv"
            };
            var c3 = new CityEntity {
                Id = 3, Name = "Zhytomyr"
            };
            var c4 = new CityEntity {
                Id = 4, Name = "Chernivtsi"
            };
            var c5 = new CityEntity {
                Id = 5, Name = "Sumy"
            };

            var d1 = new DayEntity {
                Id = 1, Date = DateTime.Today
            };
            var d2 = new DayEntity {
                Id = 2, Date = DateTime.Today.AddDays(1)
            };
            var d3 = new DayEntity {
                Id = 3, Date = DateTime.Today.AddDays(2)
            };

            var s1 = new SeatEntity {
                Id = 1, IsTaken = false, Number = 1, CarriageEntityId = 1
            };
            var s2 = new SeatEntity {
                Id = 2, IsTaken = false, Number = 2, CarriageEntityId = 1
            };
            var s3 = new SeatEntity {
                Id = 3, IsTaken = false, Number = 3, CarriageEntityId = 1
            };
            var s4 = new SeatEntity {
                IsTaken = false, Number = 1, Id = 4, CarriageEntityId = 2
            };
            var s5 = new SeatEntity {
                IsTaken = false, Number = 2, Id = 5, CarriageEntityId = 2
            };
            var s6 = new SeatEntity {
                IsTaken = false, Number = 3, Id = 6, CarriageEntityId = 2
            };
            var s7 = new SeatEntity {
                IsTaken = false, Number = 1, Id = 7, CarriageEntityId = 3
            };
            var s8 = new SeatEntity {
                IsTaken = false, Number = 2, Id = 8, CarriageEntityId = 3
            };
            var s9 = new SeatEntity {
                IsTaken = false, Number = 3, Id = 9, CarriageEntityId = 3
            };
            var s10 = new SeatEntity {
                IsTaken = false, Number = 1, Id = 10, CarriageEntityId = 4
            };
            var s11 = new SeatEntity {
                IsTaken = false, Number = 2, Id = 11, CarriageEntityId = 4
            };
            var s12 = new SeatEntity {
                IsTaken = false, Number = 3, Id = 12, CarriageEntityId = 4
            };

            var ct1 = new CitiesTrains {
                TrainEntityId = 1, CityEntityId = 1, Id = 1
            };
            var ct2 = new CitiesTrains {
                TrainEntityId = 1, CityEntityId = 2, Id = 2
            };
            var ct3 = new CitiesTrains {
                TrainEntityId = 1, CityEntityId = 3, Id = 3
            };
            var ct4 = new CitiesTrains {
                TrainEntityId = 1, CityEntityId = 4, Id = 4
            };
            var ct5 = new CitiesTrains {
                TrainEntityId = 2, CityEntityId = 1, Id = 5
            };
            var ct6 = new CitiesTrains {
                TrainEntityId = 2, CityEntityId = 3, Id = 6
            };
            var ct7 = new CitiesTrains {
                TrainEntityId = 2, CityEntityId = 5, Id = 7
            };

            var dt1 = new DaysTrains {
                TrainEntityId = 1, DayId = 1, Id = 1
            };
            var dt2 = new DaysTrains {
                TrainEntityId = 1, DayId = 2, Id = 2
            };
            var dt3 = new DaysTrains {
                TrainEntityId = 1, DayId = 3, Id = 3
            };
            var dt4 = new DaysTrains {
                TrainEntityId = 2, DayId = 1, Id = 4
            };
            var dt5 = new DaysTrains {
                TrainEntityId = 2, DayId = 3, Id = 5
            };

            var car1 = new CarriageEntity {
                Id = 1, TrainId = 1, Class = CarriageClass.First, Number = 1
            };
            var car2 = new CarriageEntity {
                Id = 2, TrainId = 1, Class = CarriageClass.Second, Number = 2
            };
            var car3 = new CarriageEntity {
                Id = 3, TrainId = 2, Class = CarriageClass.Second, Number = 1
            };
            var car4 = new CarriageEntity {
                Id = 4, TrainId = 2, Class = CarriageClass.Business, Number = 2
            };

            var train1 = new TrainEntity {
                Id = 1, Number = 1
            };
            var train2 = new TrainEntity {
                Id = 2, Number = 2
            };

            modelBuilder.Entity <TrainEntity>().HasData(train1, train2);
            modelBuilder.Entity <CarriageEntity>().HasData(car1, car2, car3, car4);
            modelBuilder.Entity <SeatEntity>().HasData(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12);
            modelBuilder.Entity <DayEntity>().HasData(d1, d2, d3);
            modelBuilder.Entity <CityEntity>().HasData(c1, c2, c3, c4, c5);
            modelBuilder.Entity <DaysTrains>().HasData(dt1, dt2, dt3, dt4, dt5);
            modelBuilder.Entity <CitiesTrains>().HasData(ct1, ct2, ct3, ct4, ct5, ct6, ct7);

            base.OnModelCreating(modelBuilder);
        }
Esempio n. 28
0
    ///// <summary>
    ///// 当前游戏状态
    ///// </summary>
    //public MahjongGameState CurrentState;

    ///// <summary>
    ///// 游戏规则
    ///// </summary>
    //public MahjongRule Rule;



    #endregion

    #region InitRoom 初始化房间数据
    public void InitRoom(ROOM_INFO protoRoom)
    {
        //ROOM_INFO protoRoom = proto.roomInfo;
        CurrentRoom = new RoomEntity()
        {
            //BaseScore = proto.baseScore,
            roomId      = protoRoom.roomId,
            ownerId     = protoRoom.ownerId,
            currentLoop = protoRoom.loop,
            //matchId = protoRoom.matchId,//比赛场ID
            Status           = (RoomEntity.RoomStatus)protoRoom.roomStatus,
            maxLoop          = protoRoom.maxLoop,
            DisbandStartTime = protoRoom.dismissTime,
            DisbandTime      = protoRoom.dismissMaxTime,
            DisbandTimeMax   = (int)(protoRoom.dismissMaxTime - protoRoom.dismissTime),
        };
        CurrentRoom.HistoryPoker = new List <Poker>();

        CurrentRoom.SeatList = new List <SeatEntity>();

        //收到数据存到模型基类
        CurrentRoom.Config.Clear();
        for (int i = 0; i < protoRoom.settingIdCount(); ++i)
        {
            cfg_settingEntity settingEntity = cfg_settingDBModel.Instance.Get(protoRoom.getSettingId(i));

            if (settingEntity != null)
            {
                CurrentRoom.Config.Add(settingEntity);
            }
        }

        //获得当前游戏模式
        for (int i = 0; i < CurrentRoom.Config.Count; i++)
        {
            if (CurrentRoom.Config[i].tags.Equals("mode"))
            {
                //CurrentRoom.roomModel = (Room.RoomModel)CurrentRoom.Config[i].value;
            }
        }
        for (int i = 0; i < CurrentRoom.Config.Count; i++)
        {
            if (CurrentRoom.Config[i].tags.Equals("roomMode"))
            {
                //CurrentRoom.superModel = (Room.SuperModel)CurrentRoom.Config[i].value;
                //Debug.Log("服务器发送的房间 普通高级场模式为为:" + CurrentRoom.Config[i].value);
            }
        }



        Debug.Log("房间ID为:" + protoRoom.roomId);
        Debug.Log("服务器发送的房间座位长度为:" + protoRoom.getSeatInfoList().Count);

        CurrentRoom.SeatCount = protoRoom.getSeatInfoList().Count;

        CurrentRoom.SeatList = new List <SeatEntity>();

        for (int i = 0; i < CurrentRoom.SeatCount; ++i)
        {
            SEAT_INFO  protoSeat = protoRoom.getSeatInfo(i);
            SeatEntity seat      = new SeatEntity();


            //是否同意解散
            if (protoSeat.hasSeatStatus())
            {
                seat.DisbandState = (DisbandState)protoSeat.dismiss_status;
            }

            //庄
            //seat.IsBanker = protoSeat.isBanker;
            //玩家ID
            seat.PlayerId = protoSeat.playerId;
            //房主
            seat.isLandlord = seat.PlayerId == protoRoom.ownerId;
            //pos
            seat.Pos = protoSeat.pos;
            //昵称
            seat.Nickname = protoSeat.nickname;
            //头像
            seat.Avatar = protoSeat.avatar;
            //性别
            seat.Gender = protoSeat.gender;
            //是否准备
            seat.IsReady = protoSeat.isReady;

            //已有金币
            seat.Gold = protoSeat.gold;

            //座位状态
            seat.Status = (SeatEntity.SeatStatus)protoSeat.seatStatus;
            ////本局收益
            //seat.Earnings = protoSeat.nn_earnings;
            ////是否是胜利者
            //seat.Winner = protoSeat.isWiner;

            ////纬度
            //if (protoSeat.hasLatitude()) seat.Latitude = protoSeat.latitude;

            ////经度
            //if (protoSeat.hasLongitude()) seat.Longitude = protoSeat.longitude;


            //手牌类型


            seat.pokerList = new List <Poker>();
            //具体手牌
            if (protoSeat.hasPokerInfo())
            {
                List <POKER_INFO> prPokerList = protoSeat.getPokerInfoList();
                Debug.Log("prPokerList:" + prPokerList.Count);
                for (int j = 0; j < prPokerList.Count; ++j)
                {
                    seat.pokerList.Add(new Poker(prPokerList[j].index, prPokerList[j].size, prPokerList[j].color));
                }
                seat.HandPockerNum = prPokerList.Count;
            }

            CurrentRoom.SeatList.Add(seat);
            if (seat.Status == SeatEntity.SeatStatus.Operate)
            {
                CurrentRoom.OperateSeat = seat;
            }
        }

        CalculateSeatIndex();

        //上家出牌
        List <Poker>      recentlyPlayPoker = new List <Poker>();
        List <POKER_INFO> leftPoker         = new List <POKER_INFO>();

        if (protoRoom.hasLeftPoker())
        {
            leftPoker = protoRoom.leftPoker.getPokerInfoList();
        }
        for (int i = 0; i < leftPoker.Count; ++i)
        {
            recentlyPlayPoker.Add(new Poker(leftPoker[i].index, leftPoker[i].size, leftPoker[i].color));
        }
        int leftPokerPos = protoRoom.hasLeftPoker() ? protoRoom.leftPoker.pos : 0;

        CurrentRoom.CurrAlreadyPlayPos = leftPokerPos;
        CurrentRoom.RecentlyPlayPoker  = new CombinationPokersEntity(leftPokerPos, recentlyPlayPoker, PokersType.None, 0);
        PaoDeKuaiHelper.CheckPokerType(CurrentRoom.RecentlyPlayPoker);
        Currhint = new HintPokersEntity(CurrentRoom.RecentlyPlayPoker);

        SeatEntity leftseat = GetSeatBySeatPos(leftPokerPos);

        if (leftseat != null)
        {
            if (recentlyPlayPoker.Count > 0)
            {
                leftseat.pokerList.AddRange(recentlyPlayPoker);
            }
        }

        SetSeatPass(CurrentRoom.RecentlyPlayPoker.Pos, CurrentRoom.OperateSeat);

        //if (proto.nn_room.hasUnixtime())
        //{
        //    CurrentRoom.serverTime = proto.nn_room.unixtime;//(时间戳)
        //}
    }
Esempio n. 29
0
    /// <summary>
    /// 吃碰杠
    /// </summary>
    public Combination3D Operate(int seatPos, OperatorType operateId, int subTypeId, List <Poker> pokers)
    {
        List <MaJiangCtrl> lst = new List <MaJiangCtrl>();

        Combination3D combination = null;

        if (operateId == OperatorType.Gang)
        {
            if (m_DicPeng.ContainsKey(seatPos))
            {
                List <Combination3D> usedList = m_DicPeng[seatPos];
                for (int i = 0; i < usedList.Count; ++i)
                {
                    if (usedList[i].OperatorType == OperatorType.Peng || usedList[i].OperatorType == OperatorType.Kou)
                    {
                        for (int j = 0; j < pokers.Count; ++j)
                        {
                            if (usedList[i].PokerList[0].Poker.index == pokers[j].index)
                            {
                                combination = usedList[i];
                                for (int k = 0; k < combination.PokerList.Count; ++k)
                                {
                                    lst.Add(combination.PokerList[k]);
                                }
                                usedList.Remove(combination);
                                break;
                            }
                        }
                    }
                }
            }
        }


        List <MaJiangCtrl> handList = m_DicHand[seatPos];
        Dictionary <int, List <MaJiangCtrl> > deskDic = m_DicTable;

        for (int i = 0; i < pokers.Count; ++i)
        {
            foreach (var pair in deskDic)
            {
                for (int j = 0; j < pair.Value.Count; ++j)
                {
                    if (pair.Value[j].Poker.index == pokers[i].index)
                    {
                        lst.Add(pair.Value[j]);
                        pair.Value.RemoveAt(j);
                        break;
                    }
                }
            }

            foreach (var pair in m_DicHand)
            {
                if (pair.Value == null)
                {
                    continue;
                }
                for (int j = 0; j < pair.Value.Count; ++j)
                {
                    if (pair.Value[j].Poker.index == pokers[i].index)
                    {
                        lst.Add(pair.Value[j]);
                        pair.Value.RemoveAt(j);
                        break;
                    }
                }
            }
        }
        if (operateId != OperatorType.Gang)
        {
            Sort(handList, RoomMaJiangProxy.Instance.GetSeatBySeatId(seatPos).UniversalList);
        }

        if (!m_DicPeng.ContainsKey(seatPos))
        {
            m_DicPeng.Add(seatPos, new List <Combination3D>());
        }

        if (lst.Count != pokers.Count)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendFormat("客户端找到牌的数量:{0},有", lst.Count);
            for (int i = 0; i < lst.Count; ++i)
            {
                sb.Append(lst[i].Poker.ToString(true, true));
                sb.Append(" ");
            }
            sb.AppendFormat(",服务器的数量:{0},有", pokers.Count);
            for (int i = 0; i < pokers.Count; ++i)
            {
                sb.Append(pokers[i].ToString(true, true));
                sb.Append(" ");
            }
            sb.AppendLine();
            sb.Append("客户端所有的手牌数据:");
            SeatEntity seat = RoomMaJiangProxy.Instance.GetSeatBySeatId(seatPos);
            if (seat != null)
            {
                for (int i = 0; i < seat.PokerList.Count; ++i)
                {
                    sb.Append(seat.PokerList[i].ToString(true, true));
                    sb.Append(" ");
                }
                sb.AppendLine();
                sb.Append("客户端所有的模型:");
            }
            for (int i = 0; i < handList.Count; ++i)
            {
                sb.Append(handList[i].Poker.ToString(true, true));
                sb.Append(" ");
            }
            AppDebug.ThrowError(sb.ToString());
        }

        List <MaJiangCtrl> newList = new List <MaJiangCtrl>();

        for (int i = 0; i < pokers.Count; ++i)
        {
            MaJiangCtrl ctrl = SpawnMaJiang(seatPos, pokers[i], "Table");
            if (pokers[i].pos != seatPos && (operateId == OperatorType.Chi || operateId == OperatorType.ChiTing))
            {
                ctrl.isGray = true;
            }

            if (operateId == OperatorType.LiangXi)
            {
                ctrl.isGray = true;
            }

            if (lst.Count == pokers.Count)
            {
                ctrl.transform.position = lst[i].transform.position;
                ctrl.transform.rotation = lst[i].transform.rotation;
            }
            newList.Add(ctrl);
        }

        if (combination == null)
        {
            combination = new Combination3D((int)operateId, subTypeId, newList);
        }
        else
        {
            combination.BuGang(newList);
        }

        for (int i = 0; i < lst.Count; ++i)
        {
            DespawnMaJiang(lst[i]);
        }
        m_DicPeng[seatPos].Add(combination);

        return(combination);
    }
Esempio n. 30
0
 /// <summary>
 /// 断线重连和中途加入实例化牌
 /// </summary>
 /// <param name="seat"></param>
 /// <param name="roomStatus"></param>
 public void SetSeatInfoTwo(SeatEntity seat, ENUM_ROOM_STATUS roomStatus)
 {
     if (m_nSeatIndex == seat.Index)
     {
         if (seat.seatStatus != ENUM_SEAT_STATUS.IDLE && seat.seatStatus != ENUM_SEAT_STATUS.READY)//&& seat.seatStatus != ENUM_SEAT_STATUS.DEAL && seat.seatStatus != ENUM_SEAT_STATUS.DEAL //seat.seatStatus != ENUM_SEAT_STATUS.IDLE &&seat.seatStatus != ENUM_SEAT_STATUS.READY
         {
             string stateName   = seat.seatStatus == ENUM_SEAT_STATUS.THECARD ? (seat.Index == 1 || seat.Index == 2 || seat.Index == 6) ? "img_shibaiyou" : "img_shibaizuo" : (seat.Index == 1 || seat.Index == 2 || seat.Index == 3) ? "img_qipaiyou" : "img_qipaizuo";
             string pokerStatus = (seat.Index == 1 || seat.Index == 2 || seat.Index == 6) ? "img_yikanpaiyou" : "img_yikanpaizuo";
             //#### 如果在游戏中,并且看牌了
             if (seat.pokerStatus == ENUM_POKER_STATUS.POSITIVE)
             {
                 //####如果在游戏中,看牌后弃牌了
                 if (seat.seatToperateStatus == ENUM_SEATOPERATE_STATUS.Discard)
                 {
                     //执行实例化看牌后弃牌
                     if (seat.pos == RoomZhaJHProxy.Instance.PlayerSeat.pos)
                     {
                         //执行看牌的方法,实例化牌
                         TransferData data = new TransferData();
                         data.SetValue("index", seat.Index);
                         data.SetValue("pokerList", seat.pokerList);
                         data.SetValue("spriteName", "failpoker");
                         // SendNotification(ZhaJHMethodname.LookPoker, data);
                         if (display != null)
                         {
                             display.enabled = false;
                         }
                         ModelDispatcher.Instance.Dispatch(ZhaJHMethodname.OnZJHLookPoker, data);
                         m_zhuangtai.enabled = true;
                         m_zhuangtai.sprite  = ZJHSpriteManager.Instance.ZJHSprite(stateName);
                     }
                     else
                     {
                         InstantiationPoker(seat, "failpoker");
                         m_zhuangtai.enabled = true;
                         m_zhuangtai.sprite  = ZJHSpriteManager.Instance.ZJHSprite(stateName);
                     }
                 }
                 //####如果在游戏中,看牌后未弃牌
                 else
                 {
                     if (seat.pos == RoomZhaJHProxy.Instance.PlayerSeat.pos)
                     {
                         TransferData data = new TransferData();
                         data.SetValue("index", seat.Index);
                         data.SetValue("pokerList", seat.pokerList);
                         data.SetValue("spriteName", "normalpoker");
                         JudgingCardType(seat);
                         ModelDispatcher.Instance.Dispatch(ZhaJHMethodname.OnZJHLookPoker, data);
                     }
                     else
                     {
                         InstantiationPoker(seat, "normalpoker");
                         m_zhuangtai.enabled = true;
                         m_zhuangtai.sprite  = ZJHSpriteManager.Instance.ZJHSprite(pokerStatus);
                     }
                 }
             }
             //#### 如果在游戏中,没有看牌
             else
             {
                 if (seat.seatToperateStatus == ENUM_SEATOPERATE_STATUS.Discard)
                 {
                     if (seat.pos == RoomZhaJHProxy.Instance.PlayerSeat.pos)
                     {
                         InstantiationPoker(seat, "failpoker");
                         m_zhuangtai.enabled = true;
                         m_zhuangtai.sprite  = ZJHSpriteManager.Instance.ZJHSprite(stateName);
                     }
                     else
                     {
                         InstantiationPoker(seat, "failpoker");
                         m_zhuangtai.enabled = true;
                         m_zhuangtai.sprite  = ZJHSpriteManager.Instance.ZJHSprite(stateName);
                     }
                 }
                 else
                 {
                     if (seat.pos == RoomZhaJHProxy.Instance.PlayerSeat.pos)
                     {
                         InstantiationPoker(seat, "normalpoker");
                     }
                     else
                     {
                         InstantiationPoker(seat, "normalpoker");
                     }
                 }
             }
         }
     }
 }