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

来源:互联网 发布:拍拍贷网络最新黑名单 编辑:程序博客网 时间:2024/04/30 14:44

这里写图片描述


注意: 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)

原创粉丝点击