/// <summary> /// 进入匹配的结果 /// </summary> /// <param name="obj"></param> private void HandleLobbyToMatchS2C(BufferEntity response) { LobbyToMatchS2C s2cMSG = ProtobufHelper.FromBytes <LobbyToMatchS2C>(response.proto); if (s2cMSG.Result == 0) { MatchModeBtn.gameObject.SetActive(false); QualifyingBtn.gameObject.SetActive(false); StopMatchBtn.gameObject.SetActive(true); MatchTips.gameObject.SetActive(true); } else { //无法进行匹配 可能是被惩罚 需要等待 } }
//进入匹配 private void HandleLobbyToMatchC2S(BufferEntity request) { LobbyToMatchC2S c2sMSG = ProtobufHelper.FromBytes <LobbyToMatchC2S>(request.proto); LobbyToMatchS2C s2cMSG = new LobbyToMatchS2C(); s2cMSG.Result = 0; MatchEntity matchEntity = new MatchEntity(); PlayerEntity player = PlayerManager.GetPlayerEntityFromSession(request.session); //缓存匹配信息 player.matchEntity = matchEntity; matchEntity.TeamID = player.rolesInfo.RolesID; matchEntity.player = player; BufferFactory.CreqateAndSendPackage(request, s2cMSG); //让角色进入匹配状态 MatchManager.Instance.Add(matchEntity); }