//断线重连 private bool OnSocketSubGameScene(byte[] data, int dataSize) { if (dataSize != Marshal.SizeOf(typeof(CMD_S_StatusPlay))) { return(false); } CMD_S_StatusPlay gsmeStatus = NetUtil.BytesToStruct <CMD_S_StatusPlay>(data); return(true); //TODO: }
void OnPlayScence(byte[] data, int dataSize) { //旁观者或者重连 var typeValue = typeof(CMD_S_StatusPlay); int localDataSize = Marshal.SizeOf(typeValue); if (dataSize != localDataSize) { Debug.LogError("OnPlayScence:localDataSize=" + localDataSize + ", serverDataSize=" + dataSize); return; } CMD_S_StatusPlay pNetInfo = (CMD_S_StatusPlay)StructConverterByteArray.BytesToStruct(data, typeValue); GlobalUserInfo pGlobalUserInfo = GlobalUserInfo.GetInstance(); tagGlobalUserData pGlobalUserData = pGlobalUserInfo.GetGlobalUserData(); pGlobalUserData.cbMapIndexRand = pNetInfo.cbMapIndex; pGlobalUserData.wRandseed = pNetInfo.wRandseed; pGlobalUserData.wRandseedForRandomGameObject = pNetInfo.wRandseedForRandomGameObject; pGlobalUserData.wRandseedForInventory = pNetInfo.wRandseedForInventory; //道具同步 Array.Copy(pNetInfo.sInventoryList, pGlobalUserData.sInventoryList, pNetInfo.sInventoryList.Length); //Buffer.BlockCopy(pNetInfo.sInventoryList, 0, pGlobalUserData.sInventoryList, 0, pNetInfo.sInventoryList.Length); //旁观者 int nStatus = SocketDefines.US_NULL; IClientUserItem pMeItem = CServerItem.get().GetMeUserItem(); if (pMeItem != null) { nStatus = pMeItem.GetUserStatus(); } if (nStatus == SocketDefines.US_LOOKON) { Loom.QueueOnMainThread(() => { hnManager.LoadHideSeekSceneOfWangHu(); }); } else { //mChen add, temp Loom.QueueOnMainThread(() => { hnManager.LoadHideSeekSceneOfWangHu(); }); if (false)//if (!hnManager.bEnteredGameScene) { //没进入游戏场景 //强杀进程后进来 Debug.LogError("OnPlayScence : 在大厅重连?强杀进程后回来? cbGameStatus=" + pNetInfo.cbGameStatus + " UserStatus=" + nStatus + " bEnteredGameScene=" + hnManager.bEnteredGameScene); //在大厅重连? Loom.QueueOnMainThread(() => { //hnManager.LoadHideSeekSceneOfWangHu(); //hnManager.SetLoading(false); hnManager.StartOrStopGameSceneHeartBeat(false); hnManager.LeaveRoom(); hnManager.LeaveGameToHall(); //CServerItem.get().IntermitConnect(true); }); } } //重连 byte cbGameStatus = pNetInfo.cbGameStatus; Debug.Log("OnPlayScence : cbGameStatus=" + cbGameStatus + " UserStatus=" + nStatus + " bEnteredGameScene=" + hnManager.bEnteredGameScene); //mChen add, for HideSeek: //if (nStatus != SocketDefines.US_LOOKON && !hnManager.bEnteredGameScene) //{ // //在大厅重连? // StartOrStopGameSceneHeartBeat(false); // CServerItem.get().IntermitConnect(true); // hnManager.LeaveRoom(); //} defaultState(); }
internal void initPlayScene(CMD_S_StatusPlay cs) { //struct CMD_S_StatusPlay //{ // //状态信息 // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public byte[] cbPlayStatus; //用户状态 // public byte cbDynamicJoin; //动态加入 // public long lTurnMaxScore; //最大下注 // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public long[] lTableScore; //下注数目 // public ushort wBankerUser; //庄家用户 // public long lWeekBonsesInfo; // public long lMoneyScore; // public tagSGetBonsesInfo BonsesInfo; // //扑克信息 // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public byte[][] cbHandCardData;//桌面扑克 // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public byte[] bOxCard; //牛牛数据 // //历史积分 // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public long[] lTurnScore; //积分信息 // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public long[] lCollectScore; //积分信息 // [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)PROTOCOL_PACKET.SERVER_LEN)] // public string[] szGameRoomName; //房间名称 // public int bGameOption; //游戏配置 // public bool bUserLookTable; //锁桌信息 // public byte[] cbOxInfo; //}; long[] lTableScore = cs.lTableScore; //下注数目 ushort wBankerUser = cs.wBankerUser; //庄家用户 //显示玩家下注结果 if ((int)lTableScore[0] != 0) { FourBull.Messager.Broadcast(FourBullEvent.BetPosZero, (int)lTableScore[0]); } if ((int)lTableScore[1] != 0) { FourBull.Messager.Broadcast(FourBullEvent.BetPosOne, (int)lTableScore[1]); } if ((int)lTableScore[2] != 0) { FourBull.Messager.Broadcast(FourBullEvent.BetPosTwo, (int)lTableScore[2]); } if ((int)lTableScore[3] != 0) { FourBull.Messager.Broadcast(FourBullEvent.BetPosThree, (int)lTableScore[3]); } //显示庄家标识 if (0 == FourBullCommand.Instance.SwitchViewChairID(wBankerUser)) { FourBull.Messager.Broadcast(FourBullEvent.TablePosZeroPlayerIsBanker); } else if (1 == FourBullCommand.Instance.SwitchViewChairID(wBankerUser)) { FourBull.Messager.Broadcast(FourBullEvent.TablePosOnePlayerIsBanker); } else if (2 == FourBullCommand.Instance.SwitchViewChairID(wBankerUser)) { FourBull.Messager.Broadcast(FourBullEvent.TablePosTwoPlayerIsBanker); } else if (3 == FourBullCommand.Instance.SwitchViewChairID(wBankerUser)) { FourBull.Messager.Broadcast(FourBullEvent.TablePosThreePlayerIsBanker); } //struct CMD_S_SendCard //{ // [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)PROTOCOL_PACKET.GAME_PLAYER)] // public byte[][] cbCardData; //用户扑克 // public ushort wPlayerCount; //}; CMD_S_SendCard cardStruct = new CMD_S_SendCard(); cardStruct.cbCardData = cs.cbHandCardData; //发牌 FourBull.Messager.Broadcast(FourBullEvent.StartdealPoker, cardStruct); //摊牌结果 for (ushort index = 0; index < 4; index++) { if (0 == FourBullCommand.Instance.SwitchViewChairID(index)) { //未摊牌 if (cs.cbOxInfo[index] != 0xff) { FourBull.Messager.Broadcast(FourBullEvent.showCow, 0); } } else if (1 == FourBullCommand.Instance.SwitchViewChairID(index)) { if (cs.cbOxInfo[index] != 0xff) { FourBull.Messager.Broadcast(FourBullEvent.showCow, 1); } } else if (2 == FourBullCommand.Instance.SwitchViewChairID(index)) { if (cs.cbOxInfo[index] != 0xff) { FourBull.Messager.Broadcast(FourBullEvent.showCow, 2); } } else if (3 == FourBullCommand.Instance.SwitchViewChairID(index)) { if (cs.cbOxInfo[index] != 0xff) { FourBull.Messager.Broadcast(FourBullEvent.showCow, 3); } } } }