// 发送 private void SendGiveUpFrame() { #if !SERVER FramePacket packet = new FramePacket(); packet.type = 2; packet.giveup = new GiveUpPacket(); packet.giveup.team = battleData.currentTeam; byte[] bytestr = Json.EnCodeBytes(packet); NetMessage.PbFrame pb = new PbFrame(); NetMessage.CSFrame build = new CSFrame(); pb.content = bytestr; build.frame = pb; NetSystem.Instance.Send <NetMessage.CSFrame> ((int)NetMessage.MsgId.ID_CSFrame, build); #endif }
void UpdateBattleSpeed() { if (speedUp) { return; } int elapsed = Mathf.RoundToInt(BattleSystem.Instance.sceneManager.GetBattleTime()); if (elapsed >= 60 * 3) { speedUp = true; FramePacket packet = new FramePacket(); packet.type = 3; byte[] bytestr = Json.EnCodeBytes(packet); NetMessage.PbFrame pb = new PbFrame(); NetMessage.CSFrame build = new CSFrame(); pb.content = bytestr; build.frame = pb; NetSystem.Instance.Send <NetMessage.CSFrame>((int)NetMessage.MsgId.ID_CSFrame, build); EventSystem.Instance.FireEvent(EventId.OnPVPBattleAccelerate, null); } }
void SendKeyInfo() { CSFrame proto = new CSFrame(); proto.UUID = UUID; proto.FrameID = CurFrameID; for (int i = 0; i < CurFrameInfo.Count; ++i) { proto.KeyInfo.Add((System.UInt32)CurFrameInfo[i]); } CurFrameInfo.Clear(); byte[] bytes = ProtoSerialize.Serialize <CSFrame>(proto); int size = bytes.Length; MessageBody body = new MessageBody(); body.size = (uint)(size + MessageBody.HEADER_TYPE_BYTES); body.type = (ushort)EMessageType.ECSFrame; body.data = bytes; TCPClient.Instance.Send(body); }