多人麻将 后台发牌 +客户端响应

这里写图片描述


注意: listcard保存的是 4遍 0-33之间的整数(且包含0和33),这些数字具体代表什么意义,看看下面客户端的代码和截图就知道


所谓洗牌 简单理解就是把listcard数组中所有数字互相随机的调换顺序


下面看看发牌:
这里写图片描述


这里写图片描述


这里写图片描述




以下是客户端收到服务器分发的牌:

    public void startGame(ClientResponse response)  //客户端收到牌的响应
    {
        GlobalDataScript.roomAvatarVoList = avatarList;
        //GlobalDataScript.surplusTimes -= 1;
        StartGameVO sgvo = JsonMapper.ToObject<StartGameVO>(response.message);
        bankerId = sgvo.bankerId;
        cleanGameplayUI ();
        //开始游戏后不显示
        MyDebug.Log("startGame");
        GlobalDataScript.surplusTimes --;
        curDirString = getDirection (bankerId);
        LeavedRoundNumText.text = GlobalDataScript.surplusTimes+"";//刷新剩余圈数
        if (!isFirstOpen) {
            btnActionScript = gameObject.GetComponent<ButtonActionScript> ();
            initPanel ();
            initArrayList ();
            avatarList [bankerId].main = true;
        }

        GlobalDataScript.finalGameEndVo = null;
        GlobalDataScript.mainUuid = avatarList [bankerId].account.uuid;
        initArrayList ();
        curDirString = getDirection (bankerId);
        playerItems [curDirIndex].setbankImgEnable (true);//显示庄家图标
        SetDirGameObjectAction();
        isFirstOpen = false;
        GlobalDataScript.isOverByPlayer = false;

        mineList = sgvo.paiArray;  //取出牌的信息

        UpateTimeReStart ();

        setAllPlayerReadImgVisbleToFalse ();
        initMyCardListAndOtherCard (13,13,13);

        ShowLeavedCardsNumForInit();

        if (curDirString == DirectionEnum.Bottom) {
            //isSelfPickCard = true;
            GlobalDataScript.isDrag = true;
        } else {
            //isSelfPickCard = false;
            GlobalDataScript.isDrag = false;
        }
    }

这里写图片描述


这里写图片描述



这里写图片描述



这里写图片描述



这里写图片描述


这里写图片描述



这一块的核心逻辑如下:

玩家点击开始准备按钮
服务器检测是否可以开始游戏(玩家数量够+每一个玩家都准备好)
洗牌,发牌,然后将各自的牌组发给玩家
玩家收到牌组后,实例化每一张牌,定位置,然后保存



FR:海涛高软(Hunk Xu)

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值