//开始游戏 public void OnEventGameStart(byte[] tmpBuf, int size) { CMD_S_GameStart gameStart = NetUtil.BytesToStruct <CMD_S_GameStart>(tmpBuf); MyDebug.Log("房间号" + (long)(gameStart.lUserScore)); MyDebug.Log("房间号" + (ushort)(gameStart.wSpecialType)); MyDebug.Log("房间号" + NetUtil.BytesToStruct <CMD_S_GameStart>(tmpBuf)); }
public void OnSubGameStart(byte[] pBuffer, ushort wDataSize) { var typeValue = typeof(CMD_S_GameStart); Debug.Log("建德游戏开始" + Marshal.SizeOf(typeValue)); if (wDataSize != Marshal.SizeOf(typeValue)) { return; } //变量定义 CMD_S_GameStart pGameStart = (CMD_S_GameStart)StructConverterByteArray.BytesToStruct(pBuffer, typeValue); defaultState(); m_iBankerUser = pGameStart.wBankerUser; m_iCurrentUser = pGameStart.wCurrentUser; m_iUserAction = pGameStart.cbUserAction; //WidgetFun::setText(this, "LastCardCout", (int)pGameStart.cbLeftCardCount); //WidgetFun::setVisible(this, "XZDDButton_WeiXinFriend", false);//mChen hack for (int i = 0; i < MAX_PLAYER; i++) { var player = getPlayerByChairID(i); player.setHandCard(pGameStart.cbCardData, i * HNMJ_Defines.MAX_COUNT, HNMJ_Defines.MAX_COUNT - 1); player.startGame(); } Loom.QueueOnMainThread(() => { //Lin: pGameStart.lSiceCount 服务端未设置,暂时rand一个 hnManager.SetLeftCard(pGameStart.cbLeftCardCount); Random.state = new Random.State(); var buf = new byte[(HNMJ_Defines.MAX_COUNT) * HNMJ_Defines.GAME_PLAYER]; Buffer.BlockCopy(pGameStart.cbCardData, 0, buf, 0, buf.Length); hnManager.GameStartProcedure(Random.Range(2, 13), m_iBankerUser, buf); //hnManager.GameStartProcedure(pGameStart.lSiceCount, m_iBankerUser); }); //HNMJButtonAction_ShowCard(); getPlayerByChairID(m_iBankerUser).setZhuang(); if (pGameStart.cbXiaoHuTag == 1) { setGameState(MJState.HNMJ_STATE_XIAO_HU); } else { setGameState(MJState.HNMJ_STATE_PLAYING); } }