实例介绍
介绍Socket网络连接模块: 主要分为四部分: 一、套接字管理器(SocketManager.cs) 1)、连接 2)、断开 3)、接收(线程) 4)、发送(携程) 二、消息中心:(MessageCenter.cs) 1)、游戏逻辑事件 2)、网络数据事件(线程) 三、数据封装: 1)、网络数据缓冲器(DataBuff.cs) 2)、二进制字节流(ByteStreamBuffer.cs)
【实例截图】
【核心代码】
SampleSocket
└── SampleSocket
├── ProtoGen
│ ├── BuildCS.bat
│ ├── common.xslt
│ ├── csharp.xslt
│ ├── Licence.txt
│ ├── protobuf-net.dll
│ ├── protobuf-net.pdb
│ ├── protobuf-net.xml
│ ├── protocal_loginserver.cs
│ ├── protocal_loginserver.proto
│ ├── protoc-license.txt
│ ├── protogen.exe
│ ├── protogen.exe.config
│ ├── protogen.pdb
│ ├── vb.xslt
│ ├── xml.xslt
│ └── 说明文档.txt
└── Socket
├── Assets
│ ├── Scripts
│ │ ├── Client.cs
│ │ ├── Client.cs.meta
│ │ ├── GameConst.cs
│ │ ├── GameConst.cs.meta
│ │ ├── Server.cs
│ │ ├── Server.cs.meta
│ │ ├── Socket
│ │ │ ├── ByteStreamBuff.cs
│ │ │ ├── ByteStreamBuff.cs.meta
│ │ │ ├── DataBuff.cs
│ │ │ ├── DataBuff.cs.meta
│ │ │ ├── EventDefinition.cs
│ │ │ ├── EventDefinition.cs.meta
│ │ │ ├── MessageCenter.cs
│ │ │ ├── MessageCenter.cs.meta
│ │ │ ├── protobuf
│ │ │ │ ├── BclHelpers.cs
│ │ │ │ ├── BclHelpers.cs.meta
│ │ │ │ ├── BufferExtension.cs
│ │ │ │ ├── BufferExtension.cs.meta
│ │ │ │ ├── BufferPool.cs
│ │ │ │ ├── BufferPool.cs.meta
│ │ │ │ ├── CallbackAttributes.cs
│ │ │ │ ├── CallbackAttributes.cs.meta
│ │ │ │ ├── Compiler
│ │ │ │ │ ├── CompilerContext.cs
│ │ │ │ │ ├── CompilerContext.cs.meta
│ │ │ │ │ ├── CompilerDelegates.cs
│ │ │ │ │ ├── CompilerDelegates.cs.meta
│ │ │ │ │ ├── Local.cs
│ │ │ │ │ └── Local.cs.meta
│ │ │ │ ├── Compiler.meta
│ │ │ │ ├── DataFormat.cs
│ │ │ │ ├── DataFormat.cs.meta
│ │ │ │ ├── Extensible.cs
│ │ │ │ ├── Extensible.cs.meta
│ │ │ │ ├── ExtensibleUtil.cs
│ │ │ │ ├── ExtensibleUtil.cs.meta
│ │ │ │ ├── GlobalSuppressions.cs
│ │ │ │ ├── GlobalSuppressions.cs.meta
│ │ │ │ ├── Helpers.cs
│ │ │ │ ├── Helpers.cs.meta
│ │ │ │ ├── IExtensible.cs
│ │ │ │ ├── IExtensible.cs.meta
│ │ │ │ ├── IExtension.cs
│ │ │ │ ├── IExtension.cs.meta
│ │ │ │ ├── ImplicitFields.cs
│ │ │ │ ├── ImplicitFields.cs.meta
│ │ │ │ ├── KeyValuePairProxy.cs
│ │ │ │ ├── KeyValuePairProxy.cs.meta
│ │ │ │ ├── Meta
│ │ │ │ │ ├── AttributeMap.cs
│ │ │ │ │ ├── AttributeMap.cs.meta
│ │ │ │ │ ├── BasicList.cs
│ │ │ │ │ ├── BasicList.cs.meta
│ │ │ │ │ ├── CallbackSet.cs
│ │ │ │ │ ├── CallbackSet.cs.meta
│ │ │ │ │ ├── MetaType.cs
│ │ │ │ │ ├── MetaType.cs.meta
│ │ │ │ │ ├── RuntimeTypeModel.cs
│ │ │ │ │ ├── RuntimeTypeModel.cs.meta
│ │ │ │ │ ├── SubType.cs
│ │ │ │ │ ├── SubType.cs.meta
│ │ │ │ │ ├── TypeFormatEventArgs.cs
│ │ │ │ │ ├── TypeFormatEventArgs.cs.meta
│ │ │ │ │ ├── TypeModel.cs
│ │ │ │ │ ├── TypeModel.cs.meta
│ │ │ │ │ ├── ValueMember.cs
│ │ │ │ │ └── ValueMember.cs.meta
│ │ │ │ ├── Meta.meta
│ │ │ │ ├── NetObjectCache.cs
│ │ │ │ ├── NetObjectCache.cs.meta
│ │ │ │ ├── PrefixStyle.cs
│ │ │ │ ├── PrefixStyle.cs.meta
│ │ │ │ ├── ProtoContractAttribute.cs
│ │ │ │ ├── ProtoContractAttribute.cs.meta
│ │ │ │ ├── ProtoEnumAttribute.cs
│ │ │ │ ├── ProtoEnumAttribute.cs.meta
│ │ │ │ ├── ProtoException.cs
│ │ │ │ ├── ProtoException.cs.meta
│ │ │ │ ├── ProtoIgnoreAttribute.cs
│ │ │ │ ├── ProtoIgnoreAttribute.cs.meta
│ │ │ │ ├── ProtoIncludeAttribute.cs
│ │ │ │ ├── ProtoIncludeAttribute.cs.meta
│ │ │ │ ├── ProtoMemberAttribute.cs
│ │ │ │ ├── ProtoMemberAttribute.cs.meta
│ │ │ │ ├── ProtoReader.cs
│ │ │ │ ├── ProtoReader.cs.meta
│ │ │ │ ├── ProtoWriter.cs
│ │ │ │ ├── ProtoWriter.cs.meta
│ │ │ │ ├── SerializationContext.cs
│ │ │ │ ├── SerializationContext.cs.meta
│ │ │ │ ├── Serializer.cs
│ │ │ │ ├── Serializer.cs.meta
│ │ │ │ ├── Serializers
│ │ │ │ │ ├── ArrayDecorator.cs
│ │ │ │ │ ├── ArrayDecorator.cs.meta
│ │ │ │ │ ├── BlobSerializer.cs
│ │ │ │ │ ├── BlobSerializer.cs.meta
│ │ │ │ │ ├── BooleanSerializer.cs
│ │ │ │ │ ├── BooleanSerializer.cs.meta
│ │ │ │ │ ├── ByteSerializer.cs
│ │ │ │ │ ├── ByteSerializer.cs.meta
│ │ │ │ │ ├── CharSerializer.cs
│ │ │ │ │ ├── CharSerializer.cs.meta
│ │ │ │ │ ├── CompiledSerializer.cs
│ │ │ │ │ ├── CompiledSerializer.cs.meta
│ │ │ │ │ ├── DateTimeSerializer.cs
│ │ │ │ │ ├── DateTimeSerializer.cs.meta
│ │ │ │ │ ├── DecimalSerializer.cs
│ │ │ │ │ ├── DecimalSerializer.cs.meta
│ │ │ │ │ ├── DefaultValueDecorator.cs
│ │ │ │ │ ├── DefaultValueDecorator.cs.meta
│ │ │ │ │ ├── DoubleSerializer.cs
│ │ │ │ │ ├── DoubleSerializer.cs.meta
│ │ │ │ │ ├── EnumSerializer.cs
│ │ │ │ │ ├── EnumSerializer.cs.meta
│ │ │ │ │ ├── FieldDecorator.cs
│ │ │ │ │ ├── FieldDecorator.cs.meta
│ │ │ │ │ ├── GuidSerializer.cs
│ │ │ │ │ ├── GuidSerializer.cs.meta
│ │ │ │ │ ├── Int16Serializer.cs
│ │ │ │ │ ├── Int16Serializer.cs.meta
│ │ │ │ │ ├── Int32Serializer.cs
│ │ │ │ │ ├── Int32Serializer.cs.meta
│ │ │ │ │ ├── Int64Serializer.cs
│ │ │ │ │ ├── Int64Serializer.cs.meta
│ │ │ │ │ ├── IProtoSerializer.cs
│ │ │ │ │ ├── IProtoSerializer.cs.meta
│ │ │ │ │ ├── IProtoTypeSerializer.cs
│ │ │ │ │ ├── IProtoTypeSerializer.cs.meta
│ │ │ │ │ ├── ISerializerProxy.cs
│ │ │ │ │ ├── ISerializerProxy.cs.meta
│ │ │ │ │ ├── KeyValuePairDecorator.cs
│ │ │ │ │ ├── KeyValuePairDecorator.cs.meta
│ │ │ │ │ ├── ListDecorator.cs
│ │ │ │ │ ├── ListDecorator.cs.meta
│ │ │ │ │ ├── MemberSpecifiedDecorator.cs
│ │ │ │ │ ├── MemberSpecifiedDecorator.cs.meta
│ │ │ │ │ ├── NetObjectSerializer.cs
│ │ │ │ │ ├── NetObjectSerializer.cs.meta
│ │ │ │ │ ├── NullDecorator.cs
│ │ │ │ │ ├── NullDecorator.cs.meta
│ │ │ │ │ ├── ParseableSerializer.cs
│ │ │ │ │ ├── ParseableSerializer.cs.meta
│ │ │ │ │ ├── PropertyDecorator.cs
│ │ │ │ │ ├── PropertyDecorator.cs.meta
│ │ │ │ │ ├── ProtoDecoratorBase.cs
│ │ │ │ │ ├── ProtoDecoratorBase.cs.meta
│ │ │ │ │ ├── SByteSerializer.cs
│ │ │ │ │ ├── SByteSerializer.cs.meta
│ │ │ │ │ ├── SingleSerializer.cs
│ │ │ │ │ ├── SingleSerializer.cs.meta
│ │ │ │ │ ├── StringSerializer.cs
│ │ │ │ │ ├── StringSerializer.cs.meta
│ │ │ │ │ ├── SubItemSerializer.cs
│ │ │ │ │ ├── SubItemSerializer.cs.meta
│ │ │ │ │ ├── SurrogateSerializer.cs
│ │ │ │ │ ├── SurrogateSerializer.cs.meta
│ │ │ │ │ ├── SystemTypeSerializer.cs
│ │ │ │ │ ├── SystemTypeSerializer.cs.meta
│ │ │ │ │ ├── TagDecorator.cs
│ │ │ │ │ ├── TagDecorator.cs.meta
│ │ │ │ │ ├── TimeSpanSerializer.cs
│ │ │ │ │ ├── TimeSpanSerializer.cs.meta
│ │ │ │ │ ├── TupleSerializer.cs
│ │ │ │ │ ├── TupleSerializer.cs.meta
│ │ │ │ │ ├── TypeSerializer.cs
│ │ │ │ │ ├── TypeSerializer.cs.meta
│ │ │ │ │ ├── UInt16Serializer.cs
│ │ │ │ │ ├── UInt16Serializer.cs.meta
│ │ │ │ │ ├── UInt32Serializer.cs
│ │ │ │ │ ├── UInt32Serializer.cs.meta
│ │ │ │ │ ├── UInt64Serializer.cs
│ │ │ │ │ ├── UInt64Serializer.cs.meta
│ │ │ │ │ ├── UriDecorator.cs
│ │ │ │ │ └── UriDecorator.cs.meta
│ │ │ │ ├── Serializers.meta
│ │ │ │ ├── ServiceModel
│ │ │ │ │ ├── ProtoBehaviorAttribute.cs
│ │ │ │ │ ├── ProtoBehaviorAttribute.cs.meta
│ │ │ │ │ ├── ProtoBehaviorExtensionElement.cs
│ │ │ │ │ ├── ProtoBehaviorExtensionElement.cs.meta
│ │ │ │ │ ├── ProtoEndpointBehavior.cs
│ │ │ │ │ ├── ProtoEndpointBehavior.cs.meta
│ │ │ │ │ ├── ProtoOperationBehavior.cs
│ │ │ │ │ ├── ProtoOperationBehavior.cs.meta
│ │ │ │ │ ├── XmlProtoSerializer.cs
│ │ │ │ │ └── XmlProtoSerializer.cs.meta
│ │ │ │ ├── ServiceModel.meta
│ │ │ │ ├── SubItemToken.cs
│ │ │ │ ├── SubItemToken.cs.meta
│ │ │ │ ├── WireType.cs
│ │ │ │ └── WireType.cs.meta
│ │ │ ├── protobuf.meta
│ │ │ ├── ProtocalData
│ │ │ │ ├── protocal_loginserver.cs
│ │ │ │ └── protocal_loginserver.cs.meta
│ │ │ ├── ProtocalData.meta
│ │ │ ├── ProtocalDefinition.cs
│ │ │ ├── ProtocalDefinition.cs.meta
│ │ │ ├── SocketManager.cs
│ │ │ └── SocketManager.cs.meta
│ │ └── Socket.meta
│ ├── Scripts.meta
│ ├── Singleton.cs
│ ├── Singleton.cs.meta
│ ├── SocketTest.unity
│ └── SocketTest.unity.meta
├── ProjectSettings
│ ├── AudioManager.asset
│ ├── ClusterInputManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorBuildSettings.asset
│ ├── EditorSettings.asset
│ ├── GraphicsSettings.asset
│ ├── InputManager.asset
│ ├── NavMeshAreas.asset
│ ├── NetworkManager.asset
│ ├── Physics2DSettings.asset
│ ├── ProjectSettings.asset
│ ├── ProjectVersion.txt
│ ├── QualitySettings.asset
│ ├── TagManager.asset
│ ├── TimeManager.asset
│ ├── UnityAdsSettings.asset
│ └── UnityConnectSettings.asset
└── 说明文档.txt
13 directories, 236 files
标签:
小贴士
感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。
- 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
- 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
- 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
- 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。
关于好例子网
本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明
网友评论
我要评论