예제 #1
0
    public void OnItemClick()
    {
        //操作

        if (mOpt.ins == eMJInstructionsType.GANG)
        {
            if (mOpt.cards.Count > 1)
            {
                //mPlayer.ShowInstructions(null);//关闭选项界面
                mPlayer.SetSpeciaInstructions(mOpt);
                return;
            }
        }

        /*
         * else if (mOpt.ins == eMJInstructionsType.chi)
         * {
         *  List<MJliangcard> list = mPlayer.GetChiCards();
         *  if (list.Count > 1)
         *  {
         *      mPlayer.ShowInstructions(null);//关闭选项界面
         *      mPlayer.SetSpeciaInstructions(mOpt);
         *      return;
         *  }
         * }
         */
        if (mPlayer != null)
        {
            mPlayer.ShowInstructions(null);
        }

        OptRequest req = new OptRequest();

        req.ins   = mOptIndex;
        req.cards = new List <int>();
        if (mOpt.cards != null)
        {
            req.cards.Add(mOpt.cards[0]);
        }
        Global.Inst.GetController <MJGameController>().SendInstructions(req, () =>
        {
            if (mPlayer != null)
            {
                mPlayer.ShowInstructions(null);
            }
        });
    }
예제 #2
0
    /// <summary>
    /// 初始化 玩家数据
    /// </summary>
    /// <param name="info"></param>
    public void InfoAllPlayerData(StartGameRespone info)
    {
        InitData();                                                                                        //初始化操作列表信息
        if (info.roomInfo.roomState == eRoomState.READY || info.roomInfo.roomState == eRoomState.GAMEOVER) // 不显示剩余牌数量
        {
            SetLeftCardNum(info.startInfo.leaveCardNum, false);
        }
        else
        {
            SetLeftCardNum(info.startInfo.leaveCardNum, true);
        }

        InitMJScene();
        //准备
        InitReady(info);
        //头像
        foreach (var item in info.roomInfo.playerList)
        {
            int index = MJGameModel.Inst.mnewSeatToIndex[item.seatId];
            InitOnePlayerIcon(mAllPlayer[index], item);
            SetPlayerSeatId(item.seatId, mAllPlayer[index]);   //座位号///**********************
            InitOnePlayerOnlineState(mAllPlayer[index], item); //在线状态
        }
        //手牌
        BuildHandMahjong(MJGameModel.Inst.allPlayersCardsInfoStruct);
        //打出的牌
        InitAllPlayerCollectCards(MJGameModel.Inst.allPlayersCardsInfoStruct);
        //碰的牌
        InfoAllPlayerPengCard(MJGameModel.Inst.allPlayersCardsInfoStruct);
        //听牌标记
        //InitAllTingTag(info.playerList);
        //胡牌标记
        InitAllHuTag(MJGameModel.Inst.allPlayersCardsInfoStruct);
        //定缺标记
        InitAllFixeType(MJGameModel.Inst.allPlayersCardsInfoStruct, info.roomInfo.roomState);
        //设置 打牌指针 轮到谁操作
        mMJSceneRoot.SetLight(MJGameModel.Inst.mCurInsSeatId);
        //cd
        SetAllPlayerCD(MJGameModel.Inst.mCurInsSeatId);
        //设置 色子显示
        mMJSceneRoot.SetTouZiNum(info.startInfo.dices);
        //桌上的牌
        if (info.roomInfo.roomState == eRoomState.READY || info.roomInfo.roomState == eRoomState.GAMEOVER)//准备和结束不显桌上的牌
        {
            mMJSceneRoot.SetDeskCard(0, info.startInfo.dices, true);
        }
        else
        {
            mMJSceneRoot.SetDeskCard(info.startInfo.leaveCardNum, info.startInfo.dices, true);
        }
        //桌子位置
        mMJSceneRoot.SetDescRotate(MJGameModel.Inst.mMySeatId - 1);
        //桌子上信息
        int _roomId = info.roomInfo.mode == "m4" ? 0 : int.Parse(info.roomInfo.roomId);                                                //如果是平台房就不显示房间号

        mMJSceneRoot.SetDescInfo(999, int.Parse(info.roomInfo.roomId), info.roomInfo.currGameCount, info.roomInfo.maxGameCount, 9999); //  番数       低分  没有
        //上一次打出牌特效
        if (info.roomInfo.roomState == eRoomState.START && info.roomInfo.lastHitSeatId != 0)
        {
            int index = MJGameModel.Inst.mnewSeatToIndex[info.roomInfo.lastHitSeatId];
            SetCurCardEffect(mAllPlayer[index], eMJInstructionsType.HIT, mCurCardOffset); //打出的牌特效
        }
        SetRoomPlayNum(MJGameModel.Inst.mStartGameData.roomInfo.currGameCount, true);     //设局数显示
        //我的操作列表
        mSelfPlayer.ShowInstructions(info.roomInfo.optList);
        //MJGameModel.Inst.mIsTing = false;//听牌
        MJGameModel.Inst.isFirstGetStartGameData = false;

        mIsStart = true;
    }