同步操作将从 liyonghelpme/GameServerCsharp 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System.Collections;using Google.ProtocolBuffers;using System.Collections.Generic;using System;namespace MyLib{public class ServerBundle{static System.UInt32 serverPushFlowId = 0;KBEngine.MemoryStream stream = new KBEngine.MemoryStream();public int messageLength = 0;public KBEngine.Message msgtype = null;public int moduleId;public int msgId;public System.UInt32 flowId;void newMessage(System.Type type) {Debug.Log ("ServerBundle:: 开始发送消息 Message is " + type.Name);var pa = Util.GetMsgID (type.Name);if(pa == null) {Debug.LogError("GetMessage Id Error, please Update NameMap.json "+type.Name);}moduleId = pa.moduleId;msgId = pa.messageId;msgtype = null;}uint writePB(byte[] v, int errorCode=0) {int bodyLength = 4 + 1 + 2+ 4 + 2 + v.Length;int totalLength = 1 + 4 + bodyLength;//checkStream (totalLength);Debug.Log ("ServerBundle::writePB pack data is "+bodyLength+" pb length "+v.Length+" totalLength "+totalLength);Debug.Log ("ServerBundle::writePB module Id msgId " + moduleId+" "+msgId);stream.writeUint8 (Convert.ToByte(0xcc));stream.writeUint32 (Convert.ToUInt32(bodyLength));stream.writeUint32 (Convert.ToUInt32(flowId));stream.writeUint8 (Convert.ToByte(moduleId));stream.writeUint16 (Convert.ToUInt16(msgId));stream.writeUint32 (Convert.ToUInt32 (123));//response timestream.writeUint16 (Convert.ToUInt16 (errorCode)); // no error reponse flagstream.writePB (v);return flowId;}uint writePB(IMessageLite pbMsg, int errorCode=0) {Debug.Log ("WritePB: "+pbMsg);byte[] bytes;using (System.IO.MemoryStream stream = new System.IO.MemoryStream()) {pbMsg.WriteTo (stream);bytes = stream.ToArray ();}return writePB (bytes, errorCode);}public static byte[] sendImmediateError(IBuilderLite build, uint flowId, int errorCode) {var data = build.WeakBuild ();var bundle = new ServerBundle ();bundle.newMessage (data.GetType());bundle.flowId = flowId;bundle.writePB (data, errorCode);return bundle.stream.getbuffer();}public static byte[] MakePacket(IBuilderLite build, uint flowId) {var data = build.WeakBuild ();var bundle = new ServerBundle ();bundle.newMessage (data.GetType());bundle.flowId = flowId;bundle.writePB (data);return bundle.stream.getbuffer();}}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。