Showing preview only (926K chars total). Download the full file or copy to clipboard to get everything.
Repository: colyseus/colyseus-unity3d
Branch: master
Commit: 08ba8e2303cf
Files: 449
Total size: 807.8 KB
Directory structure:
gitextract_6zht0_qm/
├── .editorconfig
├── .github/
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE.md
│ └── workflows/
│ ├── nuget-publish.yml
│ ├── tests.yml
│ └── upmsemver.yml
├── .gitignore
├── Assets/
│ ├── Colyseus/
│ │ ├── .editorconfig
│ │ ├── .gitignore
│ │ ├── Documentation~/
│ │ │ ├── .gitkeep
│ │ │ └── GettingStarted.md
│ │ ├── Editor/
│ │ │ ├── Colyseus.Editor.asmdef
│ │ │ ├── Colyseus.Editor.asmdef.meta
│ │ │ ├── README.md
│ │ │ ├── README.md.meta
│ │ │ ├── RoomInspector.cs
│ │ │ └── RoomInspector.cs.meta
│ │ ├── Editor.meta
│ │ ├── LICENSE
│ │ ├── LICENSE.meta
│ │ ├── Runtime/
│ │ │ ├── Colyseus/
│ │ │ │ ├── Auth.cs
│ │ │ │ ├── Auth.cs.meta
│ │ │ │ ├── Client.cs
│ │ │ │ ├── Client.cs.meta
│ │ │ │ ├── Connection.cs
│ │ │ │ ├── Connection.cs.meta
│ │ │ │ ├── HTTP.cs
│ │ │ │ ├── HTTP.cs.meta
│ │ │ │ ├── Manager.cs
│ │ │ │ ├── Manager.cs.meta
│ │ │ │ ├── Platform/
│ │ │ │ │ ├── ColyseusContext.cs
│ │ │ │ │ ├── ColyseusContext.cs.meta
│ │ │ │ │ ├── Defaults/
│ │ │ │ │ │ ├── ConsoleLogger.cs
│ │ │ │ │ │ ├── ConsoleLogger.cs.meta
│ │ │ │ │ │ ├── DefaultHttpClient.cs
│ │ │ │ │ │ ├── DefaultHttpClient.cs.meta
│ │ │ │ │ │ ├── InMemoryTokenStorage.cs
│ │ │ │ │ │ └── InMemoryTokenStorage.cs.meta
│ │ │ │ │ ├── Defaults.meta
│ │ │ │ │ ├── IHttpClient.cs
│ │ │ │ │ ├── IHttpClient.cs.meta
│ │ │ │ │ ├── ILogger.cs
│ │ │ │ │ ├── ILogger.cs.meta
│ │ │ │ │ ├── ITokenStorage.cs
│ │ │ │ │ ├── ITokenStorage.cs.meta
│ │ │ │ │ ├── IWebSocket.cs
│ │ │ │ │ ├── IWebSocket.cs.meta
│ │ │ │ │ ├── PreserveAttribute.cs
│ │ │ │ │ ├── PreserveAttribute.cs.meta
│ │ │ │ │ ├── Unity/
│ │ │ │ │ │ ├── UnityHttpClient.cs
│ │ │ │ │ │ ├── UnityHttpClient.cs.meta
│ │ │ │ │ │ ├── UnityLogger.cs
│ │ │ │ │ │ ├── UnityLogger.cs.meta
│ │ │ │ │ │ ├── UnityPlatform.cs
│ │ │ │ │ │ ├── UnityPlatform.cs.meta
│ │ │ │ │ │ ├── UnitySettings.cs
│ │ │ │ │ │ ├── UnitySettings.cs.meta
│ │ │ │ │ │ ├── UnityTokenStorage.cs
│ │ │ │ │ │ └── UnityTokenStorage.cs.meta
│ │ │ │ │ └── Unity.meta
│ │ │ │ ├── Platform.meta
│ │ │ │ ├── Protocol/
│ │ │ │ │ ├── ErrorCode.cs
│ │ │ │ │ ├── ErrorCode.cs.meta
│ │ │ │ │ ├── MatchMakeResponse.cs
│ │ │ │ │ ├── MatchMakeResponse.cs.meta
│ │ │ │ │ ├── MessageHandler.cs
│ │ │ │ │ ├── MessageHandler.cs.meta
│ │ │ │ │ ├── Protocol.cs
│ │ │ │ │ ├── Protocol.cs.meta
│ │ │ │ │ ├── RoomAvailable.cs
│ │ │ │ │ └── RoomAvailable.cs.meta
│ │ │ │ ├── Protocol.meta
│ │ │ │ ├── Room.cs
│ │ │ │ ├── Room.cs.meta
│ │ │ │ ├── Serializer/
│ │ │ │ │ ├── Conversion/
│ │ │ │ │ │ ├── BigEndianBitConverter.cs
│ │ │ │ │ │ ├── BigEndianBitConverter.cs.meta
│ │ │ │ │ │ ├── DoubleConverter.cs
│ │ │ │ │ │ ├── DoubleConverter.cs.meta
│ │ │ │ │ │ ├── EndianBitConverter.cs
│ │ │ │ │ │ ├── EndianBitConverter.cs.meta
│ │ │ │ │ │ ├── Endianness.cs
│ │ │ │ │ │ ├── Endianness.cs.meta
│ │ │ │ │ │ ├── LittleEndianBitConverter.cs
│ │ │ │ │ │ └── LittleEndianBitConverter.cs.meta
│ │ │ │ │ ├── Conversion.meta
│ │ │ │ │ ├── NoneSerializer.cs
│ │ │ │ │ ├── NoneSerializer.cs.meta
│ │ │ │ │ ├── Schema/
│ │ │ │ │ │ ├── Callbacks/
│ │ │ │ │ │ │ ├── Callbacks.cs
│ │ │ │ │ │ │ └── Callbacks.cs.meta
│ │ │ │ │ │ ├── Callbacks.meta
│ │ │ │ │ │ ├── Decoder.cs
│ │ │ │ │ │ ├── Decoder.cs.meta
│ │ │ │ │ │ ├── DynamicSchema.cs
│ │ │ │ │ │ ├── DynamicSchema.cs.meta
│ │ │ │ │ │ ├── ReferenceTracker.cs
│ │ │ │ │ │ ├── ReferenceTracker.cs.meta
│ │ │ │ │ │ ├── Schema.cs
│ │ │ │ │ │ ├── Schema.cs.meta
│ │ │ │ │ │ ├── TypeContext.cs
│ │ │ │ │ │ ├── TypeContext.cs.meta
│ │ │ │ │ │ ├── Types/
│ │ │ │ │ │ │ ├── ArraySchema.cs
│ │ │ │ │ │ │ ├── ArraySchema.cs.meta
│ │ │ │ │ │ │ ├── CustomType.cs
│ │ │ │ │ │ │ ├── CustomType.cs.meta
│ │ │ │ │ │ │ ├── MapSchema.cs
│ │ │ │ │ │ │ ├── MapSchema.cs.meta
│ │ │ │ │ │ │ ├── Reflection.cs
│ │ │ │ │ │ │ └── Reflection.cs.meta
│ │ │ │ │ │ ├── Types.meta
│ │ │ │ │ │ ├── Utils/
│ │ │ │ │ │ │ ├── Decode.cs
│ │ │ │ │ │ │ ├── Decode.cs.meta
│ │ │ │ │ │ │ ├── Encode.cs
│ │ │ │ │ │ │ └── Encode.cs.meta
│ │ │ │ │ │ └── Utils.meta
│ │ │ │ │ ├── Schema.meta
│ │ │ │ │ ├── SchemaSerializer.cs
│ │ │ │ │ ├── SchemaSerializer.cs.meta
│ │ │ │ │ ├── Serializer.cs
│ │ │ │ │ └── Serializer.cs.meta
│ │ │ │ ├── Serializer.meta
│ │ │ │ ├── Settings/
│ │ │ │ │ ├── Settings.cs
│ │ │ │ │ └── Settings.cs.meta
│ │ │ │ ├── Settings.meta
│ │ │ │ ├── Transport/
│ │ │ │ │ ├── WebSocket.cs
│ │ │ │ │ ├── WebSocket.cs.meta
│ │ │ │ │ ├── WebSocketDispatchLoop.cs
│ │ │ │ │ └── WebSocketDispatchLoop.cs.meta
│ │ │ │ ├── Transport.meta
│ │ │ │ ├── Utils/
│ │ │ │ │ ├── Exceptions.cs
│ │ │ │ │ ├── Exceptions.cs.meta
│ │ │ │ │ ├── ExtensionMethods.cs
│ │ │ │ │ ├── ExtensionMethods.cs.meta
│ │ │ │ │ ├── ObjectExtensions.cs
│ │ │ │ │ ├── ObjectExtensions.cs.meta
│ │ │ │ │ ├── UnityWebRequestAwaiter.cs
│ │ │ │ │ └── UnityWebRequestAwaiter.cs.meta
│ │ │ │ └── Utils.meta
│ │ │ ├── Colyseus.meta
│ │ │ ├── ColyseusSDK.asmdef
│ │ │ ├── ColyseusSDK.asmdef.meta
│ │ │ ├── Editor Default Resources/
│ │ │ │ ├── .gitkeep
│ │ │ │ ├── Icons/
│ │ │ │ │ ├── ColyseusSettings.png.import
│ │ │ │ │ ├── ColyseusSettings.png.import.meta
│ │ │ │ │ └── ColyseusSettings.png.meta
│ │ │ │ └── Icons.meta
│ │ │ ├── Editor Default Resources.meta
│ │ │ ├── Example.meta
│ │ │ ├── Example~/
│ │ │ │ ├── ColyseusNetworkManager.cs
│ │ │ │ ├── ColyseusNetworkManager.cs.meta
│ │ │ │ ├── ConnectionManager.cs
│ │ │ │ ├── ConnectionManager.cs.meta
│ │ │ │ ├── ExampleScene.unity
│ │ │ │ ├── ExampleScene.unity.meta
│ │ │ │ ├── MyServerSettings.asset
│ │ │ │ ├── MyServerSettings.asset.meta
│ │ │ │ ├── Schema/
│ │ │ │ │ ├── Item.cs
│ │ │ │ │ ├── Item.cs.meta
│ │ │ │ │ ├── MyRoomState.cs
│ │ │ │ │ ├── MyRoomState.cs.meta
│ │ │ │ │ ├── Player.cs
│ │ │ │ │ └── Player.cs.meta
│ │ │ │ └── Schema.meta
│ │ │ ├── GameDevWare.Serialization/
│ │ │ │ ├── ArrayExtensions.cs
│ │ │ │ ├── ArrayExtensions.cs.meta
│ │ │ │ ├── GenerateTypeSerializerAttribute.cs
│ │ │ │ ├── GenerateTypeSerializerAttribute.cs.meta
│ │ │ │ ├── IJsonReader.cs
│ │ │ │ ├── IJsonReader.cs.meta
│ │ │ │ ├── IJsonWriter.cs
│ │ │ │ ├── IJsonWriter.cs.meta
│ │ │ │ ├── IValueInfo.cs
│ │ │ │ ├── IValueInfo.cs.meta
│ │ │ │ ├── IndexedDictionary.cs
│ │ │ │ ├── IndexedDictionary.cs.meta
│ │ │ │ ├── Json.cs
│ │ │ │ ├── Json.cs.meta
│ │ │ │ ├── JsonMember.cs
│ │ │ │ ├── JsonMember.cs.meta
│ │ │ │ ├── JsonReader.cs
│ │ │ │ ├── JsonReader.cs.meta
│ │ │ │ ├── JsonReaderExtentions.cs
│ │ │ │ ├── JsonReaderExtentions.cs.meta
│ │ │ │ ├── JsonSerializationException.cs
│ │ │ │ ├── JsonSerializationException.cs.meta
│ │ │ │ ├── JsonStreamReader.cs
│ │ │ │ ├── JsonStreamReader.cs.meta
│ │ │ │ ├── JsonStreamWriter.cs
│ │ │ │ ├── JsonStreamWriter.cs.meta
│ │ │ │ ├── JsonStringBuilderReader.cs
│ │ │ │ ├── JsonStringBuilderReader.cs.meta
│ │ │ │ ├── JsonStringBuilderWriter.cs
│ │ │ │ ├── JsonStringBuilderWriter.cs.meta
│ │ │ │ ├── JsonStringReader.cs
│ │ │ │ ├── JsonStringReader.cs.meta
│ │ │ │ ├── JsonTextReader.cs
│ │ │ │ ├── JsonTextReader.cs.meta
│ │ │ │ ├── JsonTextWriter.cs
│ │ │ │ ├── JsonTextWriter.cs.meta
│ │ │ │ ├── JsonToken.cs
│ │ │ │ ├── JsonToken.cs.meta
│ │ │ │ ├── JsonUtils.cs
│ │ │ │ ├── JsonUtils.cs.meta
│ │ │ │ ├── JsonWriter.cs
│ │ │ │ ├── JsonWriter.cs.meta
│ │ │ │ ├── JsonWriterExtentions.cs
│ │ │ │ ├── JsonWriterExtentions.cs.meta
│ │ │ │ ├── MessagePack/
│ │ │ │ │ ├── BigEndianBitConverter.cs
│ │ │ │ │ ├── BigEndianBitConverter.cs.meta
│ │ │ │ │ ├── DefaultMsgPackExtensionTypeHandler.cs
│ │ │ │ │ ├── DefaultMsgPackExtensionTypeHandler.cs.meta
│ │ │ │ │ ├── EndianBitConverter.cs
│ │ │ │ │ ├── EndianBitConverter.cs.meta
│ │ │ │ │ ├── Endianness.cs
│ │ │ │ │ ├── Endianness.cs.meta
│ │ │ │ │ ├── LittleEndianBitConverter.cs
│ │ │ │ │ ├── LittleEndianBitConverter.cs.meta
│ │ │ │ │ ├── MsgPackExtensionType.cs
│ │ │ │ │ ├── MsgPackExtensionType.cs.meta
│ │ │ │ │ ├── MsgPackExtensionTypeHandler.cs
│ │ │ │ │ ├── MsgPackExtensionTypeHandler.cs.meta
│ │ │ │ │ ├── MsgPackReader.cs
│ │ │ │ │ ├── MsgPackReader.cs.meta
│ │ │ │ │ ├── MsgPackTimestamp.cs
│ │ │ │ │ ├── MsgPackTimestamp.cs.meta
│ │ │ │ │ ├── MsgPackType.cs
│ │ │ │ │ ├── MsgPackType.cs.meta
│ │ │ │ │ ├── MsgPackWriter.cs
│ │ │ │ │ ├── MsgPackWriter.cs.meta
│ │ │ │ │ ├── UnknownMsgPackExtentionTypeException.cs
│ │ │ │ │ ├── UnknownMsgPackExtentionTypeException.cs.meta
│ │ │ │ │ ├── UnknownMsgPackFormatException.cs
│ │ │ │ │ └── UnknownMsgPackFormatException.cs.meta
│ │ │ │ ├── MessagePack.meta
│ │ │ │ ├── Metadata/
│ │ │ │ │ ├── DataMemberDescription.cs
│ │ │ │ │ ├── DataMemberDescription.cs.meta
│ │ │ │ │ ├── FieldDescription.cs
│ │ │ │ │ ├── FieldDescription.cs.meta
│ │ │ │ │ ├── MemberDescription.cs
│ │ │ │ │ ├── MemberDescription.cs.meta
│ │ │ │ │ ├── MetadataReflection.cs
│ │ │ │ │ ├── MetadataReflection.cs.meta
│ │ │ │ │ ├── PropertyDescription.cs
│ │ │ │ │ ├── PropertyDescription.cs.meta
│ │ │ │ │ ├── TypeDescription.cs
│ │ │ │ │ └── TypeDescription.cs.meta
│ │ │ │ ├── Metadata.meta
│ │ │ │ ├── MsgPack.cs
│ │ │ │ ├── MsgPack.cs.meta
│ │ │ │ ├── PathSegment.cs
│ │ │ │ ├── PathSegment.cs.meta
│ │ │ │ ├── ReflectionExtentions.cs
│ │ │ │ ├── ReflectionExtentions.cs.meta
│ │ │ │ ├── SerializationContext.cs
│ │ │ │ ├── SerializationContext.cs.meta
│ │ │ │ ├── SerializationOptions.cs
│ │ │ │ ├── SerializationOptions.cs.meta
│ │ │ │ ├── Serializers/
│ │ │ │ │ ├── ArraySerializer.cs
│ │ │ │ │ ├── ArraySerializer.cs.meta
│ │ │ │ │ ├── BinarySerializer.cs
│ │ │ │ │ ├── BinarySerializer.cs.meta
│ │ │ │ │ ├── BoundsSerializer.cs
│ │ │ │ │ ├── BoundsSerializer.cs.meta
│ │ │ │ │ ├── DateTimeOffsetSerializer.cs
│ │ │ │ │ ├── DateTimeOffsetSerializer.cs.meta
│ │ │ │ │ ├── DateTimeSerializer.cs
│ │ │ │ │ ├── DateTimeSerializer.cs.meta
│ │ │ │ │ ├── DictionaryEntrySerializer.cs
│ │ │ │ │ ├── DictionaryEntrySerializer.cs.meta
│ │ │ │ │ ├── DictionarySerializer.cs
│ │ │ │ │ ├── DictionarySerializer.cs.meta
│ │ │ │ │ ├── EnumNumberSerializer.cs
│ │ │ │ │ ├── EnumNumberSerializer.cs.meta
│ │ │ │ │ ├── EnumSerializer.cs
│ │ │ │ │ ├── EnumSerializer.cs.meta
│ │ │ │ │ ├── GuidSerializer.cs
│ │ │ │ │ ├── GuidSerializer.cs.meta
│ │ │ │ │ ├── Matrix4x4Serializer.cs
│ │ │ │ │ ├── Matrix4x4Serializer.cs.meta
│ │ │ │ │ ├── MsgPackExtensionTypeSerializer.cs
│ │ │ │ │ ├── MsgPackExtensionTypeSerializer.cs.meta
│ │ │ │ │ ├── MsgPackTimestampSerializer.cs
│ │ │ │ │ ├── MsgPackTimestampSerializer.cs.meta
│ │ │ │ │ ├── ObjectSerializer.cs
│ │ │ │ │ ├── ObjectSerializer.cs.meta
│ │ │ │ │ ├── PrimitiveTypeSerializer.cs
│ │ │ │ │ ├── PrimitiveTypeSerializer.cs.meta
│ │ │ │ │ ├── QuaternionSerializer.cs
│ │ │ │ │ ├── QuaternionSerializer.cs.meta
│ │ │ │ │ ├── RectSerializer.cs
│ │ │ │ │ ├── RectSerializer.cs.meta
│ │ │ │ │ ├── StreamSerializer.cs
│ │ │ │ │ ├── StreamSerializer.cs.meta
│ │ │ │ │ ├── TimeSpanSerializer.cs
│ │ │ │ │ ├── TimeSpanSerializer.cs.meta
│ │ │ │ │ ├── UriSerializer.cs
│ │ │ │ │ ├── UriSerializer.cs.meta
│ │ │ │ │ ├── Vector2Serializer.cs
│ │ │ │ │ ├── Vector2Serializer.cs.meta
│ │ │ │ │ ├── Vector3Serializer.cs
│ │ │ │ │ ├── Vector3Serializer.cs.meta
│ │ │ │ │ ├── Vector4Serializer.cs
│ │ │ │ │ ├── Vector4Serializer.cs.meta
│ │ │ │ │ ├── VersionSerializer.cs
│ │ │ │ │ └── VersionSerializer.cs.meta
│ │ │ │ ├── Serializers.meta
│ │ │ │ ├── TypeSerializer.cs
│ │ │ │ ├── TypeSerializer.cs.meta
│ │ │ │ ├── TypeSerializerAttribute.cs
│ │ │ │ └── TypeSerializerAttribute.cs.meta
│ │ │ ├── GameDevWare.Serialization.meta
│ │ │ └── WebSocket.meta
│ │ ├── Runtime.meta
│ │ ├── Tests/
│ │ │ ├── .gitkeep
│ │ │ ├── Colyseus.Editor.Tests.asmdef
│ │ │ ├── Colyseus.Editor.Tests.asmdef.meta
│ │ │ ├── Editor/
│ │ │ │ ├── ColyseusTests.meta
│ │ │ │ ├── ServerSettingsEditor.cs
│ │ │ │ └── ServerSettingsEditor.cs.meta
│ │ │ ├── Editor.meta
│ │ │ ├── Runtime/
│ │ │ │ └── .gitkeep
│ │ │ └── Runtime.meta
│ │ ├── Tests.meta
│ │ ├── package.json
│ │ └── package.json.meta
│ └── Colyseus.meta
├── CLAUDE.md
├── LICENSE
├── Packages/
│ ├── manifest.json
│ └── packages-lock.json
├── ProjectSettings/
│ ├── AudioManager.asset
│ ├── ClusterInputManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorBuildSettings.asset
│ ├── EditorSettings.asset
│ ├── GraphicsSettings.asset
│ ├── InputManager.asset
│ ├── NavMeshAreas.asset
│ ├── NetworkManager.asset
│ ├── PackageManagerSettings.asset
│ ├── Physics2DSettings.asset
│ ├── PresetManager.asset
│ ├── ProjectSettings.asset
│ ├── ProjectVersion.txt
│ ├── QualitySettings.asset
│ ├── TagManager.asset
│ ├── TimeManager.asset
│ ├── UnityConnectSettings.asset
│ ├── VFXManager.asset
│ ├── VersionControlSettings.asset
│ └── XRSettings.asset
├── README.md
├── UserSettings/
│ └── EditorUserSettings.asset
├── nuget/
│ ├── Colyseus.csproj
│ ├── README.md
│ └── tests/
│ ├── HTTPTest.cs
│ ├── HTTPTest.cs.meta
│ ├── IntegrationTest.cs
│ ├── IntegrationTest.cs.meta
│ ├── Schema/
│ │ ├── ArraySchemaClear/
│ │ │ ├── ArraySchemaClear.cs
│ │ │ └── ArraySchemaClear.cs.meta
│ │ ├── ArraySchemaClear.meta
│ │ ├── ArraySchemaMultipleSplice/
│ │ │ ├── Item.cs
│ │ │ ├── Item.cs.meta
│ │ │ ├── MultipleArraySpliceState.cs
│ │ │ ├── MultipleArraySpliceState.cs.meta
│ │ │ ├── Player.cs
│ │ │ └── Player.cs.meta
│ │ ├── ArraySchemaMultipleSplice.meta
│ │ ├── ArraySchemaTypes/
│ │ │ ├── ArraySchemaTypes.cs
│ │ │ ├── ArraySchemaTypes.cs.meta
│ │ │ ├── IAmAChild.cs
│ │ │ └── IAmAChild.cs.meta
│ │ ├── ArraySchemaTypes.meta
│ │ ├── BackwardsForwards/
│ │ │ ├── PlayerV1.cs
│ │ │ ├── PlayerV1.cs.meta
│ │ │ ├── PlayerV2.cs
│ │ │ ├── PlayerV2.cs.meta
│ │ │ ├── StateV1.cs
│ │ │ ├── StateV1.cs.meta
│ │ │ ├── StateV2.cs
│ │ │ └── StateV2.cs.meta
│ │ ├── BackwardsForwards.meta
│ │ ├── Callbacks/
│ │ │ ├── CallbacksState.cs
│ │ │ ├── CallbacksState.cs.meta
│ │ │ ├── Container.cs
│ │ │ ├── Container.cs.meta
│ │ │ ├── Item.cs
│ │ │ ├── Item.cs.meta
│ │ │ ├── Player.cs
│ │ │ ├── Player.cs.meta
│ │ │ ├── Vec3.cs
│ │ │ └── Vec3.cs.meta
│ │ ├── Callbacks.meta
│ │ ├── ChildSchemaTypes/
│ │ │ ├── ChildSchemaTypes.cs
│ │ │ ├── ChildSchemaTypes.cs.meta
│ │ │ ├── IAmAChild.cs
│ │ │ └── IAmAChild.cs.meta
│ │ ├── ChildSchemaTypes.meta
│ │ ├── FilteredTypes/
│ │ │ ├── Player.cs
│ │ │ ├── Player.cs.meta
│ │ │ ├── State.cs
│ │ │ └── State.cs.meta
│ │ ├── FilteredTypes.meta
│ │ ├── InheritedTypes/
│ │ │ ├── Bot.cs
│ │ │ ├── Bot.cs.meta
│ │ │ ├── Entity.cs
│ │ │ ├── Entity.cs.meta
│ │ │ ├── InheritedTypes.cs
│ │ │ ├── InheritedTypes.cs.meta
│ │ │ ├── Player.cs
│ │ │ └── Player.cs.meta
│ │ ├── InheritedTypes.meta
│ │ ├── InstanceSharingTypes/
│ │ │ ├── Player.cs
│ │ │ ├── Player.cs.meta
│ │ │ ├── Position.cs
│ │ │ ├── Position.cs.meta
│ │ │ ├── State.cs
│ │ │ └── State.cs.meta
│ │ ├── InstanceSharingTypes.meta
│ │ ├── Item.cs
│ │ ├── Item.cs.meta
│ │ ├── MapSchemaInt8/
│ │ │ ├── MapSchemaInt8.cs
│ │ │ └── MapSchemaInt8.cs.meta
│ │ ├── MapSchemaInt8.meta
│ │ ├── MapSchemaMoveNullifyType/
│ │ │ ├── State.cs
│ │ │ └── State.cs.meta
│ │ ├── MapSchemaMoveNullifyType.meta
│ │ ├── MapSchemaTypes/
│ │ │ ├── IAmAChild.cs
│ │ │ ├── IAmAChild.cs.meta
│ │ │ ├── MapSchemaTypes.cs
│ │ │ └── MapSchemaTypes.cs.meta
│ │ ├── MapSchemaTypes.meta
│ │ ├── MyRoomState.cs
│ │ ├── MyRoomState.cs.meta
│ │ ├── Player.cs
│ │ ├── Player.cs.meta
│ │ ├── PrimitiveTypes/
│ │ │ ├── PrimitiveTypes.cs
│ │ │ └── PrimitiveTypes.cs.meta
│ │ └── PrimitiveTypes.meta
│ ├── Schema.meta
│ ├── SchemaDeserializerTest.cs
│ ├── SchemaDeserializerTest.cs.meta
│ ├── SerializationTest.cs
│ ├── SerializationTest.cs.meta
│ └── WebSocketTransportTest.cs
├── nuget-monogame/
│ ├── Colyseus.MonoGame.csproj
│ ├── ColyseusGameComponent.cs
│ └── README.md
└── unity-setup.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .editorconfig
================================================
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
[*.{js,ts}]
indent_style = space
indent_size = 2
[*.{cs}]
indent_style = tab
indent_size = 2
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: endel # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://www.paypal.me/endeld # Replace with a single custom sponsorship URL
================================================
FILE: .github/ISSUE_TEMPLATE.md
================================================
<!--
Looking for help? Post on the forum instead: http://discuss.colyseus.io
-->
================================================
FILE: .github/workflows/nuget-publish.yml
================================================
name: NuGet Publish
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x
- name: Test
run: dotnet test nuget/Colyseus.csproj --filter "FullyQualifiedName!~IntegrationTest" --verbosity normal
publish:
name: Publish to NuGet
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x
- name: Check for version change
id: version
run: |
CURRENT=$(python3 -c "import json; print(json.load(open('Assets/Colyseus/package.json'))['version'])")
PREVIOUS=$(git show HEAD~1:Assets/Colyseus/package.json 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['version'])" 2>/dev/null || echo "")
echo "current=$CURRENT" >> $GITHUB_OUTPUT
echo "previous=$PREVIOUS" >> $GITHUB_OUTPUT
if [ "$CURRENT" != "$PREVIOUS" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Version changed: $PREVIOUS -> $CURRENT"
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "Version unchanged: $CURRENT"
fi
- name: Pack
if: steps.version.outputs.changed == 'true'
run: |
dotnet pack nuget/Colyseus.csproj -c Release -o $GITHUB_WORKSPACE/packages/
dotnet nuget add source $GITHUB_WORKSPACE/packages/ --name local
dotnet pack nuget-monogame/Colyseus.MonoGame.csproj -c Release -o $GITHUB_WORKSPACE/packages/
- name: Publish to NuGet
if: steps.version.outputs.changed == 'true'
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: dotnet nuget push $GITHUB_WORKSPACE/packages/*.nupkg --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
================================================
FILE: .github/workflows/tests.yml
================================================
name: Tests
on:
push:
branches: [master, universal]
pull_request:
branches: [master, universal]
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x
- name: Run unit tests
run: dotnet test nuget/Colyseus.csproj --filter "FullyQualifiedName!~IntegrationTest" --verbosity normal
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
10.0.x
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Clone test server
run: git clone https://github.com/colyseus/sdks-test-server.git sdks-test-server
- name: Install test server dependencies
working-directory: sdks-test-server
run: npm install
- name: Start test server
working-directory: sdks-test-server
run: npx tsx src/index.ts > ../server.log 2>&1 &
- name: Wait for server to be ready
run: |
for i in $(seq 1 30); do
if curl -s http://localhost:2567 > /dev/null 2>&1; then
echo "Server is ready!"
exit 0
fi
echo "Waiting for server... ($i/30)"
sleep 1
done
echo "Server failed to start"
cat server.log
exit 1
- name: Run integration tests
run: dotnet test nuget/Colyseus.csproj --filter "FullyQualifiedName~IntegrationTest" --verbosity normal
- name: Print server logs
if: always()
run: cat server.log || true
================================================
FILE: .github/workflows/upmsemver.yml
================================================
name: Update Unity UPM semantic versioning
on:
push:
branches:
- master
- dev
jobs:
checkSemver:
name: Check for Semver Change
runs-on: ubuntu-latest
outputs:
semver-updated: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout Code
uses: actions/checkout@v2
- uses: EndBug/version-check@v2
id: check
with:
file-name: Assets/Colyseus/package.json
diff-search: true
updateUPM:
name: Update UPM branch
runs-on: ubuntu-latest
needs: [checkSemver]
if: needs.checkSemver.outputs.semver-updated == 'true'
steps:
- uses: actions/checkout@v2
- name: Fetch NativeWebSocket
run: bash unity-setup.sh
- name: Remove test symlink
run: rm -rf Assets/Colyseus/Tests
- name: Push package directory to subtree
uses: s0/git-publish-subdir-action@develop
env:
REPO: self
BRANCH: upm
FOLDER: Assets/Colyseus/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
createPackage:
name: Create Unity Package and Release
runs-on: ubuntu-latest
needs: [checkSemver]
if: needs.checkSemver.outputs.semver-updated == 'true'
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Fetch NativeWebSocket
run: bash unity-setup.sh
- name: Remove test symlink
run: rm -rf Assets/Colyseus/Tests
- name: Gather files
run: |
echo "Assets/Colyseus.meta" > metaList
find Assets/Colyseus/ -name \*.meta >> metaList
- name: Extract Version
id: version
uses: notiz-dev/github-action-json-property@release
with:
path: 'Assets/Colyseus/package.json'
prop_path: 'version'
- run: echo ${{steps.version.outputs.prop}}
- name: Create Directory
run: mkdir Release
- name: Generate Unity Package
id: build-package
uses: pCYSl5EDgo/create-unitypackage@v1.2.3
with:
package-path: 'Colyseus_Plugin.unitypackage'
include-files: metaList
- name: Upload Package
uses: actions/upload-artifact@master
with:
path: ./Colyseus_Plugin.unitypackage
name: Colyseus_Plugin
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: Changelog
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.prop }}
release_name: ${{ steps.version.outputs.prop }}
body: |
${{ steps.Changelog.outputs.changelog }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Colyseus_Plugin.unitypackage
asset_name: Colyseus_Plugin.unitypackage
asset_content_type: application/x-gzip
================================================
FILE: .gitignore
================================================
# Server build files
Server/build
# NuGet Dependencies
/Assets/Colyseus/Runtime/WebSocket
#User Specific
*.userprefs
*.usertasks
.DS_Store
.vs/
.vsconfig
.idea/
#Mono Project Files
*.pidb
*.resources
test-results/
bin
obj
#NuGet packages
Colyseus/packages
!packages/repositories.config
# Node.js
node_modules
npm-debug.log
package-lock.json
# Unity
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*
/Assets/Colyseus/Runtime/Example/
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
!nuget/**/*.csproj
!nuget-monogame/**/*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
# Godot
*.uid
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# Logs
/Logs/
================================================
FILE: Assets/Colyseus/.editorconfig
================================================
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
[*.{js,ts}]
indent_style = space
indent_size = 2
[*.{cs}]
indent_style = tab
indent_size = 4
================================================
FILE: Assets/Colyseus/.gitignore
================================================
#User Specific
*.userprefs
*.usertasks
.DS_Store
.vs/
#Mono Project Files
*.pidb
*.resources
test-results/
bin
obj
#NuGet packages
Colyseus/packages
!packages/repositories.config
# Node.js
node_modules
npm-debug.log
package-lock.json
# Unity
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/Assets/AssetStoreTools*
# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Builds
*.apk
*.unitypackage
# Logs
/Logs/
================================================
FILE: Assets/Colyseus/Documentation~/.gitkeep
================================================
================================================
FILE: Assets/Colyseus/Documentation~/GettingStarted.md
================================================
# Unity SDK
For more information, please visit our [documentation site](https://docs.colyseus.io/)
# Setup
Here we'll be going over the steps to get your Unity client up and running and connected to a Colyseus server.
Topics covered include:
- Running the server locally
- Server settings
- Connecting to a server
- Connecting to a room
- Communicating with a room, and the room's state.
The topics should be enough for you to set up a basic client on your own, however, you are welcome to use and modify the included example code to suit your needs.
## Running the server locally
To run the demonstration server locally, run the following commands in your terminal:
```
cd Server
npm install
npm start
```
The built-in demonstration comes with a single [room handler](https://github.com/colyseus/colyseus-unity3d/blob/master/Server/src/rooms/MyRoom.ts), containing a suggested way of handling entities and players. Feel free to change all of it to fit your needs!
## Creating a Colyseus Settings Object:
- Right-click anywhere in the Project folder, select "Create", select "Colyseus", and click "Generate ColyseusSettings Scriptable Object"
- Fill in the fields as necessary.
- **Server Address**
- The address to your Colyseus server.
- **Server Port**
- The port to your Colyseus server.
- **Use secure protocol**
- Check this if requests and messages to your server should use the "https" and "wss" protocols.
- **Default headers**
- You can add an unlimited number of default headers for non web socket requests to your server.
- The default headers are used by the `ColyseusRequest` class.
- An example header could have a `"Name"` of `"Content-Type"` and a `"Value"` of `"application/json"`
## Colyseus Manager:
- You will need to create your own Manager script that inherits from `ColyseusManager` or use and modify the provided `ExampleManager`.
```csharp
public class ExampleManager : ColyseusManager<ExampleManager>
```
- Make an in-scene manager object to host your custom Manager script.
- Provide your Manager with a reference to your Colyseus Settings object in the scene inspector.
## Client:
- Call the `InitializeClient()` method of your Manager to create a `ColyseusClient` object which is stored in the `client` variable of `ColyseusManager`. This will be used to create/join rooms and form a connection with the server.
```csharp
ExampleManager.Instance.InitializeClient();
```
- If your Manager has additional classes that need reference to your `Client`, you can override `InitializeClient` and make those connections in there.
```csharp
//In ExampleManager.cs
public override void InitializeClient()
{
base.InitializeClient();
//Pass the newly created Client reference to our RoomController
_roomController.SetClient(client);
}
```
- You can get available rooms on the server by calling `GetAvailableRooms` of `ColyseusClient`:
```csharp
return await GetAvailableRooms<ColyseusRoomAvailable>(roomName, headers);
```
## Connecting to a Room:
- There are several ways to create and/or join a room.
- You can create a room by calling the `Create` method of `ColyseusClient` which will automatically create an instance of the room on the server and join it:
```csharp
ExampleRoomState room = await client.Create<ExampleRoomState>(roomName);
```
- You can join a specific room by calling `JoinById`:
```csharp
ExampleRoomState room = await client.JoinById<ExampleRoomState>(roomId);
```
- You can call the `JoinOrCreate` method of `ColyseusClient` which will matchmake into an available room, if able to, or will create a new instance of the room and then join it on the server:
```csharp
ExampleRoomState room = await client.JoinOrCreate<ExampleRoomState>(roomName);
```
## Room Options:
- When creating a new room you have the ability to pass in a dictionary of room options, such as a minimum number of players required to start a game or the name of the custom logic file to run on your server.
- Options are of type `object` and are keyed by the type `string`:
```csharp
Dictionary<string, object> roomOptions = new Dictionary<string, object>
{
["YOUR_ROOM_OPTION_1"] = "option 1",
["YOUR_ROOM_OPTION_2"] = "option 2"
};
ExampleRoomState room = await ExampleManager.Instance.JoinOrCreate<ExampleRoomState>(roomName, roomOptions);
```
## Room Events:
`ColyseusRoom` has various events that you will want to subscribe to:
### OnJoin
- Gets called after the client has successfully connected to the room.
### OnLeave
- Gets called after the client has been disconnected from the room.
- Has a `WebSocketCloseCode` parameter with the reason for the disconnection.
```csharp
room.OnLeave += OnLeaveRoom;
```
### OnStateChange
- Any time the room's state changes, including the initial state, this event will get fired.
```csharp
room.OnStateChange += OnStateChangeHandler;
private static void OnStateChangeHandler(ExampleRoomState state, bool isFirstState)
{
// Do something with the state
}
```
### OnError
- When a room related error occurs on the server it will be reported with this event.
- Has parameters for an error code and an error message.
## Room Messages:
You have the ability to listen for or to send custom messages from/to a room instance on the server.
### OnMessage
- To add a listener you call `OnMessage` passing in the type and the action to be taken when that message is received by the client.
- Messages are useful for events that occur in the room on the server. (Take a look at our [tech demos](https://docs.colyseus.io/demo/shooting-gallery/) for use case examples of using `OnMessage`)
```csharp
room.OnMessage<ExampleNetworkedUser>("onUserJoin", currentNetworkedUser =>
{
_currentNetworkedUser = currentNetworkedUser;
});
```
### Send
- To send a custom message to the room on the server use the `Send` method of `ColyseusRoom`
- Specify the `type` and an optional `message` parameters to send to your room.
```csharp
room.Send("createEntity", new EntityCreationMessage() { creationId = creationId, attributes = attributes });
```
### Room State:
> See how to generate your `RoomState` from [State Handling](https://docs.colyseus.io/state/schema/#client-side-schema-generation)
- Each room holds its own state. The mutations of the state are synchronized automatically to all connected clients.
- In regards to room state synchronization:
- When the user successfully joins the room, they receive the full state from the server.
- At every `patchRate`, binary patches of the state are sent to every client (default is 50ms)
- `onStateChange` is called on the client-side after every patch received from the server.
- Each serialization method has its own particular way to handle incoming state patches.
- `ColyseusRoomState` is the base room state you will want your room state to inherit from.
- Take a look at our tech demos for implementation examples of synchronizable data in a room's state such as networked entities, networked users, or room attributes. ([Shooting Gallery Tech Demo](https://docs.colyseus.io/demo/shooting-gallery/))
```csharp
public class ExampleRoomState : Schema
{
[Type(0, "map", typeof(MapSchema<ExampleNetworkedEntity>))]
public MapSchema<ExampleNetworkedEntity> networkedEntities = new MapSchema<ExampleNetworkedEntity>();
[Type(1, "map", typeof(MapSchema<ExampleNetworkedUser>))]
public MapSchema<ExampleNetworkedUser> networkedUsers = new MapSchema<ExampleNetworkedUser>();
[Type(2, "map", typeof(MapSchema<string>), "string")]
public MapSchema<string> attributes = new MapSchema<string>();
}
```
## Debugging
If you set a breakpoint in your application while the WebSocket connection is open, the connection will be closed automatically after 3 seconds due to inactivity. To prevent the WebSocket connection from dropping, use `pingInterval: 0` in your server code during development:
```typescript
import { Server, RedisPresence } from "colyseus";
const gameServer = new Server({
// ...
pingInterval: 0 // HERE
});
```
Make sure to have a `pingInterval` higher than `0` on production. The default `pingInterval` value is `3000`.
================================================
FILE: Assets/Colyseus/Editor/Colyseus.Editor.asmdef
================================================
{
"name": "Colyseus.Editor",
"rootNamespace": "ColyseusEditor",
"references": [
"ColyseusSDK"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
================================================
FILE: Assets/Colyseus/Editor/Colyseus.Editor.asmdef.meta
================================================
fileFormatVersion: 2
guid: e4cb50f060ca4467c819ea269f994a8b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Editor/README.md
================================================
# Colyseus Room Inspector
Unity Editor tool for inspecting connected Colyseus room states in real-time during Play mode.
## Usage
1. Open **Window > Colyseus > Room Inspector**
2. Enter Play mode and connect to a Colyseus server
3. Active rooms are automatically discovered and displayed
### Toolbar
| Button | Description |
|--------|-------------|
| **Auto Refresh** | Toggle automatic updates (every 0.5s) |
| **Refresh Now** | Manually refresh the display |
| **Copy State JSON** | Copy current state to clipboard |
### Example Output
Given a room with `MapSchema<Player> players` and `float gameTime`:
```
Room: my_room (abc123)
+-- Connection Info
| +-- Room ID: abc123
| +-- Session ID: xyz789
| +-- Connection: Connected
| +-- Source Object: NetworkManager
+-- Room State
+-- State Type: MyRoomState
+-- players (MapSchema) [2 items]
| +-- [player1] (Player)
| | +-- x: 10.5
| | +-- y: 20.3
| | +-- name: "Alice"
| +-- [player2] (Player)
| +-- x: 15.2
| +-- y: 18.7
| +-- name: "Bob"
+-- gameTime: 45.2
```
## Supported Types
- Primitives (int, float, string, bool)
- Nested Schema objects
- `MapSchema<T>` and `ArraySchema<T>` collections
## Limitations
- **Play mode only** -- not available in Edit mode
- **Read-only** -- cannot edit state values
- Collections limited to **100 items** displayed
- Nesting limited to **10 levels** deep
## Troubleshooting
**"No active Colyseus rooms found"** -- Ensure you are in Play mode and have connected to a room. The inspector discovers rooms by scanning MonoBehaviour fields via reflection.
**State shows as "null"** -- The room is connected but hasn't received the initial state yet. Wait a moment or check your server-side room.
**Values not updating** -- Check that Auto Refresh is enabled in the toolbar and that the room is still connected.
================================================
FILE: Assets/Colyseus/Editor/README.md.meta
================================================
fileFormatVersion: 2
guid: 6aa8c0736e5e54df49e298b67fd58dcc
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Editor/RoomInspector.cs
================================================
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Colyseus;
using Colyseus.Schema;
using UnityEditor;
using UnityEngine;
using System.Text;
using GameDevWare.Serialization;
namespace Colyseus.Editor
{
/// <summary>
/// Static initializer to automatically capture message types from rooms
/// </summary>
static class RoomMessageType
{
// Shared storage for message types across all rooms
public static readonly Dictionary<string, Dictionary<string, object>> CapturedMessageTypes = new Dictionary<string, Dictionary<string, object>>();
[UnityEditor.InitializeOnLoadMethod]
private static void Initialize()
{
// Subscribe to play mode state changes to reset tracking
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
}
private static void OnPlayModeStateChanged(PlayModeStateChange state)
{
if (state == PlayModeStateChange.ExitingPlayMode || state == PlayModeStateChange.EnteredEditMode)
{
// Clear captured data when exiting play mode
CapturedMessageTypes.Clear();
}
}
}
/// <summary>
/// Unity Editor window for inspecting connected Colyseus room states in real-time
/// </summary>
public class RoomInspector : EditorWindow
{
private Vector2 _scrollPosition;
private bool _autoRefresh = true;
private double _lastRefreshTime;
private const double RefreshInterval = 0.5; // Refresh every 0.5 seconds
private Dictionary<string, bool> _foldouts = new Dictionary<string, bool>();
private Dictionary<string, Dictionary<string, string>> _messageInputs = new Dictionary<string, Dictionary<string, string>>();
private Dictionary<string, int> _selectedMessageTypeIndex = new Dictionary<string, int>();
private Dictionary<string, string> _lastSelectedMessageType = new Dictionary<string, string>();
private Dictionary<string, string> _rawJsonInputs = new Dictionary<string, string>();
private Dictionary<string, bool> _useRawJson = new Dictionary<string, bool>();
private Dictionary<string, string> _customMessageTypes = new Dictionary<string, string>();
// Splitter state for Room State / Messages sections
private Dictionary<string, float> _roomSplitterPosition = new Dictionary<string, float>();
private Dictionary<string, bool> _isResizingRoomSplitter = new Dictionary<string, bool>();
private const float MinPanelHeight = 150f;
private const float SplitterHeight = 4f;
// Tab selection for rooms
private int _selectedRoomIndex = 0;
[MenuItem("Window/Colyseus/Room Inspector (experimental)")]
public static void ShowWindow()
{
Debug.LogWarning("The Colyseus Room Inspector is experimental. Please report any issues to https://github.com/colyseus/colyseus-unity-sdk/issues");
var window = GetWindow<RoomInspector>("Colyseus Room Inspector");
window.minSize = new Vector2(400, 300);
window.Show();
}
private void OnEnable()
{
EditorApplication.update += OnEditorUpdate;
}
private void OnDisable()
{
EditorApplication.update -= OnEditorUpdate;
}
private void OnEditorUpdate()
{
if (_autoRefresh && EditorApplication.timeSinceStartup - _lastRefreshTime > RefreshInterval)
{
_lastRefreshTime = EditorApplication.timeSinceStartup;
Repaint();
}
}
private void OnGUI()
{
DrawToolbar();
var rooms = FindAllColyseusRooms();
if (rooms.Count == 0)
{
EditorGUILayout.HelpBox(
"No active Colyseus rooms found.\n\n" +
"Make sure:\n" +
"• A scene is running (Play mode)\n" +
"• You have a MonoBehaviour with a Room field\n" +
"• The room is connected to the server",
MessageType.Info
);
return;
}
// Draw room tabs
DrawRoomTabs(rooms);
_scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition);
// Ensure selected index is valid
if (_selectedRoomIndex >= rooms.Count)
{
_selectedRoomIndex = 0;
}
// Draw selected room content
if (rooms.Count > 0 && _selectedRoomIndex >= 0 && _selectedRoomIndex < rooms.Count)
{
DrawRoomContent(rooms[_selectedRoomIndex]);
}
EditorGUILayout.EndScrollView();
}
private void DrawRoomTabs(List<RoomInfo> rooms)
{
EditorGUILayout.BeginHorizontal();
for (int i = 0; i < rooms.Count; i++)
{
var room = rooms[i];
var tabLabel = !string.IsNullOrEmpty(room.Name) ? room.Name : $"Room {i + 1}";
// Add connection status indicator
var statusIcon = room.IsConnected ? "●" : "○";
tabLabel = $"{statusIcon} {tabLabel}";
// Create tab style based on selection
var tabStyle = new GUIStyle(EditorStyles.toolbarButton);
if (i == _selectedRoomIndex)
{
tabStyle.fontStyle = FontStyle.Bold;
tabStyle.normal.textColor = EditorGUIUtility.isProSkin
? new Color(0.4f, 0.8f, 1f)
: new Color(0.1f, 0.4f, 0.8f);
}
if (GUILayout.Toggle(i == _selectedRoomIndex, tabLabel, tabStyle))
{
_selectedRoomIndex = i;
}
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
// Draw separator line below tabs
var rect = EditorGUILayout.GetControlRect(false, 2);
EditorGUI.DrawRect(rect, new Color(0.3f, 0.3f, 0.3f, 0.5f));
EditorGUILayout.Space(5);
}
private void DrawToolbar()
{
EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
_autoRefresh = GUILayout.Toggle(_autoRefresh, "Auto Refresh", EditorStyles.toolbarButton, GUILayout.Width(100));
GUILayout.FlexibleSpace();
if (GUILayout.Button("Refresh Now", EditorStyles.toolbarButton, GUILayout.Width(100)))
{
Repaint();
}
if (GUILayout.Button("Copy State JSON", EditorStyles.toolbarButton, GUILayout.Width(120)))
{
CopyStateToClipboard();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space(5);
}
private void CopyStateToClipboard()
{
try
{
var rooms = FindAllColyseusRooms();
if (rooms.Count == 0)
{
EditorUtility.DisplayDialog("Copy State", "No active rooms found to copy.", "OK");
return;
}
// Ensure selected index is valid
if (_selectedRoomIndex >= rooms.Count)
{
_selectedRoomIndex = 0;
}
var room = rooms[_selectedRoomIndex];
var stateData = new System.Text.StringBuilder();
stateData.AppendLine("=== Colyseus Room State ===");
stateData.AppendLine($"Captured at: {DateTime.Now:yyyy-MM-dd HH:mm:ss}");
stateData.AppendLine();
stateData.AppendLine($"Room: {room.Name} ({room.RoomId})");
stateData.AppendLine($"Session ID: {room.SessionId}");
stateData.AppendLine($"Connected: {room.IsConnected}");
stateData.AppendLine();
if (room.State != null)
{
stateData.AppendLine("State:");
SerializeStateToText(room.State, room.StateType, stateData, 1);
}
else
{
stateData.AppendLine("State: null");
}
EditorGUIUtility.systemCopyBuffer = stateData.ToString();
Debug.Log("Room state copied to clipboard!");
EditorUtility.DisplayDialog("Copy State", "Room state has been copied to clipboard!", "OK");
}
catch (Exception ex)
{
Debug.LogError($"Failed to copy state: {ex.Message}");
EditorUtility.DisplayDialog("Copy State", $"Failed to copy state:\n{ex.Message}", "OK");
}
}
private void SerializeStateToText(object obj, System.Type type, System.Text.StringBuilder sb, int indent)
{
if (obj == null || indent > 10)
{
return;
}
var indentStr = new string(' ', indent * 2);
var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance)
.Where(f => f.GetCustomAttribute<Colyseus.Schema.Type>() != null)
.OrderBy(f => f.GetCustomAttribute<Colyseus.Schema.Type>().Index)
.ToList();
foreach (var field in fields)
{
var fieldValue = field.GetValue(obj);
var fieldType = field.FieldType;
if (IsPrimitiveOrString(fieldType))
{
sb.AppendLine($"{indentStr}{field.Name}: {fieldValue ?? "null"}");
}
else if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(MapSchema<>))
{
var itemsProperty = fieldType.GetField("items");
var itemsValue = itemsProperty?.GetValue(fieldValue);
var enumerable = itemsValue as IDictionary;
var count = enumerable?.Count ?? 0;
sb.AppendLine($"{indentStr}{field.Name} (MapSchema): {count} items");
if (enumerable != null && count > 0)
{
foreach (DictionaryEntry kvp in enumerable)
{
var key = kvp.Key?.ToString() ?? "null";
sb.AppendLine($"{indentStr} [{key}]:");
if (kvp.Value != null && typeof(Schema.Schema).IsAssignableFrom(kvp.Value.GetType()))
{
SerializeStateToText(kvp.Value, kvp.Value.GetType(), sb, indent + 2);
}
else
{
sb.AppendLine($"{indentStr} {kvp.Value}");
}
}
}
}
else if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(ArraySchema<>))
{
var enumerable = fieldValue as IEnumerable;
var countProp = fieldType.GetProperty("Count");
var count = countProp?.GetValue(fieldValue) as int? ?? 0;
sb.AppendLine($"{indentStr}{field.Name} (ArraySchema): {count} items");
if (enumerable != null && count > 0)
{
var index = 0;
foreach (var item in enumerable)
{
sb.AppendLine($"{indentStr} [{index}]:");
if (item != null && typeof(Schema.Schema).IsAssignableFrom(item.GetType()))
{
SerializeStateToText(item, item.GetType(), sb, indent + 2);
}
else
{
sb.AppendLine($"{indentStr} {item}");
}
index++;
}
}
}
else if (typeof(Schema.Schema).IsAssignableFrom(fieldType))
{
sb.AppendLine($"{indentStr}{field.Name} ({fieldType.Name}):");
if (fieldValue != null)
{
SerializeStateToText(fieldValue, fieldType, sb, indent + 1);
}
else
{
sb.AppendLine($"{indentStr} null");
}
}
}
}
private void DrawRoomContent(RoomInfo roomInfo)
{
// Room Information Section
DrawSection("Connection Info", () =>
{
DrawReadOnlyField("Room ID", roomInfo.RoomId ?? "N/A");
DrawReadOnlyField("Session ID", roomInfo.SessionId ?? "N/A");
DrawReadOnlyField("Status", roomInfo.IsConnected ? "Connected" : "Disconnected");
DrawReadOnlyObjectField("Source Object", roomInfo.SourceObject, typeof(MonoBehaviour));
EditorGUILayout.Space(5);
// Leave/Drop buttons
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginDisabledGroup(!roomInfo.IsConnected);
if (GUILayout.Button("Leave", GUILayout.Height(24)))
{
LeaveRoom(roomInfo, consented: true);
}
if (GUILayout.Button("Drop", GUILayout.Height(24)))
{
DropRoom(roomInfo);
}
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndHorizontal();
});
EditorGUILayout.Space(5);
// Draw horizontal split panel for State and Messages
DrawStateAndMessagesSplitPanel(roomInfo);
}
private void DrawSection(string title, Action content)
{
var foldoutKey = $"section_{title}_{EditorGUI.indentLevel}";
if (!_foldouts.ContainsKey(foldoutKey))
{
_foldouts[foldoutKey] = true;
}
_foldouts[foldoutKey] = EditorGUILayout.Foldout(_foldouts[foldoutKey], title, true, EditorStyles.foldoutHeader);
if (_foldouts[foldoutKey])
{
EditorGUI.indentLevel++;
content?.Invoke();
EditorGUI.indentLevel--;
}
}
private void DrawSchemaObject(object obj, System.Type type, string path, int depth = 0)
{
if (obj == null || depth > 10) // Prevent infinite recursion
{
EditorGUILayout.LabelField("null", EditorStyles.miniLabel);
return;
}
var fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance)
.Where(f => f.GetCustomAttribute<Colyseus.Schema.Type>() != null)
.OrderBy(f => f.GetCustomAttribute<Colyseus.Schema.Type>().Index)
.ToList();
foreach (var field in fields)
{
var fieldValue = field.GetValue(obj);
var fieldType = field.FieldType;
var fieldPath = $"{path}.{field.Name}";
// Handle different field types
if (IsPrimitiveOrString(fieldType))
{
DrawReadOnlyField(field.Name, fieldValue?.ToString() ?? "null");
}
else if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(MapSchema<>))
{
DrawMapSchema(field.Name, fieldValue, fieldPath, depth);
}
else if (fieldType.IsGenericType && fieldType.GetGenericTypeDefinition() == typeof(ArraySchema<>))
{
DrawArraySchema(field.Name, fieldValue, fieldPath, depth);
}
else if (typeof(Schema.Schema).IsAssignableFrom(fieldType))
{
DrawNestedSchema(field.Name, fieldValue, fieldType, fieldPath, depth);
}
else
{
DrawReadOnlyField(field.Name, $"<{fieldType.Name}>");
}
}
}
private void DrawMapSchema(string fieldName, object mapObj, string path, int depth)
{
var foldoutKey = $"map_{path}";
if (!_foldouts.ContainsKey(foldoutKey))
{
_foldouts[foldoutKey] = true; // Expand by default
}
if (mapObj == null)
{
DrawReadOnlyField(fieldName, "null (MapSchema)");
return;
}
var mapType = mapObj.GetType();
var countProp = mapType.GetProperty("Count");
var count = countProp?.GetValue(mapObj) as int? ?? 0;
_foldouts[foldoutKey] = EditorGUILayout.Foldout(
_foldouts[foldoutKey],
$"{fieldName} (MapSchema) [{count} items]",
true
);
if (_foldouts[foldoutKey])
{
EditorGUI.indentLevel++;
if (count == 0)
{
EditorGUILayout.LabelField("(empty)", EditorStyles.miniLabel);
}
else
{
// Access the items property of MapSchema
var itemsProperty = mapType.GetField("items");
var itemsValue = itemsProperty?.GetValue(mapObj);
var enumerable = itemsValue as IDictionary;
if (enumerable != null)
{
var index = 0;
foreach (DictionaryEntry kvp in enumerable)
{
var key = kvp.Key?.ToString() ?? "null";
var value = kvp.Value;
var itemPath = $"{path}[{key}]";
if (value != null && typeof(Schema.Schema).IsAssignableFrom(value.GetType()))
{
DrawNestedSchema($"[{key}]", value, value.GetType(), itemPath, depth + 1);
}
else
{
DrawReadOnlyField($"[{key}]", value?.ToString() ?? "null");
}
index++;
if (index > 100) // Limit display to prevent performance issues
{
EditorGUILayout.LabelField($"... and {count - 100} more items", EditorStyles.miniLabel);
break;
}
}
}
else
{
EditorGUILayout.LabelField($"Error: Could not access MapSchema items", EditorStyles.miniLabel);
}
}
EditorGUI.indentLevel--;
}
}
private void DrawArraySchema(string fieldName, object arrayObj, string path, int depth)
{
var foldoutKey = $"array_{path}";
if (!_foldouts.ContainsKey(foldoutKey))
{
_foldouts[foldoutKey] = true; // Expand by default
}
if (arrayObj == null)
{
DrawReadOnlyField(fieldName, "null (ArraySchema)");
return;
}
var arrayType = arrayObj.GetType();
var countProp = arrayType.GetProperty("Count");
var count = countProp?.GetValue(arrayObj) as int? ?? 0;
_foldouts[foldoutKey] = EditorGUILayout.Foldout(
_foldouts[foldoutKey],
$"{fieldName} (ArraySchema) [{count} items]",
true
);
if (_foldouts[foldoutKey])
{
EditorGUI.indentLevel++;
if (count == 0)
{
EditorGUILayout.LabelField("(empty)", EditorStyles.miniLabel);
}
else
{
// Access the items field of ArraySchema (which is a List<T>)
var itemsField = arrayType.GetField("items");
var itemsValue = itemsField?.GetValue(arrayObj);
var enumerable = itemsValue as IList;
if (enumerable != null)
{
var index = 0;
foreach (var item in enumerable)
{
var itemPath = $"{path}[{index}]";
if (item != null && typeof(Schema.Schema).IsAssignableFrom(item.GetType()))
{
DrawNestedSchema($"[{index}]", item, item.GetType(), itemPath, depth + 1);
}
else
{
DrawReadOnlyField($"[{index}]", item?.ToString() ?? "null");
}
index++;
if (index > 100) // Limit display to prevent performance issues
{
EditorGUILayout.LabelField($"... and {count - 100} more items", EditorStyles.miniLabel);
break;
}
}
}
else
{
EditorGUILayout.LabelField($"Error: Could not access ArraySchema items", EditorStyles.miniLabel);
}
}
EditorGUI.indentLevel--;
}
}
private void DrawNestedSchema(string fieldName, object schemaObj, System.Type schemaType, string path, int depth)
{
var foldoutKey = $"schema_{path}";
if (!_foldouts.ContainsKey(foldoutKey))
{
_foldouts[foldoutKey] = false; // Collapsed by default for nested schemas
}
if (schemaObj == null)
{
DrawReadOnlyField(fieldName, $"null ({schemaType.Name})");
return;
}
_foldouts[foldoutKey] = EditorGUILayout.Foldout(
_foldouts[foldoutKey],
$"{fieldName} ({schemaType.Name})",
true
);
if (_foldouts[foldoutKey])
{
EditorGUI.indentLevel++;
DrawSchemaObject(schemaObj, schemaType, path, depth + 1);
EditorGUI.indentLevel--;
}
}
private void DrawReadOnlyField(string label, string value)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, GUILayout.Width(EditorGUIUtility.labelWidth - 20));
EditorGUILayout.SelectableLabel(value, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight));
EditorGUILayout.EndHorizontal();
}
private void DrawReadOnlyObjectField(string label, UnityEngine.Object obj, System.Type type)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, GUILayout.Width(EditorGUIUtility.labelWidth - 20));
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.ObjectField(obj, type, true);
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndHorizontal();
}
private bool IsPrimitiveOrString(System.Type type)
{
return type.IsPrimitive || type == typeof(string) || type == typeof(decimal) ||
type.IsEnum || type == typeof(DateTime);
}
private List<RoomInfo> FindAllColyseusRooms()
{
var roomInfos = new List<RoomInfo>();
var processedRooms = new HashSet<object>(); // Avoid duplicates
if (!Application.isPlaying)
{
return roomInfos;
}
// Find all MonoBehaviours in the scene
var allMonoBehaviours = FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None);
foreach (var behaviour in allMonoBehaviours)
{
if (behaviour == null) continue;
var behaviourType = behaviour.GetType();
// Check instance fields
var instanceFields = behaviourType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
foreach (var field in instanceFields)
{
if (IsColyseusRoomType(field.FieldType))
{
var roomObj = field.GetValue(behaviour);
if (roomObj != null && !processedRooms.Contains(roomObj))
{
processedRooms.Add(roomObj);
var roomInfo = ExtractRoomInfo(roomObj, field.FieldType, behaviour);
if (roomInfo != null)
{
roomInfos.Add(roomInfo);
}
}
}
}
// Check static fields
var staticFields = behaviourType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
foreach (var field in staticFields)
{
if (IsColyseusRoomType(field.FieldType))
{
var roomObj = field.GetValue(null); // null for static fields
if (roomObj != null && !processedRooms.Contains(roomObj))
{
processedRooms.Add(roomObj);
var roomInfo = ExtractRoomInfo(roomObj, field.FieldType, behaviour);
if (roomInfo != null)
{
roomInfos.Add(roomInfo);
}
}
}
}
}
return roomInfos;
}
private bool IsColyseusRoomType(System.Type type)
{
if (type == null) return false;
// Check if it's a generic Room<T>
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Room<>))
{
return true;
}
// Check if it implements IRoom
return typeof(IRoom).IsAssignableFrom(type);
}
private RoomInfo ExtractRoomInfo(object room, System.Type roomType, MonoBehaviour source)
{
try
{
var roomInfo = new RoomInfo
{
SourceObject = source,
RoomType = roomType,
RoomInstance = room
};
// Get RoomId (field)
var roomIdField = roomType.GetField("RoomId");
roomInfo.RoomId = roomIdField?.GetValue(room) as string;
// Get SessionId (field)
var sessionIdField = roomType.GetField("SessionId");
roomInfo.SessionId = sessionIdField?.GetValue(room) as string;
// Get Name (field)
var nameField = roomType.GetField("Name");
roomInfo.Name = nameField?.GetValue(room) as string;
// Get Connection status (field)
var connectionField = roomType.GetField("Connection");
var connection = connectionField?.GetValue(room);
if (connection != null)
{
var isOpenProp = connection.GetType().GetField("IsOpen");
roomInfo.IsConnected = (isOpenProp?.GetValue(connection) as bool?) ?? false;
}
// Get State (property)
var stateProp = roomType.GetProperty("State");
roomInfo.State = stateProp?.GetValue(room);
if (roomInfo.State != null)
{
roomInfo.StateType = roomInfo.State.GetType();
}
// Note: Room message type capture is now handled automatically
// via compile-time checks in Room.OnMessage()
return roomInfo;
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to extract room info: {ex.Message}");
return null;
}
}
private void DrawStateAndMessagesSplitPanel(RoomInfo roomInfo)
{
var roomId = roomInfo.RoomId;
var splitterKey = $"room_splitter_{roomId}";
// Initialize splitter position for this room
if (!_roomSplitterPosition.ContainsKey(splitterKey))
{
_roomSplitterPosition[splitterKey] = 300f; // Default top panel height
}
if (!_isResizingRoomSplitter.ContainsKey(splitterKey))
{
_isResizingRoomSplitter[splitterKey] = false;
}
// Calculate available height (estimate remaining scroll view height)
var availableHeight = 600f; // Default available height
var topPanelHeight = Mathf.Clamp(_roomSplitterPosition[splitterKey], MinPanelHeight, availableHeight - MinPanelHeight - SplitterHeight);
var bottomPanelHeight = availableHeight - topPanelHeight - SplitterHeight;
// Top Panel - Room State
EditorGUILayout.BeginVertical(GUILayout.Height(topPanelHeight));
DrawStateSection(roomInfo);
EditorGUILayout.EndVertical();
// Horizontal Splitter
DrawHorizontalSplitter(splitterKey, availableHeight);
// Bottom Panel - Messages
EditorGUILayout.BeginVertical(GUILayout.Height(bottomPanelHeight));
DrawMessagesSection(roomInfo);
EditorGUILayout.EndVertical();
}
private void DrawHorizontalSplitter(string splitterKey, float availableHeight)
{
var splitterRect = EditorGUILayout.GetControlRect(GUILayout.Height(SplitterHeight), GUILayout.ExpandWidth(true));
EditorGUI.DrawRect(splitterRect, new Color(0.3f, 0.3f, 0.3f, 0.5f));
EditorGUIUtility.AddCursorRect(splitterRect, MouseCursor.ResizeVertical);
var e = Event.current;
if (e.type == EventType.MouseDown && splitterRect.Contains(e.mousePosition))
{
_isResizingRoomSplitter[splitterKey] = true;
e.Use();
}
if (_isResizingRoomSplitter[splitterKey])
{
if (e.type == EventType.MouseDrag)
{
_roomSplitterPosition[splitterKey] += e.delta.y;
_roomSplitterPosition[splitterKey] = Mathf.Clamp(
_roomSplitterPosition[splitterKey],
MinPanelHeight,
availableHeight - MinPanelHeight - SplitterHeight
);
Repaint();
e.Use();
}
if (e.type == EventType.MouseUp)
{
_isResizingRoomSplitter[splitterKey] = false;
e.Use();
}
}
}
private void DrawStateSection(RoomInfo roomInfo)
{
var stateScrollKey = $"state_scroll_{roomInfo.RoomId}";
if (!_foldouts.ContainsKey(stateScrollKey))
{
_foldouts[stateScrollKey] = true;
}
DrawSection("Room State", () =>
{
if (roomInfo.State != null)
{
DrawReadOnlyField("State Type", roomInfo.StateType?.Name ?? "Unknown");
EditorGUILayout.Space(3);
DrawSchemaObject(roomInfo.State, roomInfo.StateType, "state");
}
else
{
EditorGUILayout.HelpBox("State is null or not yet initialized", MessageType.Warning);
}
});
}
private void DrawMessagesSection(RoomInfo roomInfo)
{
var roomId = roomInfo.RoomId;
if (string.IsNullOrEmpty(roomId))
{
return;
}
DrawSection("Messages", () =>
{
// Access message types from static capture
if (!RoomMessageType.CapturedMessageTypes.ContainsKey(roomId) ||
RoomMessageType.CapturedMessageTypes[roomId] == null ||
RoomMessageType.CapturedMessageTypes[roomId].Count == 0)
{
EditorGUILayout.HelpBox(
"No message types available.\n\n" +
"Waiting for '__playground_message_types' message from server.",
MessageType.Info
);
return;
}
if (!_messageInputs.ContainsKey(roomId))
{
_messageInputs[roomId] = new Dictionary<string, string>();
}
if (!_selectedMessageTypeIndex.ContainsKey(roomId))
{
_selectedMessageTypeIndex[roomId] = 0;
}
var messageTypes = RoomMessageType.CapturedMessageTypes[roomId];
var messageInputs = _messageInputs[roomId];
// Create array of message type names for popup
var messageTypeList = messageTypes.Keys.ToList();
messageTypeList.Add("* (Custom)");
var messageTypeNames = messageTypeList.ToArray();
if (messageTypeNames.Length == 0)
{
EditorGUILayout.HelpBox("No message types available. Enable playground in the server to see message types here.", MessageType.Info);
return;
}
// Ensure index is valid
if (_selectedMessageTypeIndex[roomId] >= messageTypeNames.Length)
{
_selectedMessageTypeIndex[roomId] = 0;
}
// Draw message interface
DrawMessageInterface(roomInfo, messageTypeNames, messageTypes, messageInputs);
});
}
private void DrawMessageInterface(RoomInfo roomInfo, string[] messageTypeNames, Dictionary<string, object> messageTypes, Dictionary<string, string> messageInputs)
{
var roomId = roomInfo.RoomId;
// Message type selector
EditorGUILayout.LabelField("Message Type:", EditorStyles.boldLabel);
var previousIndex = _selectedMessageTypeIndex[roomId];
_selectedMessageTypeIndex[roomId] = EditorGUILayout.Popup(
_selectedMessageTypeIndex[roomId],
messageTypeNames,
GUILayout.Height(20)
);
var selectedMessageName = messageTypeNames[_selectedMessageTypeIndex[roomId]];
var isCustomMessage = selectedMessageName == "* (Custom)";
// Handle custom message type
if (isCustomMessage)
{
var customKey = $"{roomId}_custom";
if (!_customMessageTypes.ContainsKey(customKey))
{
_customMessageTypes[customKey] = "";
}
EditorGUILayout.Space(4);
EditorGUILayout.LabelField("Custom Message Type:", EditorStyles.boldLabel);
_customMessageTypes[customKey] = EditorGUILayout.TextField(_customMessageTypes[customKey], GUILayout.Height(20));
selectedMessageName = _customMessageTypes[customKey];
}
IDictionary messageSchema = !isCustomMessage && messageTypes.ContainsKey(selectedMessageName)
? messageTypes[selectedMessageName] as IDictionary
: null;
EditorGUILayout.Space(4);
// Initialize raw JSON toggle state
var rawJsonKey = $"{roomId}_{selectedMessageName}";
if (!_useRawJson.ContainsKey(rawJsonKey))
{
_useRawJson[rawJsonKey] = false;
}
// Initialize raw JSON input
if (!_rawJsonInputs.ContainsKey(rawJsonKey))
{
_rawJsonInputs[rawJsonKey] = messageSchema != null ? GenerateDefaultJSON(messageSchema) : "{}";
}
// Check if message type changed - update raw JSON when switching message types
var currentMessageKey = isCustomMessage ? "* (Custom)" : selectedMessageName;
if (!_lastSelectedMessageType.ContainsKey(roomId) ||
_lastSelectedMessageType[roomId] != currentMessageKey)
{
_lastSelectedMessageType[roomId] = currentMessageKey;
_rawJsonInputs[rawJsonKey] = messageSchema != null ? GenerateDefaultJSON(messageSchema) : "{}";
// Clear all field inputs for this message type
if (!isCustomMessage)
{
var keysToRemove = messageInputs.Keys.Where(k => k.StartsWith($"{roomId}_{selectedMessageName}_field_")).ToList();
foreach (var key in keysToRemove)
{
messageInputs.Remove(key);
}
}
}
// Toggle between form fields and raw JSON
var previousUseRawJson = _useRawJson[rawJsonKey];
// Only show toggle if schema is available
if (messageSchema != null)
{
_useRawJson[rawJsonKey] = EditorGUILayout.Toggle("Use Raw JSON", _useRawJson[rawJsonKey]);
EditorGUILayout.Space(4);
}
// When switching to raw JSON mode, populate from field values
if (_useRawJson[rawJsonKey] && !previousUseRawJson && messageSchema != null)
{
_rawJsonInputs[rawJsonKey] = GenerateJSONFromFields(roomId, selectedMessageName, messageSchema, messageInputs);
}
// If raw JSON mode is enabled or schema is invalid, show JSON text area
if (_useRawJson[rawJsonKey] || messageSchema == null)
{
EditorGUILayout.Space(4);
EditorGUILayout.LabelField("JSON Payload:", EditorStyles.boldLabel);
// Multi-line text area for JSON input
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
var textAreaStyle = new GUIStyle(EditorStyles.textArea);
textAreaStyle.wordWrap = true;
textAreaStyle.stretchHeight = true;
_rawJsonInputs[rawJsonKey] = EditorGUILayout.TextArea(
_rawJsonInputs[rawJsonKey],
textAreaStyle,
GUILayout.MinHeight(40),
GUILayout.MaxHeight(80)
);
EditorGUILayout.EndVertical();
}
else
{
// Get required fields
List<object> requiredFields = null;
if (messageSchema.Contains("required"))
{
requiredFields = messageSchema["required"] as List<object>;
}
// Draw individual field inputs
if (messageSchema.Contains("properties"))
{
var properties = messageSchema["properties"] as IDictionary;
if (properties != null && properties.Count > 0)
{
EditorGUILayout.LabelField("Payload:", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
foreach (DictionaryEntry prop in properties)
{
var propName = prop.Key as string;
var propSchema = prop.Value as IDictionary;
if (propSchema != null && propSchema.Contains("type"))
{
var isRequired = requiredFields != null && requiredFields.Any(r => r.ToString() == propName);
DrawMessageField(roomId, selectedMessageName, propName, propSchema, isRequired, messageInputs);
}
}
EditorGUI.indentLevel--;
}
}
else
{
EditorGUILayout.HelpBox("No fields defined for this message type.", MessageType.Info);
}
}
EditorGUILayout.Space(8);
// Send button
var canSend = !isCustomMessage || !string.IsNullOrWhiteSpace(selectedMessageName);
var buttonLabel = isCustomMessage && string.IsNullOrWhiteSpace(selectedMessageName)
? "Send (enter message type above)"
: $"Send '{selectedMessageName}'";
EditorGUI.BeginDisabledGroup(!canSend);
if (GUILayout.Button(buttonLabel, GUILayout.Height(30)))
{
// Use raw JSON when explicitly enabled OR when messageSchema is null
if (_useRawJson[rawJsonKey] || messageSchema == null)
{
SendMessageFromRawJson(roomInfo, selectedMessageName, _rawJsonInputs[rawJsonKey]);
}
else
{
SendMessageFromFields(roomInfo, selectedMessageName, messageSchema, messageInputs);
}
}
EditorGUI.EndDisabledGroup();
}
private void DrawMessageField(string roomId, string messageName, string fieldName, IDictionary fieldSchema, bool isRequired, Dictionary<string, string> messageInputs)
{
var fieldKey = $"{roomId}_{messageName}_field_{fieldName}";
var fieldType = fieldSchema["type"] as string;
// Initialize with default value if not exists
if (!messageInputs.ContainsKey(fieldKey))
{
messageInputs[fieldKey] = GetDefaultValueForType(fieldSchema);
}
// Create label with asterisk for required fields
var label = isRequired ? $"{fieldName} *" : fieldName;
// Add description as tooltip if available
GUIContent labelContent;
if (fieldSchema.Contains("description"))
{
var description = fieldSchema["description"].ToString();
labelContent = new GUIContent(label, description);
}
else
{
labelContent = new GUIContent(label);
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(labelContent, GUILayout.Width(EditorGUIUtility.labelWidth - 20));
// Draw appropriate input control based on field type
switch (fieldType)
{
case "boolean":
var boolValue = messageInputs[fieldKey] == "true";
boolValue = EditorGUILayout.Toggle(boolValue);
messageInputs[fieldKey] = boolValue.ToString().ToLower();
break;
case "integer":
if (int.TryParse(messageInputs[fieldKey], out int intValue))
{
intValue = EditorGUILayout.IntField(intValue);
messageInputs[fieldKey] = intValue.ToString();
}
else
{
messageInputs[fieldKey] = EditorGUILayout.TextField(messageInputs[fieldKey]);
}
break;
case "number":
if (float.TryParse(messageInputs[fieldKey], out float floatValue))
{
floatValue = EditorGUILayout.FloatField(floatValue);
messageInputs[fieldKey] = floatValue.ToString();
}
else
{
messageInputs[fieldKey] = EditorGUILayout.TextField(messageInputs[fieldKey]);
}
break;
case "string":
// Remove quotes if present for display
var stringValue = messageInputs[fieldKey];
if (stringValue.StartsWith("\"") && stringValue.EndsWith("\""))
{
stringValue = stringValue.Substring(1, stringValue.Length - 2);
}
stringValue = EditorGUILayout.TextField(stringValue);
messageInputs[fieldKey] = stringValue;
break;
case "array":
case "object":
// For complex types, use a text field with JSON
EditorGUILayout.LabelField($"({fieldType})", GUILayout.Width(60));
messageInputs[fieldKey] = EditorGUILayout.TextField(messageInputs[fieldKey]);
break;
default:
messageInputs[fieldKey] = EditorGUILayout.TextField(messageInputs[fieldKey]);
break;
}
EditorGUILayout.EndHorizontal();
}
private void SendMessageFromFields(RoomInfo roomInfo, string messageName, IDictionary messageSchema, Dictionary<string, string> messageInputs)
{
try
{
var roomId = roomInfo.RoomId;
var messageData = new Dictionary<string, object>();
// Build message object from field values
if (messageSchema.Contains("properties"))
{
var properties = messageSchema["properties"] as IDictionary;
if (properties != null)
{
foreach (DictionaryEntry prop in properties)
{
var propName = prop.Key as string;
var propSchema = prop.Value as IDictionary;
if (propSchema == null || !propSchema.Contains("type")) continue;
var fieldKey = $"{roomId}_{messageName}_field_{propName}";
if (!messageInputs.ContainsKey(fieldKey)) continue;
var fieldValue = messageInputs[fieldKey];
var fieldType = propSchema["type"] as string;
// Convert field value to appropriate type
object typedValue = ConvertFieldValue(fieldValue, fieldType);
messageData[propName] = typedValue;
}
}
}
// Get the Send method from the room
var sendMethod = roomInfo.RoomType.GetMethod("Send", new[] { typeof(string), typeof(object) });
if (sendMethod == null)
{
EditorUtility.DisplayDialog("Error", "Failed to find Send method on room.", "OK");
return;
}
// Invoke Send method
var task = sendMethod.Invoke(roomInfo.RoomInstance, new object[] { messageName, messageData }) as System.Threading.Tasks.Task;
if (task != null)
{
// Note: We can't await in a non-async void method, but the task will execute
Debug.Log($"Message '{messageName}' sent");
}
}
catch (Exception ex)
{
Debug.LogError($"Failed to send message '{messageName}': {ex.Message}\n{ex.StackTrace}");
EditorUtility.DisplayDialog("Error", $"Failed to send message:\n{ex.Message}", "OK");
}
}
private void LeaveRoom(RoomInfo roomInfo, bool consented)
{
try
{
// Get the Leave method from the room (with bool parameter)
var leaveMethod = roomInfo.RoomType.GetMethod("Leave", new[] { typeof(bool) });
if (leaveMethod == null)
{
EditorUtility.DisplayDialog("Error", "Failed to find Leave method on room.", "OK");
return;
}
// Invoke Leave method
var task = leaveMethod.Invoke(roomInfo.RoomInstance, new object[] { consented }) as System.Threading.Tasks.Task;
if (task != null)
{
Debug.Log($"Room '{roomInfo.Name}' - Leave requested");
}
}
catch (Exception ex)
{
Debug.LogError($"Failed to leave room: {ex.Message}\n{ex.StackTrace}");
EditorUtility.DisplayDialog("Error", $"Failed to leave room:\n{ex.Message}", "OK");
}
}
private void DropRoom(RoomInfo roomInfo)
{
try
{
// Get the Connection field from the room
var connectionField = roomInfo.RoomType.GetField("Connection");
if (connectionField == null)
{
EditorUtility.DisplayDialog("Error", "Failed to find Connection field on room.", "OK");
return;
}
var connection = connectionField.GetValue(roomInfo.RoomInstance);
if (connection == null)
{
EditorUtility.DisplayDialog("Error", "Connection is null.", "OK");
return;
}
// Get the Drop method from the connection
var dropMethod = connection.GetType().GetMethod("Drop");
if (dropMethod == null)
{
EditorUtility.DisplayDialog("Error", "Failed to find Drop method on connection.", "OK");
return;
}
// Invoke Drop method
dropMethod.Invoke(connection, null);
Debug.Log($"Room '{roomInfo.Name}' - Connection dropped");
}
catch (Exception ex)
{
Debug.LogError($"Failed to drop room connection: {ex.Message}\n{ex.StackTrace}");
EditorUtility.DisplayDialog("Error", $"Failed to drop connection:\n{ex.Message}", "OK");
}
}
private void SendMessageFromRawJson(RoomInfo roomInfo, string messageName, string jsonData)
{
try
{
// Parse JSON to object
object messageData;
try
{
messageData = Json.Deserialize(typeof(Dictionary<string, object>), jsonData);
}
catch (Exception jsonEx)
{
EditorUtility.DisplayDialog("JSON Parse Error", $"Failed to parse JSON:\n{jsonEx.Message}", "OK");
Debug.LogError($"JSON parse error: {jsonEx.Message}\n{jsonData}");
return;
}
// Get the Send method from the room
var sendMethod = roomInfo.RoomType.GetMethod("Send", new[] { typeof(string), typeof(object) });
if (sendMethod == null)
{
EditorUtility.DisplayDialog("Error", "Failed to find Send method on room.", "OK");
return;
}
// Invoke Send method
var task = sendMethod.Invoke(roomInfo.RoomInstance, new object[] { messageName, messageData }) as System.Threading.Tasks.Task;
if (task != null)
{
Debug.Log($"Message '{messageName}' sent with raw JSON");
}
}
catch (Exception ex)
{
Debug.LogError($"Failed to send message '{messageName}': {ex.Message}\n{ex.StackTrace}");
EditorUtility.DisplayDialog("Error", $"Failed to send message:\n{ex.Message}", "OK");
}
}
private object ConvertFieldValue(string fieldValue, string fieldType)
{
switch (fieldType)
{
case "boolean":
return fieldValue == "true";
case "integer":
if (int.TryParse(fieldValue, out int intValue))
return intValue;
return 0;
case "number":
if (double.TryParse(fieldValue, out double doubleValue))
return doubleValue;
return 0.0;
case "string":
return fieldValue;
case "array":
try
{
return Json.Deserialize(typeof(List<object>), fieldValue);
}
catch
{
return new List<object>();
}
case "object":
try
{
return Json.Deserialize(typeof(Dictionary<string, object>), fieldValue);
}
catch
{
return new Dictionary<string, object>();
}
default:
return fieldValue;
}
}
private string GenerateDefaultJSON(IDictionary schema)
{
try
{
if (!schema.Contains("properties"))
{
return "{}";
}
var properties = schema["properties"] as IDictionary;
if (properties == null || properties.Count == 0)
{
return "{}";
}
var sb = new StringBuilder();
sb.AppendLine("{");
var propCount = 0;
foreach (DictionaryEntry prop in properties)
{
var propName = prop.Key as string;
var propSchema = prop.Value as IDictionary;
if (propSchema == null) continue;
sb.Append($" \"{propName}\": ");
var defaultValue = GetDefaultValueForType(propSchema);
sb.Append(defaultValue);
propCount++;
if (propCount < properties.Count)
{
sb.AppendLine(",");
}
else
{
sb.AppendLine();
}
}
sb.Append("}");
return sb.ToString();
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to generate default JSON: {ex.Message}");
return "{}";
}
}
private string GetDefaultValueForType(IDictionary propSchema)
{
if (!propSchema.Contains("type"))
{
return "null";
}
var type = propSchema["type"] as string;
switch (type)
{
case "string":
return "\"\"";
case "number":
case "integer":
return "0";
case "boolean":
return "false";
case "array":
return "[]";
case "object":
return "{}";
default:
return "null";
}
}
private string GenerateJSONFromFields(string roomId, string messageName, IDictionary messageSchema, Dictionary<string, string> messageInputs)
{
try
{
if (!messageSchema.Contains("properties"))
{
return "{}";
}
var properties = messageSchema["properties"] as IDictionary;
if (properties == null || properties.Count == 0)
{
return "{}";
}
var sb = new StringBuilder();
sb.AppendLine("{");
var propCount = 0;
var totalProps = properties.Count;
foreach (DictionaryEntry prop in properties)
{
var propName = prop.Key as string;
var propSchema = prop.Value as IDictionary;
if (propSchema == null || !propSchema.Contains("type")) continue;
var fieldKey = $"{roomId}_{messageName}_field_{propName}";
var fieldType = propSchema["type"] as string;
sb.Append($" \"{propName}\": ");
// Get value from field input or use default
string jsonValue;
if (messageInputs.ContainsKey(fieldKey))
{
var fieldValue = messageInputs[fieldKey];
jsonValue = ConvertFieldValueToJSON(fieldValue, fieldType);
}
else
{
jsonValue = GetDefaultValueForType(propSchema);
}
sb.Append(jsonValue);
propCount++;
if (propCount < totalProps)
{
sb.AppendLine(",");
}
else
{
sb.AppendLine();
}
}
sb.Append("}");
return sb.ToString();
}
catch (Exception ex)
{
Debug.LogWarning($"Failed to generate JSON from fields: {ex.Message}");
return GenerateDefaultJSON(messageSchema);
}
}
private string ConvertFieldValueToJSON(string fieldValue, string fieldType)
{
switch (fieldType)
{
case "boolean":
return fieldValue == "true" ? "true" : "false";
case "integer":
if (int.TryParse(fieldValue, out int intValue))
return intValue.ToString();
return "0";
case "number":
if (double.TryParse(fieldValue, out double doubleValue))
return doubleValue.ToString();
return "0";
case "string":
// Escape quotes and wrap in quotes
var escaped = fieldValue.Replace("\\", "\\\\").Replace("\"", "\\\"");
return $"\"{ escaped}\"";
case "array":
case "object":
// Try to parse as JSON, otherwise treat as string
try
{
var parsed = Json.Deserialize(typeof(object), fieldValue);
return fieldValue; // If it parses, use as-is
}
catch
{
return fieldValue.StartsWith("[") || fieldValue.StartsWith("{") ? fieldValue : "{}";
}
default:
return $"\"{fieldValue}\"";
}
}
private async void SendMessage(RoomInfo roomInfo, string messageName, string jsonData)
{
try
{
// Parse JSON to object
var messageData = ParseJSON(jsonData);
// Get the Send method from the room
var sendMethod = roomInfo.RoomType.GetMethod("Send", new[] { typeof(string), typeof(object) });
if (sendMethod == null)
{
EditorUtility.DisplayDialog("Error", "Failed to find Send method on room.", "OK");
return;
}
// Invoke Send method
var task = sendMethod.Invoke(roomInfo.RoomInstance, new object[] { messageName, messageData }) as System.Threading.Tasks.Task;
if (task != null)
{
await task;
Debug.Log($"Message '{messageName}' sent successfully!");
}
}
catch (Exception ex)
{
Debug.LogError($"Failed to send message '{messageName}': {ex.Message}\n{ex.StackTrace}");
EditorUtility.DisplayDialog("Error", $"Failed to send message:\n{ex.Message}", "OK");
}
}
private object ParseJSON(string json)
{
// Parse JSON using GameDevWare.Serialization.Json
try
{
return Json.Deserialize(typeof(Dictionary<string, object>), json);
}
catch (Exception ex)
{
Debug.LogError($"Failed to parse JSON: {ex.Message}");
throw;
}
}
private void DrawSchemaInfo(IDictionary schema)
{
if (schema == null)
{
EditorGUILayout.LabelField("No schema information available", EditorStyles.miniLabel);
return;
}
// Display schema type
if (schema.Contains("type"))
{
DrawReadOnlyField("Type", schema["type"].ToString());
}
// Display properties
if (schema.Contains("properties"))
{
var properties = schema["properties"] as IDictionary;
if (properties != null && properties.Count > 0)
{
EditorGUILayout.LabelField("Properties:", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
foreach (DictionaryEntry prop in properties)
{
var propName = prop.Key as string;
var propSchema = prop.Value as IDictionary;
if (propSchema != null && propSchema.Contains("type"))
{
var propType = propSchema["type"].ToString();
var propInfo = propType;
// Add description if available
if (propSchema.Contains("description"))
{
propInfo += $" - {propSchema["description"]}";
}
DrawReadOnlyField(propName, propInfo);
}
}
EditorGUI.indentLevel--;
}
}
// Display required fields
if (schema.Contains("required"))
{
var required = schema["required"] as List<object>;
if (required != null && required.Count > 0)
{
var requiredStr = string.Join(", ", required.Select(r => r.ToString()));
DrawReadOnlyField("Required", requiredStr);
}
}
}
private class RoomInfo
{
public string RoomId;
public string SessionId;
public string Name;
public bool IsConnected;
public object State;
public System.Type StateType;
public System.Type RoomType;
public MonoBehaviour SourceObject;
public object RoomInstance;
}
}
}
================================================
FILE: Assets/Colyseus/Editor/RoomInspector.cs.meta
================================================
fileFormatVersion: 2
guid: 7306c18ccdb7b40c78a54abc8f917b50
================================================
FILE: Assets/Colyseus/Editor.meta
================================================
fileFormatVersion: 2
guid: 12db36416327a4e74873a275325fd6f5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/LICENSE
================================================
Copyright (c) 2021 Lucid Sight
Copyright (c) 2015-2021 Endel Dreyer
MIT License:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
================================================
FILE: Assets/Colyseus/LICENSE.meta
================================================
fileFormatVersion: 2
guid: 28fed75626a4d4144b26bef3670248f7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Auth.cs
================================================
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using GameDevWare.Serialization;
namespace Colyseus
{
public interface IAuthData
{
string Token { get; }
IndexedDictionary<string, object> RawUser { get; set; }
Type UserType { get; }
}
[Serializable]
public class AuthData<T> : IAuthData
{
public string token;
public T user;
private IndexedDictionary<string, object> rawUser;
public AuthData() { }
public AuthData(string _token, IndexedDictionary<string, object> userData)
{
token = _token;
rawUser = userData;
if (typeof(T) == typeof(IndexedDictionary<string, object>))
{
user = (T)(object)rawUser;
}
else if (userData != null)
{
user = ConvertType(userData);
}
}
public string Token
{
get => token;
}
public IndexedDictionary<string, object> RawUser
{
get
{
// TODO: refactor here...
if (rawUser == null && typeof(T) == typeof(IndexedDictionary<string, object>))
{
rawUser = (IndexedDictionary<string, object>)(object)user;
}
return rawUser;
}
set => rawUser = value;
}
public Type UserType
{
get => typeof(T);
}
public static T ConvertType(IndexedDictionary<string, object> rawUser)
{
Type targetType = typeof(T);
T instance = (T)Activator.CreateInstance(targetType);
for (var i = 0; i < rawUser.Keys.Count; i++)
{
var field = targetType.GetField(rawUser.Keys[i]);
if (field != null)
{
try
{
field.SetValue(instance, Convert.ChangeType(rawUser.Values[i], field.FieldType));
}
catch (Exception e)
{
ColyseusContext.Logger.LogWarning("Colyseus.Auth: cannot convert " + targetType.ToString() + " property '" + field.Name + "' from " + rawUser.Values[i].GetType() + " to " + field.FieldType + " (" + e.Message + ")");
}
}
}
return instance;
}
}
public interface IAuthChangeHandler
{
Type Type { get; }
Type UserType { get; set; }
void Invoke(object authData);
}
public class AuthChangeHandler<T> : IAuthChangeHandler
{
private Type userType;
public Action<T> Action;
public void Invoke(object authData) { Action.Invoke((T)authData); }
public Type Type { get => typeof(T); }
public Type UserType { get => userType; set => userType = value; }
}
/// <summary>
/// Colyseus.Auth
/// </summary>
/// <remarks>
/// Colyseus Authentication Module Tools.
/// See https://docs.colyseus.io/authentication/module/
/// </remarks>
public class Auth
{
public static string PATH = "auth";
public static string TOKEN_CACHE_KEY = "AuthToken";
private Client _client;
private List<IAuthChangeHandler> OnChangeHandlers = new List<IAuthChangeHandler>();
private bool initialized = false;
public Auth(Client client)
{
_client = client;
Token = ColyseusContext.TokenStorage.GetToken(TOKEN_CACHE_KEY);
}
public string Token
{
get => _client.Http.AuthToken;
set => _client.Http.AuthToken = value;
}
public async Task<Action> OnChange<T>(Action<AuthData<T>> callback)
{
var handler = new AuthChangeHandler<AuthData<T>>
{
Action = callback,
UserType = typeof(T)
};
OnChangeHandlers.Add(handler);
if (!initialized)
{
initialized = true;
try
{
emitChange(new AuthData<T> {
token = Token,
user = await GetUserData<T>()
});
} catch (Exception e)
{
ColyseusContext.Logger.LogWarning(e.ToString());
emitChange(new AuthData<object> { user = null, token = null });
}
}
return () => OnChangeHandlers.Remove(handler);
}
public async Task<T> GetUserData<T>()
{
if (string.IsNullOrEmpty(Token))
{
throw new Exception("missing Auth.Token");
}
else
{
return getAuthData<T>(await _client.Http.Request<AuthData<IndexedDictionary<string, object>>>("GET", $"{PATH}/userdata")).user;
}
}
public async Task<AuthData<T>> RegisterWithEmailAndPassword<T>(string email, string password, Dictionary<string, object> options = null)
{
var response = getAuthData<T>(await _client.Http.Request<AuthData<IndexedDictionary<string, object>>>("POST", $"{PATH}/register", new Dictionary<string, object>
{
{ "email", email },
{ "password", password },
{ "options", options },
}));
emitChange(response);
return response;
}
public async Task<IAuthData> RegisterWithEmailAndPassword(string email, string password, Dictionary<string, object> options = null)
{
return await RegisterWithEmailAndPassword<IndexedDictionary<string, object>>(email, password, options);
}
public async Task<AuthData<T>> SignInWithEmailAndPassword<T>(string email, string password)
{
var response = getAuthData<T>(await _client.Http.Request<AuthData<IndexedDictionary<string, object>>>("POST", $"{PATH}/login", new Dictionary<string, object>
{
{ "email", email },
{ "password", password },
}));
emitChange(response);
return response;
}
public async Task<IAuthData> SignInWithEmailAndPassword(string email, string password)
{
return await SignInWithEmailAndPassword<IndexedDictionary<string, object>>(email, password);
}
public async Task<AuthData<T>> SignInAnonymously<T>(Dictionary<string, object> options = null)
{
var response = getAuthData<T>(await _client.Http.Request<AuthData<IndexedDictionary<string, object>>>("POST", $"{PATH}/anonymous", options));
emitChange(response);
return response;
}
public async Task<IAuthData> SignInAnonymously(Dictionary<string, object> options = null)
{
return await SignInAnonymously<IndexedDictionary<string, object>>(options);
}
public async Task<AuthData<T>> SignInWithProvider<T>(string providerName, Dictionary<string, object> settings = null)
{
await Task.Run(() => {/* Satisfy the compiler async/await. This method is not implemented yet. */});
//
// Implementation reference: https://github.com/colyseus/colyseus.js/blob/1f2208d4ff49e858a737e4e7d1581148de196cce/src/Auth.ts#L112C26-L161
//
throw new Exception("Not implemented. See implementation reference on JavaScript SDK");
}
public async Task<IAuthData> SignInWithProvider(string providerName, Dictionary<string, object> settings = null)
{
return await SignInWithProvider<IndexedDictionary<string, object>>(providerName, settings);
}
public async Task<string> SendResetPasswordEmail(string email, string password)
{
return await _client.Http.Request("POST", $"{PATH}/login", new Dictionary<string, object>
{
{ "email", email },
{ "password", password },
});
}
public void SignOut()
{
emitChange(new AuthData<object> { token = null, user = null});
}
private void emitChange(IAuthData authData)
{
Token = authData.Token;
if (!string.IsNullOrEmpty(Token))
{
ColyseusContext.TokenStorage.SetToken(TOKEN_CACHE_KEY, authData.Token);
}
else
{
ColyseusContext.TokenStorage.DeleteToken(TOKEN_CACHE_KEY);
}
OnChangeHandlers.ForEach((handler) =>
{
if (authData.GetType() == handler.Type)
{
handler.Invoke(authData);
}
else if (authData.UserType == typeof(IndexedDictionary<string, object>))
{
// convert AuthData<handler.UserType>
object instance = Activator.CreateInstance(handler.Type, authData.Token, authData.RawUser);
handler.Invoke(instance);
}
else if (authData.RawUser == null)
{
object instance = Activator.CreateInstance(handler.Type, authData.Token, null);
handler.Invoke(instance);
}
else
{
ColyseusContext.Logger.Log("Not triggering...");
}
});
}
private AuthData<T> getAuthData<T>(AuthData<IndexedDictionary<string, object>> authData)
{
if (typeof(T) == typeof(IndexedDictionary<string, object>))
{
return (AuthData<T>)(object)authData;
}
else
{
return new AuthData<T>(authData.token, authData.RawUser);
}
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Auth.cs.meta
================================================
fileFormatVersion: 2
guid: c500d710fb1854e15ac69bebeab976b6
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Client.cs
================================================
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
// ReSharper disable InconsistentNaming
namespace Colyseus
{
/// <summary>
/// Options for latency measurement.
/// </summary>
public class LatencyOptions
{
/// <summary>
/// "ws" for WebSocket, "h3" for WebTransport (default: "ws")
/// </summary>
public string Protocol { get; set; } = "ws";
/// <summary>
/// Number of pings to send (default: 1). Returns the average latency when > 1.
/// </summary>
public int PingCount { get; set; } = 1;
}
/// <summary>
/// Colyseus.Client
/// </summary>
/// <remarks>
/// Provides integration between Colyseus Game Server through WebSocket protocol (
/// <see href="http://tools.ietf.org/html/rfc6455">RFC 6455</see>).
/// </remarks>
public class Client
{
/// <summary>
/// Authentication tools, see: https://docs.colyseus.io/auth/
/// </summary>
public Auth Auth;
/// <summary>
/// Reference to the client's <see cref="UriBuilder" />
/// </summary>
private UriBuilder Endpoint;
/// <summary>
/// Object to perform <see cref="UnityEngine.Networking.UnityWebRequest"/>s to the server.
/// </summary>
public HTTP Http;
/// <summary>
/// Initializes a new instance of the <see cref="Client" /> class with
/// the specified Colyseus Game Server endpoint.
/// </summary>
/// <param name="endpoint">
/// A <see cref="string" /> that represents the WebSocket URL to connect.
/// </param>
public Client(string endpoint)
{
Endpoint = new UriBuilder(endpoint);
// Create Settings object to pass to the ColyseusRequest object
Settings settings = Settings.Create();
settings.colyseusServerAddress = $"{Endpoint.Host}{Endpoint.Path}";
settings.colyseusServerPort = Endpoint.Port.ToString();
settings.useSecureProtocol = string.Equals(Endpoint.Scheme, "wss") || string.Equals(Endpoint.Scheme, "https");
Settings = settings;
Auth = new Auth(this);
}
/// <summary>
/// Initializes a new instance of the <see cref="Client"/> class with
/// the specified Colyseus Settings object.
/// </summary>
/// <param name="settings">The settings you wish to use</param>
/// <param name="useWebSocketEndpoint">Determines whether the connection endpoint should use either web socket or http protocols.</param>
public Client(Settings settings)
{
Settings = settings;
Auth = new Auth(this);
}
/// <summary>
/// The getter for the <see cref="Settings"/> currently assigned to this client object
/// </summary>
private Settings _colyseusSettings;
public Settings Settings
{
get
{
return _colyseusSettings;
}
set
{
_colyseusSettings = value;
Endpoint = new UriBuilder(_colyseusSettings.WebSocketEndpoint);
// Instantiate our ColyseusRequest object with the settings object
Http = new HTTP(_colyseusSettings);
}
}
/// <summary>
/// Join or Create a <see cref="Room{T}" />
/// </summary>
/// <param name="roomName">Room identifier</param>
/// <param name="options">Dictionary of options to pass to the room upon creation/joining</param>
/// <param name="headers">Dictionary of headers to pass to the server when we create/join the room</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we want to join or create</typeparam>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<T>> JoinOrCreate<T>(string roomName, Dictionary<string, object> options = null, Dictionary<string, string> headers = null)
where T : Schema.Schema
{
return await CreateMatchMakeRequest<T>("joinOrCreate", roomName, options, headers);
}
/// <summary>
/// Create a <see cref="Room{T}" />
/// </summary>
/// <param name="roomName">Room identifier</param>
/// <param name="options">Dictionary of options to pass to the room upon creation</param>
/// <param name="headers">Dictionary of headers to pass to the server when we create the room</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we want to create</typeparam>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<T>> Create<T>(string roomName, Dictionary<string, object> options = null, Dictionary<string, string> headers = null)
where T : Schema.Schema
{
return await CreateMatchMakeRequest<T>("create", roomName, options, headers);
}
/// <summary>
/// Join a <see cref="Room{T}" />
/// </summary>
/// <param name="roomName">Room identifier</param>
/// <param name="options">Dictionary of options to pass to the room upon joining</param>
/// <param name="headers">Dictionary of headers to pass to the server when we join the room</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we want to join</typeparam>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<T>> Join<T>(string roomName, Dictionary<string, object> options = null, Dictionary<string, string> headers = null)
where T : Schema.Schema
{
return await CreateMatchMakeRequest<T>("join", roomName, options, headers);
}
/// <summary>
/// Join a <see cref="Room{T}" /> by ID
/// </summary>
/// <param name="roomId">ID of the room</param>
/// <param name="options">Dictionary of options to pass to the room upon joining</param>
/// <param name="headers">Dictionary of headers to pass to the server when we join the room</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we want to join</typeparam>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<T>> JoinById<T>(string roomId, Dictionary<string, object> options = null, Dictionary<string, string> headers = null)
where T : Schema.Schema
{
return await CreateMatchMakeRequest<T>("joinById", roomId, options, headers);
}
/// <summary>
/// Reconnect to a <see cref="Room{T}" />
/// </summary>
/// <param name="reconnectionToken">Previously connected ReconnectionToken</param>
/// <param name="headers">Dictionary of headers to pass to the server when we reconnect to the room</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we want to reconnect with</typeparam>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<T>> Reconnect<T>(ReconnectionToken reconnectionToken, Dictionary<string, string> headers = null)
where T : Schema.Schema
{
Dictionary<string, object> options = new Dictionary<string, object>();
options.Add("reconnectionToken", reconnectionToken.Token);
return await CreateMatchMakeRequest<T>("reconnect", reconnectionToken.RoomId, options, headers);
}
//
// FossilDelta/None serializer versions for joining the state
//
/// <summary>
/// Join or Create a <see cref="Room{T}" />
/// </summary>
/// <param name="roomName">Room identifier</param>
/// <param name="options">Dictionary of options to pass to the room upon creation/joining</param>
/// <param name="headers">Dictionary of headers to pass to the server when we create/join the room</param>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<NoState>> JoinOrCreate(string roomName, Dictionary<string, object> options = null, Dictionary<string, string> headers = null)
{
return await CreateMatchMakeRequest<NoState>("joinOrCreate", roomName, options, headers);
}
/// <summary>
/// Create a <see cref="Room{T}" />
/// </summary>
/// <param name="roomName">Room identifier</param>
/// <param name="options">Dictionary of options to pass to the room upon creation</param>
/// <param name="headers">Dictionary of headers to pass to the server when we create the room</param>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<NoState>> Create(string roomName, Dictionary<string, object> options = null,
Dictionary<string, string> headers = null)
{
return await CreateMatchMakeRequest<NoState>("create", roomName, options, headers);
}
/// <summary>
/// Join a <see cref="Room{T}" />
/// </summary>
/// <param name="roomName">Room identifier</param>
/// <param name="options">Dictionary of options to pass to the room upon joining</param>
/// <param name="headers">Dictionary of headers to pass to the server when we join the room</param>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<NoState>> Join(string roomName, Dictionary<string, object> options = null,
Dictionary<string, string> headers = null)
{
return await CreateMatchMakeRequest<NoState>("join", roomName, options, headers);
}
/// <summary>
/// Join a <see cref="Room{T}" /> by ID
/// </summary>
/// <param name="roomId">ID of the room</param>
/// <param name="options">Dictionary of options to pass to the room upon joining</param>
/// <param name="headers">Dictionary of headers to pass to the server when we join the room</param>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<NoState>> JoinById(string roomId, Dictionary<string, object> options = null,
Dictionary<string, string> headers = null)
{
return await CreateMatchMakeRequest<NoState>("joinById", roomId, options, headers);
}
/// <summary>
/// Reconnect to a <see cref="Room{T}" />
/// </summary>
/// <param name="roomId">ID of the room</param>
/// <param name="sessionId">Previously connected sessionId</param>
/// <param name="headers">Dictionary of headers to pass to the server when we reconnect to the room</param>
/// <returns><see cref="Room{T}" /> via async task</returns>
public async Task<Room<NoState>> Reconnect(string roomId, string sessionId,
Dictionary<string, string> headers = null)
{
Dictionary<string, object> options = new Dictionary<string, object>();
options.Add("sessionId", sessionId);
return await CreateMatchMakeRequest<NoState>("joinById", roomId, options, headers);
}
/// <summary>
/// Consume the seat reservation
/// </summary>
/// <param name="response">The response from the matchmaking attempt</param>
/// <param name="headers">Dictionary of headers to pass to the server</param>
/// <param name="previousRoom">Previous Room{T} instance to re-establish the server connection: Please do not use this devMode param for general purposes</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we're consuming the seat from</typeparam>
/// <returns><see cref="Room{T}" /> in which we now have a seat via async task</returns>
public async Task<Room<T>> ConsumeSeatReservation<T>(SeatReservation response, Dictionary<string, string> headers = null)
where T : Schema.Schema
{
Room<T> room = new Room<T>(response.name)
{
RoomId = response.roomId,
SessionId = response.sessionId
};
Dictionary<string, object> queryString = new Dictionary<string, object>
{
{ "sessionId", room.SessionId }
};
// forward reconnection token
if (response.reconnectionToken != null)
{
queryString.Add("reconnectionToken", response.reconnectionToken);
}
room.SetConnection(CreateConnection(response, queryString, headers));
TaskCompletionSource<Room<T>> tcs = new TaskCompletionSource<Room<T>>();
void OnError(int code, string message)
{
room.OnError -= OnError;
tcs.SetException(new MatchMakeException(code, message));
}
void OnJoin()
{
room.OnError -= OnError;
tcs.TrySetResult(room);
}
room.OnError += OnError;
room.OnJoin += OnJoin;
_ = room.Connect();
return await tcs.Task;
}
/// <summary>
/// Create a match making request
/// </summary>
/// <param name="method">The type of request we're making (join, create, etc)</param>
/// <param name="roomName">Room identifierroom we're trying to match</param>
/// <param name="options">Dictionary of options to use in the match making process</param>
/// <param name="headers">Dictionary of headers to pass to the server</param>
/// <typeparam name="T">Type of <see cref="Room{T}" /> we want to match with</typeparam>
/// <returns><see cref="Room{T}" /> we have matched with via async task</returns>
/// <exception cref="Exception">Thrown if there is a network related error</exception>
/// <exception cref="MatchMakeException">Thrown if there is an error in the match making process on the server side</exception>
protected async Task<Room<T>> CreateMatchMakeRequest<T>(string method, string roomName, Dictionary<string, object> options, Dictionary<string, string> headers)
where T : Schema.Schema
{
if (options == null)
{
options = new Dictionary<string, object>();
}
if (headers == null)
{
headers = new Dictionary<string, string>();
}
var response = await Http.Post<SeatReservation>($"matchmake/{method}/{roomName}", options, headers);
if (response == null)
{
throw new Exception($"Error with request: {response}");
}
// forward reconnection token on reconnect
if (method == "reconnect")
{
response.reconnectionToken = (string)options["reconnectionToken"];
}
return await ConsumeSeatReservation<T>(response, headers);
}
/// <summary>
/// Create a connection with a room
/// </summary>
/// <param name="path">Additional info used as the <see cref="UriBuilder.Path" /></param>
/// <param name="options">Dictionary of options to use when connecting</param>
/// <param name="headers">Dictionary of headers to pass when connecting</param>
/// <returns></returns>
protected Connection CreateConnection(
SeatReservation room,
Dictionary<string, object> options = null,
Dictionary<string, string> headers = null
)
{
if (room.protocol != null && room.protocol == "h3") {
// TODO: support h3 protocol (WebTransport)
throw new Exception("WebTransport protocol is not supported yet. Please use WebSocket protocol instead.");
}
if (options == null)
{
options = new Dictionary<string, object>();
}
// Add authentication token to query string
if (!string.IsNullOrEmpty(Http.AuthToken))
{
options.Add("_authToken", Http.AuthToken);
}
List<string> list = new List<string>();
foreach (KeyValuePair<string, object> item in options)
{
list.Add(item.Key + "=" + (item.Value != null ? Convert.ToString(item.Value) : "null"));
}
// Try to connect directly to custom publicAddress, if present.
var endpoint = (room.publicAddress != null && room.publicAddress.Length > 0)
? new Uri($"{Endpoint.Scheme}://{room.publicAddress}")
: Endpoint.Uri;
var basePath = endpoint.AbsolutePath;
// make sure to end path with backslash
if (basePath.Length > 0 && !basePath.EndsWith("/"))
{
basePath += "/";
}
UriBuilder uriBuilder = new UriBuilder(endpoint)
{
Path = $"{basePath}{room.processId}/{room.roomId}",
Query = string.Join("&", list.ToArray())
};
return new Connection(uriBuilder.ToString(), headers);
}
/// <summary>
/// Select the endpoint with the lowest latency.
/// </summary>
/// <param name="endpoints">Array of endpoints to select from.</param>
/// <param name="latencyOptions">Latency measurement options (protocol, pingCount).</param>
/// <returns>The client with the lowest latency.</returns>
public static async Task<Client> SelectByLatency(string[] endpoints, LatencyOptions latencyOptions = null)
{
if (latencyOptions == null)
{
latencyOptions = new LatencyOptions();
}
var clients = new Client[endpoints.Length];
for (int i = 0; i < endpoints.Length; i++)
{
clients[i] = new Client(endpoints[i]);
}
var latencyTasks = new Task<(int index, double latency, bool success)>[clients.Length];
for (int i = 0; i < clients.Length; i++)
{
int index = i;
latencyTasks[i] = MeasureClientLatency(clients[index], index, latencyOptions);
}
var results = await Task.WhenAll(latencyTasks);
int bestIndex = -1;
double bestLatency = double.MaxValue;
for (int i = 0; i < results.Length; i++)
{
if (results[i].success && results[i].latency < bestLatency)
{
bestLatency = results[i].latency;
bestIndex = results[i].index;
}
}
if (bestIndex == -1)
{
throw new Exception("All endpoints failed to respond");
}
return clients[bestIndex];
}
private static async Task<(int index, double latency, bool success)> MeasureClientLatency(Client client, int index, LatencyOptions options)
{
try
{
var latency = await client.GetLatency(options);
var settings = client.Settings;
ColyseusContext.Logger.Log($"Endpoint Latency: {latency}ms - {settings.colyseusServerAddress}:{settings.colyseusServerPort}");
return (index, latency, success: true);
}
catch (Exception)
{
return (index, latency: double.MaxValue, success: false);
}
}
/// <summary>
/// Create a new connection with the server, and measure the latency.
/// </summary>
/// <param name="options">Latency measurement options (protocol, pingCount).</param>
/// <returns>The average latency in milliseconds.</returns>
public Task<double> GetLatency(LatencyOptions options = null)
{
if (options == null)
{
options = new LatencyOptions();
}
var protocol = options.Protocol ?? "ws";
var pingCount = options.PingCount > 0 ? options.PingCount : 1;
if (protocol == "h3")
{
throw new Exception("WebTransport protocol is not supported yet. Please use WebSocket protocol instead.");
}
var tcs = new TaskCompletionSource<double>();
var latencies = new List<double>();
long pingStart = 0;
var conn = new Connection(Endpoint.ToString(), null);
void OnOpen()
{
pingStart = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
_ = conn.Send(new byte[] { Protocol.PING });
}
void OnMessage(byte[] data)
{
latencies.Add(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - pingStart);
if (latencies.Count < pingCount)
{
// Send another ping
pingStart = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
_ = conn.Send(new byte[] { Protocol.PING });
}
else
{
// Done, calculate average and close
conn.OnOpen -= OnOpen;
conn.OnMessage -= OnMessage;
conn.OnError -= OnError;
_ = conn.Close();
double sum = 0;
for (int i = 0; i < latencies.Count; i++)
{
sum += latencies[i];
}
tcs.TrySetResult(sum / latencies.Count);
}
}
void OnError(string errorMsg)
{
conn.OnOpen -= OnOpen;
conn.OnMessage -= OnMessage;
conn.OnError -= OnError;
tcs.TrySetException(new MatchMakeException((int)CloseCode.ABNORMAL_CLOSURE, $"Failed to get latency: {errorMsg}"));
}
conn.OnOpen += OnOpen;
conn.OnMessage += OnMessage;
conn.OnError += OnError;
_ = conn.Connect();
return tcs.Task;
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Client.cs.meta
================================================
fileFormatVersion: 2
guid: b31ab8167fc564dee91f45b0dd6d57ff
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Connection.cs
================================================
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
// ReSharper disable InconsistentNaming
namespace Colyseus
{
/// <summary>
/// WebSocket connection representation with some custom functionality
/// </summary>
public class Connection
{
public event WebSocketOpenEventHandler OnOpen;
public event WebSocketMessageEventHandler OnMessage;
public event WebSocketErrorEventHandler OnError;
public event WebSocketCloseEventHandler OnClose;
/// <summary>
/// Is the connection currently open
/// </summary>
public bool IsOpen;
private WebSocketTransport _transport;
private string _url;
private Dictionary<string, string> _headers;
public Connection(string url, Dictionary<string, string> headers)
{
_url = url;
_headers = headers;
}
public async Task Connect()
{
_transport = new WebSocketTransport();
_transport.OnOpen += () => { IsOpen = true; OnOpen?.Invoke(); };
_transport.OnMessage += (data) => OnMessage?.Invoke(data);
_transport.OnError += (msg) => OnError?.Invoke(msg);
_transport.OnClose += (code) => { IsOpen = false; OnClose?.Invoke(code); };
await _transport.Connect(_url, _headers);
}
public Task Send(byte[] data)
{
return _transport.Send(data);
}
public Task Close()
{
return _transport.Close();
}
public void Drop()
{
CancelConnection();
}
public void CancelConnection()
{
_transport?.CancelConnection();
}
#if !UNITY_WEBGL || UNITY_EDITOR
/// <summary>
/// Dispatch queued WebSocket callbacks manually from a custom game loop.
/// This is only needed when no SynchronizationContext or external dispatcher is available.
/// </summary>
public void DispatchMessageQueue()
{
_transport?.DispatchMessageQueue();
}
#endif
/// <summary>
/// Reconnect to the same endpoint with a new reconnection token
/// </summary>
/// <param name="reconnectionToken">The token to use for reconnection</param>
public async Task Reconnect(string reconnectionToken)
{
var uri = new Uri(_url);
var queryParams = new List<string>();
// Preserve existing query parameters
if (!string.IsNullOrEmpty(uri.Query))
{
var existingQuery = uri.Query.TrimStart('?');
if (!string.IsNullOrEmpty(existingQuery))
{
foreach (var param in existingQuery.Split('&'))
{
var key = param.Split('=')[0];
// Skip params we're going to override
if (key != "reconnectionToken" && key != "skipHandshake")
{
queryParams.Add(param);
}
}
}
}
queryParams.Add("reconnectionToken=" + Uri.EscapeDataString(reconnectionToken));
queryParams.Add("skipHandshake=1");
var uriBuilder = new UriBuilder(uri) { Query = string.Join("&", queryParams) };
_url = uriBuilder.ToString();
ColyseusContext.Logger.Log($"Reconnecting to {_url}");
await Connect();
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Connection.cs.meta
================================================
fileFormatVersion: 2
guid: c7b2c7c29325c4b2f81ddd0c68c1f995
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/HTTP.cs
================================================
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.IO;
using GameDevWare.Serialization;
namespace Colyseus
{
[Serializable]
public class ErrorResponse
{
public string error;
}
/// <summary>
/// Class for building out server requests
/// </summary>
public class HTTP
{
public string AuthToken;
private Settings _settings;
public HTTP(Settings settings)
{
_settings = settings;
}
public async Task<string> Get(string uriPath, Dictionary<string, string> headers = null)
{
return await Request("GET", uriPath, null, headers);
}
public async Task<T> Get<T>(string uriPath, Dictionary<string, string> headers = null)
{
return await Request<T>("GET", uriPath, null, headers);
}
public async Task<string> Post(string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return await Request("POST", uriPath, jsonBody, headers);
}
public async Task<T> Post<T>(string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return await Request<T>("POST", uriPath, jsonBody, headers);
}
public async Task<string> Delete(string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return await Request("DELETE", uriPath, jsonBody, headers);
}
public async Task<T> Delete<T>(string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return await Request<T>("DELETE", uriPath, jsonBody, headers);
}
public async Task<string> Put(string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return await Request("PUT", uriPath, jsonBody, headers);
}
public async Task<T> Put<T>(string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return await Request<T>("PUT", uriPath, jsonBody, headers);
}
public async Task<T> Request<T>(string uriMethod, string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
return Json.Deserialize<T>(await Request(uriMethod, uriPath, jsonBody, headers));
}
public async Task<string> Request(string uriMethod, string uriPath, Dictionary<string, object> jsonBody = null, Dictionary<string, string> headers = null)
{
byte[] body = null;
if (jsonBody != null)
{
MemoryStream jsonBodyStream = new MemoryStream();
Json.Serialize(jsonBody, jsonBodyStream);
body = jsonBodyStream.ToArray();
}
var allHeaders = new Dictionary<string, string>();
foreach (KeyValuePair<string, string> pair in _settings.Headers)
{
allHeaders[pair.Key] = pair.Value;
}
if (!string.IsNullOrEmpty(AuthToken))
{
allHeaders["Authorization"] = "Bearer " + AuthToken;
}
if (headers != null)
{
foreach (KeyValuePair<string, string> header in headers)
{
allHeaders[header.Key] = header.Value;
}
}
return await ColyseusContext.HttpClient.Request(uriMethod, GetRequestURL(uriPath), body, allHeaders);
}
public string GetRequestURL(string pathWithQueryString)
{
var splittedPath = pathWithQueryString.Split('?');
var path = splittedPath[0];
var query = (splittedPath.Length > 1) ? splittedPath[1] : "";
string forwardSlash = "";
if (!_settings.WebRequestEndpoint.EndsWith("/"))
{
forwardSlash = "/";
}
// WebRequestEndpoint will include any path that is included with the server address field of the server settings object so we need to add the request specific path to the WebRequestEndpoint value
UriBuilder uriBuilder = new UriBuilder($"{_settings.WebRequestEndpoint}{forwardSlash}{path}");
uriBuilder.Port = _settings.GetPort();
if (!string.IsNullOrEmpty(query))
{
uriBuilder.Query = query;
}
return uriBuilder.ToString();
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/HTTP.cs.meta
================================================
fileFormatVersion: 2
guid: ee3501581e55f44c8909b6ec76944724
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Manager.cs
================================================
using System.Collections.Generic;
using UnityEngine;
// ReSharper disable InconsistentNaming
namespace Colyseus
{
/// <summary>
/// Base manager class
/// </summary>
/// <typeparam name="T"></typeparam>
public class Manager<T> : MonoBehaviour
where T: Component
{
/// <summary>
/// Reference to the Colyseus settings object.
/// </summary>
[SerializeField]
protected Settings _colyseusSettings;
// Getters
//==========================
/// <summary>
/// The singleton instance of the Colyseus Manager.
/// </summary>
public static T Instance { get; private set; }
/// <summary>
/// Returns the Colyseus server address as defined
/// in the <see cref="Settings"/> object
/// </summary>
public string ColyseusServerAddress
{
get { return _colyseusSettings.colyseusServerAddress; }
}
/// <summary>
/// Returns the Colyseus server port as defined
/// in the <see cref="Settings"/> object
/// </summary>
public string ColyseusServerPort
{
get { return _colyseusSettings.colyseusServerPort; }
}
/// <summary>
/// Returned if the desired protocol security as defined
/// in the <see cref="Settings"/> object
/// </summary>
public bool ColyseusUseSecure
{
get { return _colyseusSettings.useSecureProtocol; }
}
//==========================
/// <summary>
/// The primary Client object responsible for making connections to the server.
/// </summary>
protected Client client;
/// <summary>
/// <see cref="MonoBehaviour"/> callback when the manager object has been destroyed.
/// </summary>
protected virtual void OnDestroy()
{
}
/// <summary>
/// <see cref="MonoBehaviour"/> callback when the script instance is being loaded.
/// </summary>
protected virtual void Awake()
{
InitializeInstance();
}
/// <summary>
/// Initializes the Colyseus manager singleton.
/// </summary>
private void InitializeInstance()
{
if (Instance != null)
{
Destroy(gameObject);
return;
}
Instance = this as T;
}
/// <summary>
/// <see cref="MonoBehaviour"/> callback when a script is enabled just before any of the Update methods are called the first time.
/// </summary>
protected virtual void Start()
{
}
/// <summary>
/// Frame-rate independent message for physics calculations.
/// </summary>
protected virtual void FixedUpdate()
{
}
/// <summary>
/// Override the current <see cref="Settings"/>
/// </summary>
/// <param name="newSettings">The new settings to use</param>
public virtual void OverrideSettings(Settings newSettings)
{
_colyseusSettings = newSettings;
if (client != null)
{
client.Settings = newSettings;
}
}
/// <summary>
/// Get a copy of the manager's settings configuration
/// </summary>
/// <returns></returns>
public virtual Settings CloneSettings()
{
return Settings.Clone(_colyseusSettings);
}
/// <summary>
/// Creates a new <see cref="Client"/> object, with the given endpoint, and returns it
/// </summary>
/// <param name="endpoint">URL to the Colyseus server</param>
/// <returns></returns>
public Client CreateClient(string endpoint)
{
client = new Client(endpoint);
return client;
}
/// <summary>
/// /// Create a new <see cref="Client"/> along with any other client initialization you may need to perform
/// /// </summary>
public virtual void InitializeClient()
{
CreateClient(_colyseusSettings.WebSocketEndpoint);
}
/// <summary>
/// <see cref="MonoBehaviour"/> callback that gets called just before app exit.
/// </summary>
protected virtual void OnApplicationQuit()
{
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Manager.cs.meta
================================================
fileFormatVersion: 2
guid: dfd046c2a7f284b40abeb2e9c6030c2a
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ColyseusContext.cs
================================================
using System;
namespace Colyseus
{
public static class ColyseusContext
{
public static ILogger Logger { get; set; }
public static IHttpClient HttpClient { get; set; }
public static ITokenStorage TokenStorage { get; set; }
/// <summary>
/// When set, WebSocketTransport registers websockets here for external
/// dispatching (e.g. MonoGame or a custom engine loop) instead of relying
/// on SynchronizationContext dispatch or the shared fallback dispatcher.
/// </summary>
public static Action<NativeWebSocket.WebSocket> RegisterWebSocketForDispatch { get; set; }
public static Action<NativeWebSocket.WebSocket> UnregisterWebSocketForDispatch { get; set; }
static ColyseusContext()
{
SetDefaults();
}
public static void SetDefaults()
{
Logger = new ConsoleLogger();
HttpClient = new DefaultHttpClient();
TokenStorage = new InMemoryTokenStorage();
RegisterWebSocketForDispatch = null;
UnregisterWebSocketForDispatch = null;
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ColyseusContext.cs.meta
================================================
fileFormatVersion: 2
guid: e9d11516d4fd945f6bc6f9c38f59484f
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/ConsoleLogger.cs
================================================
using System;
namespace Colyseus
{
public class ConsoleLogger : ILogger
{
public void Log(string message)
{
Console.WriteLine(message);
}
public void LogWarning(string message)
{
Console.WriteLine("[WARNING] " + message);
}
public void LogError(string message)
{
Console.Error.WriteLine("[ERROR] " + message);
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/ConsoleLogger.cs.meta
================================================
fileFormatVersion: 2
guid: c61bec0c4a8f5466ead316cf8b48a7c3
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/DefaultHttpClient.cs
================================================
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
namespace Colyseus
{
public class DefaultHttpClient : IHttpClient
{
private static readonly HttpClient _client = new HttpClient();
public async Task<string> Request(string method, string url, byte[] body, Dictionary<string, string> headers)
{
var request = new HttpRequestMessage(new HttpMethod(method), url);
if (body != null)
{
request.Content = new ByteArrayContent(body);
request.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
}
if (headers != null)
{
foreach (var header in headers)
{
request.Headers.TryAddWithoutValidation(header.Key, header.Value);
}
}
var response = await _client.SendAsync(request);
var responseBody = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
throw new HttpException((int)response.StatusCode, responseBody);
}
return responseBody;
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/DefaultHttpClient.cs.meta
================================================
fileFormatVersion: 2
guid: b76ed9cf151944e27a2b3dd129f71ec1
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/InMemoryTokenStorage.cs
================================================
using System.Collections.Generic;
namespace Colyseus
{
public class InMemoryTokenStorage : ITokenStorage
{
private Dictionary<string, string> _tokens = new Dictionary<string, string>();
public string GetToken(string key)
{
_tokens.TryGetValue(key, out var value);
return value ?? string.Empty;
}
public void SetToken(string key, string value)
{
_tokens[key] = value;
}
public void DeleteToken(string key)
{
_tokens.Remove(key);
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/InMemoryTokenStorage.cs.meta
================================================
fileFormatVersion: 2
guid: f08fd06971bb7429493182bdbe6bc586
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults.meta
================================================
fileFormatVersion: 2
guid: a936aa0bb60cb45839f98f94e6b99ff3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/IHttpClient.cs
================================================
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Colyseus
{
public interface IHttpClient
{
Task<string> Request(string method, string url, byte[] body, Dictionary<string, string> headers);
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/IHttpClient.cs.meta
================================================
fileFormatVersion: 2
guid: d0b5fc7c6915d4fbb8d3912865fa3a39
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ILogger.cs
================================================
namespace Colyseus
{
public interface ILogger
{
void Log(string message);
void LogWarning(string message);
void LogError(string message);
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ILogger.cs.meta
================================================
fileFormatVersion: 2
guid: 7a651e0ae0860483aa3bdd31fb0c1ff0
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ITokenStorage.cs
================================================
namespace Colyseus
{
public interface ITokenStorage
{
string GetToken(string key);
void SetToken(string key, string value);
void DeleteToken(string key);
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ITokenStorage.cs.meta
================================================
fileFormatVersion: 2
guid: a28d0b00b73cb4b5e88d58109c69b4bc
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/IWebSocket.cs
================================================
namespace Colyseus
{
public delegate void WebSocketOpenEventHandler();
public delegate void WebSocketMessageEventHandler(byte[] data);
public delegate void WebSocketErrorEventHandler(string errorMsg);
public delegate void WebSocketCloseEventHandler(int closeCode);
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/IWebSocket.cs.meta
================================================
fileFormatVersion: 2
guid: 3fe20329183ae4a0eb091fee0b8a61bc
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/PreserveAttribute.cs
================================================
using System;
namespace Colyseus
{
/// <summary>
/// Custom Preserve attribute that works on all platforms.
/// Unity's IL2CPP linker recognizes any attribute named "Preserve" regardless of namespace.
/// </summary>
[AttributeUsage(AttributeTargets.All)]
public sealed class PreserveAttribute : Attribute { }
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/PreserveAttribute.cs.meta
================================================
fileFormatVersion: 2
guid: 3123978311a4e4dd68b79ae85a198a18
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityHttpClient.cs
================================================
#if UNITY_5_3_OR_NEWER
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
using GameDevWare.Serialization;
namespace Colyseus
{
public class UnityHttpClient : IHttpClient
{
public async Task<string> Request(string method, string url, byte[] body, Dictionary<string, string> headers)
{
using (UnityWebRequest req = new UnityWebRequest())
{
req.method = method;
req.url = url;
if (body != null)
{
req.uploadHandler = new UploadHandlerRaw(body)
{
contentType = "application/json"
};
}
if (headers != null)
{
foreach (KeyValuePair<string, string> header in headers)
{
req.SetRequestHeader(header.Key, header.Value);
}
}
req.downloadHandler = new DownloadHandlerBuffer();
await req.SendWebRequest();
#if UNITY_2020_1_OR_NEWER
if (req.result == UnityWebRequest.Result.ConnectionError || req.result == UnityWebRequest.Result.ProtocolError)
#else
if (req.isNetworkError || req.isHttpError)
#endif
{
var errorMessage = req.error;
if (!string.IsNullOrEmpty(req.downloadHandler.text))
{
try
{
var data = Json.Deserialize<ErrorResponse>(req.downloadHandler.text);
if (!string.IsNullOrEmpty(data.error))
{
errorMessage = data.error;
}
}
catch { }
}
throw new HttpException((int)req.responseCode, errorMessage);
}
return req.downloadHandler.text;
}
}
}
}
#endif
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityHttpClient.cs.meta
================================================
fileFormatVersion: 2
guid: 3cf7b230495374a76948cb8b92393feb
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityLogger.cs
================================================
#if UNITY_5_3_OR_NEWER
using UnityEngine;
namespace Colyseus
{
public class UnityLogger : ILogger
{
public void Log(string message)
{
Debug.Log(message);
}
public void LogWarning(string message)
{
Debug.LogWarning(message);
}
public void LogError(string message)
{
Debug.LogError(message);
}
}
}
#endif
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityLogger.cs.meta
================================================
fileFormatVersion: 2
guid: 641a11947d6ae4ca785718cc095a8422
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityPlatform.cs
================================================
#if UNITY_5_3_OR_NEWER
using UnityEngine;
namespace Colyseus
{
/// <summary>
/// Auto-initializes ColyseusContext with Unity-specific implementations.
/// This runs before any scene loads, ensuring all Unity users get the correct platform bindings.
/// </summary>
public static class UnityPlatform
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Initialize()
{
ColyseusContext.Logger = new UnityLogger();
ColyseusContext.HttpClient = new UnityHttpClient();
ColyseusContext.TokenStorage = new UnityTokenStorage();
}
}
}
#endif
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityPlatform.cs.meta
================================================
fileFormatVersion: 2
guid: 7f3783fa34f724310885d356cb346c8b
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnitySettings.cs
================================================
#if UNITY_5_3_OR_NEWER
using System;
using UnityEngine;
namespace Colyseus
{
/// <summary>
/// ScriptableObject wrapper around the core Settings POCO for Unity inspector compatibility.
/// Maintains backward compatibility with existing Unity projects that use Settings as a ScriptableObject.
/// </summary>
[CreateAssetMenu(fileName = "MyServerSettings", menuName = "Colyseus/Server Settings Scriptable Object", order = 1)]
[Serializable]
public class UnitySettings : ScriptableObject
{
/// <summary>
/// The server address
/// </summary>
public string colyseusServerAddress = "localhost";
/// <summary>
/// The port to connect to
/// </summary>
public string colyseusServerPort = "2567";
/// <summary>
/// If true, we use secure protocols (wss, https) otherwise we use ws, http
/// </summary>
public bool useSecureProtocol = false;
[SerializeField]
private Settings.RequestHeader[] _requestHeaders;
/// <summary>
/// Convert this UnitySettings to a core Settings object
/// </summary>
public Settings ToSettings()
{
var settings = new Settings
{
colyseusServerAddress = colyseusServerAddress,
colyseusServerPort = colyseusServerPort,
useSecureProtocol = useSecureProtocol
};
if (_requestHeaders != null)
{
settings.SetRequestHeaders(_requestHeaders);
}
return settings;
}
/// <summary>
/// Implicit conversion to Settings for backward compatibility
/// </summary>
public static implicit operator Settings(UnitySettings unitySettings)
{
return unitySettings.ToSettings();
}
}
}
#endif
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnitySettings.cs.meta
================================================
fileFormatVersion: 2
guid: 6d1d0994d204e41f2a1ad4fd8d0062a9
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityTokenStorage.cs
================================================
#if UNITY_5_3_OR_NEWER
using UnityEngine;
namespace Colyseus
{
public class UnityTokenStorage : ITokenStorage
{
public string GetToken(string key)
{
return PlayerPrefs.GetString(key);
}
public void SetToken(string key, string value)
{
PlayerPrefs.SetString(key, value);
}
public void DeleteToken(string key)
{
PlayerPrefs.DeleteKey(key);
}
}
}
#endif
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityTokenStorage.cs.meta
================================================
fileFormatVersion: 2
guid: 49c288c14bb62415b8ccd07edc0fcae2
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity.meta
================================================
fileFormatVersion: 2
guid: d570a06a0e1f64179a4e50e694ea47a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Platform.meta
================================================
fileFormatVersion: 2
guid: 11ca095b9c22845eca472b0e5ae92d6d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/ErrorCode.cs
================================================
// ReSharper disable InconsistentNaming
namespace Colyseus
{
/// <summary>
/// Colyseus error codes mapping.
/// </summary>
public class ErrorCode
{
public static int MATCHMAKE_NO_HANDLER = 4210;
public static int MATCHMAKE_INVALID_CRITERIA = 4211;
public static int MATCHMAKE_INVALID_ROOM_ID = 4212;
public static int MATCHMAKE_UNHANDLED = 4213;
public static int MATCHMAKE_EXPIRED = 4214;
public static int AUTH_FAILED = 4215;
public static int APPLICATION_ERROR = 4216;
/// <summary>
/// When local schema is different from schema on the server.
/// </summary>
public static int SCHEMA_MISMATCH = 4300;
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/ErrorCode.cs.meta
================================================
fileFormatVersion: 2
guid: 91ff24d8f9ec0420ebf7619585071190
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/MatchMakeResponse.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Colyseus
{
/// <summary>
/// Wrapper class for a match making response
/// </summary>
/// <remarks>Returns room and sessionId if successful; code and error if not</remarks>
[Serializable]
public class SeatReservation
{
public string name;
public string sessionId;
public string roomId;
public string publicAddress;
public string processId;
public string reconnectionToken;
public bool devMode;
public string protocol;
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/MatchMakeResponse.cs.meta
================================================
fileFormatVersion: 2
guid: 96657d6a1a8244a298dd8bf4c14906c2
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/MessageHandler.cs
================================================
using System;
namespace Colyseus
{
/// <summary>
/// Base interface for MessageHandlers
/// </summary>
public interface IMessageHandler
{
/// <summary>
/// Message Type
/// </summary>
Type Type { get; }
/// <summary>
/// Base invocation for the MessageHandler
/// </summary>
/// <param name="message">The data to be passed into the function</param>
void Invoke(object message);
}
/// <summary>
/// Base Implementation of the IMessageHandler interface
/// </summary>
/// <typeparam name="T">Message Type</typeparam>
public class MessageHandler<T> : IMessageHandler
{
/// <summary>
/// The Action this message will invoke
/// </summary>
public Action<T> Action;
/// <summary>
/// Invokes this message's Action
/// </summary>
/// <param name="message">Data for the Action, will be cast to "T"</param>
public void Invoke(object message)
{
Action.Invoke((T) message);
}
/// <summary>
/// Implementation of the interface Type
/// </summary>
/// <returns>typeof(T)</returns>
public Type Type
{
get { return typeof(T); }
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/MessageHandler.cs.meta
================================================
fileFormatVersion: 2
guid: c67f9a6a0cc1b422195dd94a31f6e4e8
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/Protocol.cs
================================================
// ReSharper disable InconsistentNaming
namespace Colyseus
{
/// <summary>
/// Colyseus server protocol codes mapping.
/// </summary>
public class Protocol
{
/// <summary>
/// When client receives its unique id.
/// </summary>
public static byte USER_ID = 1;
//
// Room-related (9~19)
//
/// <summary>
/// When JOIN is requested.
/// </summary>
public static byte JOIN_REQUEST = 9;
/// <summary>
/// When JOIN request is accepted.
/// </summary>
public static byte JOIN_ROOM = 10;
/// <summary>
/// When an error has happened in the server-side.
/// </summary>
public static byte ERROR = 11;
/// <summary>
/// When server explicitly removes <see cref="Client" /> from the <see cref="Room{T}" />
/// </summary>
public static byte LEAVE_ROOM = 12;
/// <summary>
/// When server sends data to a particular <see cref="Room{T}" />
/// </summary>
public static byte ROOM_DATA = 13;
/// <summary>
/// When server sends <see cref="Room{T}" /> state to its clients.
/// </summary>
public static byte ROOM_STATE = 14;
/// <summary>
/// When server sends <see cref="Room{T}" /> state to its clients.
/// </summary>
public static byte ROOM_STATE_PATCH = 15;
/// <summary>
/// When server sends a Schema-encoded message.
/// </summary>
public static byte ROOM_DATA_SCHEMA = 16;
public static byte ROOM_DATA_BYTES = 17;
/// <summary>
/// Ping message for measuring round-trip latency.
/// </summary>
public static byte PING = 18;
//
// Matchmaking messages (20~30)
//
public static byte ROOM_LIST = 20;
//
// Generic messages (50~60)
//
/// <summary>
/// When server doesn't understand a request, it returns <see cref="BAD_REQUEST" /> to the <see cref="Client" />
/// </summary>
public static byte BAD_REQUEST = 50;
// public Protocol (){}
}
public enum CloseCode
{
NORMAL_CLOSURE = 1000,
GOING_AWAY = 1001,
NO_STATUS_RECEIVED = 1005,
ABNORMAL_CLOSURE = 1006,
CONSENTED = 4000,
SERVER_SHUTDOWN = 4001,
WITH_ERROR = 4002,
FAILED_TO_RECONNECT = 4003,
MAY_TRY_RECONNECT = 4010,
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/Protocol.cs.meta
================================================
fileFormatVersion: 2
guid: c8b23e2aef1384ae9af846c81bbe9b72
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/RoomAvailable.cs
================================================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Colyseus
{
/// <summary>
/// Wrapper class for important, shorthand Room information
/// </summary>
[Serializable]
public class RoomAvailable
{
/// <summary>
/// Current client count
/// </summary>
public int clients;
/// <summary>
/// Maximum clients in this room (may be Infinity when unlimited)
/// </summary>
public double maxClients;
/// <summary>
/// Room name
/// </summary>
public string name;
/// <summary>
/// Public host address (optional)
/// </summary>
public string publicAddress;
/// <summary>
/// Process ID used for connection
/// </summary>
public string processId;
/// <summary>
/// Room ID
/// </summary>
public string roomId;
// public object metadata;
}
/// <summary>
/// Get a collection of rooms
/// </summary>
/// <typeparam name="T">Type of room inherited from <see cref="RoomAvailable" /></typeparam>
[Serializable]
public class RoomAvailableCollection<T>
{
/// <summary>
/// Rooms in this collection
/// </summary>
public T[] rooms;
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/RoomAvailable.cs.meta
================================================
fileFormatVersion: 2
guid: 4844d7e0171e642b283b1c9bce462e70
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol.meta
================================================
fileFormatVersion: 2
guid: 1bde545c640ce40139e914607b757e39
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Room.cs
================================================
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Colyseus.Schema;
using GameDevWare.Serialization;
namespace Colyseus
{
using Decode = Schema.Utils.Decode;
using Encode = Schema.Utils.Encode;
public delegate void NoArgsEventHandler();
/// <summary>
/// Delegate function for when <see cref="Client" /> leaves this room.
/// </summary>
/// <param name="code">Reason for closure</param>
public delegate void CloseWithCodeEventHandler(int code); // , string reason
/// <summary>
/// Delegate function for when some error has been triggered in the room.
/// </summary>
/// <param name="code">Error code</param>
/// <param name="message">Error message</param>
public delegate void ErrorEventHandler(int code, string message);
/// <summary>
/// Interface for functions expected of any <see cref="Room{T}"></see>.
/// </summary>
public interface IRoom
{
event CloseWithCodeEventHandler OnLeave;
/// <summary>
/// Connection task
/// </summary>
/// <returns>Task that completes upon connection (or failure to connect)</returns>
Task Connect();
/// <summary>
/// Disconnection task
/// </summary>
/// <param name="consented">True if by user's choice, false otherwise</param>
/// <returns>Task that completes upon Leaving</returns>
Task Leave(bool consented);
}
[Serializable]
public class ReconnectionToken
{
public string RoomId;
public string Token;
}
/// <summary>
/// Configuration options for automatic reconnection behavior
/// </summary>
[Serializable]
public class ReconnectionOptions
{
/// <summary>
/// Whether automatic reconnection is enabled.
/// Set to false to disable automatic reconnection entirely.
/// </summary>
public bool Enabled = true;
/// <summary>
/// The maximum number of reconnection attempts.
/// </summary>
public int MaxRetries = 15;
/// <summary>
/// The minimum delay between reconnection attempts (in milliseconds).
/// </summary>
public int MinDelay = 100;
/// <summary>
/// The maximum delay between reconnection attempts (in milliseconds).
/// </summary>
public int MaxDelay = 5000;
/// <summary>
/// The minimum uptime of the room before reconnection attempts can be made (in milliseconds).
/// </summary>
public int MinUptime = 5000;
/// <summary>
/// The current number of reconnection attempts.
/// </summary>
public int RetryCount = 0;
/// <summary>
/// The initial delay between reconnection attempts (in milliseconds).
/// </summary>
public int Delay = 100;
/// <summary>
/// Whether the room is currently reconnecting.
/// </summary>
public bool IsReconnecting = false;
/// <summary>
/// The maximum number of enqueued messages to buffer.
/// </summary>
public int MaxEnqueuedMessages = 10;
/// <summary>
/// Buffer for messages sent while connection is not open.
/// These messages will be sent once the connection is re-established.
/// </summary>
public List<byte[]> EnqueuedMessages = new List<byte[]>();
/// <summary>
/// The function to calculate the delay between reconnection attempts.
/// </summary>
public Func<int, int, int> Backoff = ExponentialBackoff;
/// <summary>
/// Default exponential backoff function.
/// </summary>
/// <param name="attempt">The current attempt number.</param>
/// <param name="delay">The initial delay between reconnection attempts.</param>
/// <returns>The delay between reconnection attempts.</returns>
public static int ExponentialBackoff(int attempt, int delay)
{
return (int)Math.Floor(Math.Pow(2, attempt) * delay);
}
}
public class Room<T> : IRoom where T : Schema.Schema
{
/// <summary>
/// Delegate for room state changes
/// </summary>
/// <param name="state">The state change received</param>
/// <param name="isFirstState">Flag if first state received</param>
public delegate void StateChangeEventHandler(T state, bool isFirstState);
/// <summary>
/// Reference to the room's WebSocket Connection
/// </summary>
public Connection Connection;
/// <summary>
/// Room ID
/// </summary>
public string RoomId;
/// <summary>
/// Room name
/// </summary>
public string Name;
/// <summary>
/// Dictionary of the message handlers that have been provided to the room
/// </summary>
protected Dictionary<string, IMessageHandler> OnMessageHandlers =
new Dictionary<string, IMessageHandler>();
/// <summary>
/// Reference to the Serializer this room uses, determined and then generated based on the <see cref="SerializerId" />
/// </summary>
internal ISerializer<T> Serializer;
/// <summary>
/// ID to determine which kind of serializer this room uses (<see cref="SchemaSerializer{T}" /> or
/// <see cref="FossilDeltaSerializer" />)
/// </summary>
public string SerializerId;
/// <summary>
/// The room's session ID
/// </summary>
public string SessionId;
/// <summary>
/// Reconnection Token for this room session. (must be provided for client.Reconnect())
/// </summary>
public ReconnectionToken ReconnectionToken;
/// <summary>
/// Configuration options for automatic reconnection behavior.
/// </summary>
public ReconnectionOptions Reconnection = new ReconnectionOptions();
/// <summary>
/// Timestamp when the room was joined (used for minUptime check).
/// </summary>
protected long JoinedAtTime = 0;
/// <summary>
/// Timestamp of the last ping request (in milliseconds).
/// </summary>
private long _lastPingTime = 0;
/// <summary>
/// Callback to invoke when ping response is received.
/// </summary>
private Action<int> _pingCallback = null;
/// <summary>
/// Initializes a new instance of the <see cref="Room{T}" /> class.
/// It synchronizes state automatically with the server and send and receive messaes.
/// </summary>
/// <param name="name">The Room identifier</param>
public Room(string name)
{
Name = name;
OnLeave += (code) => Destroy();
#if UNITY_EDITOR
// Register handler for editor Room Inspector message type capture
// Uses reflection to avoid assembly reference from runtime to editor
OnMessage<Dictionary<string, object>>("__playground_message_types", (messageTypes) =>
{
try
{
var editorAssembly = System.Reflection.Assembly.Load("Colyseus.Editor");
if (editorAssembly != null)
{
var captureType = editorAssembly.GetType("Colyseus.Editor.RoomMessageType");
if (captureType != null)
{
var field = captureType.GetField("CapturedMessageTypes",
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
if (field != null)
{
var dict = field.GetValue(null) as Dictionary<string, Dictionary<string, object>>;
if (dict != null && !string.IsNullOrEmpty(RoomId))
{
dict[RoomId] = messageTypes;
}
}
}
}
}
catch
{
// Silently ignore if editor assembly is not available
}
});
#endif
}
/// <summary>
/// Getter for the <see cref="Room{T}" />'s current state
/// </summary>
public T State
{
get { return Serializer.GetState(); }
}
[Obsolete(".Id is deprecated. Please use .RoomId instead.")]
public string Id
{
get { return RoomId; }
}
/// <summary>
/// Occurs when <see cref="Client" /> leaves this room.
/// </summary>
public event CloseWithCodeEventHandler OnLeave;
/// <summary>
/// Implementation of <see cref="IRoom.Connect" />
/// </summary>
/// <returns>Response from <see cref="Connection"></see>.Connect()</returns>
public async Task Connect()
{
await Connection.Connect();
}
/// <summary>
/// Leave the room
/// </summary>
/// <param name="consented">If the user agreed to this disconnection</param>
/// <returns>Connection closure depending on user consent</returns>
public async Task Leave(bool consented = true)
{
if (!Connection.IsOpen) {
return;
}
if (RoomId != null)
{
var tcs = new TaskCompletionSource<int>();
void onLeave(int code) { tcs.TrySetResult(code); }
OnLeave += onLeave;
try
{
if (consented)
{
await Connection.Send(new[] {Protocol.LEAVE_ROOM});
}
else
{
await Connection.Close();
}
}
catch (OperationCanceledException)
{
// Connection already dropped — leave will complete via OnLeave
}
try
{
// Wait for the connection to fully close (with timeout to avoid hanging)
await Task.WhenAny(tcs.Task, Task.Delay(5000));
}
finally
{
OnLeave -= onLeave;
}
}
else
{
OnLeave?.Invoke((int)CloseCode.CONSENTED);
}
}
// Internal OnJoin event. It is used by Client.cs during matchmaking.
internal event NoArgsEventHandler OnJoin;
// <summary>
/// Occurs when the room connection is dropped unexpectedly.
/// Use to notify the user that a reconnection is being made.
/// </summary>
public event CloseWithCodeEventHandler OnDrop;
/// <summary>
/// Occurs when automatically reconnected to the room after a connection drop.
/// </summary>
public event NoArgsEventHandler OnReconnect;
/// <summary>
/// Occurs when some error has been triggered in the room.
/// </summary>
public event ErrorEventHandler OnError;
/// <summary>
/// Occurs after applying the patched state on this <see cref="Room{T}" />.
/// </summary>
public event StateChangeEventHandler OnStateChange;
/// <summary>
/// Called by the <see cref="Client" /> upon connection to a room
/// </summary>
/// <param name="connection">The connection created by the client</param>
public void SetConnection(Connection connection)
{
Connection = connection;
Connection.OnClose += code => {
if (JoinedAtTime == 0) {
OnError?.Invoke(code, "Connection closed before joining room");
return;
}
if (
code == (int) CloseCode.NO_STATUS_RECEIVED ||
code == (int) CloseCode.ABNORMAL_CLOSURE ||
code == (int) CloseCode.GOING_AWAY ||
code == (int) CloseCode.MAY_TRY_RECONNECT
) {
OnDrop?.Invoke(code);
HandleReconnection(code);
} else {
OnLeave?.Invoke(code);
}
};
// TODO: expose WebSocket error code!
// Connection.OnError += (code, message) => OnError?.Invoke(code, message);
Connection.OnError += message => this.OnError?.Invoke(0, message);
Connection.OnMessage += bytes => this.ParseMessage(bytes);
}
/// <summary>
/// Response to state changes received as messages
/// </summary>
/// ///
/// <remarks>Invokes everything subscribed to <see cref="OnStateChange" /></remarks>
/// <param name="encodedState">Byte array of the new state data</param>
/// <param name="offset">Offset to provide the room's <see cref="Serializer" /></param>
public void SetState(byte[] encodedState, int offset)
{
Serializer.SetState(encodedState, offset);
OnStateChange?.Invoke(Serializer.GetState(), true);
}
/// <summary>
/// Send a message by number type, without payload
/// </summary>
/// <param name="type">Message type</param>
public async Task Send(byte type)
{
byte[] bytes = new[] {Protocol.ROOM_DATA, type};
// If connection is not open, buffer the message
if (!Connection.IsOpen)
{
EnqueueMessage(bytes);
return;
}
await Connection.Send(bytes);
}
/// <summary>
/// Send a message by number type with payload
/// </summary>
/// <param name="type">Message type</param>
/// <param name="message">Message payload</param>
public async Task Send(byte type, object message)
{
MemoryStream serializationOutput = new MemoryStream();
MsgPack.Serialize(message, serializationOutput, SerializationOptions.SuppressTypeInformation);
byte[] initialBytes = {Protocol.ROOM_DATA, type};
byte[] encodedMessage = serializationOutput.ToArray();
byte[] bytes = new byte[initialBytes.Length + encodedMessage.Length];
Buffer.BlockCopy(initialBytes, 0, bytes, 0, initialBytes.Length);
Buffer.BlockCopy(encodedMessage, 0, bytes, initialBytes.Length, encodedMessage.Length);
// If connection is not open, buffer the message
if (!Connection.IsOpen)
{
EnqueueMessage(bytes);
return;
}
await Connection.Send(bytes);
}
/// <summary>
/// Send a message by string type, without payload
/// </summary>
/// <param name="type">Message type</param>
public async Task Send(string type)
{
byte[] encodedType = Encoding.UTF8.GetBytes(type);
byte[] initialBytes = Encode.getInitialBytesFromEncodedType(encodedType, Protocol.ROOM_DATA);
byte[] bytes = new byte[initialBytes.Length + encodedType.Length];
Buffer.BlockCopy(initialBytes, 0, bytes, 0, initialBytes.Length);
Buffer.BlockCopy(encodedType, 0, bytes, initialBytes.Length, encodedType.Length);
// If connection is not open, buffer the message
if (!Connection.IsOpen)
{
EnqueueMessage(bytes);
return;
}
await Connection.Send(bytes);
}
/// <summary>
/// Send a message by string type with payload
/// </summary>
/// <param name="type">Message type</param>
/// <param name="message">Message payload</param>
public async Task Send(string type, object message)
{
MemoryStream serializationOutput = new MemoryStream();
MsgPack.Serialize(message, serializationOutput, SerializationOptions.SuppressTypeInformation);
byte[] encodedType = Encoding.UTF8.GetBytes(type);
byte[] initialBytes = Encode.getInitialBytesFromEncodedType(encodedType, Protocol.ROOM_DATA);
byte[] encodedMessage = serializationOutput.ToArray();
byte[] bytes = new byte[encodedType.Length + encodedMessage.Length + initialBytes.Length];
Buffer.BlockCopy(initialBytes, 0, bytes, 0, initialBytes.Length);
Buffer.BlockCopy(encodedType, 0, bytes, initialBytes.Length, encodedType.Length);
Buffer.BlockCopy(encodedMessage, 0, bytes, initialBytes.Length + encodedType.Length, encodedMessage.Length);
// If connection is not open, buffer the message
if (!Connection.IsOpen)
{
EnqueueMessage(bytes);
return;
}
await Connection.Send(bytes);
}
/// <summary>
/// Send a message by number type with raw bytes payload
/// </summary>
/// <param name="type">Message type</param>
/// <param name="bytes">Message payload</param>
public async Task SendBytes(byte type, byte[] bytes)
{
byte[] initialBytes = { Protocol.ROOM_DATA_BYTES, type };
byte[] bytesToSend = new byte[initialBytes.Length + bytes.Length];
Buffer.BlockCopy(initialBytes, 0, bytesToSend, 0, initialBytes.Length);
Buffer.BlockCopy(bytes, 0, bytesToSend, initialBytes.Length, bytes.Length);
// If connection is not open, buffer the message
if (!Connection.IsOpen)
{
EnqueueMessage(bytesToSend);
return;
}
await Connection.Send(bytesToSend);
}
/// <summary>
/// Send a message by string type with raw bytes payload
/// </summary>
/// <param name="type">Message type</param>
/// <param name="bytes">Message payload</param>
public async Task SendBytes(string type, byte[] bytes)
{
byte[] encodedType = Encoding.UTF8.GetBytes(type);
byte[] initialBytes = Encode.getInitialBytesFromEncodedType(encodedType, Protocol.ROOM_DATA_BYTES);
byte[] bytesToSend = new byte[encodedType.Length + bytes.Length + initialBytes.Length];
Buffer.BlockCopy(initialBytes, 0, bytesToSend, 0, initialBytes.Length);
Buffer.BlockCopy(encodedType, 0, bytesToSend, initialBytes.Length, encodedType.Length);
Buffer.BlockCopy(bytes, 0, bytesToSend, initialBytes.Length + encodedType.Length, bytes.Length);
// If connection is not open, buffer the message
if (!Connection.IsOpen)
{
EnqueueMessage(bytesToSend);
return;
}
await Connection.Send(bytesToSend);
}
/// <summary>
/// Send a ping to the server and measure round-trip latency.
/// </summary>
/// <param name="callback">Callback invoked with the round-trip time in milliseconds</param>
public async void Ping(Action<int> callback)
{
// Skip if connection is not open
if (Connection == null || !Connection.IsOpen)
{
return;
}
_lastPingTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
_pingCallback = callback;
await Connection.Send(new[] { Protocol.PING });
}
/// <summary>
/// Method to add new message handlers to the room
/// </summary>
/// <param name="type">The type of message received</param>
/// <param name="handler"></param>
/// <typeparam name="MessageType">The type of object this message should respond with</typeparam>
public void OnMessage<MessageType>(string type, Action<MessageType> handler)
{
OnMessageHandlers.Add(type, new MessageHandler<MessageType>
{
Action = handler
});
}
/// <summary>
/// Method to add new message handlers to the room
/// </summary>
/// <param name="type">The type of message received</param>
/// <param name="handler"></param>
/// <typeparam name="MessageType">The type of object this message should respond with</typeparam>
public void OnMessage<MessageType>(byte type, Action<MessageType> handler)
{
OnMessageHandlers.Add("i" + type, new MessageHandler<MessageType>
{
Action = handler
});
}
/// <summary>
/// The function that will be called when the <see cref="Connection" /> receives a message
/// </summary>
/// <param name="bytes">The message as provided from the <see cref="Connection" /></param>
protected async void ParseMessage(byte[] bytes)
{
byte code = bytes[0];
if (code == Protocol.JOIN_ROOM)
{
int offset = 1;
var reconnectionToken = Encoding.UTF8.GetString(bytes, offset + 1, bytes[offset]);
offset += reconnectionToken.Length + 1;
SerializerId = Encoding.UTF8.GetString(bytes, offset + 1, bytes[offset]);
offset += SerializerId.Length + 1;
if (SerializerId == "schema")
{
try
{
Serializer = new SchemaSerializer<T>();
}
catch (Exception e)
{
DisplaySerializerErrorHelp(e,
"Consider using the \"schema-codegen\" and providing the same room state for matchmaking instead of \"" +
typeof(T).Name + "\"");
}
}
else if (SerializerId == "fossil-delta")
{
ColyseusContext.Logger.LogError(
"FossilDelta Serialization has been deprecated. It is highly recommended that you update your code to use the Schema Serializer. Otherwise, you must use an earlier version of the Colyseus plugin");
}
else
{
Serializer = (ISerializer<T>) new NoneSerializer();
}
if (bytes.Length > offset)
{
try {
Serializer.Handshake(bytes, offset);
}
catch (Exception e)
{
await Leave(false);
OnError?.Invoke(ErrorCode.SCHEMA_MISMATCH, e.Message);
return;
}
}
ReconnectionToken = new ReconnectionToken()
{
RoomId = RoomId,
Token = reconnectionToken
};
if (JoinedAtTime == 0)
{
// First time joining
JoinedAtTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
OnJoin?.Invoke();
}
else
{
// Successful reconnection
ColyseusContext.Logger.Log("[Colyseus reconnection]: Reconnection successful!");
Reconnection.IsReconnecting = false;
OnReconnect?.Invoke();
}
// Acknowledge JOIN_ROOM
await Connection.Send(new[] {Protocol.JOIN_ROOM});
// Flush any enqueued messages that were buffered while disconnected
await FlushEnqueuedMessages();
}
else if (code == Protocol.ERROR)
{
Iterator it = new Iterator {Offset = 1};
float errorCode = Decode.DecodeNumber(bytes, it);
string errorMessage = Decode.DecodeString(bytes, it);
OnError?.Invoke((int) errorCode, errorMessage);
}
else if (code == Protocol.LEAVE_ROOM)
{
await Leave();
}
else if (code == Protocol.ROOM_STATE)
{
SetState(bytes, 1);
}
else if (code == Protocol.ROOM_STATE_PATCH)
{
Patch(bytes, 1);
}
else if (code == Protocol.PING)
{
long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
_pingCallback?.Invoke((int)(now - _lastPingTime));
_pingCallback = null;
}
else if (code == Protocol.ROOM_DATA || code == Protocol.ROOM_DATA_BYTES)
{
IMessageHandler handler = null;
object type;
Iterator it = new Iterator {Offset = 1};
if (Decode.NumberCheck(bytes, it))
{
type = Decode.DecodeNumber(bytes, it);
OnMessageHandlers.TryGetValue("i" + type, out handler);
}
else
{
type = Decode.DecodeString(bytes, it);
OnMessageHandlers.TryGetValue(type.ToString(), out handler);
}
if (handler != null)
{
object message = null;
if ( code == Protocol.ROOM_DATA )
{
//
// MsgPack deserialization can be optimized:
// https://github.com/deniszykov/msgpack-unity3d/issues/23
//
message = bytes.Length > it.Offset
? MsgPack.Deserialize(handler.Type,
new MemoryStream(bytes, it.Offset, bytes.Length - it.Offset, false))
: null;
}
else if ( code == Protocol.ROOM_DATA_BYTES )
{
message = new byte[bytes.Length - it.Offset];
Buffer.BlockCopy(bytes, it.Offset, (byte[])message, 0, bytes.Length - it.Offset);
}
handler.Invoke(message);
}
else if (type != null && !type.ToString().StartsWith("__"))
{
ColyseusContext.Logger.LogWarning("room.OnMessage() not registered for: '" + type + "'");
}
}
}
/// <summary>
/// Update the state with just the new changes to the state
/// </summary>
/// <remarks>Invokes everything subscribed to <see cref="OnStateChange" /></remarks>
/// <param name="delta">The updates to the state</param>
/// <param name="offset">Offset to provide the room's <see cref="Serializer" /></param>
protected void Patch(byte[] delta, int offset)
{
Serializer.Patch(delta, offset);
OnStateChange?.Invoke(Serializer.GetState(), false);
}
/// <summary>
/// Helper function to display errors with de-serializing messages from server
/// </summary>
/// <param name="e">Exception information</param>
/// <param name="helpMessage">Additional information to display</param>
/// <exception cref="Exception">Throws <paramref name="e" /></exception>
protected void DisplaySerializerErrorHelp(Exception e, string helpMessage)
{
ColyseusContext.Logger.LogWarning("The serializer from the server is: '" + SerializerId + "'. " + helpMessage);
throw e;
}
private void HandleReconnection(int code)
{
if (!Reconnection.Enabled)
{
OnLeave?.Invoke(code);
return;
}
// Check minimum uptime before allowing reconnection
long currentTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
if (currentTime - JoinedAtTime < Reconnection.MinUptime)
{
ColyseusContext.Logger.Log($"[Colyseus reconnection]: Room not up long enough for auto-reconnect (min uptime: {Reconnection.MinUptime}ms)");
OnLeave?.Invoke((int)CloseCode.ABNORMAL_CLOSURE);
return;
}
if (!Reconnection.IsReconnecting)
{
Reconnection.RetryCount = 0;
Reconnection.IsReconnecting = true;
}
_ = RetryReconnection();
}
private async Task RetryReconnection()
{
if (Reconnection.RetryCount >= Reconnection.MaxRetries)
{
// No more retries
ColyseusContext.Logger.Log($"[Colyseus reconnection]: Reconnection failed after {Reconnection.MaxRetries} attempts.");
Reconnection.IsReconnecting = false;
OnLeave?.Invoke((int)CloseCode.FAILED_TO_RECONNECT);
return;
}
Reconnection.RetryCount++;
int delay = Math.Min(Reconnection.MaxDelay,
Math.Max(Reconnection.MinDelay,
Reconnection.Backoff(Reconnection.RetryCount, Reconnection.Delay)));
ColyseusContext.Logger.Log($"[Colyseus reconnection]: Will retry in {delay / 1000f:F1} seconds...");
await Task.Delay(delay);
ColyseusContext.Logger.Log($"[Colyseus reconnection]: Re-establishing sessionId '{SessionId}' with roomId '{RoomId}'... (attempt {Reconnection.RetryCount} of {Reconnection.MaxRetries})");
try
{
await Connection.Reconnect(ReconnectionToken.Token);
}
catch (Exception e)
{
ColyseusContext.Logger.Log($"[Colyseus reconnection]: Reconnect failed - {e.Message}");
_ = RetryReconnection();
}
}
/// <summary>
/// Enqueue a message to be sent when the connection is re-established.
/// </summary>
/// <param name="data">The message data to enqueue</param>
private void EnqueueMessage(byte[] data)
{
Reconnection.EnqueuedMessages.Add(data);
if (Reconnection.EnqueuedMessages.Count > Reconnection.MaxEnqueuedMessages)
{
Reconnection.EnqueuedMessages.RemoveAt(0);
}
}
/// <summary>
/// Flush all enqueued messages after reconnection.
/// </summary>
private async Task FlushEnqueuedMessages()
{
if (Reconnection.EnqueuedMessages.Count == 0) return;
foreach (var message in Reconnection.EnqueuedMessages)
{
await Connection.Send(message);
}
Reconnection.EnqueuedMessages.Clear();
}
private void Destroy()
{
Serializer.Teardown();
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Room.cs.meta
================================================
fileFormatVersion: 2
guid: b196046f3733f4667a642ce7d71263ae
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/BigEndianBitConverter.cs
================================================
/*
"Miscellaneous Utility Library" Software Licence
Version 1.0
Copyright (c) 2004-2008 Jon Skeet and Marc Gravell.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment:
"This product includes software developed by Jon Skeet
and Marc Gravell. Contact skeet@pobox.com, or see
http://www.pobox.com/~skeet/)."
Alternately, this acknowledgment may appear in the software itself,
if and wherever such third-party acknowledgments normally appear.
4. The name "Miscellaneous Utility Library" must not be used to endorse
or promote products derived from this software without prior written
permission. For written permission, please contact skeet@pobox.com.
5. Products derived from this software may not be called
"Miscellaneous Utility Library", nor may "Miscellaneous Utility Library"
appear in their name, without prior written permission of Jon Skeet.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL JON SKEET BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
namespace MiscUtil.Conversion
{
/// <summary>
/// Implementation of EndianBitConverter which converts to/from big-endian
/// byte arrays.
/// </summary>
public sealed class BigEndianBitConverter : EndianBitConverter
{
/// <summary>
/// Indicates the byte order ("endianess") in which data is converted using this class.
/// </summary>
/// <remarks>
/// Different computer architectures store data using different byte orders. "Big-endian"
/// means the most significant byte is on the left end of a word. "Little-endian" means the
/// most significant byte is on the right end of a word.
/// </remarks>
/// <returns>true if this converter is little-endian, false otherwise.</returns>
public sealed override bool IsLittleEndian()
{
return false;
}
/// <summary>
/// Indicates the byte order ("endianess") in which data is converted using this class.
/// </summary>
public sealed override Endianness Endianness
{
get { return Endianness.BigEndian; }
}
/// <summary>
/// Copies the specified number of bytes from value to buffer, starting at index.
/// </summary>
/// <param name="value">The value to copy</param>
/// <param name="bytes">The number of bytes to copy</param>
/// <param name="buffer">The buffer to copy the bytes into</param>
/// <param name="index">The index to start at</param>
protected override void CopyBytesImpl(long value, int bytes, byte[] buffer, int index)
{
int endOffset = index+bytes-1;
for (int i=0; i < bytes; i++)
{
buffer[endOffset-i] = unchecked((byte)(value&0xff));
value = value >> 8;
}
}
/// <summary>
/// Returns a value built from the specified number of bytes from the given buffer,
/// starting at index.
/// </summary>
/// <param name="buffer">The data in byte array format</param>
/// <param name="startIndex">The first index to use</param>
/// <param name="bytesToConvert">The number of bytes to use</param>
/// <returns>The value built from the given bytes</returns>
protected override long FromBytes(byte[] buffer, int startIndex, int bytesToConvert)
{
long ret = 0;
for (int i=0; i < bytesToConvert; i++)
{
ret = unchecked((ret << 8) | buffer[startIndex+i]);
}
return ret;
}
}
}
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/BigEndianBitConverter.cs.meta
================================================
fileFormatVersion: 2
guid: d2db5d6cc28318447a02c83fcba42a1f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
================================================
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/DoubleConverter.cs
================================================
/*
"Miscellaneous Utility Library" Software Licence
Version 1.0
Copyright (c) 2004-2008 Jon Skeet and Marc Gravell.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment:
"This product includes software developed by Jon Skeet
and Marc Gravell. Contact skeet@pobox.com, or see
http://www.pobox.com/~skeet/)."
Alternately, this acknowledgment may appear in the software itself,
if and wherever such third-party acknowledgments normally appear.
4. The name "Miscellaneous Utility Library" must not be used to endorse
or promote products derived from this software without prior written
permission. For written permission, please contact skeet@pobox.com.
5. Products derived from this software may not be called
"Miscellaneous Utility Library", nor may "Miscellaneous Utility Library"
appear in their name, without prior written permission of Jon Skeet.
THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL JON SKEET BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Globalization;
namespace MiscUtil.Conversion
{
/// <summary>
/// A class to allow the conversion of doubles to string representations of
/// their exact decimal values. The implementation aims for readability over
/// efficiency.
/// </summary>
public class DoubleConverter
{
/// <summary>
/// Converts the given double to a string representation of its
/// exact decimal value.
/// </summary>
/// <param name="d">The double to convert.</param>
/// <returns>A string representation of the double's exact decimal value.</returns>
public static string ToExactString (double d)
{
if (double.IsPositiveInfinity(d))
return "+Infinity";
if (double.IsNegativeInfinity(d))
return "-Infinity";
if (double.IsNaN(d))
return "NaN";
// Translate the double into sign, exponent and mantissa.
long bits = BitConverter.DoubleToInt64Bits(d);
bool negative = (bits < 0);
int exponent = (int) ((bits >> 52) & 0x7ffL);
long mantissa = bits & 0xfffffffffffffL;
// Subnormal numbers; exponent is effectively one higher,
// but there's no extra normalisation bit in the mantissa
if (exponent==0)
{
exponent++;
}
// Normal numbers; leave exponent as it is but add extra
// bit to the front of the mantissa
else
{
mantissa = mantissa | (1L<<52);
}
// Bias the exponent. It's actually biased by 1023, but we're
// treating the mantissa as m.0 rather than 0.m, so we need
// to subtract another 52 from it.
exponent -= 1075;
if (mantissa == 0)
{
return "0";
}
/* Normalize */
while((mantissa & 1) == 0)
{ /* i.e., Mantissa is even */
mantissa >>= 1;
exponent++;
}
// Construct a new decimal expansion with the mantissa
ArbitraryDecimal ad = new ArbitraryDecimal (mantissa);
// If the exponent is less than 0, we need to repeatedly
// divide by 2 - which is the equivalent of multiplying
// by 5 and dividing by 10.
if (exponent < 0)
{
for (int i=0; i < -exponent; i++)
ad.MultiplyBy(5);
ad.Shift(-exponent);
}
// Otherwise, we need to repeatedly multiply by 2
else
{
for (int i=0; i < exponent; i++)
ad.MultiplyBy(2);
}
// Finally, return the string with an appropriate sign
if (negative)
return "-"+ad.ToString();
else
return ad.ToString();
}
/// <summary>
/// Private class used for manipulating sequences of decimal digits.
/// </summary>
class ArbitraryDecimal
{
/// <summary>Digits in the decimal expansion, one byte per digit</summary>
byte[] digits;
/// <summary>
/// How many digits are *after* the decimal point
/// </summary>
int decimalPoint=0;
/// <summary>
/// Constructs an arbitrary decimal expansion from the given long.
/// The long must not be negative.
/// </summary>
internal ArbitraryDecimal (long x)
{
string tmp = x.ToString(CultureInfo.InvariantCulture);
digits = new byte[tmp.Length];
for (int i=0; i < tmp.Length; i++)
digits[i] = (byte) (tmp[i]-'0');
Normalize();
}
/// <summary>
/// Multiplies the current expansion by the given amount, which should
/// only be 2 or 5.
/// </summary>
internal void MultiplyBy(int amount)
{
byte[] result = new byte[digits.Length+1];
for (int i=digits.Length-1; i >= 0; i--)
{
int resultDigit = digits[i]*amount+result[i+1];
result[i]=(byte)(resultDigit/10);
result[i+1]=(byte)(resultDigit%10);
}
if (result[0] != 0)
{
digits=result;
}
else
{
Array.Copy (result, 1, digits, 0, digits.Length);
}
Normalize();
}
/// <summary>
/// Shifts the decimal point; a negative value makes
/// the decimal expansion bigger (as fewer digits come after the
/// decimal place) and a positive value makes the decimal
/// expansion smaller.
/// </summary>
internal void Shift (int amount)
{
decimalPoint += amount;
}
/// <summary>
/// Removes leading/trailing zeroes from
gitextract_6zht0_qm/ ├── .editorconfig ├── .github/ │ ├── FUNDING.yml │ ├── ISSUE_TEMPLATE.md │ └── workflows/ │ ├── nuget-publish.yml │ ├── tests.yml │ └── upmsemver.yml ├── .gitignore ├── Assets/ │ ├── Colyseus/ │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── Documentation~/ │ │ │ ├── .gitkeep │ │ │ └── GettingStarted.md │ │ ├── Editor/ │ │ │ ├── Colyseus.Editor.asmdef │ │ │ ├── Colyseus.Editor.asmdef.meta │ │ │ ├── README.md │ │ │ ├── README.md.meta │ │ │ ├── RoomInspector.cs │ │ │ └── RoomInspector.cs.meta │ │ ├── Editor.meta │ │ ├── LICENSE │ │ ├── LICENSE.meta │ │ ├── Runtime/ │ │ │ ├── Colyseus/ │ │ │ │ ├── Auth.cs │ │ │ │ ├── Auth.cs.meta │ │ │ │ ├── Client.cs │ │ │ │ ├── Client.cs.meta │ │ │ │ ├── Connection.cs │ │ │ │ ├── Connection.cs.meta │ │ │ │ ├── HTTP.cs │ │ │ │ ├── HTTP.cs.meta │ │ │ │ ├── Manager.cs │ │ │ │ ├── Manager.cs.meta │ │ │ │ ├── Platform/ │ │ │ │ │ ├── ColyseusContext.cs │ │ │ │ │ ├── ColyseusContext.cs.meta │ │ │ │ │ ├── Defaults/ │ │ │ │ │ │ ├── ConsoleLogger.cs │ │ │ │ │ │ ├── ConsoleLogger.cs.meta │ │ │ │ │ │ ├── DefaultHttpClient.cs │ │ │ │ │ │ ├── DefaultHttpClient.cs.meta │ │ │ │ │ │ ├── InMemoryTokenStorage.cs │ │ │ │ │ │ └── InMemoryTokenStorage.cs.meta │ │ │ │ │ ├── Defaults.meta │ │ │ │ │ ├── IHttpClient.cs │ │ │ │ │ ├── IHttpClient.cs.meta │ │ │ │ │ ├── ILogger.cs │ │ │ │ │ ├── ILogger.cs.meta │ │ │ │ │ ├── ITokenStorage.cs │ │ │ │ │ ├── ITokenStorage.cs.meta │ │ │ │ │ ├── IWebSocket.cs │ │ │ │ │ ├── IWebSocket.cs.meta │ │ │ │ │ ├── PreserveAttribute.cs │ │ │ │ │ ├── PreserveAttribute.cs.meta │ │ │ │ │ ├── Unity/ │ │ │ │ │ │ ├── UnityHttpClient.cs │ │ │ │ │ │ ├── UnityHttpClient.cs.meta │ │ │ │ │ │ ├── UnityLogger.cs │ │ │ │ │ │ ├── UnityLogger.cs.meta │ │ │ │ │ │ ├── UnityPlatform.cs │ │ │ │ │ │ ├── UnityPlatform.cs.meta │ │ │ │ │ │ ├── UnitySettings.cs │ │ │ │ │ │ ├── UnitySettings.cs.meta │ │ │ │ │ │ ├── UnityTokenStorage.cs │ │ │ │ │ │ └── UnityTokenStorage.cs.meta │ │ │ │ │ └── Unity.meta │ │ │ │ ├── Platform.meta │ │ │ │ ├── Protocol/ │ │ │ │ │ ├── ErrorCode.cs │ │ │ │ │ ├── ErrorCode.cs.meta │ │ │ │ │ ├── MatchMakeResponse.cs │ │ │ │ │ ├── MatchMakeResponse.cs.meta │ │ │ │ │ ├── MessageHandler.cs │ │ │ │ │ ├── MessageHandler.cs.meta │ │ │ │ │ ├── Protocol.cs │ │ │ │ │ ├── Protocol.cs.meta │ │ │ │ │ ├── RoomAvailable.cs │ │ │ │ │ └── RoomAvailable.cs.meta │ │ │ │ ├── Protocol.meta │ │ │ │ ├── Room.cs │ │ │ │ ├── Room.cs.meta │ │ │ │ ├── Serializer/ │ │ │ │ │ ├── Conversion/ │ │ │ │ │ │ ├── BigEndianBitConverter.cs │ │ │ │ │ │ ├── BigEndianBitConverter.cs.meta │ │ │ │ │ │ ├── DoubleConverter.cs │ │ │ │ │ │ ├── DoubleConverter.cs.meta │ │ │ │ │ │ ├── EndianBitConverter.cs │ │ │ │ │ │ ├── EndianBitConverter.cs.meta │ │ │ │ │ │ ├── Endianness.cs │ │ │ │ │ │ ├── Endianness.cs.meta │ │ │ │ │ │ ├── LittleEndianBitConverter.cs │ │ │ │ │ │ └── LittleEndianBitConverter.cs.meta │ │ │ │ │ ├── Conversion.meta │ │ │ │ │ ├── NoneSerializer.cs │ │ │ │ │ ├── NoneSerializer.cs.meta │ │ │ │ │ ├── Schema/ │ │ │ │ │ │ ├── Callbacks/ │ │ │ │ │ │ │ ├── Callbacks.cs │ │ │ │ │ │ │ └── Callbacks.cs.meta │ │ │ │ │ │ ├── Callbacks.meta │ │ │ │ │ │ ├── Decoder.cs │ │ │ │ │ │ ├── Decoder.cs.meta │ │ │ │ │ │ ├── DynamicSchema.cs │ │ │ │ │ │ ├── DynamicSchema.cs.meta │ │ │ │ │ │ ├── ReferenceTracker.cs │ │ │ │ │ │ ├── ReferenceTracker.cs.meta │ │ │ │ │ │ ├── Schema.cs │ │ │ │ │ │ ├── Schema.cs.meta │ │ │ │ │ │ ├── TypeContext.cs │ │ │ │ │ │ ├── TypeContext.cs.meta │ │ │ │ │ │ ├── Types/ │ │ │ │ │ │ │ ├── ArraySchema.cs │ │ │ │ │ │ │ ├── ArraySchema.cs.meta │ │ │ │ │ │ │ ├── CustomType.cs │ │ │ │ │ │ │ ├── CustomType.cs.meta │ │ │ │ │ │ │ ├── MapSchema.cs │ │ │ │ │ │ │ ├── MapSchema.cs.meta │ │ │ │ │ │ │ ├── Reflection.cs │ │ │ │ │ │ │ └── Reflection.cs.meta │ │ │ │ │ │ ├── Types.meta │ │ │ │ │ │ ├── Utils/ │ │ │ │ │ │ │ ├── Decode.cs │ │ │ │ │ │ │ ├── Decode.cs.meta │ │ │ │ │ │ │ ├── Encode.cs │ │ │ │ │ │ │ └── Encode.cs.meta │ │ │ │ │ │ └── Utils.meta │ │ │ │ │ ├── Schema.meta │ │ │ │ │ ├── SchemaSerializer.cs │ │ │ │ │ ├── SchemaSerializer.cs.meta │ │ │ │ │ ├── Serializer.cs │ │ │ │ │ └── Serializer.cs.meta │ │ │ │ ├── Serializer.meta │ │ │ │ ├── Settings/ │ │ │ │ │ ├── Settings.cs │ │ │ │ │ └── Settings.cs.meta │ │ │ │ ├── Settings.meta │ │ │ │ ├── Transport/ │ │ │ │ │ ├── WebSocket.cs │ │ │ │ │ ├── WebSocket.cs.meta │ │ │ │ │ ├── WebSocketDispatchLoop.cs │ │ │ │ │ └── WebSocketDispatchLoop.cs.meta │ │ │ │ ├── Transport.meta │ │ │ │ ├── Utils/ │ │ │ │ │ ├── Exceptions.cs │ │ │ │ │ ├── Exceptions.cs.meta │ │ │ │ │ ├── ExtensionMethods.cs │ │ │ │ │ ├── ExtensionMethods.cs.meta │ │ │ │ │ ├── ObjectExtensions.cs │ │ │ │ │ ├── ObjectExtensions.cs.meta │ │ │ │ │ ├── UnityWebRequestAwaiter.cs │ │ │ │ │ └── UnityWebRequestAwaiter.cs.meta │ │ │ │ └── Utils.meta │ │ │ ├── Colyseus.meta │ │ │ ├── ColyseusSDK.asmdef │ │ │ ├── ColyseusSDK.asmdef.meta │ │ │ ├── Editor Default Resources/ │ │ │ │ ├── .gitkeep │ │ │ │ ├── Icons/ │ │ │ │ │ ├── ColyseusSettings.png.import │ │ │ │ │ ├── ColyseusSettings.png.import.meta │ │ │ │ │ └── ColyseusSettings.png.meta │ │ │ │ └── Icons.meta │ │ │ ├── Editor Default Resources.meta │ │ │ ├── Example.meta │ │ │ ├── Example~/ │ │ │ │ ├── ColyseusNetworkManager.cs │ │ │ │ ├── ColyseusNetworkManager.cs.meta │ │ │ │ ├── ConnectionManager.cs │ │ │ │ ├── ConnectionManager.cs.meta │ │ │ │ ├── ExampleScene.unity │ │ │ │ ├── ExampleScene.unity.meta │ │ │ │ ├── MyServerSettings.asset │ │ │ │ ├── MyServerSettings.asset.meta │ │ │ │ ├── Schema/ │ │ │ │ │ ├── Item.cs │ │ │ │ │ ├── Item.cs.meta │ │ │ │ │ ├── MyRoomState.cs │ │ │ │ │ ├── MyRoomState.cs.meta │ │ │ │ │ ├── Player.cs │ │ │ │ │ └── Player.cs.meta │ │ │ │ └── Schema.meta │ │ │ ├── GameDevWare.Serialization/ │ │ │ │ ├── ArrayExtensions.cs │ │ │ │ ├── ArrayExtensions.cs.meta │ │ │ │ ├── GenerateTypeSerializerAttribute.cs │ │ │ │ ├── GenerateTypeSerializerAttribute.cs.meta │ │ │ │ ├── IJsonReader.cs │ │ │ │ ├── IJsonReader.cs.meta │ │ │ │ ├── IJsonWriter.cs │ │ │ │ ├── IJsonWriter.cs.meta │ │ │ │ ├── IValueInfo.cs │ │ │ │ ├── IValueInfo.cs.meta │ │ │ │ ├── IndexedDictionary.cs │ │ │ │ ├── IndexedDictionary.cs.meta │ │ │ │ ├── Json.cs │ │ │ │ ├── Json.cs.meta │ │ │ │ ├── JsonMember.cs │ │ │ │ ├── JsonMember.cs.meta │ │ │ │ ├── JsonReader.cs │ │ │ │ ├── JsonReader.cs.meta │ │ │ │ ├── JsonReaderExtentions.cs │ │ │ │ ├── JsonReaderExtentions.cs.meta │ │ │ │ ├── JsonSerializationException.cs │ │ │ │ ├── JsonSerializationException.cs.meta │ │ │ │ ├── JsonStreamReader.cs │ │ │ │ ├── JsonStreamReader.cs.meta │ │ │ │ ├── JsonStreamWriter.cs │ │ │ │ ├── JsonStreamWriter.cs.meta │ │ │ │ ├── JsonStringBuilderReader.cs │ │ │ │ ├── JsonStringBuilderReader.cs.meta │ │ │ │ ├── JsonStringBuilderWriter.cs │ │ │ │ ├── JsonStringBuilderWriter.cs.meta │ │ │ │ ├── JsonStringReader.cs │ │ │ │ ├── JsonStringReader.cs.meta │ │ │ │ ├── JsonTextReader.cs │ │ │ │ ├── JsonTextReader.cs.meta │ │ │ │ ├── JsonTextWriter.cs │ │ │ │ ├── JsonTextWriter.cs.meta │ │ │ │ ├── JsonToken.cs │ │ │ │ ├── JsonToken.cs.meta │ │ │ │ ├── JsonUtils.cs │ │ │ │ ├── JsonUtils.cs.meta │ │ │ │ ├── JsonWriter.cs │ │ │ │ ├── JsonWriter.cs.meta │ │ │ │ ├── JsonWriterExtentions.cs │ │ │ │ ├── JsonWriterExtentions.cs.meta │ │ │ │ ├── MessagePack/ │ │ │ │ │ ├── BigEndianBitConverter.cs │ │ │ │ │ ├── BigEndianBitConverter.cs.meta │ │ │ │ │ ├── DefaultMsgPackExtensionTypeHandler.cs │ │ │ │ │ ├── DefaultMsgPackExtensionTypeHandler.cs.meta │ │ │ │ │ ├── EndianBitConverter.cs │ │ │ │ │ ├── EndianBitConverter.cs.meta │ │ │ │ │ ├── Endianness.cs │ │ │ │ │ ├── Endianness.cs.meta │ │ │ │ │ ├── LittleEndianBitConverter.cs │ │ │ │ │ ├── LittleEndianBitConverter.cs.meta │ │ │ │ │ ├── MsgPackExtensionType.cs │ │ │ │ │ ├── MsgPackExtensionType.cs.meta │ │ │ │ │ ├── MsgPackExtensionTypeHandler.cs │ │ │ │ │ ├── MsgPackExtensionTypeHandler.cs.meta │ │ │ │ │ ├── MsgPackReader.cs │ │ │ │ │ ├── MsgPackReader.cs.meta │ │ │ │ │ ├── MsgPackTimestamp.cs │ │ │ │ │ ├── MsgPackTimestamp.cs.meta │ │ │ │ │ ├── MsgPackType.cs │ │ │ │ │ ├── MsgPackType.cs.meta │ │ │ │ │ ├── MsgPackWriter.cs │ │ │ │ │ ├── MsgPackWriter.cs.meta │ │ │ │ │ ├── UnknownMsgPackExtentionTypeException.cs │ │ │ │ │ ├── UnknownMsgPackExtentionTypeException.cs.meta │ │ │ │ │ ├── UnknownMsgPackFormatException.cs │ │ │ │ │ └── UnknownMsgPackFormatException.cs.meta │ │ │ │ ├── MessagePack.meta │ │ │ │ ├── Metadata/ │ │ │ │ │ ├── DataMemberDescription.cs │ │ │ │ │ ├── DataMemberDescription.cs.meta │ │ │ │ │ ├── FieldDescription.cs │ │ │ │ │ ├── FieldDescription.cs.meta │ │ │ │ │ ├── MemberDescription.cs │ │ │ │ │ ├── MemberDescription.cs.meta │ │ │ │ │ ├── MetadataReflection.cs │ │ │ │ │ ├── MetadataReflection.cs.meta │ │ │ │ │ ├── PropertyDescription.cs │ │ │ │ │ ├── PropertyDescription.cs.meta │ │ │ │ │ ├── TypeDescription.cs │ │ │ │ │ └── TypeDescription.cs.meta │ │ │ │ ├── Metadata.meta │ │ │ │ ├── MsgPack.cs │ │ │ │ ├── MsgPack.cs.meta │ │ │ │ ├── PathSegment.cs │ │ │ │ ├── PathSegment.cs.meta │ │ │ │ ├── ReflectionExtentions.cs │ │ │ │ ├── ReflectionExtentions.cs.meta │ │ │ │ ├── SerializationContext.cs │ │ │ │ ├── SerializationContext.cs.meta │ │ │ │ ├── SerializationOptions.cs │ │ │ │ ├── SerializationOptions.cs.meta │ │ │ │ ├── Serializers/ │ │ │ │ │ ├── ArraySerializer.cs │ │ │ │ │ ├── ArraySerializer.cs.meta │ │ │ │ │ ├── BinarySerializer.cs │ │ │ │ │ ├── BinarySerializer.cs.meta │ │ │ │ │ ├── BoundsSerializer.cs │ │ │ │ │ ├── BoundsSerializer.cs.meta │ │ │ │ │ ├── DateTimeOffsetSerializer.cs │ │ │ │ │ ├── DateTimeOffsetSerializer.cs.meta │ │ │ │ │ ├── DateTimeSerializer.cs │ │ │ │ │ ├── DateTimeSerializer.cs.meta │ │ │ │ │ ├── DictionaryEntrySerializer.cs │ │ │ │ │ ├── DictionaryEntrySerializer.cs.meta │ │ │ │ │ ├── DictionarySerializer.cs │ │ │ │ │ ├── DictionarySerializer.cs.meta │ │ │ │ │ ├── EnumNumberSerializer.cs │ │ │ │ │ ├── EnumNumberSerializer.cs.meta │ │ │ │ │ ├── EnumSerializer.cs │ │ │ │ │ ├── EnumSerializer.cs.meta │ │ │ │ │ ├── GuidSerializer.cs │ │ │ │ │ ├── GuidSerializer.cs.meta │ │ │ │ │ ├── Matrix4x4Serializer.cs │ │ │ │ │ ├── Matrix4x4Serializer.cs.meta │ │ │ │ │ ├── MsgPackExtensionTypeSerializer.cs │ │ │ │ │ ├── MsgPackExtensionTypeSerializer.cs.meta │ │ │ │ │ ├── MsgPackTimestampSerializer.cs │ │ │ │ │ ├── MsgPackTimestampSerializer.cs.meta │ │ │ │ │ ├── ObjectSerializer.cs │ │ │ │ │ ├── ObjectSerializer.cs.meta │ │ │ │ │ ├── PrimitiveTypeSerializer.cs │ │ │ │ │ ├── PrimitiveTypeSerializer.cs.meta │ │ │ │ │ ├── QuaternionSerializer.cs │ │ │ │ │ ├── QuaternionSerializer.cs.meta │ │ │ │ │ ├── RectSerializer.cs │ │ │ │ │ ├── RectSerializer.cs.meta │ │ │ │ │ ├── StreamSerializer.cs │ │ │ │ │ ├── StreamSerializer.cs.meta │ │ │ │ │ ├── TimeSpanSerializer.cs │ │ │ │ │ ├── TimeSpanSerializer.cs.meta │ │ │ │ │ ├── UriSerializer.cs │ │ │ │ │ ├── UriSerializer.cs.meta │ │ │ │ │ ├── Vector2Serializer.cs │ │ │ │ │ ├── Vector2Serializer.cs.meta │ │ │ │ │ ├── Vector3Serializer.cs │ │ │ │ │ ├── Vector3Serializer.cs.meta │ │ │ │ │ ├── Vector4Serializer.cs │ │ │ │ │ ├── Vector4Serializer.cs.meta │ │ │ │ │ ├── VersionSerializer.cs │ │ │ │ │ └── VersionSerializer.cs.meta │ │ │ │ ├── Serializers.meta │ │ │ │ ├── TypeSerializer.cs │ │ │ │ ├── TypeSerializer.cs.meta │ │ │ │ ├── TypeSerializerAttribute.cs │ │ │ │ └── TypeSerializerAttribute.cs.meta │ │ │ ├── GameDevWare.Serialization.meta │ │ │ └── WebSocket.meta │ │ ├── Runtime.meta │ │ ├── Tests/ │ │ │ ├── .gitkeep │ │ │ ├── Colyseus.Editor.Tests.asmdef │ │ │ ├── Colyseus.Editor.Tests.asmdef.meta │ │ │ ├── Editor/ │ │ │ │ ├── ColyseusTests.meta │ │ │ │ ├── ServerSettingsEditor.cs │ │ │ │ └── ServerSettingsEditor.cs.meta │ │ │ ├── Editor.meta │ │ │ ├── Runtime/ │ │ │ │ └── .gitkeep │ │ │ └── Runtime.meta │ │ ├── Tests.meta │ │ ├── package.json │ │ └── package.json.meta │ └── Colyseus.meta ├── CLAUDE.md ├── LICENSE ├── Packages/ │ ├── manifest.json │ └── packages-lock.json ├── ProjectSettings/ │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── NetworkManager.asset │ ├── PackageManagerSettings.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityConnectSettings.asset │ ├── VFXManager.asset │ ├── VersionControlSettings.asset │ └── XRSettings.asset ├── README.md ├── UserSettings/ │ └── EditorUserSettings.asset ├── nuget/ │ ├── Colyseus.csproj │ ├── README.md │ └── tests/ │ ├── HTTPTest.cs │ ├── HTTPTest.cs.meta │ ├── IntegrationTest.cs │ ├── IntegrationTest.cs.meta │ ├── Schema/ │ │ ├── ArraySchemaClear/ │ │ │ ├── ArraySchemaClear.cs │ │ │ └── ArraySchemaClear.cs.meta │ │ ├── ArraySchemaClear.meta │ │ ├── ArraySchemaMultipleSplice/ │ │ │ ├── Item.cs │ │ │ ├── Item.cs.meta │ │ │ ├── MultipleArraySpliceState.cs │ │ │ ├── MultipleArraySpliceState.cs.meta │ │ │ ├── Player.cs │ │ │ └── Player.cs.meta │ │ ├── ArraySchemaMultipleSplice.meta │ │ ├── ArraySchemaTypes/ │ │ │ ├── ArraySchemaTypes.cs │ │ │ ├── ArraySchemaTypes.cs.meta │ │ │ ├── IAmAChild.cs │ │ │ └── IAmAChild.cs.meta │ │ ├── ArraySchemaTypes.meta │ │ ├── BackwardsForwards/ │ │ │ ├── PlayerV1.cs │ │ │ ├── PlayerV1.cs.meta │ │ │ ├── PlayerV2.cs │ │ │ ├── PlayerV2.cs.meta │ │ │ ├── StateV1.cs │ │ │ ├── StateV1.cs.meta │ │ │ ├── StateV2.cs │ │ │ └── StateV2.cs.meta │ │ ├── BackwardsForwards.meta │ │ ├── Callbacks/ │ │ │ ├── CallbacksState.cs │ │ │ ├── CallbacksState.cs.meta │ │ │ ├── Container.cs │ │ │ ├── Container.cs.meta │ │ │ ├── Item.cs │ │ │ ├── Item.cs.meta │ │ │ ├── Player.cs │ │ │ ├── Player.cs.meta │ │ │ ├── Vec3.cs │ │ │ └── Vec3.cs.meta │ │ ├── Callbacks.meta │ │ ├── ChildSchemaTypes/ │ │ │ ├── ChildSchemaTypes.cs │ │ │ ├── ChildSchemaTypes.cs.meta │ │ │ ├── IAmAChild.cs │ │ │ └── IAmAChild.cs.meta │ │ ├── ChildSchemaTypes.meta │ │ ├── FilteredTypes/ │ │ │ ├── Player.cs │ │ │ ├── Player.cs.meta │ │ │ ├── State.cs │ │ │ └── State.cs.meta │ │ ├── FilteredTypes.meta │ │ ├── InheritedTypes/ │ │ │ ├── Bot.cs │ │ │ ├── Bot.cs.meta │ │ │ ├── Entity.cs │ │ │ ├── Entity.cs.meta │ │ │ ├── InheritedTypes.cs │ │ │ ├── InheritedTypes.cs.meta │ │ │ ├── Player.cs │ │ │ └── Player.cs.meta │ │ ├── InheritedTypes.meta │ │ ├── InstanceSharingTypes/ │ │ │ ├── Player.cs │ │ │ ├── Player.cs.meta │ │ │ ├── Position.cs │ │ │ ├── Position.cs.meta │ │ │ ├── State.cs │ │ │ └── State.cs.meta │ │ ├── InstanceSharingTypes.meta │ │ ├── Item.cs │ │ ├── Item.cs.meta │ │ ├── MapSchemaInt8/ │ │ │ ├── MapSchemaInt8.cs │ │ │ └── MapSchemaInt8.cs.meta │ │ ├── MapSchemaInt8.meta │ │ ├── MapSchemaMoveNullifyType/ │ │ │ ├── State.cs │ │ │ └── State.cs.meta │ │ ├── MapSchemaMoveNullifyType.meta │ │ ├── MapSchemaTypes/ │ │ │ ├── IAmAChild.cs │ │ │ ├── IAmAChild.cs.meta │ │ │ ├── MapSchemaTypes.cs │ │ │ └── MapSchemaTypes.cs.meta │ │ ├── MapSchemaTypes.meta │ │ ├── MyRoomState.cs │ │ ├── MyRoomState.cs.meta │ │ ├── Player.cs │ │ ├── Player.cs.meta │ │ ├── PrimitiveTypes/ │ │ │ ├── PrimitiveTypes.cs │ │ │ └── PrimitiveTypes.cs.meta │ │ └── PrimitiveTypes.meta │ ├── Schema.meta │ ├── SchemaDeserializerTest.cs │ ├── SchemaDeserializerTest.cs.meta │ ├── SerializationTest.cs │ ├── SerializationTest.cs.meta │ └── WebSocketTransportTest.cs ├── nuget-monogame/ │ ├── Colyseus.MonoGame.csproj │ ├── ColyseusGameComponent.cs │ └── README.md └── unity-setup.sh
SYMBOL INDEX (1264 symbols across 170 files)
FILE: Assets/Colyseus/Editor/RoomInspector.cs
class RoomMessageType (line 18) | static class RoomMessageType
method Initialize (line 23) | [UnityEditor.InitializeOnLoadMethod]
method OnPlayModeStateChanged (line 30) | private static void OnPlayModeStateChanged(PlayModeStateChange state)
class RoomInspector (line 43) | public class RoomInspector : EditorWindow
method ShowWindow (line 66) | [MenuItem("Window/Colyseus/Room Inspector (experimental)")]
method OnEnable (line 75) | private void OnEnable()
method OnDisable (line 80) | private void OnDisable()
method OnEditorUpdate (line 85) | private void OnEditorUpdate()
method OnGUI (line 94) | private void OnGUI()
method DrawRoomTabs (line 133) | private void DrawRoomTabs(List<RoomInfo> rooms)
method DrawToolbar (line 171) | private void DrawToolbar()
method CopyStateToClipboard (line 193) | private void CopyStateToClipboard()
method SerializeStateToText (line 242) | private void SerializeStateToText(object obj, System.Type type, System...
method DrawRoomContent (line 329) | private void DrawRoomContent(RoomInfo roomInfo)
method DrawSection (line 365) | private void DrawSection(string title, Action content)
method DrawSchemaObject (line 383) | private void DrawSchemaObject(object obj, System.Type type, string pat...
method DrawMapSchema (line 426) | private void DrawMapSchema(string fieldName, object mapObj, string pat...
method DrawArraySchema (line 501) | private void DrawArraySchema(string fieldName, object arrayObj, string...
method DrawNestedSchema (line 574) | private void DrawNestedSchema(string fieldName, object schemaObj, Syst...
method DrawReadOnlyField (line 602) | private void DrawReadOnlyField(string label, string value)
method DrawReadOnlyObjectField (line 610) | private void DrawReadOnlyObjectField(string label, UnityEngine.Object ...
method IsPrimitiveOrString (line 620) | private bool IsPrimitiveOrString(System.Type type)
method FindAllColyseusRooms (line 626) | private List<RoomInfo> FindAllColyseusRooms()
method IsColyseusRoomType (line 687) | private bool IsColyseusRoomType(System.Type type)
method ExtractRoomInfo (line 701) | private RoomInfo ExtractRoomInfo(object room, System.Type roomType, Mo...
method DrawStateAndMessagesSplitPanel (line 757) | private void DrawStateAndMessagesSplitPanel(RoomInfo roomInfo)
method DrawHorizontalSplitter (line 791) | private void DrawHorizontalSplitter(string splitterKey, float availabl...
method DrawStateSection (line 827) | private void DrawStateSection(RoomInfo roomInfo)
method DrawMessagesSection (line 850) | private void DrawMessagesSection(RoomInfo roomInfo)
method DrawMessageInterface (line 908) | private void DrawMessageInterface(RoomInfo roomInfo, string[] messageT...
method DrawMessageField (line 1077) | private void DrawMessageField(string roomId, string messageName, strin...
method SendMessageFromFields (line 1165) | private void SendMessageFromFields(RoomInfo roomInfo, string messageNa...
method LeaveRoom (line 1220) | private void LeaveRoom(RoomInfo roomInfo, bool consented)
method DropRoom (line 1246) | private void DropRoom(RoomInfo roomInfo)
method SendMessageFromRawJson (line 1284) | private void SendMessageFromRawJson(RoomInfo roomInfo, string messageN...
method ConvertFieldValue (line 1323) | private object ConvertFieldValue(string fieldValue, string fieldType)
method GenerateDefaultJSON (line 1368) | private string GenerateDefaultJSON(IDictionary schema)
method GetDefaultValueForType (line 1419) | private string GetDefaultValueForType(IDictionary propSchema)
method GenerateJSONFromFields (line 1445) | private string GenerateJSONFromFields(string roomId, string messageNam...
method ConvertFieldValueToJSON (line 1512) | private string ConvertFieldValueToJSON(string fieldValue, string field...
method SendMessage (line 1552) | private async void SendMessage(RoomInfo roomInfo, string messageName, ...
method ParseJSON (line 1582) | private object ParseJSON(string json)
method DrawSchemaInfo (line 1596) | private void DrawSchemaInfo(IDictionary schema)
class RoomInfo (line 1655) | private class RoomInfo
FILE: Assets/Colyseus/Runtime/Colyseus/Auth.cs
type IAuthData (line 8) | public interface IAuthData
class AuthData (line 15) | [Serializable]
method AuthData (line 23) | public AuthData() { }
method AuthData (line 24) | public AuthData(string _token, IndexedDictionary<string, object> userD...
method ConvertType (line 63) | public static T ConvertType(IndexedDictionary<string, object> rawUser)
type IAuthChangeHandler (line 87) | public interface IAuthChangeHandler
method Invoke (line 91) | void Invoke(object authData);
class AuthChangeHandler (line 94) | public class AuthChangeHandler<T> : IAuthChangeHandler
method Invoke (line 98) | public void Invoke(object authData) { Action.Invoke((T)authData); }
class Auth (line 110) | public class Auth
method Auth (line 119) | public Auth(Client client)
method OnChange (line 131) | public async Task<Action> OnChange<T>(Action<AuthData<T>> callback)
method GetUserData (line 160) | public async Task<T> GetUserData<T>()
method RegisterWithEmailAndPassword (line 172) | public async Task<AuthData<T>> RegisterWithEmailAndPassword<T>(string ...
method RegisterWithEmailAndPassword (line 186) | public async Task<IAuthData> RegisterWithEmailAndPassword(string email...
method SignInWithEmailAndPassword (line 191) | public async Task<AuthData<T>> SignInWithEmailAndPassword<T>(string em...
method SignInWithEmailAndPassword (line 204) | public async Task<IAuthData> SignInWithEmailAndPassword(string email, ...
method SignInAnonymously (line 209) | public async Task<AuthData<T>> SignInAnonymously<T>(Dictionary<string,...
method SignInAnonymously (line 218) | public async Task<IAuthData> SignInAnonymously(Dictionary<string, obje...
method SignInWithProvider (line 223) | public async Task<AuthData<T>> SignInWithProvider<T>(string providerNa...
method SignInWithProvider (line 232) | public async Task<IAuthData> SignInWithProvider(string providerName, D...
method SendResetPasswordEmail (line 237) | public async Task<string> SendResetPasswordEmail(string email, string ...
method SignOut (line 246) | public void SignOut()
method emitChange (line 251) | private void emitChange(IAuthData authData)
method getAuthData (line 288) | private AuthData<T> getAuthData<T>(AuthData<IndexedDictionary<string, ...
FILE: Assets/Colyseus/Runtime/Colyseus/Client.cs
class LatencyOptions (line 12) | public class LatencyOptions
class Client (line 32) | public class Client
method Client (line 56) | public Client(string endpoint)
method Client (line 76) | public Client(Settings settings)
method JoinOrCreate (line 112) | public async Task<Room<T>> JoinOrCreate<T>(string roomName, Dictionary...
method Create (line 126) | public async Task<Room<T>> Create<T>(string roomName, Dictionary<strin...
method Join (line 140) | public async Task<Room<T>> Join<T>(string roomName, Dictionary<string,...
method JoinById (line 154) | public async Task<Room<T>> JoinById<T>(string roomId, Dictionary<strin...
method Reconnect (line 167) | public async Task<Room<T>> Reconnect<T>(ReconnectionToken reconnection...
method JoinOrCreate (line 185) | public async Task<Room<NoState>> JoinOrCreate(string roomName, Diction...
method Create (line 197) | public async Task<Room<NoState>> Create(string roomName, Dictionary<st...
method Join (line 210) | public async Task<Room<NoState>> Join(string roomName, Dictionary<stri...
method JoinById (line 223) | public async Task<Room<NoState>> JoinById(string roomId, Dictionary<st...
method Reconnect (line 236) | public async Task<Room<NoState>> Reconnect(string roomId, string sessi...
method ConsumeSeatReservation (line 252) | public async Task<Room<T>> ConsumeSeatReservation<T>(SeatReservation r...
method CreateMatchMakeRequest (line 307) | protected async Task<Room<T>> CreateMatchMakeRequest<T>(string method,...
method CreateConnection (line 342) | protected Connection CreateConnection(
method SelectByLatency (line 398) | public static async Task<Client> SelectByLatency(string[] endpoints, L...
method MeasureClientLatency (line 440) | private static async Task<(int index, double latency, bool success)> M...
method GetLatency (line 460) | public Task<double> GetLatency(LatencyOptions options = null)
FILE: Assets/Colyseus/Runtime/Colyseus/Connection.cs
class Connection (line 11) | public class Connection
method Connection (line 27) | public Connection(string url, Dictionary<string, string> headers)
method Connect (line 33) | public async Task Connect()
method Send (line 45) | public Task Send(byte[] data)
method Close (line 50) | public Task Close()
method Drop (line 55) | public void Drop()
method CancelConnection (line 60) | public void CancelConnection()
method DispatchMessageQueue (line 70) | public void DispatchMessageQueue()
method Reconnect (line 80) | public async Task Reconnect(string reconnectionToken)
FILE: Assets/Colyseus/Runtime/Colyseus/HTTP.cs
class ErrorResponse (line 9) | [Serializable]
class HTTP (line 18) | public class HTTP
method HTTP (line 24) | public HTTP(Settings settings)
method Get (line 29) | public async Task<string> Get(string uriPath, Dictionary<string, strin...
method Get (line 34) | public async Task<T> Get<T>(string uriPath, Dictionary<string, string>...
method Post (line 39) | public async Task<string> Post(string uriPath, Dictionary<string, obje...
method Post (line 44) | public async Task<T> Post<T>(string uriPath, Dictionary<string, object...
method Delete (line 49) | public async Task<string> Delete(string uriPath, Dictionary<string, ob...
method Delete (line 54) | public async Task<T> Delete<T>(string uriPath, Dictionary<string, obje...
method Put (line 59) | public async Task<string> Put(string uriPath, Dictionary<string, objec...
method Put (line 64) | public async Task<T> Put<T>(string uriPath, Dictionary<string, object>...
method Request (line 69) | public async Task<T> Request<T>(string uriMethod, string uriPath, Dict...
method Request (line 74) | public async Task<string> Request(string uriMethod, string uriPath, Di...
method GetRequestURL (line 107) | public string GetRequestURL(string pathWithQueryString)
FILE: Assets/Colyseus/Runtime/Colyseus/Manager.cs
class Manager (line 11) | public class Manager<T> : MonoBehaviour
method OnDestroy (line 63) | protected virtual void OnDestroy()
method Awake (line 70) | protected virtual void Awake()
method InitializeInstance (line 78) | private void InitializeInstance()
method Start (line 92) | protected virtual void Start()
method FixedUpdate (line 99) | protected virtual void FixedUpdate()
method OverrideSettings (line 107) | public virtual void OverrideSettings(Settings newSettings)
method CloneSettings (line 121) | public virtual Settings CloneSettings()
method CreateClient (line 131) | public Client CreateClient(string endpoint)
method InitializeClient (line 140) | public virtual void InitializeClient()
method OnApplicationQuit (line 148) | protected virtual void OnApplicationQuit()
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ColyseusContext.cs
class ColyseusContext (line 5) | public static class ColyseusContext
method ColyseusContext (line 19) | static ColyseusContext()
method SetDefaults (line 24) | public static void SetDefaults()
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/ConsoleLogger.cs
class ConsoleLogger (line 5) | public class ConsoleLogger : ILogger
method Log (line 7) | public void Log(string message)
method LogWarning (line 12) | public void LogWarning(string message)
method LogError (line 17) | public void LogError(string message)
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/DefaultHttpClient.cs
class DefaultHttpClient (line 8) | public class DefaultHttpClient : IHttpClient
method Request (line 12) | public async Task<string> Request(string method, string url, byte[] bo...
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/InMemoryTokenStorage.cs
class InMemoryTokenStorage (line 5) | public class InMemoryTokenStorage : ITokenStorage
method GetToken (line 9) | public string GetToken(string key)
method SetToken (line 15) | public void SetToken(string key, string value)
method DeleteToken (line 20) | public void DeleteToken(string key)
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/IHttpClient.cs
type IHttpClient (line 6) | public interface IHttpClient
method Request (line 8) | Task<string> Request(string method, string url, byte[] body, Dictionar...
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ILogger.cs
type ILogger (line 3) | public interface ILogger
method Log (line 5) | void Log(string message);
method LogWarning (line 6) | void LogWarning(string message);
method LogError (line 7) | void LogError(string message);
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/ITokenStorage.cs
type ITokenStorage (line 3) | public interface ITokenStorage
method GetToken (line 5) | string GetToken(string key);
method SetToken (line 6) | void SetToken(string key, string value);
method DeleteToken (line 7) | void DeleteToken(string key);
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/PreserveAttribute.cs
class PreserveAttribute (line 9) | [AttributeUsage(AttributeTargets.All)]
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityHttpClient.cs
class UnityHttpClient (line 10) | public class UnityHttpClient : IHttpClient
method Request (line 12) | public async Task<string> Request(string method, string url, byte[] bo...
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityLogger.cs
class UnityLogger (line 6) | public class UnityLogger : ILogger
method Log (line 8) | public void Log(string message)
method LogWarning (line 13) | public void LogWarning(string message)
method LogError (line 18) | public void LogError(string message)
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityPlatform.cs
class UnityPlatform (line 10) | public static class UnityPlatform
method Initialize (line 12) | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLo...
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnitySettings.cs
class UnitySettings (line 11) | [CreateAssetMenu(fileName = "MyServerSettings", menuName = "Colyseus/Ser...
method ToSettings (line 36) | public Settings ToSettings()
FILE: Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityTokenStorage.cs
class UnityTokenStorage (line 6) | public class UnityTokenStorage : ITokenStorage
method GetToken (line 8) | public string GetToken(string key)
method SetToken (line 13) | public void SetToken(string key, string value)
method DeleteToken (line 18) | public void DeleteToken(string key)
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/ErrorCode.cs
class ErrorCode (line 8) | public class ErrorCode
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/MatchMakeResponse.cs
class SeatReservation (line 13) | [Serializable]
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/MessageHandler.cs
type IMessageHandler (line 8) | public interface IMessageHandler
method Invoke (line 19) | void Invoke(object message);
class MessageHandler (line 26) | public class MessageHandler<T> : IMessageHandler
method Invoke (line 37) | public void Invoke(object message)
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/Protocol.cs
class Protocol (line 8) | public class Protocol
type CloseCode (line 83) | public enum CloseCode
FILE: Assets/Colyseus/Runtime/Colyseus/Protocol/RoomAvailable.cs
class RoomAvailable (line 12) | [Serializable]
class RoomAvailableCollection (line 52) | [Serializable]
FILE: Assets/Colyseus/Runtime/Colyseus/Room.cs
type IRoom (line 32) | public interface IRoom
method Connect (line 40) | Task Connect();
method Leave (line 47) | Task Leave(bool consented);
class ReconnectionToken (line 50) | [Serializable]
class ReconnectionOptions (line 60) | [Serializable]
method ExponentialBackoff (line 126) | public static int ExponentialBackoff(int attempt, int delay)
class Room (line 132) | public class Room<T> : IRoom where T : Schema.Schema
method Room (line 208) | public Room(string name)
method Connect (line 271) | public async Task Connect()
method Leave (line 281) | public async Task Leave(bool consented = true)
method SetConnection (line 353) | public void SetConnection(Connection connection)
method SetState (line 391) | public void SetState(byte[] encodedState, int offset)
method Send (line 401) | public async Task Send(byte type)
method Send (line 420) | public async Task Send(byte type, object message)
method Send (line 446) | public async Task Send(string type)
method Send (line 470) | public async Task Send(string type, object message)
method SendBytes (line 499) | public async Task SendBytes(byte type, byte[] bytes)
method SendBytes (line 522) | public async Task SendBytes(string type, byte[] bytes)
method Ping (line 546) | public async void Ping(Action<int> callback)
method OnMessage (line 565) | public void OnMessage<MessageType>(string type, Action<MessageType> ha...
method OnMessage (line 579) | public void OnMessage<MessageType>(byte type, Action<MessageType> hand...
method ParseMessage (line 591) | protected async void ParseMessage(byte[] bytes)
method Patch (line 746) | protected void Patch(byte[] delta, int offset)
method DisplaySerializerErrorHelp (line 758) | protected void DisplaySerializerErrorHelp(Exception e, string helpMess...
method HandleReconnection (line 764) | private void HandleReconnection(int code)
method RetryReconnection (line 790) | private async Task RetryReconnection()
method EnqueueMessage (line 827) | private void EnqueueMessage(byte[] data)
method FlushEnqueuedMessages (line 839) | private async Task FlushEnqueuedMessages()
method Destroy (line 850) | private void Destroy()
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/BigEndianBitConverter.cs
class BigEndianBitConverter (line 57) | public sealed class BigEndianBitConverter : EndianBitConverter
method IsLittleEndian (line 68) | public sealed override bool IsLittleEndian()
method CopyBytesImpl (line 88) | protected override void CopyBytesImpl(long value, int bytes, byte[] bu...
method FromBytes (line 106) | protected override long FromBytes(byte[] buffer, int startIndex, int b...
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/DoubleConverter.cs
class DoubleConverter (line 61) | public class DoubleConverter
method ToExactString (line 69) | public static string ToExactString (double d)
class ArbitraryDecimal (line 143) | class ArbitraryDecimal
method ArbitraryDecimal (line 156) | internal ArbitraryDecimal (long x)
method MultiplyBy (line 169) | internal void MultiplyBy(int amount)
method Shift (line 195) | internal void Shift (int amount)
method Normalize (line 203) | internal void Normalize()
method ToString (line 228) | public override String ToString()
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/EndianBitConverter.cs
class EndianBitConverter (line 59) | public abstract class EndianBitConverter
method IsLittleEndian (line 71) | public abstract bool IsLittleEndian();
method DoubleToInt64Bits (line 109) | public long DoubleToInt64Bits(double value)
method Int64BitsToDouble (line 121) | public double Int64BitsToDouble (long value)
method SingleToInt32Bits (line 133) | public int SingleToInt32Bits(float value)
method Int32BitsToSingle (line 145) | public float Int32BitsToSingle (int value)
method ToBoolean (line 158) | public bool ToBoolean (byte[] value, int startIndex)
method ToChar (line 170) | public char ToChar (byte[] value, int startIndex)
method ToDouble (line 182) | public double ToDouble (byte[] value, int startIndex)
method ToSingle (line 194) | public float ToSingle (byte[] value, int startIndex)
method ToInt16 (line 205) | public short ToInt16 (byte[] value, int startIndex)
method ToInt32 (line 216) | public int ToInt32 (byte[] value, int startIndex)
method ToInt64 (line 227) | public long ToInt64 (byte[] value, int startIndex)
method ToUInt16 (line 238) | public ushort ToUInt16 (byte[] value, int startIndex)
method ToUInt32 (line 249) | public uint ToUInt32 (byte[] value, int startIndex)
method ToUInt64 (line 260) | public ulong ToUInt64 (byte[] value, int startIndex)
method CheckByteArgument (line 275) | static void CheckByteArgument(byte[] value, int startIndex, int bytesR...
method CheckedFromBytes (line 295) | long CheckedFromBytes(byte[] value, int startIndex, int bytesToConvert)
method FromBytes (line 310) | protected abstract long FromBytes(byte[] value, int startIndex, int by...
method ToString (line 323) | public static string ToString(byte[] value)
method ToString (line 338) | public static string ToString(byte[] value, int startIndex)
method ToString (line 354) | public static string ToString(byte[] value, int startIndex, int length)
method ToDecimal (line 368) | public decimal ToDecimal (byte[] value, int startIndex)
method GetBytes (line 386) | public byte[] GetBytes(decimal value)
method CopyBytes (line 404) | public void CopyBytes(decimal value, byte[] buffer, int index)
method GetBytes (line 422) | byte[] GetBytes(long value, int bytes)
method GetBytes (line 434) | public byte[] GetBytes(bool value)
method GetBytes (line 444) | public byte[] GetBytes(char value)
method GetBytes (line 454) | public byte[] GetBytes(double value)
method GetBytes (line 464) | public byte[] GetBytes(short value)
method GetBytes (line 474) | public byte[] GetBytes(int value)
method GetBytes (line 484) | public byte[] GetBytes(long value)
method GetBytes (line 494) | public byte[] GetBytes(float value)
method GetBytes (line 504) | public byte[] GetBytes(ushort value)
method GetBytes (line 514) | public byte[] GetBytes(uint value)
method GetBytes (line 524) | public byte[] GetBytes(ulong value)
method CopyBytes (line 542) | void CopyBytes(long value, int bytes, byte[] buffer, int index)
method CopyBytesImpl (line 566) | protected abstract void CopyBytesImpl(long value, int bytes, byte[] bu...
method CopyBytes (line 575) | public void CopyBytes(bool value, byte[] buffer, int index)
method CopyBytes (line 587) | public void CopyBytes(char value, byte[] buffer, int index)
method CopyBytes (line 599) | public void CopyBytes(double value, byte[] buffer, int index)
method CopyBytes (line 611) | public void CopyBytes(short value, byte[] buffer, int index)
method CopyBytes (line 623) | public void CopyBytes(int value, byte[] buffer, int index)
method CopyBytes (line 635) | public void CopyBytes(long value, byte[] buffer, int index)
method CopyBytes (line 647) | public void CopyBytes(float value, byte[] buffer, int index)
method CopyBytes (line 659) | public void CopyBytes(ushort value, byte[] buffer, int index)
method CopyBytes (line 671) | public void CopyBytes(uint value, byte[] buffer, int index)
method CopyBytes (line 683) | public void CopyBytes(ulong value, byte[] buffer, int index)
type Int32SingleUnion (line 694) | [StructLayout(LayoutKind.Explicit)]
method Int32SingleUnion (line 712) | internal Int32SingleUnion(int i)
method Int32SingleUnion (line 722) | internal Int32SingleUnion(float f)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/Endianness.cs
type Endianness (line 56) | public enum Endianness
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/LittleEndianBitConverter.cs
class LittleEndianBitConverter (line 57) | public sealed class LittleEndianBitConverter : EndianBitConverter
method IsLittleEndian (line 68) | public sealed override bool IsLittleEndian()
method CopyBytesImpl (line 88) | protected override void CopyBytesImpl(long value, int bytes, byte[] bu...
method FromBytes (line 105) | protected override long FromBytes(byte[] buffer, int startIndex, int b...
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/NoneSerializer.cs
class NoState (line 4) | public class NoState : Schema.Schema { }
class NoneSerializer (line 9) | public class NoneSerializer : ISerializer<NoState>
method SetState (line 14) | public void SetState(byte[] rawEncodedState, int offset)
method GetState (line 19) | public NoState GetState()
method Patch (line 25) | public void Patch(byte[] bytes, int offset)
method Teardown (line 30) | public void Teardown()
method Handshake (line 35) | public void Handshake(byte[] bytes, int offset)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Callbacks/Callbacks.cs
class ExpressionHelper (line 11) | internal static class ExpressionHelper
method GetPropertyChain (line 17) | public static List<string> GetPropertyChain(Expression expression)
method GetRootExpression (line 34) | public static Expression GetRootExpression(Expression expression)
class StateCallbackStrategy (line 72) | public class StateCallbackStrategy<TState>
method StateCallbackStrategy (line 81) | public StateCallbackStrategy(Decoder<TState> decoder)
method AddCallback (line 87) | protected Action AddCallback(int refId, object operationOrProperty, De...
method NavigateNestedProperties (line 112) | protected Action NavigateNestedProperties(Schema instance, List<string...
method AddCallbackOrWaitCollectionAvailable (line 178) | protected Action AddCallbackOrWaitCollectionAvailable<TInstance, TRetu...
method AddCallbackOrWaitCollectionAvailableSimple (line 205) | protected Action AddCallbackOrWaitCollectionAvailableSimple(Schema ins...
method Listen (line 245) | public Action Listen<TReturn>(Expression<Func<TState, TReturn>> proper...
method Listen (line 250) | public Action Listen<TInstance, TReturn>(TInstance instance, Expressio...
method ListenSimple (line 276) | protected Action ListenSimple<TReturn>(Schema instance, string propert...
method OnChange (line 291) | public Action OnChange<T>(T instance, OnInstanceChangeEventHandler han...
method OnAdd (line 297) | public Action OnAdd<TReturn>(Expression<Func<TState, ArraySchema<TRetu...
method OnAdd (line 302) | public Action OnAdd<TInstance, TReturn>(TInstance instance, Expression...
method OnAdd (line 308) | public Action OnAdd<TReturn>(Expression<Func<TState, MapSchema<TReturn...
method OnAdd (line 313) | public Action OnAdd<TInstance, TReturn>(TInstance instance, Expression...
method OnChange (line 319) | public Action OnChange<TReturn>(Expression<Func<TState, ArraySchema<TR...
method OnChange (line 324) | public Action OnChange<TInstance, TReturn>(TInstance instance, Express...
method OnChange (line 330) | public Action OnChange<TReturn>(Expression<Func<TState, MapSchema<TRet...
method OnChange (line 335) | public Action OnChange<TInstance, TReturn>(TInstance instance, Express...
method OnRemove (line 341) | public Action OnRemove<TReturn>(Expression<Func<TState, ArraySchema<TR...
method OnRemove (line 346) | public Action OnRemove<TInstance, TReturn>(TInstance instance, Express...
method OnRemove (line 352) | public Action OnRemove<TReturn>(Expression<Func<TState, MapSchema<TRet...
method OnRemove (line 357) | public Action OnRemove<TInstance, TReturn>(TInstance instance, Express...
method Listen (line 367) | public Action Listen<TReturn>(string propertyName, PropertyChangeEvent...
method Listen (line 372) | public Action Listen<TReturn>(Schema instance, string propertyName, Pr...
method OnAdd (line 377) | public Action OnAdd<TReturn>(string propertyName, KeyValueEventHandler...
method OnAdd (line 382) | public Action OnAdd<TReturn>(Schema instance, string propertyName, Key...
method OnAdd (line 387) | public Action OnAdd<TReturn>(string propertyName, KeyValueEventHandler...
method OnAdd (line 392) | public Action OnAdd<TReturn>(Schema instance, string propertyName, Key...
method OnRemove (line 397) | public Action OnRemove<TReturn>(string propertyName, KeyValueEventHand...
method OnRemove (line 402) | public Action OnRemove<TReturn>(Schema instance, string propertyName, ...
method OnRemove (line 407) | public Action OnRemove<TReturn>(string propertyName, KeyValueEventHand...
method OnRemove (line 412) | public Action OnRemove<TReturn>(Schema instance, string propertyName, ...
method OnChange (line 417) | public Action OnChange<TReturn>(string propertyName, KeyValueEventHand...
method OnChange (line 422) | public Action OnChange<TReturn>(Schema instance, string propertyName, ...
method OnChange (line 427) | public Action OnChange<TReturn>(string propertyName, KeyValueEventHand...
method OnChange (line 432) | public Action OnChange<TReturn>(Schema instance, string propertyName, ...
method BindTo (line 443) | public Action BindTo<T>(Schema from, T to, bool immediate = true)
method TriggerChanges (line 473) | protected void TriggerChanges(ref List<DataChange> allChanges)
class Callbacks (line 630) | public class Callbacks // <T> where T : Schema
method Get (line 632) | public static StateCallbackStrategy<T> Get<T>(Room<T> room)
method Get (line 639) | public static StateCallbackStrategy<T> Get<T>(Decoder<T> decoder)
method RemoveChildRefs (line 645) | internal static void RemoveChildRefs(ISchemaCollection collection, Lis...
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Decoder.cs
class Decoder (line 8) | public class Decoder<T> where T : Schema
method Decoder (line 27) | public Decoder()
method Decode (line 43) | public void Decode(byte[] bytes, Iterator it = null)
method DecodeValue (line 128) | protected void DecodeValue(byte[] bytes, Iterator it, IRef _ref, int f...
method DecodeSchema (line 271) | protected bool DecodeSchema(byte[] bytes, Iterator it, Schema refSchema)
method DecodeMapSchema (line 319) | protected bool DecodeMapSchema (byte[] bytes, Iterator it, IMapSchema ...
method DecodeArraySchema (line 388) | protected bool DecodeArraySchema(byte[] bytes, Iterator it, IArraySche...
method GetSchemaType (line 522) | protected System.Type GetSchemaType(byte[] bytes, Iterator it, System....
method CreateTypeInstance (line 542) | protected object CreateTypeInstance(System.Type type)
method Teardown (line 547) | internal void Teardown()
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/DynamicSchema.cs
class DynamicTypeDefinition (line 11) | public class DynamicTypeDefinition
method ParseFieldType (line 27) | public void ParseFieldType(int fieldIndex, string fieldName, string fi...
class DynamicSchema (line 92) | public class DynamicSchema : Schema
method DynamicSchema (line 101) | public DynamicSchema() { }
method Get (line 131) | public T Get<T>(string fieldName)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/ReferenceTracker.cs
class ReferenceTracker (line 9) | public class ReferenceTracker
method Add (line 38) | public void Add(int refId, IRef _ref, bool incrementCount = true)
method Get (line 61) | public IRef Get(int refId)
method Has (line 73) | public bool Has(int refId)
method Remove (line 82) | public bool Remove(int refId)
method GarbageCollection (line 105) | public void GarbageCollection()
method Clear (line 154) | public void Clear()
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Schema.cs
class Type (line 48) | [AttributeUsage(AttributeTargets.Field)]
method Type (line 71) | public Type(int index, string type, System.Type childType = null, stri...
class Iterator (line 83) | public class Iterator
type SPEC (line 94) | public enum SPEC : byte
type OPERATION (line 110) | [SuppressMessage("ReSharper", "MissingXmlDoc")]
class DataChange (line 131) | public class DataChange
type ISchemaCollection (line 167) | [SuppressMessage("ReSharper", "MissingXmlDoc")]
method GetItems (line 176) | IEnumerable GetItems();
method ForEach (line 177) | void ForEach(Action<object, object> action);
method SetItems (line 178) | void SetItems(object items);
method Clear (line 179) | void Clear(List<DataChange> changes, ReferenceTracker refs);
method GetChildType (line 181) | System.Type GetChildType();
method GetTypeDefaultValue (line 182) | object GetTypeDefaultValue();
method Clone (line 184) | ISchemaCollection Clone();
type IArraySchema (line 187) | [SuppressMessage("ReSharper", "MissingXmlDoc")]
method OnDecodeEnd (line 190) | void OnDecodeEnd();
method SetByIndex (line 191) | void SetByIndex(int index, object value, byte operation);
method Reverse (line 192) | void Reverse();
type IMapSchema (line 195) | [SuppressMessage("ReSharper", "MissingXmlDoc")]
method SetIndex (line 198) | void SetIndex(int index, object dynamicIndex);
method GetIndex (line 199) | object GetIndex(int index);
method SetByIndex (line 200) | void SetByIndex(int index, object dynamicIndex, object value);
type IRef (line 206) | [SuppressMessage("ReSharper", "MissingXmlDoc")]
method GetByIndex (line 214) | object GetByIndex(int index);
method DeleteByIndex (line 215) | void DeleteByIndex(int index);
class Schema (line 221) | public class Schema : IRef
method Schema (line 247) | public Schema()
method CreateMetadata (line 258) | private static Metadata CreateMetadata(System.Type type)
method GetByIndex (line 311) | public object GetByIndex(int index)
method DeleteByIndex (line 321) | public void DeleteByIndex(int index)
method GetFieldChildTypes (line 333) | internal Dictionary<string, System.Type> GetFieldChildTypes()
method CheckSchemaChild (line 344) | public static bool CheckSchemaChild(System.Type toCheck)
class Metadata (line 366) | private class Metadata
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/TypeContext.cs
class TypeContext (line 8) | public class TypeContext
method SetTypeId (line 22) | public void SetTypeId(System.Type type, float typeid)
method Get (line 32) | public System.Type Get(float typeid)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/ArraySchema.cs
class ArraySchema (line 12) | public class ArraySchema<T> : IArraySchema
method ArraySchema (line 21) | [Preserve]
method ArraySchema (line 27) | public ArraySchema(List<T> items = null)
method SetByIndex (line 44) | public void SetByIndex(int index, object value, byte operation)
method GetByIndex (line 86) | public object GetByIndex(int index)
method DeleteByIndex (line 102) | public void DeleteByIndex(int index)
method Clear (line 119) | public void Clear(List<DataChange> changes, ReferenceTracker refs)
method Reverse (line 125) | public void Reverse()
method Clone (line 134) | public ISchemaCollection Clone()
method GetChildType (line 146) | public System.Type GetChildType()
method GetTypeDefaultValue (line 157) | public object GetTypeDefaultValue()
method GetItems (line 198) | public IEnumerable GetItems()
method IndexOf (line 203) | public int IndexOf(T value)
method SetItems (line 224) | public void SetItems(object items)
method ForEach (line 233) | public void ForEach(Action<int, T> action)
method ForEach (line 243) | public void ForEach(Action<object, object> action)
method OnDecodeEnd (line 253) | public void OnDecodeEnd()
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/CustomType.cs
class CustomType (line 6) | class CustomType
method GetInstance (line 14) | public static CustomType GetInstance()
method Add (line 19) | public void Add(string id, System.Type type)
method Get (line 27) | public System.Type Get(string id)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/MapSchema.cs
class MapSchema (line 12) | public class MapSchema<T> : IMapSchema
method MapSchema (line 21) | [Preserve]
method MapSchema (line 27) | public MapSchema(OrderedDictionary items = null)
method SetIndex (line 70) | public void SetIndex(int index, object dynamicIndex)
method SetByIndex (line 85) | public void SetByIndex(int index, object dynamicIndex, object value)
method GetIndex (line 96) | public object GetIndex(int index)
method GetByIndex (line 110) | public object GetByIndex(int index)
method DeleteByIndex (line 122) | public void DeleteByIndex(int index)
method Clone (line 143) | public ISchemaCollection Clone()
method GetChildType (line 158) | public System.Type GetChildType()
method GetTypeDefaultValue (line 169) | public object GetTypeDefaultValue()
method ContainsKey (line 179) | public bool ContainsKey(object key)
method GetItems (line 212) | public IEnumerable GetItems()
method Clear (line 221) | public void Clear(List<DataChange> changes, ReferenceTracker refs)
method Reverse (line 228) | public void Reverse()
method SetItems (line 247) | public void SetItems(object items) //TODO: Is it ok if this is unimple...
method Add (line 256) | public void Add(KeyValuePair<string, T> item)
method Contains (line 266) | public bool Contains(KeyValuePair<string, T> item)
method Remove (line 279) | public bool Remove(KeyValuePair<string, T> item)
method Add (line 296) | public void Add(string key, T value)
method Remove (line 301) | public bool Remove(string key)
method TryGetValue (line 312) | public bool TryGetValue(string key, out T value)
method ForEach (line 330) | public void ForEach(Action<string, T> action)
method ForEach (line 338) | public void ForEach(Action<object, object> action)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/Reflection.cs
class ReflectionField (line 8) | [Preserve]
class ReflectionType (line 30) | [Preserve]
method ReflectionType (line 52) | [Preserve]
class Reflection (line 59) | [Preserve]
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils/Decode.cs
class Decode (line 7) | public class Decode
method DecodePrimitiveType (line 20) | public static object DecodePrimitiveType(string type, byte[] bytes, It...
method DecodeNumber (line 96) | public static float DecodeNumber(byte[] bytes, Iterator it)
method DecodeInt8 (line 181) | public static sbyte DecodeInt8(byte[] bytes, Iterator it)
method DecodeUint8 (line 192) | public static byte DecodeUint8(byte[] bytes, Iterator it)
method DecodeInt16 (line 203) | public static short DecodeInt16(byte[] bytes, Iterator it)
method DecodeUint16 (line 216) | public static ushort DecodeUint16(byte[] bytes, Iterator it)
method DecodeInt32 (line 229) | public static int DecodeInt32(byte[] bytes, Iterator it)
method DecodeUint32 (line 242) | public static uint DecodeUint32(byte[] bytes, Iterator it)
method DecodeFloat32 (line 255) | public static float DecodeFloat32(byte[] bytes, Iterator it)
method DecodeFloat64 (line 268) | public static double DecodeFloat64(byte[] bytes, Iterator it)
method DecodeInt64 (line 281) | public static long DecodeInt64(byte[] bytes, Iterator it)
method DecodeUint64 (line 294) | public static ulong DecodeUint64(byte[] bytes, Iterator it)
method DecodeBoolean (line 307) | public static bool DecodeBoolean(byte[] bytes, Iterator it)
method DecodeString (line 318) | public static string DecodeString(byte[] bytes, Iterator it)
method SwitchStructureCheck (line 361) | public static bool SwitchStructureCheck(byte[] bytes, Iterator it)
method NumberCheck (line 372) | public static bool NumberCheck(byte[] bytes, Iterator it)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils/Encode.cs
class Encode (line 5) | public class Encode
method getInitialBytesFromEncodedType (line 13) | public static byte[] getInitialBytesFromEncodedType(byte[] encodedType...
method addByteToArray (line 44) | private static byte[] addByteToArray(byte[] byteArray, byte[] newBytes)
method uint8 (line 52) | private static byte[] uint8(byte[] bytes, int value)
method uint16 (line 57) | private static byte[] uint16(byte[] bytes, int value)
method uint32 (line 63) | private static byte[] uint32(byte[] bytes, int value)
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/SchemaSerializer.cs
class SchemaSerializer (line 13) | public class SchemaSerializer<T> : ISerializer<T> where T : Schema.Schema
method SetState (line 23) | public void SetState(byte[] data, int offset = 0)
method GetState (line 30) | public T GetState()
method Patch (line 36) | public void Patch(byte[] data, int offset = 0)
method Teardown (line 43) | public void Teardown()
method Handshake (line 50) | public void Handshake(byte[] bytes, int offset)
method HandshakeDynamic (line 94) | private void HandshakeDynamic(Reflection reflection, ReflectionType[] ...
method DebugReflectionType (line 131) | private static string DebugReflectionType(ReflectionType reflectionTyp...
method CompareTypes (line 141) | private static bool CompareTypes(System.Type schemaType, List<Reflecti...
method GetFieldsFromType (line 184) | private List<ReflectionField> GetFieldsFromType(ReflectionType reflect...
FILE: Assets/Colyseus/Runtime/Colyseus/Serializer/Serializer.cs
type ISerializer (line 7) | public interface ISerializer<T>
method SetState (line 14) | void SetState(byte[] data, int offset);
method GetState (line 20) | T GetState();
method Patch (line 27) | void Patch(byte[] data, int offset);
method Teardown (line 32) | void Teardown();
method Handshake (line 39) | void Handshake(byte[] bytes, int offset);
FILE: Assets/Colyseus/Runtime/Colyseus/Settings/Settings.cs
class Settings (line 14) | [CreateAssetMenu(fileName = "MyServerSettings", menuName = "Colyseus/Ser...
class RequestHeader (line 40) | [Serializable]
method SetRequestHeaders (line 54) | public void SetRequestHeaders(RequestHeader[] headers)
method GetRequestHeaders (line 63) | public RequestHeader[] GetRequestHeaders()
method Create (line 111) | public static Settings Create()
method Clone (line 125) | public static Settings Clone(Settings orig)
method BuildWebRequestEndpoint (line 136) | private string BuildWebRequestEndpoint()
method BuildWebSocketEndpoint (line 145) | private string BuildWebSocketEndpoint()
method GetBaseEndpoint (line 154) | private string GetBaseEndpoint(string scheme)
method GetWebSocketEndpointScheme (line 159) | public string GetWebSocketEndpointScheme()
method GetWebRequestEndpointScheme (line 164) | public string GetWebRequestEndpointScheme()
method GetPort (line 169) | public int GetPort()
method ShouldIncludeServerPort (line 181) | private bool ShouldIncludeServerPort()
class Settings (line 19) | public class Settings
class RequestHeader (line 40) | [Serializable]
method SetRequestHeaders (line 54) | public void SetRequestHeaders(RequestHeader[] headers)
method GetRequestHeaders (line 63) | public RequestHeader[] GetRequestHeaders()
method Create (line 111) | public static Settings Create()
method Clone (line 125) | public static Settings Clone(Settings orig)
method BuildWebRequestEndpoint (line 136) | private string BuildWebRequestEndpoint()
method BuildWebSocketEndpoint (line 145) | private string BuildWebSocketEndpoint()
method GetBaseEndpoint (line 154) | private string GetBaseEndpoint(string scheme)
method GetWebSocketEndpointScheme (line 159) | public string GetWebSocketEndpointScheme()
method GetWebRequestEndpointScheme (line 164) | public string GetWebRequestEndpointScheme()
method GetPort (line 169) | public int GetPort()
method ShouldIncludeServerPort (line 181) | private bool ShouldIncludeServerPort()
FILE: Assets/Colyseus/Runtime/Colyseus/Transport/WebSocket.cs
class WebSocketTransport (line 8) | public class WebSocketTransport
method ShouldUseSharedDispatchLoop (line 19) | internal static bool ShouldUseSharedDispatchLoop(SynchronizationContex...
method Connect (line 24) | public async Task Connect(string url, Dictionary<string, string> headers)
method Send (line 64) | public Task Send(byte[] data) => _ws.Send(data);
method Close (line 66) | public Task Close() => _ws.Close();
method CancelConnection (line 68) | public void CancelConnection() => _ws.CancelConnection();
method DispatchMessageQueue (line 71) | public void DispatchMessageQueue()
method DispatchMessageQueueFromSharedLoop (line 85) | internal void DispatchMessageQueueFromSharedLoop()
FILE: Assets/Colyseus/Runtime/Colyseus/Transport/WebSocketDispatchLoop.cs
class WebSocketDispatchLoop (line 9) | internal static class WebSocketDispatchLoop
method Register (line 19) | public static void Register(WebSocketTransport socket)
method Unregister (line 39) | public static void Unregister(WebSocketTransport socket)
method EnsureThread (line 54) | private static void EnsureThread()
method DispatchLoop (line 69) | private static void DispatchLoop()
FILE: Assets/Colyseus/Runtime/Colyseus/Utils/Exceptions.cs
class MatchMakeException (line 8) | public class MatchMakeException : Exception
method MatchMakeException (line 14) | public MatchMakeException(int code, string message) : base(message)
class HttpException (line 20) | public class HttpException : Exception
method HttpException (line 27) | public HttpException(int statusCode, string message) : base(message)
FILE: Assets/Colyseus/Runtime/Colyseus/Utils/ExtensionMethods.cs
class ColyseusExtensionMethods (line 11) | public static class ColyseusExtensionMethods
method GetAwaiter (line 18) | public static UnityWebRequestAwaiter GetAwaiter(this UnityWebRequestAs...
FILE: Assets/Colyseus/Runtime/Colyseus/Utils/ObjectExtensions.cs
class ColyseusObjectExtensions (line 11) | public static class ColyseusObjectExtensions
method ToObject (line 19) | public static T ToObject<T>(this IDictionary<string, object> source)
method AsDictionary (line 41) | public static IDictionary<string, object> AsDictionary(this object sou...
FILE: Assets/Colyseus/Runtime/Colyseus/Utils/UnityWebRequestAwaiter.cs
class UnityWebRequestAwaiter (line 12) | public class UnityWebRequestAwaiter : INotifyCompletion
method UnityWebRequestAwaiter (line 17) | public UnityWebRequestAwaiter(UnityWebRequestAsyncOperation asyncOp)
method OnCompleted (line 35) | public void OnCompleted(Action continuation)
method GetResult (line 43) | public void GetResult()
method OnRequestCompleted (line 47) | private void OnRequestCompleted(AsyncOperation obj)
FILE: Assets/Colyseus/Runtime/Example~/ColyseusNetworkManager.cs
class WeatherMessage (line 6) | public class WeatherMessage {
class ColyseusNetworkManager (line 10) | public class ColyseusNetworkManager : MonoBehaviour
method Start (line 19) | void Start()
method Update (line 47) | void Update()
method OnDestroy (line 52) | async void OnDestroy()
method joinMyRoom (line 61) | protected async void joinMyRoom()
method joinLobbyRoom (line 110) | protected async void joinLobbyRoom()
method joinQueueRoom (line 133) | protected async void joinQueueRoom()
FILE: Assets/Colyseus/Runtime/Example~/ConnectionManager.cs
class ConnectionManager (line 5) | public class ConnectionManager : MonoBehaviour
method Start (line 8) | void Start()
method Update (line 14) | void Update()
FILE: Assets/Colyseus/Runtime/Example~/Schema/Item.cs
class Item (line 13) | public partial class Item : Schema {
method Item (line 14) | #if UNITY_5_3_OR_NEWER
FILE: Assets/Colyseus/Runtime/Example~/Schema/MyRoomState.cs
class MyRoomState (line 13) | public partial class MyRoomState : Schema {
method MyRoomState (line 14) | #if UNITY_5_3_OR_NEWER
FILE: Assets/Colyseus/Runtime/Example~/Schema/Player.cs
class Player (line 13) | public partial class Player : Schema {
method Player (line 14) | #if UNITY_5_3_OR_NEWER
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/ArrayExtensions.cs
class ArrayExtensions (line 4) | internal static class ArrayExtensions
method ConvertAll (line 6) | public static OutputT[] ConvertAll<T, OutputT>(this T[] array, Func<T,...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/GenerateTypeSerializerAttribute.cs
class GenerateTypeSerializerAttribute (line 21) | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inheri...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/IJsonReader.cs
type IJsonReader (line 20) | public interface IJsonReader
method NextToken (line 28) | bool NextToken();
method IsEndOfStream (line 30) | bool IsEndOfStream();
method Reset (line 35) | void Reset();
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/IJsonWriter.cs
type IJsonWriter (line 21) | public interface IJsonWriter
method Flush (line 25) | void Flush();
method Write (line 27) | void Write(string value);
method Write (line 28) | void Write(JsonMember value);
method Write (line 29) | void Write(int number);
method Write (line 30) | void Write(uint number);
method Write (line 31) | void Write(long number);
method Write (line 32) | void Write(ulong number);
method Write (line 33) | void Write(float number);
method Write (line 34) | void Write(double number);
method Write (line 35) | void Write(decimal number);
method Write (line 36) | void Write(bool value);
method Write (line 37) | void Write(DateTime dateTime);
method Write (line 38) | void Write(DateTimeOffset dateTimeOffset);
method WriteObjectBegin (line 39) | void WriteObjectBegin(int numberOfMembers);
method WriteObjectEnd (line 40) | void WriteObjectEnd();
method WriteArrayBegin (line 41) | void WriteArrayBegin(int numberOfMembers);
method WriteArrayEnd (line 42) | void WriteArrayEnd();
method WriteNull (line 43) | void WriteNull();
method WriteJson (line 45) | void WriteJson(string jsonString);
method WriteJson (line 46) | void WriteJson(char[] jsonString, int index, int charCount);
method Reset (line 48) | void Reset();
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/IValueInfo.cs
type IValueInfo (line 6) | public interface IValueInfo
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/IndexedDictionary.cs
class IndexedDictionary (line 11) | [Serializable, DebuggerDisplay("IndexedDictionary, Count: {Count}")]
method IndexedDictionary (line 81) | public IndexedDictionary()
method IndexedDictionary (line 87) | public IndexedDictionary(int count)
method IndexedDictionary (line 97) | public IndexedDictionary(IDictionary<KeyT, ValueT> dictionary)
method IndexedDictionary (line 105) | public IndexedDictionary(IEnumerable<KeyValuePair<KeyT, ValueT>> pairs)
method IndexedDictionary (line 116) | public IndexedDictionary(IDictionary<KeyT, ValueT> dictionary, ICollec...
method Add (line 128) | public void Add(KeyT key, ValueT value)
method Add (line 134) | public void Add(IndexedDictionary<KeyT, ValueT> other)
method Insert (line 155) | public void Insert(int index, KeyT key, ValueT value)
method ContainsKey (line 162) | public bool ContainsKey(KeyT key)
method ContainsKey (line 167) | public bool ContainsKey(KeyT key, IEqualityComparer<KeyT> keyComparer)
method ContainsValue (line 175) | public bool ContainsValue(ValueT value)
method ContainsValue (line 183) | public bool ContainsValue(ValueT value, IEqualityComparer comparer)
method Remove (line 193) | public bool Remove(KeyT key)
method TryGetValue (line 202) | public bool TryGetValue(KeyT key, out ValueT value)
method IndexOf (line 208) | public int IndexOf(KeyT key)
method RemoveAt (line 213) | public void RemoveAt(int index)
method SortKeys (line 221) | public void SortKeys(IComparer<KeyT> comparer)
method Clear (line 229) | public void Clear()
method GetValues (line 235) | private ReadOnlyCollection<ValueT> GetValues()
method Contains (line 245) | bool IDictionary.Contains(object key)
method Add (line 250) | void IDictionary.Add(object key, object value)
method GetEnumerator (line 255) | IDictionaryEnumerator IDictionary.GetEnumerator()
method Remove (line 260) | void IDictionary.Remove(object key)
method CopyTo (line 265) | void ICollection.CopyTo(Array array, int index)
method Add (line 276) | void ICollection<KeyValuePair<KeyT, ValueT>>.Add(KeyValuePair<KeyT, Va...
method Contains (line 281) | bool ICollection<KeyValuePair<KeyT, ValueT>>.Contains(KeyValuePair<Key...
method CopyTo (line 287) | void ICollection<KeyValuePair<KeyT, ValueT>>.CopyTo(KeyValuePair<KeyT,...
method Remove (line 297) | bool ICollection<KeyValuePair<KeyT, ValueT>>.Remove(KeyValuePair<KeyT,...
method GetEnumerator (line 305) | IEnumerator<KeyValuePair<KeyT, ValueT>> IEnumerable<KeyValuePair<KeyT,...
method GetEnumerator (line 310) | IEnumerator IEnumerable.GetEnumerator()
method GetEnumerator (line 315) | public Enumerator GetEnumerator()
method ToString (line 321) | public override string ToString()
type Enumerator (line 326) | public struct Enumerator : IEnumerator<KeyValuePair<KeyT, ValueT>>, ID...
method Enumerator (line 332) | public Enumerator(IndexedDictionary<KeyT, ValueT> owner)
method MoveNext (line 351) | public bool MoveNext()
method Reset (line 361) | public void Reset()
method Dispose (line 366) | public void Dispose()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Json.cs
class Json (line 27) | public static class Json
method Json (line 67) | static Json()
method Serialize (line 123) | public static void Serialize<T>(T objectToSerialize, Stream jsonOutput)
method Serialize (line 127) | public static void Serialize<T>(T objectToSerialize, Stream jsonOutput...
method Serialize (line 131) | public static void Serialize<T>(T objectToSerialize, Stream jsonOutput...
method Serialize (line 135) | public static void Serialize<T>(T objectToSerialize, Stream jsonOutput...
method Serialize (line 139) | public static void Serialize<T>(T objectToSerialize, Stream jsonOutput...
method Serialize (line 158) | public static void Serialize<T>(T objectToSerialize, TextWriter textWr...
method Serialize (line 162) | public static void Serialize<T>(T objectToSerialize, TextWriter textWr...
method Serialize (line 166) | public static void Serialize<T>(T objectToSerialize, TextWriter textWr...
method Serialize (line 184) | public static void Serialize<T>(T objectToSerialize, IJsonWriter write...
method SerializeToString (line 200) | public static string SerializeToString<T>(T objectToSerialize)
method SerializeToString (line 204) | public static string SerializeToString<T>(T objectToSerialize, Seriali...
method SerializeToString (line 208) | public static string SerializeToString<T>(T objectToSerialize, Seriali...
method Deserialize (line 222) | public static object Deserialize(Type objectType, byte[] jsonBytes, in...
method Deserialize (line 228) | public static object Deserialize(Type objectType, byte[] jsonBytes, in...
method Deserialize (line 234) | public static object Deserialize(Type objectType, byte[] jsonBytes, in...
method Deserialize (line 240) | public static object Deserialize(Type objectType, byte[] jsonBytes, in...
method Deserialize (line 246) | public static object Deserialize(Type objectType, byte[] jsonBytes, in...
method Deserialize (line 253) | public static object Deserialize(Type objectType, Stream jsonStream)
method Deserialize (line 257) | public static object Deserialize(Type objectType, Stream jsonStream, E...
method Deserialize (line 261) | public static object Deserialize(Type objectType, Stream jsonStream, S...
method Deserialize (line 265) | public static object Deserialize(Type objectType, Stream jsonStream, S...
method Deserialize (line 269) | public static object Deserialize(Type objectType, Stream jsonStream, S...
method Deserialize (line 280) | public static object Deserialize(Type objectType, TextReader textReader)
method Deserialize (line 284) | public static object Deserialize(Type objectType, TextReader textReade...
method Deserialize (line 288) | public static object Deserialize(Type objectType, TextReader textReade...
method Deserialize (line 298) | public static object Deserialize(Type objectType, string jsonString)
method Deserialize (line 302) | public static object Deserialize(Type objectType, string jsonString, S...
method Deserialize (line 306) | public static object Deserialize(Type objectType, string jsonString, S...
method Deserialize (line 317) | public static object Deserialize(Type objectType, IJsonReader reader)
method Deserialize (line 326) | public static T Deserialize<T>(byte[] jsonBytes, int offset, int length)
method Deserialize (line 332) | public static T Deserialize<T>(byte[] jsonBytes, int offset, int lengt...
method Deserialize (line 338) | public static T Deserialize<T>(byte[] jsonBytes, int offset, int lengt...
method Deserialize (line 344) | public static T Deserialize<T>(byte[] jsonBytes, int offset, int lengt...
method Deserialize (line 350) | public static T Deserialize<T>(byte[] jsonBytes, int offset, int lengt...
method Deserialize (line 358) | public static T Deserialize<T>(Stream jsonStream)
method Deserialize (line 362) | public static T Deserialize<T>(Stream jsonStream, Encoding encoding)
method Deserialize (line 366) | public static T Deserialize<T>(Stream jsonStream, SerializationOptions...
method Deserialize (line 370) | public static T Deserialize<T>(Stream jsonStream, SerializationOptions...
method Deserialize (line 374) | public static T Deserialize<T>(Stream jsonStream, SerializationContext...
method Deserialize (line 380) | public static T Deserialize<T>(TextReader textReader)
method Deserialize (line 384) | public static T Deserialize<T>(TextReader textReader, SerializationOpt...
method Deserialize (line 388) | public static T Deserialize<T>(TextReader textReader, SerializationCon...
method Deserialize (line 393) | public static T Deserialize<T>(string jsonString)
method Deserialize (line 397) | public static T Deserialize<T>(string jsonString, SerializationOptions...
method Deserialize (line 401) | public static T Deserialize<T>(string jsonString, SerializationContext...
method Deserialize (line 406) | public static T Deserialize<T>(IJsonReader reader)
method CreateDefaultContext (line 414) | private static SerializationContext CreateDefaultContext(Serialization...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonMember.cs
type JsonMember (line 22) | public struct JsonMember : IEquatable<JsonMember>, IEquatable<string>
method JsonMember (line 33) | public JsonMember(string name)
method JsonMember (line 38) | public JsonMember(string name, bool escapedAndQuoted)
method JsonMember (line 48) | public JsonMember(char[] name)
method JsonMember (line 53) | public JsonMember(char[] name, bool escapedAndQuoted)
method GetHashCode (line 63) | public override int GetHashCode()
method Equals (line 68) | public override bool Equals(object obj)
method Equals (line 78) | public bool Equals(JsonMember other)
method Equals (line 83) | public bool Equals(string other)
method ToString (line 98) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReader.cs
class JsonReader (line 25) | public abstract class JsonReader : IJsonReader
class Buffer (line 29) | private sealed class Buffer : IList<char>
method Buffer (line 76) | public Buffer(JsonReader reader, char[] buffer)
method FixateNow (line 87) | public void FixateNow()
method Fixate (line 94) | public void Fixate(int atIndex)
method FixateLater (line 115) | public void FixateLater(int atIndex)
method IsBeyondOfStream (line 125) | public bool IsBeyondOfStream(int index)
method GetChars (line 136) | public char[] GetChars()
method Reset (line 141) | public void Reset()
method ReadNextBlock (line 150) | private void ReadNextBlock()
method ShiftToZero (line 166) | private void ShiftToZero()
method BlockCopy (line 188) | private static void BlockCopy(char[] from, int fromIdx, char[] to, i...
method ToString (line 195) | public override string ToString()
method IndexOf (line 202) | int IList<char>.IndexOf(char item)
method Insert (line 207) | void IList<char>.Insert(int index, char item)
method RemoveAt (line 212) | void IList<char>.RemoveAt(int index)
method Add (line 227) | void ICollection<char>.Add(char item)
method Clear (line 232) | void ICollection<char>.Clear()
method Contains (line 237) | bool ICollection<char>.Contains(char item)
method CopyTo (line 242) | void ICollection<char>.CopyTo(char[] array, int arrayIndex)
method Remove (line 257) | bool ICollection<char>.Remove(char item)
method GetEnumerator (line 266) | IEnumerator<char> IEnumerable<char>.GetEnumerator()
method GetEnumerator (line 275) | IEnumerator IEnumerable.GetEnumerator()
class LazyValueInfo (line 283) | private sealed class LazyValueInfo : IValueInfo
type Kind (line 285) | private enum Kind : byte
method LazyValueInfo (line 384) | public LazyValueInfo(JsonReader reader)
method ClearValue (line 392) | public void ClearValue()
method SetBufferBounds (line 399) | public void SetBufferBounds(int start, int len)
method SetAsLazyString (line 411) | public void SetAsLazyString(bool quoted)
method JsonReader (line 435) | protected JsonReader(SerializationContext context, char[] buffer = null)
method NextToken (line 486) | public bool NextToken()
method IsEndOfStream (line 556) | public bool IsEndOfStream()
method Reset (line 561) | public void Reset()
method IsNumber (line 573) | private static bool IsNumber(Buffer buffer, int start, int len)
method IsInsignificantWhitespace (line 655) | private static bool IsInsignificantWhitespace(char symbol)
method IsInsignificant (line 660) | private static bool IsInsignificant(char symbol)
method IsLiteralTerminator (line 665) | private static bool IsLiteralTerminator(char ch, bool quoted, char quo...
method LookupAt (line 687) | private bool LookupAt(Buffer buffer, int start, int len, string matchS...
method LookupAtSkipWhitespace (line 696) | private bool LookupAtSkipWhitespace(Buffer buffer, int start, int len,...
method NextLexeme (line 716) | private bool NextLexeme(ref int start, ref int len, ref bool quoted, r...
method FillBuffer (line 792) | protected abstract int FillBuffer(char[] buffer, int index);
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReaderExtentions.cs
class JsonReaderExtentions (line 24) | public static class JsonReaderExtentions
method ReadArrayBegin (line 26) | public static void ReadArrayBegin(this IJsonReader reader, bool nextTo...
method ReadArrayEnd (line 40) | public static void ReadArrayEnd(this IJsonReader reader, bool nextToke...
method ReadObjectBegin (line 53) | public static void ReadObjectBegin(this IJsonReader reader, bool nextT...
method ReadObjectEnd (line 67) | public static void ReadObjectEnd(this IJsonReader reader, bool nextTok...
method ReadMember (line 79) | public static string ReadMember(this IJsonReader reader, bool nextToke...
method ReadByte (line 96) | public static byte ReadByte(this IJsonReader reader, bool nextToken = ...
method ReadByteOrNull (line 113) | public static byte? ReadByteOrNull(this IJsonReader reader, bool nextT...
method ReadSByte (line 140) | public static sbyte ReadSByte(this IJsonReader reader, bool nextToken ...
method ReadSByteOrNull (line 157) | public static sbyte? ReadSByteOrNull(this IJsonReader reader, bool nex...
method ReadInt16 (line 184) | public static short ReadInt16(this IJsonReader reader, bool nextToken ...
method ReadInt16OrNull (line 201) | public static short? ReadInt16OrNull(this IJsonReader reader, bool nex...
method ReadInt32 (line 228) | public static int ReadInt32(this IJsonReader reader, bool nextToken = ...
method ReadInt32OrNull (line 245) | public static int? ReadInt32OrNull(this IJsonReader reader, bool nextT...
method ReadInt64 (line 272) | public static long ReadInt64(this IJsonReader reader, bool nextToken =...
method ReadInt64OrNull (line 289) | public static long? ReadInt64OrNull(this IJsonReader reader, bool next...
method ReadUInt16 (line 315) | public static ushort ReadUInt16(this IJsonReader reader, bool nextToke...
method ReadUInt16OrNull (line 332) | public static ushort? ReadUInt16OrNull(this IJsonReader reader, bool n...
method ReadUInt32 (line 359) | public static uint ReadUInt32(this IJsonReader reader, bool nextToken ...
method ReadUInt32OrNull (line 376) | public static uint? ReadUInt32OrNull(this IJsonReader reader, bool nex...
method ReadUInt64 (line 403) | public static ulong ReadUInt64(this IJsonReader reader, bool nextToken...
method ReadUInt64OrNull (line 420) | public static ulong? ReadUInt64OrNull(this IJsonReader reader, bool ne...
method ReadSingle (line 447) | public static float ReadSingle(this IJsonReader reader, bool nextToken...
method ReadSingleOrNull (line 464) | public static float? ReadSingleOrNull(this IJsonReader reader, bool ne...
method ReadDouble (line 491) | public static double ReadDouble(this IJsonReader reader, bool nextToke...
method ReadDoubleOrNull (line 508) | public static double? ReadDoubleOrNull(this IJsonReader reader, bool n...
method ReadDecimal (line 535) | public static decimal ReadDecimal(this IJsonReader reader, bool nextTo...
method ReadDecimalOrNull (line 552) | public static decimal? ReadDecimalOrNull(this IJsonReader reader, bool...
method ReadBoolean (line 579) | public static bool ReadBoolean(this IJsonReader reader, bool nextToken...
method ReadBooleanOrNull (line 596) | public static bool? ReadBooleanOrNull(this IJsonReader reader, bool ne...
method ReadDateTime (line 623) | public static DateTime ReadDateTime(this IJsonReader reader, bool next...
method ReadDateTimeOrNull (line 640) | public static DateTime? ReadDateTimeOrNull(this IJsonReader reader, bo...
method ReadString (line 668) | public static string ReadString(this IJsonReader reader, bool nextToke...
method ReadNull (line 695) | public static void ReadNull(this IJsonReader reader, bool nextToken = ...
method ReadValue (line 707) | public static object ReadValue(this IJsonReader reader, Type valueType...
method DebugPrintTokens (line 736) | public static string DebugPrintTokens(this IJsonReader reader)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonSerializationException.cs
class JsonSerializationException (line 12) | [Serializable]
type ErrorCode (line 15) | public enum ErrorCode
method JsonSerializationException (line 45) | internal JsonSerializationException(string message, ErrorCode errorCod...
method JsonSerializationException (line 52) | internal JsonSerializationException(string message, ErrorCode errorCod...
method JsonSerializationException (line 59) | internal JsonSerializationException(string message, Exception innerExc...
method JsonSerializationException (line 65) | protected JsonSerializationException(SerializationInfo info, Streaming...
method Update (line 74) | private void Update(IJsonReader reader)
method GetObjectData (line 81) | [SecurityCritical]
method MemberNameIsEmpty (line 92) | public static Exception MemberNameIsEmpty(IJsonReader reader)
method MemberNameIsNotSet (line 101) | public static Exception MemberNameIsNotSet()
method DiscriminatorIsNotFirstMember (line 109) | public static Exception DiscriminatorIsNotFirstMember(IJsonReader reader)
method CantCreateInstanceOfType (line 118) | public static Exception CantCreateInstanceOfType(Type type)
method SerializationGraphIsTooBig (line 127) | public static Exception SerializationGraphIsTooBig(IJsonReader reader,...
method SerializationGraphIsTooDeep (line 135) | public static Exception SerializationGraphIsTooDeep(IJsonReader reader...
method TypeIsNotValid (line 143) | public static Exception TypeIsNotValid(Type type, string problem)
method SerializingUnknownType (line 153) | public static Exception SerializingUnknownType(Type type)
method SerializingSpecialSystemType (line 161) | public static Exception SerializingSpecialSystemType(Type type)
method UnexpectedEndOfStream (line 169) | public static Exception UnexpectedEndOfStream(IJsonReader reader)
method UnexpectedMemberName (line 178) | public static Exception UnexpectedMemberName(string memberName, string...
method UnexpectedToken (line 187) | public static Exception UnexpectedToken(IJsonReader reader, params Jso...
method UnknownEscapeSequence (line 228) | public static Exception UnknownEscapeSequence(string escape, IJsonRead...
method SerializationFramesCorruption (line 237) | public static Exception SerializationFramesCorruption()
method StreamIsNotReadable (line 245) | public static Exception StreamIsNotReadable()
method StreamIsNotWriteable (line 253) | public static Exception StreamIsNotWriteable()
method UnterminatedStringLiteral (line 261) | public static Exception UnterminatedStringLiteral(IJsonReader reader)
method UnknownNotation (line 270) | public static Exception UnknownNotation(IJsonReader reader, string not...
method TypeRequiresCustomSerializer (line 279) | public static Exception TypeRequiresCustomSerializer(Type type, Type t...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStreamReader.cs
class JsonStreamReader (line 22) | public sealed class JsonStreamReader : JsonReader
method JsonStreamReader (line 26) | public JsonStreamReader(Stream stream, SerializationContext context, c...
method FillBuffer (line 35) | protected override int FillBuffer(char[] buffer, int index)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStreamWriter.cs
class JsonStreamWriter (line 22) | public sealed class JsonStreamWriter : JsonWriter
method JsonStreamWriter (line 28) | public JsonStreamWriter(Stream stream, SerializationContext context, c...
method Flush (line 38) | public override void Flush()
method WriteJson (line 43) | public override void WriteJson(string jsonString)
method WriteJson (line 53) | public override void WriteJson(char[] jsonString, int index, int chara...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringBuilderReader.cs
class JsonStringBuilderReader (line 22) | public sealed class JsonStringBuilderReader : JsonReader
method JsonStringBuilderReader (line 27) | public JsonStringBuilderReader(StringBuilder stringBuilder, Serializat...
method FillBuffer (line 38) | protected override int FillBuffer(char[] buffer, int index)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringBuilderWriter.cs
class JsonStringBuilderWriter (line 22) | public sealed class JsonStringBuilderWriter : JsonWriter
method JsonStringBuilderWriter (line 31) | public JsonStringBuilderWriter(StringBuilder stringBuilder, Serializat...
method Flush (line 42) | public override void Flush()
method WriteJson (line 46) | public override void WriteJson(string jsonString)
method WriteJson (line 56) | public override void WriteJson(char[] jsonString, int offset, int char...
method ToString (line 73) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringReader.cs
class JsonStringReader (line 21) | public sealed class JsonStringReader : JsonReader
method JsonStringReader (line 26) | public JsonStringReader(string jsonString, SerializationContext contex...
method FillBuffer (line 37) | protected override int FillBuffer(char[] buffer, int index)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonTextReader.cs
class JsonTextReader (line 22) | public sealed class JsonTextReader : JsonReader
method JsonTextReader (line 26) | public JsonTextReader(TextReader reader, SerializationContext context,...
method FillBuffer (line 36) | protected override int FillBuffer(char[] buffer, int index)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonTextWriter.cs
class JsonTextWriter (line 22) | public sealed class JsonTextWriter : JsonWriter
method JsonTextWriter (line 31) | public JsonTextWriter(TextWriter writer, SerializationContext context,...
method Flush (line 41) | public override void Flush()
method WriteJson (line 46) | public override void WriteJson(string jsonString)
method WriteJson (line 56) | public override void WriteJson(char[] jsonString, int offset, int char...
method ToString (line 73) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonToken.cs
type JsonToken (line 20) | public enum JsonToken
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonUtils.cs
class JsonUtils (line 22) | internal static class JsonUtils
method UnescapeAndUnquote (line 29) | public static string UnescapeAndUnquote(string stringToUnescape)
method EscapeAndQuote (line 47) | public static string EscapeAndQuote(string stringToEscape)
method EscapeBuffer (line 94) | public static int EscapeBuffer(string value, ref int offset, char[] ou...
method UnescapeBuffer (line 138) | public static string UnescapeBuffer(char[] charsToUnescape, int start,...
method HexStringToUInt32 (line 238) | public static uint HexStringToUInt32(char[] buffer, int start, int len)
method UInt32ToHexBuffer (line 274) | public static int UInt32ToHexBuffer(uint uvalue, char[] buffer, int st...
method UInt16ToPaddedHexBuffer (line 306) | public static int UInt16ToPaddedHexBuffer(ushort uvalue, char[] buffer...
method PaddedHexStringToUInt16 (line 335) | public static ushort PaddedHexStringToUInt16(char[] buffer, int start,...
method StringToInt64 (line 371) | public static long StringToInt64(char[] buffer, int start, int len, IF...
method StringToInt32 (line 407) | public static int StringToInt32(char[] buffer, int start, int len, IFo...
method StringToUInt64 (line 443) | public static ulong StringToUInt64(char[] buffer, int start, int len, ...
method StringToUInt32 (line 470) | public static uint StringToUInt32(char[] buffer, int start, int len, I...
method StringToDouble (line 497) | public static double StringToDouble(char[] buffer, int start, int len,...
method StringToFloat (line 556) | public static float StringToFloat(char[] buffer, int start, int len, I...
method StringToDecimal (line 615) | public static decimal StringToDecimal(char[] buffer, int start, int le...
method Int32ToBuffer (line 630) | public static int Int32ToBuffer(int value, char[] buffer, int start, I...
method Int64ToBuffer (line 655) | public static int Int64ToBuffer(long value, char[] buffer, int start, ...
method UInt32ToBuffer (line 680) | public static int UInt32ToBuffer(uint uvalue, char[] buffer, int start...
method UInt64ToBuffer (line 702) | public static int UInt64ToBuffer(ulong uvalue, char[] buffer, int star...
method SingleToBuffer (line 723) | public static int SingleToBuffer(float value, char[] buffer, int start...
method DoubleToBuffer (line 736) | public static int DoubleToBuffer(double value, char[] buffer, int star...
method DecimalToBuffer (line 749) | public static int DecimalToBuffer(decimal value, char[] buffer, int st...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonWriter.cs
class JsonWriter (line 23) | public abstract class JsonWriter : IJsonWriter
type Structure (line 27) | [Flags]
method JsonWriter (line 62) | protected JsonWriter(SerializationContext context, char[] buffer = null)
method Flush (line 72) | public abstract void Flush();
method WriteJson (line 73) | public abstract void WriteJson(string jsonString);
method WriteJson (line 74) | public abstract void WriteJson(char[] jsonString, int offset, int char...
method Write (line 76) | public void Write(string value)
method Write (line 99) | public void Write(JsonMember member)
method Write (line 120) | public void Write(int number)
method Write (line 127) | public void Write(uint number)
method Write (line 134) | public void Write(long number)
method Write (line 145) | public void Write(ulong number)
method Write (line 156) | public void Write(float number)
method Write (line 166) | public void Write(double number)
method Write (line 176) | public void Write(decimal number)
method Write (line 186) | public void Write(DateTime dateTime)
method Write (line 201) | public void Write(DateTimeOffset dateTimeOffset)
method Write (line 209) | public void Write(bool value)
method WriteObjectBegin (line 218) | public void WriteObjectBegin(int numberOfMembers)
method WriteObjectEnd (line 225) | public void WriteObjectEnd()
method WriteArrayBegin (line 233) | public void WriteArrayBegin(int numberOfMembers)
method WriteArrayEnd (line 240) | public void WriteArrayEnd()
method WriteNull (line 247) | public void WriteNull()
method Reset (line 254) | public void Reset()
method WriteNewlineAndPad (line 260) | private void WriteNewlineAndPad(int correction)
method WriteFormatting (line 274) | private void WriteFormatting(JsonToken token)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonWriterExtentions.cs
class JsonWriterExtentions (line 21) | public static class JsonWriterExtentions
method WriteMember (line 23) | public static void WriteMember(this IJsonWriter writer, string memberN...
method WriteDateTime (line 31) | public static void WriteDateTime(this IJsonWriter writer, DateTime date)
method WriteDateTime (line 37) | public static void WriteDateTime(this IJsonWriter writer, DateTime? date)
method WriteBoolean (line 49) | public static void WriteBoolean(this IJsonWriter writer, bool value)
method WriteBoolean (line 55) | public static void WriteBoolean(this IJsonWriter writer, bool? value)
method WriteNumber (line 67) | public static void WriteNumber(this IJsonWriter writer, byte number)
method WriteNumber (line 73) | public static void WriteNumber(this IJsonWriter writer, sbyte number)
method WriteNumber (line 79) | public static void WriteNumber(this IJsonWriter writer, short number)
method WriteNumber (line 85) | public static void WriteNumber(this IJsonWriter writer, ushort number)
method WriteNumber (line 91) | public static void WriteNumber(this IJsonWriter writer, int number)
method WriteNumber (line 97) | public static void WriteNumber(this IJsonWriter writer, uint number)
method WriteNumber (line 103) | public static void WriteNumber(this IJsonWriter writer, long number)
method WriteNumber (line 109) | public static void WriteNumber(this IJsonWriter writer, ulong number)
method WriteNumber (line 115) | public static void WriteNumber(this IJsonWriter writer, float number)
method WriteNumber (line 121) | public static void WriteNumber(this IJsonWriter writer, double number)
method WriteNumber (line 127) | public static void WriteNumber(this IJsonWriter writer, decimal number)
method WriteNumber (line 133) | public static void WriteNumber(this IJsonWriter writer, byte? number)
method WriteNumber (line 143) | public static void WriteNumber(this IJsonWriter writer, sbyte? number)
method WriteNumber (line 154) | public static void WriteNumber(this IJsonWriter writer, short? number)
method WriteNumber (line 164) | public static void WriteNumber(this IJsonWriter writer, ushort? number)
method WriteNumber (line 175) | public static void WriteNumber(this IJsonWriter writer, int? number)
method WriteNumber (line 186) | public static void WriteNumber(this IJsonWriter writer, uint? number)
method WriteNumber (line 197) | public static void WriteNumber(this IJsonWriter writer, long? number)
method WriteNumber (line 208) | public static void WriteNumber(this IJsonWriter writer, ulong? number)
method WriteNumber (line 219) | public static void WriteNumber(this IJsonWriter writer, float? number)
method WriteNumber (line 230) | public static void WriteNumber(this IJsonWriter writer, double? number)
method WriteNumber (line 241) | public static void WriteNumber(this IJsonWriter writer, decimal? number)
method WriteString (line 253) | public static void WriteString(this IJsonWriter writer, string literal)
method WriteValue (line 265) | public static void WriteValue(this IJsonWriter writer, object value, T...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/BigEndianBitConverter.cs
class BigEndianBitConverter (line 59) | internal sealed class BigEndianBitConverter : EndianBitConverter
method IsLittleEndian (line 70) | public override sealed bool IsLittleEndian()
method CopyBytesImpl (line 90) | protected override void CopyBytesImpl(long value, int bytes, byte[] bu...
method FromBytes (line 108) | protected override long FromBytes(byte[] buffer, int startIndex, int b...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/DefaultMsgPackExtensionTypeHandler.cs
class DefaultMessagePackExtensionTypeHandler (line 7) | public sealed class DefaultMessagePackExtensionTypeHandler : MessagePack...
method DefaultMessagePackExtensionTypeHandler (line 29) | internal DefaultMessagePackExtensionTypeHandler(EndianBitConverter bit...
method TryRead (line 37) | public override bool TryRead(sbyte type, ArraySegment<byte> data, out ...
method TryWrite (line 120) | public override bool TryWrite(object value, out sbyte type, ref ArrayS...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/EndianBitConverter.cs
class EndianBitConverter (line 61) | internal abstract class EndianBitConverter
method IsLittleEndian (line 74) | public abstract bool IsLittleEndian();
method DoubleToInt64Bits (line 118) | public long DoubleToInt64Bits(double value)
method Int64BitsToDouble (line 130) | public double Int64BitsToDouble(long value)
method SingleToInt32Bits (line 142) | public int SingleToInt32Bits(float value)
method Int32BitsToSingle (line 154) | public float Int32BitsToSingle(int value)
method ToBoolean (line 169) | public bool ToBoolean(byte[] value, int startIndex)
method ToChar (line 181) | public char ToChar(byte[] value, int startIndex)
method ToDouble (line 193) | public double ToDouble(byte[] value, int startIndex)
method ToSingle (line 205) | public float ToSingle(byte[] value, int startIndex)
method ToInt16 (line 216) | public short ToInt16(byte[] value, int startIndex)
method ToInt32 (line 227) | public int ToInt32(byte[] value, int startIndex)
method ToInt64 (line 238) | public long ToInt64(byte[] value, int startIndex)
method ToUInt16 (line 249) | public ushort ToUInt16(byte[] value, int startIndex)
method ToUInt32 (line 260) | public uint ToUInt32(byte[] value, int startIndex)
method ToUInt64 (line 271) | public ulong ToUInt64(byte[] value, int startIndex)
method CheckByteArgument (line 286) | private static void CheckByteArgument(byte[] value, int startIndex, in...
method CheckedFromBytes (line 306) | private long CheckedFromBytes(byte[] value, int startIndex, int bytesT...
method FromBytes (line 321) | protected abstract long FromBytes(byte[] value, int startIndex, int by...
method ToString (line 336) | public static string ToString(byte[] value)
method ToString (line 351) | public static string ToString(byte[] value, int startIndex)
method ToString (line 367) | public static string ToString(byte[] value, int startIndex, int length)
method ToDecimal (line 383) | public decimal ToDecimal(byte[] value, int startIndex)
method GetBytes (line 401) | public byte[] GetBytes(decimal value)
method CopyBytes (line 419) | public void CopyBytes(decimal value, byte[] buffer, int index)
method GetBytes (line 439) | private byte[] GetBytes(long value, int bytes)
method GetBytes (line 451) | public byte[] GetBytes(bool value)
method GetBytes (line 461) | public byte[] GetBytes(char value)
method GetBytes (line 471) | public byte[] GetBytes(double value)
method GetBytes (line 481) | public byte[] GetBytes(short value)
method GetBytes (line 491) | public byte[] GetBytes(int value)
method GetBytes (line 501) | public byte[] GetBytes(long value)
method GetBytes (line 511) | public byte[] GetBytes(float value)
method GetBytes (line 521) | public byte[] GetBytes(ushort value)
method GetBytes (line 531) | public byte[] GetBytes(uint value)
method GetBytes (line 541) | public byte[] GetBytes(ulong value)
method CopyBytes (line 560) | private void CopyBytes(long value, int bytes, byte[] buffer, int index)
method CopyBytesImpl (line 584) | protected abstract void CopyBytesImpl(long value, int bytes, byte[] bu...
method CopyBytes (line 593) | public void CopyBytes(bool value, byte[] buffer, int index)
method CopyBytes (line 605) | public void CopyBytes(char value, byte[] buffer, int index)
method CopyBytes (line 617) | public void CopyBytes(double value, byte[] buffer, int index)
method CopyBytes (line 629) | public void CopyBytes(short value, byte[] buffer, int index)
method CopyBytes (line 641) | public void CopyBytes(int value, byte[] buffer, int index)
method CopyBytes (line 653) | public void CopyBytes(long value, byte[] buffer, int index)
method CopyBytes (line 665) | public void CopyBytes(float value, byte[] buffer, int index)
method CopyBytes (line 677) | public void CopyBytes(ushort value, byte[] buffer, int index)
method CopyBytes (line 689) | public void CopyBytes(uint value, byte[] buffer, int index)
method CopyBytes (line 701) | public void CopyBytes(ulong value, byte[] buffer, int index)
type Int32SingleUnion (line 713) | [StructLayout(LayoutKind.Explicit)]
method Int32SingleUnion (line 730) | internal Int32SingleUnion(int i)
method Int32SingleUnion (line 740) | internal Int32SingleUnion(float f)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/Endianness.cs
type Endianness (line 58) | public enum Endianness
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/LittleEndianBitConverter.cs
class LittleEndianBitConverter (line 59) | internal sealed class LittleEndianBitConverter : EndianBitConverter
method IsLittleEndian (line 70) | public override sealed bool IsLittleEndian()
method CopyBytesImpl (line 90) | protected override void CopyBytesImpl(long value, int bytes, byte[] bu...
method FromBytes (line 107) | protected override long FromBytes(byte[] buffer, int startIndex, int b...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/MsgPackExtensionType.cs
class MessagePackExtensionType (line 25) | [TypeSerializer(typeof(MsgPackExtensionTypeSerializer))]
method MessagePackExtensionType (line 47) | public MessagePackExtensionType()
method MessagePackExtensionType (line 52) | public MessagePackExtensionType(byte[] binaryData)
method MessagePackExtensionType (line 54) | public MessagePackExtensionType(sbyte type, byte[] binaryData)
method MessagePackExtensionType (line 58) | public MessagePackExtensionType(sbyte type, ArraySegment<byte> binaryD...
method CopyTo (line 78) | public void CopyTo(byte[] destination, int index, int bytesToCopy)
method ToByteArray (line 82) | public byte[] ToByteArray()
method ToArraySegment (line 93) | public ArraySegment<byte> ToArraySegment()
method ToBase64 (line 97) | public string ToBase64()
method Equals (line 102) | public override bool Equals(object obj)
method GetHashCode (line 106) | public override int GetHashCode()
method Equals (line 111) | public bool Equals(MessagePackExtensionType other)
method CompareTo (line 126) | public int CompareTo(object obj)
method CompareTo (line 130) | public int CompareTo(MessagePackExtensionType other)
method ToString (line 183) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/MsgPackExtensionTypeHandler.cs
class MessagePackExtensionTypeHandler (line 23) | public abstract class MessagePackExtensionTypeHandler
method TryRead (line 27) | public abstract bool TryRead(sbyte type, ArraySegment<byte> data, out ...
method TryWrite (line 28) | public abstract bool TryWrite(object value, out sbyte type, ref ArrayS...
method ToString (line 31) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/MsgPackReader.cs
class MsgPackReader (line 25) | public class MsgPackReader : IJsonReader
class MsgPackValueInfo (line 32) | internal class MsgPackValueInfo : IValueInfo
method MsgPackValueInfo (line 37) | internal MsgPackValueInfo(MsgPackReader reader)
method Reset (line 120) | public void Reset()
method SetValue (line 127) | public void SetValue(object rawValue, JsonToken token, int position)
method ToString (line 137) | public override string ToString()
type ClosingToken (line 145) | internal struct ClosingToken
method MsgPackReader (line 196) | public MsgPackReader(Stream stream, SerializationContext context, Endi...
method NextToken (line 215) | public bool NextToken()
method Reset (line 477) | public void Reset()
method IsEndOfStream (line 486) | public bool IsEndOfStream()
method ReadToBuffer (line 491) | private bool ReadToBuffer(int bytesRequired, bool throwOnEos)
method ReadBytes (line 522) | private ArraySegment<byte> ReadBytes(long bytesRequired, bool forceNew...
method ReadExtensionType (line 573) | private object ReadExtensionType(sbyte type, ArraySegment<byte> data)
method DecrementClosingTokenCounter (line 589) | private void DecrementClosingTokenCounter()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/MsgPackTimestamp.cs
type MessagePackTimestamp (line 22) | [TypeSerializer(typeof(MsgPackTimestampSerializer))]
method MessagePackTimestamp (line 30) | public MessagePackTimestamp(long seconds, uint nanoSeconds)
method GetHashCode (line 49) | public override int GetHashCode()
method Equals (line 54) | public override bool Equals(object obj)
method Equals (line 62) | public bool Equals(MessagePackTimestamp other)
method CompareTo (line 67) | public int CompareTo(MessagePackTimestamp other)
method ToString (line 101) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/MsgPackType.cs
type MsgPackType (line 20) | public enum MsgPackType : byte
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/MsgPackWriter.cs
class MsgPackWriter (line 23) | public class MsgPackWriter : IJsonWriter
method MsgPackWriter (line 33) | public MsgPackWriter(Stream stream, SerializationContext context, byte...
method Flush (line 57) | public void Flush()
method Write (line 62) | public void Write(string value)
method Write (line 104) | public void Write(JsonMember value)
method Write (line 113) | public void Write(int number)
method Write (line 152) | public void Write(uint number)
method Write (line 184) | public void Write(long number)
method Write (line 198) | public void Write(ulong number)
method Write (line 212) | public void Write(float number)
method Write (line 220) | public void Write(double number)
method Write (line 228) | public void Write(decimal number)
method Write (line 243) | public void Write(bool value)
method Write (line 251) | public void Write(DateTime dateTime)
method Write (line 274) | public void Write(DateTimeOffset dateTimeOffset)
method Write (line 290) | public void Write(byte[] value)
method Write (line 323) | public void Write(sbyte type, ArraySegment<byte> data)
method WriteObjectBegin (line 382) | public void WriteObjectBegin(int numberOfMembers)
method WriteObjectEnd (line 409) | public void WriteObjectEnd()
method WriteArrayBegin (line 413) | public void WriteArrayBegin(int numberOfMembers)
method WriteArrayEnd (line 440) | public void WriteArrayEnd()
method WriteNull (line 444) | public void WriteNull()
method WriteType (line 449) | private void WriteType(MsgPackType token)
method WriteJson (line 456) | public void WriteJson(string jsonString)
method WriteJson (line 461) | public void WriteJson(char[] jsonString, int index, int charCount)
method Reset (line 466) | public void Reset()
method GetWriteBuffer (line 472) | internal ArraySegment<byte> GetWriteBuffer()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/UnknownMsgPackExtentionTypeException.cs
class UnknownMsgPackExtentionTypeException (line 22) | [Serializable]
method UnknownMsgPackExtentionTypeException (line 25) | public UnknownMsgPackExtentionTypeException(string message, Exception ...
method UnknownMsgPackExtentionTypeException (line 29) | public UnknownMsgPackExtentionTypeException(string message) : base(mes...
method UnknownMsgPackExtentionTypeException (line 33) | public UnknownMsgPackExtentionTypeException(sbyte invalidExtType)
method UnknownMsgPackExtentionTypeException (line 38) | private UnknownMsgPackExtentionTypeException(SerializationInfo info, S...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MessagePack/UnknownMsgPackFormatException.cs
class UnknownMsgPackFormatException (line 22) | [Serializable]
method UnknownMsgPackFormatException (line 25) | public UnknownMsgPackFormatException(string message, Exception innerEx...
method UnknownMsgPackFormatException (line 29) | public UnknownMsgPackFormatException(string message) : base(message)
method UnknownMsgPackFormatException (line 33) | public UnknownMsgPackFormatException(byte invalidValue)
method UnknownMsgPackFormatException (line 39) | private UnknownMsgPackFormatException(SerializationInfo info, Streamin...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/DataMemberDescription.cs
class DataMemberDescription (line 24) | internal abstract class DataMemberDescription : MemberDescription
method DataMemberDescription (line 31) | protected DataMemberDescription(TypeDescription typeDescription, Membe...
method GetValue (line 40) | public abstract object GetValue(object target);
method SetValue (line 41) | public abstract void SetValue(object target, object value);
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/FieldDescription.cs
class FieldDescription (line 22) | internal sealed class FieldDescription : DataMemberDescription
method FieldDescription (line 32) | public FieldDescription(TypeDescription typeDescription, FieldInfo fie...
method GetValue (line 43) | public override object GetValue(object target)
method SetValue (line 53) | public override void SetValue(object target, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/MemberDescription.cs
class MemberDescription (line 25) | internal abstract class MemberDescription
method MemberDescription (line 40) | protected MemberDescription(TypeDescription typeDescription, MemberInf...
method HasAttributes (line 62) | public bool HasAttributes(Type type)
method GetAttributesOrEmptyList (line 69) | public IEnumerable<Attribute> GetAttributesOrEmptyList(Type type)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/MetadataReflection.cs
class MetadataReflection (line 30) | internal static class MetadataReflection
method MetadataReflection (line 41) | static MetadataReflection()
method TryGetMemberAccessFunc (line 67) | public static bool TryGetMemberAccessFunc(MethodInfo getMethod, Method...
method TryGetMemberAccessFunc (line 123) | public static bool TryGetMemberAccessFunc(FieldInfo fieldInfo, out Fun...
method TryGetConstructor (line 193) | public static bool TryGetConstructor(Type type, out Func<object> ctrFn...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/PropertyDescription.cs
class PropertyDescription (line 22) | internal sealed class PropertyDescription : DataMemberDescription
method PropertyDescription (line 34) | public PropertyDescription(TypeDescription typeDescription, PropertyIn...
method GetValue (line 47) | public override object GetValue(object target)
method SetValue (line 56) | public override void SetValue(object target, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/TypeDescription.cs
class TypeDescription (line 34) | internal class TypeDescription : MemberDescription
method TypeDescription (line 53) | public TypeDescription(TypeInfo objectType)
method FindMembers (line 77) | private List<DataMemberDescription> FindMembers(TypeInfo objectType)
method TryGetMember (line 122) | public bool TryGetMember(string name, out DataMemberDescription member)
method CreateInstance (line 127) | public object CreateInstance()
method Get (line 137) | public static TypeDescription Get(Type type)
method ToString (line 151) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/MsgPack.cs
class MsgPack (line 26) | public static class MsgPack
method MsgPack (line 34) | static MsgPack()
method Serialize (line 39) | public static void Serialize<T>(T objectToSerialize, Stream msgPackOut...
method Serialize (line 43) | public static void Serialize<T>(T objectToSerialize, Stream msgPackOut...
method Serialize (line 47) | public static void Serialize<T>(T objectToSerialize, Stream msgPackOut...
method Deserialize (line 63) | public static object Deserialize(Type objectType, byte[] msgPackInput,...
method Deserialize (line 69) | public static object Deserialize(Type objectType, byte[] msgPackInput,...
method Deserialize (line 75) | public static object Deserialize(Type objectType, byte[] msgPackInput,...
method Deserialize (line 82) | public static object Deserialize(Type objectType, Stream msgPackInput)
method Deserialize (line 86) | public static object Deserialize(Type objectType, Stream msgPackInput,...
method Deserialize (line 90) | public static object Deserialize(Type objectType, Stream msgPackInput,...
method Deserialize (line 101) | public static T Deserialize<T>(byte[] msgPackInput, int offset, int le...
method Deserialize (line 107) | public static T Deserialize<T>(byte[] msgPackInput, int offset, int le...
method Deserialize (line 113) | public static T Deserialize<T>(byte[] msgPackInput, int offset, int le...
method Deserialize (line 120) | public static T Deserialize<T>(Stream msgPackInput)
method Deserialize (line 124) | public static T Deserialize<T>(Stream msgPackInput, SerializationOptio...
method Deserialize (line 128) | public static T Deserialize<T>(Stream msgPackInput, SerializationConte...
method CreateDefaultContext (line 137) | private static SerializationContext CreateDefaultContext(Serialization...
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/PathSegment.cs
type PathSegment (line 6) | public struct PathSegment
method PathSegment (line 11) | public PathSegment(int index)
method PathSegment (line 18) | public PathSegment(object memberName)
method ToString (line 27) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/ReflectionExtentions.cs
class ReflectionExtensions (line 26) | internal static class ReflectionExtensions
method IsInstantiationOf (line 31) | public static bool IsInstantiationOf(this Type type, Type openGenericT...
method HasMultipleInstantiations (line 74) | public static bool HasMultipleInstantiations(this Type type, Type open...
method GetInstantiationArguments (line 121) | public static Type[] GetInstantiationArguments(this Type type, Type op...
method GetDataMemberName (line 167) | public static string GetDataMemberName(object dataMemberAttribute)
method GetTypeInfo (line 202) | public static Type GetTypeInfo(this Type type)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/SerializationContext.cs
class SerializationContext (line 29) | public sealed class SerializationContext
method SerializationContext (line 66) | public SerializationContext()
method GetSerializerForType (line 79) | public TypeSerializer GetSerializerForType(Type valueType)
method CreateDictionarySerializer (line 106) | private TypeSerializer CreateDictionarySerializer(Type valueType)
method CreateEnumSerializer (line 113) | private TypeSerializer CreateEnumSerializer(Type valueType)
method CreateArraySerializer (line 120) | private TypeSerializer CreateArraySerializer(Type valueType)
method CreateObjectSerializer (line 127) | private TypeSerializer CreateObjectSerializer(Type valueType)
method CreateCustomSerializer (line 134) | private TypeSerializer CreateCustomSerializer(Type valueType, TypeSeri...
method GetType (line 153) | public Type GetType(string name, bool throwOnError, bool ignoreCase)
method GetType (line 157) | public Type GetType(string name, bool throwOnError)
method GetType (line 161) | public Type GetType(string name)
method Reset (line 169) | public void Reset()
method GetPath (line 179) | public string GetPath()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/SerializationOptions.cs
type SerializationOptions (line 21) | [Flags]
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ArraySerializer.cs
class ArraySerializer (line 25) | public sealed class ArraySerializer : TypeSerializer
method ArraySerializer (line 33) | public ArraySerializer(Type enumerableType)
method Deserialize (line 49) | public override object Deserialize(IJsonReader reader)
method Serialize (line 84) | public override void Serialize(IJsonWriter writer, object value)
method GetElementType (line 106) | private Type GetElementType(Type arrayType)
method ToString (line 134) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/BinarySerializer.cs
class BinarySerializer (line 22) | public sealed class BinarySerializer : TypeSerializer
method Deserialize (line 28) | public override object Deserialize(IJsonReader reader)
method Serialize (line 50) | public override void Serialize(IJsonWriter writer, object value)
method ToString (line 73) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/BoundsSerializer.cs
class BoundsSerializer (line 23) | public sealed class BoundsSerializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 49) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/DateTimeOffsetSerializer.cs
class DateTimeOffsetSerializer (line 24) | public sealed class DateTimeOffsetSerializer : TypeSerializer
method Deserialize (line 28) | public override object Deserialize(IJsonReader reader)
method Serialize (line 52) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/DateTimeSerializer.cs
class DateTimeSerializer (line 24) | public sealed class DateTimeSerializer : TypeSerializer
method Deserialize (line 28) | public override object Deserialize(IJsonReader reader)
method Serialize (line 50) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/DictionaryEntrySerializer.cs
class DictionaryEntrySerializer (line 23) | public sealed class DictionaryEntrySerializer : TypeSerializer
method Deserialize (line 30) | public override object Deserialize(IJsonReader reader)
method Serialize (line 73) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/DictionarySerializer.cs
class DictionarySerializer (line 24) | public sealed class DictionarySerializer : TypeSerializer
method DictionarySerializer (line 34) | public DictionarySerializer(Type dictionaryType)
method Deserialize (line 76) | public override object Deserialize(IJsonReader reader)
method Serialize (line 193) | public override void Serialize(IJsonWriter writer, object value)
method ToString (line 238) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/EnumNumberSerializer.cs
class EnumNumberSerializer (line 21) | public sealed class EnumNumberSerializer : TypeSerializer
method EnumNumberSerializer (line 28) | public EnumNumberSerializer(Type enumType)
method Deserialize (line 37) | public override object Deserialize(IJsonReader reader)
method Serialize (line 49) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/EnumSerializer.cs
class EnumSerializer (line 21) | public sealed class EnumSerializer : TypeSerializer
method EnumSerializer (line 28) | public EnumSerializer(Type enumType)
method Deserialize (line 37) | public override object Deserialize(IJsonReader reader)
method Serialize (line 49) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/GuidSerializer.cs
class GuidSerializer (line 22) | public sealed class GuidSerializer : TypeSerializer
method Deserialize (line 26) | public override object Deserialize(IJsonReader reader)
method Serialize (line 35) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/Matrix4x4Serializer.cs
class Matrix4x4Serializer (line 23) | public sealed class Matrix4x4Serializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 65) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/MsgPackExtensionTypeSerializer.cs
class MsgPackExtensionTypeSerializer (line 23) | public sealed class MsgPackExtensionTypeSerializer : TypeSerializer
method Deserialize (line 31) | public override object Deserialize(IJsonReader reader)
method Serialize (line 83) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/MsgPackTimestampSerializer.cs
class MsgPackTimestampSerializer (line 7) | public class MsgPackTimestampSerializer : TypeSerializer
method Deserialize (line 15) | public override object Deserialize(IJsonReader reader)
method Serialize (line 50) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs
class ObjectSerializer (line 25) | public class ObjectSerializer : TypeSerializer
method ObjectSerializer (line 42) | public ObjectSerializer(SerializationContext context, Type type)
method Deserialize (line 66) | public override object Deserialize(IJsonReader reader)
method Serialize (line 89) | public override void Serialize(IJsonWriter writer, object value)
method CollectMemberValues (line 124) | private void CollectMemberValues(object instance, IndexedDictionary<Da...
method DeserializeMembers (line 140) | private object DeserializeMembers(IJsonReader reader, IndexedDictionar...
method PopulateInstance (line 215) | private object PopulateInstance(IndexedDictionary<string, object> cont...
method TryGetMember (line 270) | private bool TryGetMember(string memberName, out DataMemberDescription...
method CreateInstance (line 283) | public static object CreateInstance(IndexedDictionary<string, object> ...
method CreateInstance (line 296) | public static object CreateInstance(IndexedDictionary<string, object> ...
method GetVersionInvariantObjectTypeName (line 305) | public static string GetVersionInvariantObjectTypeName(Type type)
method ToString (line 315) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/PrimitiveTypeSerializer.cs
class PrimitiveSerializer (line 21) | public sealed class PrimitiveSerializer : TypeSerializer
method PrimitiveSerializer (line 28) | public PrimitiveSerializer(Type primitiveType)
method Deserialize (line 43) | public override object Deserialize(IJsonReader reader)
method Serialize (line 105) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/QuaternionSerializer.cs
class QuaternionSerializer (line 23) | public sealed class QuaternionSerializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 53) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/RectSerializer.cs
class RectSerializer (line 23) | public sealed class RectSerializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 53) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/StreamSerializer.cs
class StreamSerializer (line 22) | public sealed class StreamSerializer : TypeSerializer
method Deserialize (line 28) | public override object Deserialize(IJsonReader reader)
method Serialize (line 47) | public override void Serialize(IJsonWriter writer, object value)
method ToString (line 77) | public override string ToString()
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/TimeSpanSerializer.cs
class TimeSpanSerializer (line 21) | public sealed class TimeSpanSerializer : TypeSerializer
method Deserialize (line 25) | public override object Deserialize(IJsonReader reader)
method Serialize (line 37) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/UriSerializer.cs
class UriSerializer (line 21) | public sealed class UriSerializer : TypeSerializer
method Deserialize (line 25) | public override object Deserialize(IJsonReader reader)
method Serialize (line 34) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/Vector2Serializer.cs
class Vector2Serializer (line 23) | public sealed class Vector2Serializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 49) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/Vector3Serializer.cs
class Vector3Serializer (line 23) | public sealed class Vector3Serializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 50) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/Vector4Serializer.cs
class Vector4Serializer (line 23) | public sealed class Vector4Serializer : TypeSerializer
method Deserialize (line 27) | public override object Deserialize(IJsonReader reader)
method Serialize (line 51) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/VersionSerializer.cs
class VersionSerializer (line 21) | public sealed class VersionSerializer : TypeSerializer
method Deserialize (line 25) | public override object Deserialize(IJsonReader reader)
method Serialize (line 34) | public override void Serialize(IJsonWriter writer, object value)
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/TypeSerializer.cs
class TypeSerializer (line 22) | public abstract class TypeSerializer
method Deserialize (line 26) | public abstract object Deserialize(IJsonReader reader);
method Serialize (line 27) | public abstract void Serialize(IJsonWriter writer, object value);
FILE: Assets/Colyseus/Runtime/GameDevWare.Serialization/TypeSerializerAttribute.cs
class TypeSerializerAttribute (line 22) | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | Attri...
method TypeSerializerAttribute (line 27) | public TypeSerializerAttribute(Type type)
FILE: Assets/Colyseus/Tests/Editor/ServerSettingsEditor.cs
class ServerSettingsEditor (line 7) | [CustomEditor(typeof(Settings))]
method OnEnable (line 20) | void OnEnable()
method OnInspectorGUI (line 34) | public override void OnInspectorGUI()
FILE: nuget-monogame/ColyseusGameComponent.cs
class ColyseusGameComponent (line 6) | public class ColyseusGameComponent : GameComponent
method ColyseusGameComponent (line 10) | public ColyseusGameComponent(Game game) : base(game)
method Update (line 22) | public override void Update(GameTime gameTime)
FILE: nuget/tests/HTTPTest.cs
class HTTPTest (line 6) | [TestFixture]
method UnsecureRootPathWithPortTest (line 10) | [Test]
method UnsecureChildPathWithPortTest (line 22) | [Test]
method UnsecureChildPathNoPortTest (line 34) | [Test]
method SecureChildPathNoPortTest (line 47) | [Test]
method SecureChildPathWithPortTest (line 59) | [Test]
FILE: nuget/tests/IntegrationTest.cs
class IntegrationTest (line 11) | [TestFixture]
method Init (line 16) | [SetUp]
method JoinRoom (line 22) | [Test]
method ReceiveInitialState (line 35) | [Test]
method SendAndReceiveMessage_Move (line 63) | [Test]
method SendAndReceiveMessage_AddItem (line 89) | [Test]
method SendAndReceiveMessage_RemoveItem (line 114) | [Test]
method SendAndReceiveMessage_AddBot (line 139) | [Test]
method HostAssignment (line 172) | [Test]
method BroadcastMessage_Weather (line 191) | [Test]
method MultipleClients_SeeEachOther (line 210) | [Test]
method OnLeave_ConsentedLeave (line 240) | [Test]
method Reconnection_DropAndReconnect (line 258) | [Test]
method Reconnection_PlayerDisconnectedFlag (line 317) | [Test]
method Reconnection_SendMessageAfterReconnect (line 367) | [Test]
method Callbacks_OnAdd_OnRemove_Players (line 403) | [Test]
method JoinRoom_DynamicSchema (line 453) | [Test]
method ReceiveInitialState_DynamicSchema (line 466) | [Test]
method Callbacks_OnAdd_OnRemove_Players_DynamicSchema (line 495) | [Test]
method WithTimeout (line 545) | private async Task<T> WithTimeout<T>(Task<T> task, int timeoutMs)
FILE: nuget/tests/Schema/ArraySchemaClear/ArraySchemaClear.cs
class ArraySchemaClear (line 11) | public partial class ArraySchemaClear : Schema {
FILE: nuget/tests/Schema/ArraySchemaMultipleSplice/Item.cs
class Item (line 11) | public partial class Item : Schema {
FILE: nuget/tests/Schema/ArraySchemaMultipleSplice/MultipleArraySpliceState.cs
class MultipleArraySpliceState (line 11) | public partial class MultipleArraySpliceState : Schema {
FILE: nuget/tests/Schema/ArraySchemaMultipleSplice/Player.cs
class Player (line 11) | public partial class Player : Schema {
FILE: nuget/tests/Schema/ArraySchemaTypes/ArraySchemaTypes.cs
class ArraySchemaTypes (line 11) | public partial class ArraySchemaTypes : Schema {
FILE: nuget/tests/Schema/ArraySchemaTypes/IAmAChild.cs
class IAmAChild (line 11) | public partial class IAmAChild : Schema {
FILE: nuget/tests/Schema/BackwardsForwards/PlayerV1.cs
class PlayerV1 (line 11) | public partial class PlayerV1 : Schema {
FILE: nuget/tests/Schema/BackwardsForwards/PlayerV2.cs
class PlayerV2 (line 11) | public partial class PlayerV2 : Schema {
FILE: nuget/tests/Schema/BackwardsForwards/StateV1.cs
class StateV1 (line 11) | public partial class StateV1 : Schema {
FILE: nuget/tests/Schema/BackwardsForwards/StateV2.cs
class StateV2 (line 11) | public partial class StateV2 : Schema {
FILE: nuget/tests/Schema/Callbacks/CallbacksState.cs
class CallbacksState (line 11) | public partial class CallbacksState : Schema {
FILE: nuget/tests/Schema/Callbacks/Container.cs
class Container (line 11) | public partial class Container : Schema {
FILE: nuget/tests/Schema/Callbacks/Item.cs
class Item (line 11) | public partial class Item : Schema {
FILE: nuget/tests/Schema/Callbacks/Player.cs
class Player (line 11) | public partial class Player : Schema {
FILE: nuget/tests/Schema/Callbacks/Vec3.cs
class Vec3 (line 11) | public partial class Vec3 : Schema {
FILE: nuget/tests/Schema/ChildSchemaTypes/ChildSchemaTypes.cs
class ChildSchemaTypes (line 11) | public partial class ChildSchemaTypes : Schema {
FILE: nuget/tests/Schema/ChildSchemaTypes/IAmAChild.cs
class IAmAChild (line 11) | public partial class IAmAChild : Schema {
FILE: nuget/tests/Schema/FilteredTypes/Player.cs
class Player (line 11) | public partial class Player : Schema {
FILE: nuget/tests/Schema/FilteredTypes/State.cs
class State (line 11) | public partial class State : Schema {
FILE: nuget/tests/Schema/InheritedTypes/Bot.cs
class Bot (line 11) | public partial class Bot : Player {
FILE: nuget/tests/Schema/InheritedTypes/Entity.cs
class Entity (line 11) | public partial class Entity : Schema {
FILE: nuget/tests/Schema/InheritedTypes/InheritedTypes.cs
class InheritedTypes (line 11) | public partial class InheritedTypes : Schema {
FILE: nuget/tests/Schema/InheritedTypes/Player.cs
class Player (line 11) | public partial class Player : Entity {
FILE: nuget/tests/Schema/InstanceSharingTypes/Player.cs
class Player (line 11) | public partial class Player : Schema {
FILE: nuget/tests/Schema/InstanceSharingTypes/Position.cs
class Position (line 11) | public partial class Position : Schema {
FILE: nuget/tests/Schema/InstanceSharingTypes/State.cs
class State (line 11) | public partial class State : Schema {
FILE: nuget/tests/Schema/Item.cs
class Item (line 13) | public partial class Item : Schema {
method Item (line 14) | #if UNITY_5_3_OR_NEWER
FILE: nuget/tests/Schema/MapSchemaInt8/MapSchemaInt8.cs
class MapSchemaInt8 (line 11) | public partial class MapSchemaInt8 : Schema {
FILE: nuget/tests/Schema/MapSchemaMoveNullifyType/State.cs
class State (line 11) | public partial class State : Schema {
FILE: nuget/tests/Schema/MapSchemaTypes/IAmAChild.cs
class IAmAChild (line 11) | public partial class IAmAChild : Schema {
FILE: nuget/tests/Schema/MapSchemaTypes/MapSchemaTypes.cs
class MapSchemaTypes (line 11) | public partial class MapSchemaTypes : Schema {
FILE: nuget/tests/Schema/MyRoomState.cs
class MyRoomState (line 13) | public partial class MyRoomState : Schema {
method MyRoomState (line 14) | #if UNITY_5_3_OR_NEWER
FILE: nuget/tests/Schema/Player.cs
class Player (line 13) | public partial class Player : Schema {
method Player (line 14) | #if UNITY_5_3_OR_NEWER
FILE: nuget/tests/Schema/PrimitiveTypes/PrimitiveTypes.cs
class PrimitiveTypes (line 11) | public partial class PrimitiveTypes : Schema {
FILE: nuget/tests/SchemaDeserializerTest.cs
class SchemaDeserializerTest (line 7) | [TestFixture]
method PrimitiveTypesTest (line 11) | [Test]
method ChildSchemaTypesTest (line 45) | [Test]
method ArraySchemaTypesTest (line 60) | [Test]
method ArraySchemaClearTest (line 140) | [Test]
method MapSchemaTypesTest (line 171) | [Test]
method MapSchemaInt8Test (line 256) | [Test]
method MapSchemaMoveNullifyTypeTest (line 284) | [Test]
method InheritedTypesTest (line 301) | [Test]
method BackwardsForwardsTest (line 331) | [Test]
method FilteredTypesTest (line 348) | [Test]
method InstanceSharingTypesTest (line 364) | [Test]
method CallbacksTest (line 405) | [Test]
method ReflectionDecodeTest (line 484) | [Test]
FILE: nuget/tests/SerializationTest.cs
class SerializationTest (line 7) | [TestFixture]
method NoStateSerializerTest (line 11) | [Test]
FILE: nuget/tests/WebSocketTransportTest.cs
class WebSocketTransportTest (line 9) | [TestFixture]
method SetUp (line 16) | [SetUp]
method TearDown (line 26) | [TearDown]
method UsesSharedDispatchLoopWithoutContextOrExternalDispatcher (line 33) | [Test]
method SkipsSharedDispatchLoopWhenSynchronizationContextExists (line 39) | [Test]
method SkipsSharedDispatchLoopWhenExternalDispatcherExists (line 45) | [Test]
Condensed preview — 449 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (939K chars).
[
{
"path": ".editorconfig",
"chars": 201,
"preview": "[*]\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\nindent_style = space\nindent_size = 2\n\n[*.{js,ts}]\ni"
},
{
"path": ".github/FUNDING.yml",
"chars": 471,
"preview": "# These are supported funding model platforms\n\ngithub: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [u"
},
{
"path": ".github/ISSUE_TEMPLATE.md",
"chars": 81,
"preview": "<!--\nLooking for help? Post on the forum instead: http://discuss.colyseus.io\n-->\n"
},
{
"path": ".github/workflows/nuget-publish.yml",
"chars": 2287,
"preview": "name: NuGet Publish\n\non:\n push:\n branches:\n - master\n pull_request:\n branches:\n - master\n\njobs:\n buil"
},
{
"path": ".github/workflows/tests.yml",
"chars": 1897,
"preview": "name: Tests\n\non:\n push:\n branches: [master, universal]\n pull_request:\n branches: [master, universal]\n\njobs:\n un"
},
{
"path": ".github/workflows/upmsemver.yml",
"chars": 3363,
"preview": "name: Update Unity UPM semantic versioning\n\non:\n push:\n branches:\n - master\n - dev\n\njobs:\n checkSemver:\n "
},
{
"path": ".gitignore",
"chars": 794,
"preview": "# Server build files\nServer/build\n\n# NuGet Dependencies\n/Assets/Colyseus/Runtime/WebSocket\n\n#User Specific\n*.userprefs\n*"
},
{
"path": "Assets/Colyseus/.editorconfig",
"chars": 199,
"preview": "[*]\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\nindent_style = tab\nindent_size = 4\n\n[*.{js,ts}]\nind"
},
{
"path": "Assets/Colyseus/.gitignore",
"chars": 590,
"preview": "#User Specific\n*.userprefs\n*.usertasks\n.DS_Store\n.vs/\n\n#Mono Project Files\n*.pidb\n*.resources\ntest-results/\nbin\nobj\n\n#Nu"
},
{
"path": "Assets/Colyseus/Documentation~/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "Assets/Colyseus/Documentation~/GettingStarted.md",
"chars": 8171,
"preview": "\n# Unity SDK\nFor more information, please visit our [documentation site](https://docs.colyseus.io/)\n\n# Setup\n\nHere we'l"
},
{
"path": "Assets/Colyseus/Editor/Colyseus.Editor.asmdef",
"chars": 413,
"preview": "{\n \"name\": \"Colyseus.Editor\",\n \"rootNamespace\": \"ColyseusEditor\",\n \"references\": [\n \"ColyseusSDK\"\n ],"
},
{
"path": "Assets/Colyseus/Editor/Colyseus.Editor.asmdef.meta",
"chars": 166,
"preview": "fileFormatVersion: 2\nguid: e4cb50f060ca4467c819ea269f994a8b\nAssemblyDefinitionImporter:\n externalObjects: {}\n userData"
},
{
"path": "Assets/Colyseus/Editor/README.md",
"chars": 1934,
"preview": "# Colyseus Room Inspector\n\nUnity Editor tool for inspecting connected Colyseus room states in real-time during Play mode"
},
{
"path": "Assets/Colyseus/Editor/README.md.meta",
"chars": 158,
"preview": "fileFormatVersion: 2\nguid: 6aa8c0736e5e54df49e298b67fd58dcc\nTextScriptImporter:\n externalObjects: {}\n userData: \n ass"
},
{
"path": "Assets/Colyseus/Editor/RoomInspector.cs",
"chars": 64862,
"preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nus"
},
{
"path": "Assets/Colyseus/Editor/RoomInspector.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 7306c18ccdb7b40c78a54abc8f917b50"
},
{
"path": "Assets/Colyseus/Editor.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 12db36416327a4e74873a275325fd6f5\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/LICENSE",
"chars": 1106,
"preview": "Copyright (c) 2021 Lucid Sight\nCopyright (c) 2015-2021 Endel Dreyer\n\nMIT License:\n\nPermission is hereby granted, free of"
},
{
"path": "Assets/Colyseus/LICENSE.meta",
"chars": 155,
"preview": "fileFormatVersion: 2\nguid: 28fed75626a4d4144b26bef3670248f7\nDefaultImporter:\n externalObjects: {}\n userData: \n assetB"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Auth.cs",
"chars": 7929,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing GameDevWare.Serialization;\n\nnamespac"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Auth.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: c500d710fb1854e15ac69bebeab976b6"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Client.cs",
"chars": 18963,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n\n// ReSharper disable InconsistentNaming\n\n"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Client.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: b31ab8167fc564dee91f45b0dd6d57ff"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Connection.cs",
"chars": 3575,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\n// ReSharper disable InconsistentNaming\n\nn"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Connection.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: c7b2c7c29325c4b2f81ddd0c68c1f995"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/HTTP.cs",
"chars": 4679,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing System.IO;\nusing GameDevWare.Seriali"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/HTTP.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: ee3501581e55f44c8909b6ec76944724\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Manager.cs",
"chars": 4473,
"preview": "using System.Collections.Generic;\nusing UnityEngine;\n// ReSharper disable InconsistentNaming\n\nnamespace Colyseus\n{\n /"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Manager.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: dfd046c2a7f284b40abeb2e9c6030c2a"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/ColyseusContext.cs",
"chars": 1144,
"preview": "using System;\n\nnamespace Colyseus\n{\n public static class ColyseusContext\n {\n public static ILogger Logger {"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/ColyseusContext.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: e9d11516d4fd945f6bc6f9c38f59484f"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/ConsoleLogger.cs",
"chars": 439,
"preview": "using System;\n\nnamespace Colyseus\n{\n public class ConsoleLogger : ILogger\n {\n public void Log(string messag"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/ConsoleLogger.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: c61bec0c4a8f5466ead316cf8b48a7c3"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/DefaultHttpClient.cs",
"chars": 1281,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Net.Http;\nusing System.Threading.Tasks;\n\nnamespace Colyseus"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/DefaultHttpClient.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: b76ed9cf151944e27a2b3dd129f71ec1"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/InMemoryTokenStorage.cs",
"chars": 578,
"preview": "using System.Collections.Generic;\n\nnamespace Colyseus\n{\n public class InMemoryTokenStorage : ITokenStorage\n {\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults/InMemoryTokenStorage.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: f08fd06971bb7429493182bdbe6bc586"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Defaults.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: a936aa0bb60cb45839f98f94e6b99ff3\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/IHttpClient.cs",
"chars": 239,
"preview": "using System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace Colyseus\n{\n public interface IHttpClient\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/IHttpClient.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: d0b5fc7c6915d4fbb8d3912865fa3a39"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/ILogger.cs",
"chars": 178,
"preview": "namespace Colyseus\n{\n public interface ILogger\n {\n void Log(string message);\n void LogWarning(string"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/ILogger.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 7a651e0ae0860483aa3bdd31fb0c1ff0"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/ITokenStorage.cs",
"chars": 194,
"preview": "namespace Colyseus\n{\n public interface ITokenStorage\n {\n string GetToken(string key);\n void SetToken"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/ITokenStorage.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: a28d0b00b73cb4b5e88d58109c69b4bc"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/IWebSocket.cs",
"chars": 283,
"preview": "namespace Colyseus\n{\n public delegate void WebSocketOpenEventHandler();\n public delegate void WebSocketMessageEven"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/IWebSocket.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 3fe20329183ae4a0eb091fee0b8a61bc"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/PreserveAttribute.cs",
"chars": 336,
"preview": "using System;\n\nnamespace Colyseus\n{\n /// <summary>\n /// Custom Preserve attribute that works on all platforms.\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/PreserveAttribute.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 3123978311a4e4dd68b79ae85a198a18"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityHttpClient.cs",
"chars": 2138,
"preview": "#if UNITY_5_3_OR_NEWER\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing UnityEngine;\nusing UnityEng"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityHttpClient.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 3cf7b230495374a76948cb8b92393feb"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityLogger.cs",
"chars": 426,
"preview": "#if UNITY_5_3_OR_NEWER\nusing UnityEngine;\n\nnamespace Colyseus\n{\n public class UnityLogger : ILogger\n {\n pub"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityLogger.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 641a11947d6ae4ca785718cc095a8422"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityPlatform.cs",
"chars": 671,
"preview": "#if UNITY_5_3_OR_NEWER\nusing UnityEngine;\n\nnamespace Colyseus\n{\n /// <summary>\n /// Auto-initializes ColyseusConte"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityPlatform.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 7f3783fa34f724310885d356cb346c8b"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnitySettings.cs",
"chars": 1909,
"preview": "#if UNITY_5_3_OR_NEWER\nusing System;\nusing UnityEngine;\n\nnamespace Colyseus\n{\n /// <summary>\n /// ScriptableObject"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnitySettings.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 6d1d0994d204e41f2a1ad4fd8d0062a9"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityTokenStorage.cs",
"chars": 474,
"preview": "#if UNITY_5_3_OR_NEWER\nusing UnityEngine;\n\nnamespace Colyseus\n{\n public class UnityTokenStorage : ITokenStorage\n {"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity/UnityTokenStorage.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 49c288c14bb62415b8ccd07edc0fcae2"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform/Unity.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: d570a06a0e1f64179a4e50e694ea47a5\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Platform.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 11ca095b9c22845eca472b0e5ae92d6d\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/ErrorCode.cs",
"chars": 700,
"preview": "// ReSharper disable InconsistentNaming\n\nnamespace Colyseus\n{\n /// <summary>\n /// Colyseus error codes mapping"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/ErrorCode.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 91ff24d8f9ec0420ebf7619585071190"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/MatchMakeResponse.cs",
"chars": 649,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnam"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/MatchMakeResponse.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 96657d6a1a8244a298dd8bf4c14906c2"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/MessageHandler.cs",
"chars": 1343,
"preview": "using System;\n\nnamespace Colyseus\n{\n /// <summary>\n /// Base interface for MessageHandlers\n /// </summary>\n"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/MessageHandler.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: c67f9a6a0cc1b422195dd94a31f6e4e8"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/Protocol.cs",
"chars": 2522,
"preview": "// ReSharper disable InconsistentNaming\n\nnamespace Colyseus\n{\n /// <summary>\n /// Colyseus server protocol cod"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/Protocol.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: c8b23e2aef1384ae9af846c81bbe9b72"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/RoomAvailable.cs",
"chars": 1427,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnam"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol/RoomAvailable.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 4844d7e0171e642b283b1c9bce462e70"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Protocol.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 1bde545c640ce40139e914607b757e39\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Room.cs",
"chars": 30894,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Text;\nusing System.Threading.Tasks;\nusing "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Room.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: b196046f3733f4667a642ce7d71263ae"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/BigEndianBitConverter.cs",
"chars": 4377,
"preview": "/*\n\"Miscellaneous Utility Library\" Software Licence\n\nVersion 1.0\n\nCopyright (c) 2004-2008 Jon Skeet and Marc Gravell.\nAl"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/BigEndianBitConverter.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: d2db5d6cc28318447a02c83fcba42a1f\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/DoubleConverter.cs",
"chars": 8068,
"preview": "/*\n\"Miscellaneous Utility Library\" Software Licence\n\nVersion 1.0\n\nCopyright (c) 2004-2008 Jon Skeet and Marc Gravell.\nAl"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/DoubleConverter.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: c7daa1e51f7f668468924517b6446fe9\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/EndianBitConverter.cs",
"chars": 28217,
"preview": "/*\n\"Miscellaneous Utility Library\" Software Licence\n\nVersion 1.0\n\nCopyright (c) 2004-2008 Jon Skeet and Marc Gravell.\nAl"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/EndianBitConverter.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: aa6dd963847f2e6408c89a530095710a\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/Endianness.cs",
"chars": 2435,
"preview": "/*\n\"Miscellaneous Utility Library\" Software Licence\n\nVersion 1.0\n\nCopyright (c) 2004-2008 Jon Skeet and Marc Gravell.\nAl"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/Endianness.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 8885dda9cbb1c6246840582b6c637300\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/LittleEndianBitConverter.cs",
"chars": 4364,
"preview": "/*\n\"Miscellaneous Utility Library\" Software Licence\n\nVersion 1.0\n\nCopyright (c) 2004-2008 Jon Skeet and Marc Gravell.\nAl"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion/LittleEndianBitConverter.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: dfe60c6da8d01634ab384a42243791ad\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Conversion.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 3825dca9a7fae88429eff0ef4538364d\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/NoneSerializer.cs",
"chars": 848,
"preview": "namespace Colyseus\n{\n // TODO: remove dummy state dependency from NoneSerializer.\n public class NoState : Schema.S"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/NoneSerializer.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: ad9bf8bd4c18f480ca4fe0084bf21d92\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Callbacks/Callbacks.cs",
"chars": 23017,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\n\nnamespace Colyseus.Sc"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Callbacks/Callbacks.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: cdc421113be204ebf86bc7061decb2a5"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Callbacks.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 20021fffe9f50415790a724749f52d37\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Decoder.cs",
"chars": 14103,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Colyseus.Schema\n{\n public delegate void TriggerChangesDele"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Decoder.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: bf9ddf343365d470598eca60f7ccbeb0\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/DynamicSchema.cs",
"chars": 4840,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Colyseus.Schema\n{\n\t/// <summary>\n\t/// Per-type metadata b"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/DynamicSchema.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 0c5bf7be5839b48abb887366463f49e5"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/ReferenceTracker.cs",
"chars": 5595,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Colyseus.Schema\n{\n /// <summary>\n /// Keep track of"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/ReferenceTracker.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 8d1f13b23a23742dda739d463a4568e2\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Schema.cs",
"chars": 10368,
"preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing Sy"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Schema.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 7e50bf707193ce547b13afb98abb3b48\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/TypeContext.cs",
"chars": 1396,
"preview": "using System.Collections.Generic;\n\nnamespace Colyseus.Schema\n{\n /// <summary>\n /// Internal container class fo"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/TypeContext.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: a1b0877a82fcf4867af631924169de16"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/ArraySchema.cs",
"chars": 6082,
"preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing Colyseus;\n\nnamespace Colyseus.Schema\n{\n\t"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/ArraySchema.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 3ab256d5bbbf81a4591a87d62c22a878\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/CustomType.cs",
"chars": 606,
"preview": "using System;\nusing System.Collections.Generic;\n\nnamespace Colyseus.Schema\n{\n\tclass CustomType\n\t{\n\t\tprotected static Cus"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/CustomType.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 8797edbee9b8f41e0ad98a6c35a02c43\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/MapSchema.cs",
"chars": 11521,
"preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\n\nnamespa"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/MapSchema.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: ef32bb4c29e82a54d8c9ae61fbba9b56\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/Reflection.cs",
"chars": 1917,
"preview": "using Colyseus;\n\nnamespace Colyseus.Schema\n{\n /// <summary>\n /// <see cref=\"Schema\" /> used for the purposes o"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types/Reflection.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 65dac8d9cc95b40899c31429819d6949\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Types.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 917dd28b10759a045b773955c84601bf\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils/Decode.cs",
"chars": 13923,
"preview": "using System;\nusing System.Text;\nusing MiscUtil.Conversion;\n\nnamespace Colyseus.Schema.Utils\n{\n\tpublic class Decode\n\t{\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils/Decode.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: dd65c771c1d0b44399010708ca01d75d"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils/Encode.cs",
"chars": 2899,
"preview": "using System;\n\nnamespace Colyseus.Schema.Utils\n{\n\tpublic class Encode\n\t{\n /// <summary>\n /// Retrieves"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils/Encode.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 8b9a0de6846c54eec8dcc45f10ed3b1c"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema/Utils.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: bb2c980af108447b0ae4b3af69848342\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Schema.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 0bddc8a03e686dc43bea0c9ceec6d774\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/SchemaSerializer.cs",
"chars": 5745,
"preview": "using System;\nusing System.Reflection;\nusing System.Collections.Generic;\nusing Colyseus.Schema;\nusing Type = Colyseus.Sc"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/SchemaSerializer.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: c2a698bbb71fc4545a17aed07000db46\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Serializer.cs",
"chars": 1421,
"preview": "namespace Colyseus\n{\n /// <summary>\n /// Serializer Interface\n /// </summary>\n /// <typeparam name=\"T\">T"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer/Serializer.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 4fcf3a67477874e14b7685c3d289d252\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Serializer.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 6a0c82fa6f9124a47a4f2b068619c7d3\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Settings/Settings.cs",
"chars": 5200,
"preview": "using System;\nusing System.Collections.Generic;\n\n#if UNITY_5_3_OR_NEWER\nusing UnityEngine;\n#endif\n\nnamespace Colyseus\n{\n"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Settings/Settings.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 6ed729989615d4b4db072e1e8c41076c\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Settings.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 8fbeaff66f46edb4998d9d07492e454c\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Transport/WebSocket.cs",
"chars": 3134,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Colyseu"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Transport/WebSocket.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: fc5122bd7006f4974b636c76af201f44"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Transport/WebSocketDispatchLoop.cs",
"chars": 2782,
"preview": "#if !UNITY_WEBGL || UNITY_EDITOR\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\n\nnamespace Col"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Transport/WebSocketDispatchLoop.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 368242dd6ccd74f16a7436c1c53f73ff"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Transport.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 2fc81b6cb1f8d4749a81f71f7b5a8d03\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/Exceptions.cs",
"chars": 632,
"preview": "using System;\n\nnamespace Colyseus\n{\n\t/// <summary>\n\t/// Custom exception thrown when there is an issue with Match Making"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/Exceptions.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: ca772085cc5044b368171964c8140999\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/ExtensionMethods.cs",
"chars": 742,
"preview": "using System;\nusing System.Runtime.CompilerServices;\nusing UnityEngine;\nusing UnityEngine.Networking;\n\nnamespace Colyseu"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/ExtensionMethods.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 49ca7a47d6d774afa802f5b302cd2f9f\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/ObjectExtensions.cs",
"chars": 2147,
"preview": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\n\nnamespace Colyseus\n{\n /"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/ObjectExtensions.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 04fc7c8d440e04bc6afbdd8e8ceaab85\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/UnityWebRequestAwaiter.cs",
"chars": 1631,
"preview": "using System;\nusing System.Runtime.CompilerServices;\nusing UnityEngine;\nusing UnityEngine.Networking;\n\nnamespace Colyseu"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils/UnityWebRequestAwaiter.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: eeaf5a5ece0b541c5af42f9c73275e1c\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Colyseus/Utils.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 9542be54dba5d9244aed15299f49540c\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Colyseus.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 1a26a17010d5aea49b8a4f09f5801b05\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/ColyseusSDK.asmdef",
"chars": 77,
"preview": "{\n\t\"name\": \"ColyseusSDK\",\n\t\"references\": [\n\t\t\"colyseus.nativewebsocket\"\n\t]\n}\n"
},
{
"path": "Assets/Colyseus/Runtime/ColyseusSDK.asmdef.meta",
"chars": 166,
"preview": "fileFormatVersion: 2\nguid: 7d8788162c0190c4c8b801543ada1607\nAssemblyDefinitionImporter:\n externalObjects: {}\n userData"
},
{
"path": "Assets/Colyseus/Runtime/Editor Default Resources/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "Assets/Colyseus/Runtime/Editor Default Resources/Icons/ColyseusSettings.png.import",
"chars": 995,
"preview": "[remap]\n\nimporter=\"texture\"\ntype=\"CompressedTexture2D\"\nuid=\"uid://c6t3i2w508an0\"\npath=\"res://.godot/imported/ColyseusSet"
},
{
"path": "Assets/Colyseus/Runtime/Editor Default Resources/Icons/ColyseusSettings.png.import.meta",
"chars": 155,
"preview": "fileFormatVersion: 2\nguid: 40daac54efc2241099dc969333714022\nDefaultImporter:\n externalObjects: {}\n userData: \n assetB"
},
{
"path": "Assets/Colyseus/Runtime/Editor Default Resources/Icons/ColyseusSettings.png.meta",
"chars": 3498,
"preview": "fileFormatVersion: 2\nguid: 0d890485a241f1c478e0dd5844695a6f\nTextureImporter:\n internalIDToNameTable: []\n externalObjec"
},
{
"path": "Assets/Colyseus/Runtime/Editor Default Resources/Icons.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 1af14f53b56f41e4b95a1e6089cea2e6\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Editor Default Resources.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: 78d7e3c75054b9b4abf1814a70fe3695\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Example.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: ae74ab3446648452aa052bfb9ad976e8\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/Example~/ColyseusNetworkManager.cs",
"chars": 4659,
"preview": "using System.Collections.Generic;\nusing System.Threading.Tasks;\nusing UnityEngine;\nusing Colyseus;\n\npublic class Weather"
},
{
"path": "Assets/Colyseus/Runtime/Example~/ColyseusNetworkManager.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 9ca8e2dc39ba1406a8d548cecca16bde\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Example~/ConnectionManager.cs",
"chars": 301,
"preview": "using System.Collections;\nusing System.Collections.Generic;\nusing UnityEngine;\n\npublic class ConnectionManager : MonoBeh"
},
{
"path": "Assets/Colyseus/Runtime/Example~/ConnectionManager.cs.meta",
"chars": 243,
"preview": "fileFormatVersion: 2\nguid: 3ca02083085144590ae17a25ce46df36\nMonoImporter:\n externalObjects: {}\n serializedVersion: 2\n "
},
{
"path": "Assets/Colyseus/Runtime/Example~/ExampleScene.unity.meta",
"chars": 155,
"preview": "fileFormatVersion: 2\nguid: c6a63a8be1d1044869c7ef0d1a91dde4\nDefaultImporter:\n externalObjects: {}\n userData: \n assetB"
},
{
"path": "Assets/Colyseus/Runtime/Example~/MyServerSettings.asset.meta",
"chars": 189,
"preview": "fileFormatVersion: 2\nguid: c63116ed08d6d405985d628d4aeb2820\nNativeFormatImporter:\n externalObjects: {}\n mainObjectFile"
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema/Item.cs",
"chars": 466,
"preview": "// \n// THIS FILE HAS BEEN GENERATED AUTOMATICALLY\n// DO NOT CHANGE IT MANUALLY UNLESS YOU KNOW WHAT YOU'RE DOING\n// \n// "
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema/Item.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 1add4259764d34d94bf8be13e98a69ca"
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema/MyRoomState.cs",
"chars": 575,
"preview": "//\n// THIS FILE HAS BEEN GENERATED AUTOMATICALLY\n// DO NOT CHANGE IT MANUALLY UNLESS YOU KNOW WHAT YOU'RE DOING\n//\n// GE"
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema/MyRoomState.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 8ae9c4a2670084d28843c4b84c3dd530"
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema/Player.cs",
"chars": 674,
"preview": "// \n// THIS FILE HAS BEEN GENERATED AUTOMATICALLY\n// DO NOT CHANGE IT MANUALLY UNLESS YOU KNOW WHAT YOU'RE DOING\n// \n// "
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema/Player.cs.meta",
"chars": 59,
"preview": "fileFormatVersion: 2\nguid: 74cbd8724747e4d2092e580e14725b78"
},
{
"path": "Assets/Colyseus/Runtime/Example~/Schema.meta",
"chars": 172,
"preview": "fileFormatVersion: 2\nguid: a80dec46085bf4ea4b523a69ff3f2405\nfolderAsset: yes\nDefaultImporter:\n externalObjects: {}\n us"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/ArrayExtensions.cs",
"chars": 491,
"preview": "using System;\nnamespace GameDevWare.Serialization\n{\n\tinternal static class ArrayExtensions\n\t{\n\t\tpublic static OutputT[] "
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/ArrayExtensions.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: b7ce8c517c054bd5bec836e71944c782\ntimeCreated: 1653295313"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/GenerateTypeSerializerAttribute.cs",
"chars": 991,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - "
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/GenerateTypeSerializerAttribute.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 8420b011fc234497996f0dd94bd8b466\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IJsonReader.cs",
"chars": 1165,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IJsonReader.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 9e6240f54909465fb6d01ab74fa0061d\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IJsonWriter.cs",
"chars": 1563,
"preview": "/*\n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IJsonWriter.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 633fb2c48abf4347a8ffe33fafa2ce00\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IValueInfo.cs",
"chars": 618,
"preview": "using System;\n\n// ReSharper disable once CheckNamespace\nnamespace GameDevWare.Serialization\n{\n\tpublic interface IValueI"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IValueInfo.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 08a9e5333be7414aa0de623e9026075e\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IndexedDictionary.cs",
"chars": 10882,
"preview": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing Sy"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/IndexedDictionary.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 37db542680ca413d96e9d3920576ea8a\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/Json.cs",
"chars": 15823,
"preview": "/*\n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - ht"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/Json.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: ae711c9fe19244fab91b2218cc02ae50\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonMember.cs",
"chars": 2960,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - "
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonMember.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: d9e3f4d0576d4f3d9e6f9e93a0833f07\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReader.cs",
"chars": 21435,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReader.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 8ce453655ad14674adcc6bc3f730bf87\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReaderExtentions.cs",
"chars": 20827,
"preview": "/*\n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - ht"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReaderExtentions.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 91c78aa24ac24020bfde9485103e5a5b\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonSerializationException.cs",
"chars": 8967,
"preview": "using System;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Security;\nusing GameDevWare.Seri"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonSerializationException.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 9216e69600364fd8a766d27f04f18701\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStreamReader.cs",
"chars": 1683,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStreamReader.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: dba4bb2b43a34afe956f2fe58a1d435d\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStreamWriter.cs",
"chars": 2192,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStreamWriter.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: ea2e81bf26c44034887aeb8f01489170\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringBuilderReader.cs",
"chars": 1738,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringBuilderReader.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: a7c8908a12104d4080e9a2979109faa3\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringBuilderWriter.cs",
"chars": 2239,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringBuilderWriter.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: ba0b2700618d44678074988497f6811f\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringReader.cs",
"chars": 1709,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonStringReader.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 87d7e0b24d7741298d295c21eb4bdb01\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonTextReader.cs",
"chars": 1570,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonTextReader.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 17d87f5a6e50464b9a12adaeaeaf64aa\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonTextWriter.cs",
"chars": 2162,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonTextWriter.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 68aac15450ed45c78a7b616ff202c96d\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonToken.cs",
"chars": 1007,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - "
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonToken.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: db426eb135514e37ab199c140e9de479\ntimeCreated: 1653295312"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonUtils.cs",
"chars": 20220,
"preview": "/* \n\tCopyright (c) 2019 Denis Zykov, GameDevWare.com\n\n\tThis a part of \"Json & MessagePack Serialization\" Unity Asset - h"
},
{
"path": "Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonUtils.cs.meta",
"chars": 84,
"preview": "fileFormatVersion: 2\nguid: 7b759d9c7f3a47f9ab3e9e6059870693\ntimeCreated: 1653295312"
}
]
// ... and 249 more files (download for full content)
About this extraction
This page contains the full source code of the colyseus/colyseus-unity3d GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 449 files (807.8 KB), approximately 224.9k tokens, and a symbol index with 1264 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.