浏览代码

taking merge1

/main
David Woodruff 4 年前
当前提交
36fa2ccc
共有 190 个文件被更改,包括 4795 次插入9 次删除
  1. 57
      Packages/packages-lock.json
  2. 9
      ProjectSettings/DynamicsManager.asset
  3. 8
      ProjectSettings/EditorBuildSettings.asset
  4. 7
      ProjectSettings/ProjectSettings.asset
  5. 8
      Assets/Prefabs.meta
  6. 16
      ProjectSettings/BurstAotSettings_StandaloneWindows.json
  7. 7
      Assets/Prefabs/PlayerCharacter.prefab.meta
  8. 259
      Assets/Prefabs/PlayerCharacter.prefab
  9. 1001
      Assets/Scenes/MainMenu.unity
  10. 7
      Assets/Scenes/MainMenu.unity.meta
  11. 8
      Assets/Scenes/SampleScene.meta
  12. 648
      Assets/Scenes/SampleScene.unity
  13. 2
      Assets/Scenes/SampleScene/NavMesh.asset
  14. 8
      Assets/Scenes/SampleScene/NavMesh.asset.meta
  15. 88
      Assets/Scripts/Character.cs
  16. 11
      Assets/Scripts/Character.cs.meta
  17. 8
      Assets/Scripts/Client.meta
  18. 8
      Assets/Scripts/Client/UI.meta
  19. 8
      Assets/Scripts/Client/Game.meta
  20. 8
      Assets/Scripts/Client/Net.meta
  21. 11
      Assets/Scripts/Client/Game/ClientCharSelectBRState.cs.meta
  22. 11
      Assets/Scripts/Client/Game/ClientGameBRState.cs.meta
  23. 11
      Assets/Scripts/Client/Game/ClientMainMenuBRState.cs.meta
  24. 31
      Assets/Scripts/Client/Game/ClientCharSelectBRState.cs
  25. 28
      Assets/Scripts/Client/Game/ClientGameBRState.cs
  26. 37
      Assets/Scripts/Client/Game/ClientMainMenuBRState.cs
  27. 11
      Assets/Scripts/Client/Net/ClientGNHLogic.cs.meta
  28. 78
      Assets/Scripts/Client/Net/ClientGNHLogic.cs
  29. 11
      Assets/Scripts/Client/UI/MainMenuUI.cs.meta
  30. 60
      Assets/Scripts/Client/UI/MainMenuUI.cs
  31. 25
      Assets/Scripts/Interpolation.cs
  32. 11
      Assets/Scripts/Interpolation.cs.meta
  33. 40
      Assets/Scripts/PlayerInput.cs
  34. 11
      Assets/Scripts/PlayerInput.cs.meta
  35. 19
      Assets/Scripts/PositionInterpolation.cs
  36. 11
      Assets/Scripts/PositionInterpolation.cs.meta
  37. 8
      Assets/Scripts/Server.meta
  38. 8
      Assets/Scripts/Server/Game.meta
  39. 8
      Assets/Scripts/Server/Net.meta
  40. 102
      Assets/Scripts/Server/Net/ServerGNHLogic.cs
  41. 11
      Assets/Scripts/Server/Net/ServerGNHLogic.cs.meta
  42. 11
      Assets/Scripts/Server/Game/ServerCharSelectBRState.cs.meta
  43. 11
      Assets/Scripts/Server/Game/ServerGameBRState.cs.meta
  44. 31
      Assets/Scripts/Server/Game/ServerCharSelectBRState.cs
  45. 33
      Assets/Scripts/Server/Game/ServerGameBRState.cs
  46. 8
      Assets/Scripts/Shared.meta
  47. 8
      Assets/Scripts/Shared/Net.meta
  48. 11
      Assets/Scripts/Shared/Net/GameNetHub.cs.meta
  49. 149
      Assets/Scripts/Shared/Net/GameNetHub.cs
  50. 8
      Assets/Scripts/Shared/Game.meta
  51. 152
      Assets/Scripts/Shared/Game/BossRoomStateManager.cs
  52. 11
      Assets/Scripts/Shared/Game/BossRoomStateManager.cs.meta
  53. 35
      Assets/Scripts/Shared/Game/CharSelectBRState.cs
  54. 11
      Assets/Scripts/Shared/Game/CharSelectBRState.cs.meta
  55. 11
      Assets/Scripts/Shared/Game/GameBRState.cs.meta
  56. 33
      Assets/Scripts/Shared/Game/IBossRoomState.cs
  57. 11
      Assets/Scripts/Shared/Game/IBossRoomState.cs.meta
  58. 36
      Assets/Scripts/Shared/Game/GameBRState.cs
  59. 49
      Assets/Scripts/SimulationManager.cs
  60. 11
      Assets/Scripts/SimulationManager.cs.meta
  61. 5
      Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md
  62. 7
      Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md.meta
  63. 9
      Packages/com.unity.multiplayer.transport.photon-realtime/README.md
  64. 7
      Packages/com.unity.multiplayer.transport.photon-realtime/README.md.meta
  65. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime.meta
  66. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon.meta
  67. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat.meta
  68. 8
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code.meta
  69. 18
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs
  70. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta
  71. 14
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs
  72. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta
  73. 191
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs
  74. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs.meta
  75. 1001
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs
  76. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs.meta
  77. 36
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs
  78. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta
  79. 33
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs
  80. 11
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs.meta
  81. 36
      Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatOperationCode.cs

57
Packages/packages-lock.json


{
"dependencies": {
"com.unity.burst": {
"version": "1.3.7",
"depth": 2,
"source": "registry",
"dependencies": {
"com.unity.mathematics": "1.2.1"
},
"url": "https://packages.unity.com"
},
"com.unity.collab-proxy": {
"version": "1.3.9",
"depth": 0,

},
"com.unity.collections": {
"version": "0.14.0-preview.16",
"depth": 1,
"source": "registry",
"dependencies": {
"com.unity.test-framework.performance": "2.3.1-preview",
"com.unity.burst": "1.3.7"
},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.0",
"depth": 1,

"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.mathematics": {
"version": "1.2.1",
"depth": 3,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"dependencies": {},
"hash": "8e7e3ca556843794618ab91c6b8334b291ff4e3d"
"dependencies": {
"com.unity.collections": "0.14.0-preview.16"
},
"hash": "726b77f90f2bb2879303cf72a22048ac0abf4084"
},
"com.unity.multiplayer.transport.litenet": {
"version": "file:com.unity.multiplayer.transport.litenet",

"com.unity.multiplayer.mlapi": "0.0.1-preview.1"
}
},
"com.unity.multiplayer.transport.photon-realtime": {
"version": "file:com.unity.multiplayer.transport.photon-realtime",
"depth": 0,
"source": "embedded",
"dependencies": {
"com.unity.multiplayer.mlapi": "0.0.1-preview.1"
}
},
"com.unity.nuget.newtonsoft-json": {
"version": "2.0.0-preview",
"depth": 3,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.16",
"depth": 0,

"com.unity.modules.imgui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework.performance": {
"version": "2.3.1-preview",
"depth": 2,
"source": "registry",
"dependencies": {
"com.unity.test-framework": "1.1.0",
"com.unity.nuget.newtonsoft-json": "2.0.0-preview"
},
"url": "https://packages.unity.com"
},

9
ProjectSettings/DynamicsManager.asset


--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 13
m_DefaultMaxDepenetrationVelocity: 10
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6

m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSimulation: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:

m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngluarSpeed: 7
m_SolverType: 0
m_DefaultMaxAngularSpeed: 7

8
ProjectSettings/EditorBuildSettings.asset


EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes: []
m_Scenes:
- enabled: 1
path: Assets/Scenes/MainMenu.unity
guid: 4b62455423c0e284f96f7fd6ac947bf9
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 9fc0d4010bbf28b4594072e72b8655ab
m_configObjects: {}

7
ProjectSettings/ProjectSettings.asset


bakeCollisionMeshes: 0
forceSingleInstance: 0
useFlipModelSwapchain: 1
resizableWindow: 0
resizableWindow: 1
useMacAppStoreValidation: 0
macAppStoreCategory: public.app-category.games
gpuSkinning: 1

xboxEnableFitness: 0
visibleInBackground: 1
allowFullscreenSwitch: 1
fullscreenMode: 1
fullscreenMode: 3
xboxSpeechDB: 0
xboxEnableHeadOrientation: 0
xboxEnableGuest: 0

resolutionScalingMode: 0
androidSupportedAspectRatio: 1
androidMaxAspectRatio: 2.1
applicationIdentifier: {}
applicationIdentifier:
Standalone: com.DefaultCompany.com.unity.multiplayer.samples.coop
buildNumber:
Standalone: 0
iPhone: 0

8
Assets/Prefabs.meta


fileFormatVersion: 2
guid: 5d9149b0a2db9664c9d7959745d00bf9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

16
ProjectSettings/BurstAotSettings_StandaloneWindows.json


{
"MonoBehaviour": {
"Version": 3,
"EnableBurstCompilation": true,
"EnableOptimisations": true,
"EnableSafetyChecks": false,
"EnableDebugInAllBuilds": false,
"UsePlatformSDKLinker": false,
"CpuMinTargetX32": 0,
"CpuMaxTargetX32": 0,
"CpuMinTargetX64": 0,
"CpuMaxTargetX64": 0,
"CpuTargetsX32": 6,
"CpuTargetsX64": 72
}
}

7
Assets/Prefabs/PlayerCharacter.prefab.meta


fileFormatVersion: 2
guid: e57f88b20c296674cb0c1517a43f99da
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

259
Assets/Prefabs/PlayerCharacter.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &922472105905938403
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 922472105905938412}
- component: {fileID: 922472105905938413}
- component: {fileID: 922472105905938415}
- component: {fileID: 922472105905938414}
- component: {fileID: 901965000}
- component: {fileID: 2483890359039831193}
- component: {fileID: -7978990056136126243}
m_Layer: 0
m_Name: PlayerCharacter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &922472105905938412
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 308914464942347706}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &922472105905938413
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d5a57f767e5e46a458fc5d3c628d0cbb, type: 3}
m_Name:
m_EditorClassIdentifier:
NetworkedInstanceId: 0
PrefabHash: 6075374942793011955
PrefabHashGenerator: PlayerCharacter
AlwaysReplicateAsRoot: 0
DontDestroyWithOwner: 0
--- !u!136 &922472105905938415
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 1, z: 0}
--- !u!54 &922472105905938414
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 1
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!195 &901965000
NavMeshAgent:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_AgentTypeID: 0
m_Radius: 0.5
m_Speed: 3.5
m_Acceleration: 8
avoidancePriority: 50
m_AngularSpeed: 120
m_StoppingDistance: 0
m_AutoTraverseOffMeshLink: 1
m_AutoBraking: 1
m_AutoRepath: 1
m_Height: 2
m_BaseOffset: 0
m_WalkableMask: 4294967295
m_ObstacleAvoidanceType: 4
--- !u!114 &2483890359039831193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5ef335173735a554a98a17d4ef9b21c2, type: 3}
m_Name:
m_EditorClassIdentifier:
movementSpeed: 5
movementTarget: {x: 2, y: 0, z: 2}
--- !u!114 &-7978990056136126243
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 922472105905938403}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0eaaa5f4790dfc64ebc62ee85984bab9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &2312369181857326860
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3876725910249473322}
- component: {fileID: 7677370582403823428}
- component: {fileID: 1658973705582038100}
m_Layer: 0
m_Name: Capsule
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3876725910249473322
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312369181857326860}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 308914464942347706}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &7677370582403823428
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312369181857326860}
m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &1658973705582038100
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2312369181857326860}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &4347399796013429617
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 308914464942347706}
- component: {fileID: 2501205002747161907}
m_Layer: 0
m_Name: Graphics
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &308914464942347706
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347399796013429617}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3876725910249473322}
m_Father: {fileID: 922472105905938412}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2501205002747161907
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4347399796013429617}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7dac193e15c19dd47bcfb78c85bd6d8d, type: 3}
m_Name:
m_EditorClassIdentifier:

1001
Assets/Scenes/MainMenu.unity
文件差异内容过多而无法显示
查看文件

7
Assets/Scenes/MainMenu.unity.meta


fileFormatVersion: 2
guid: 4b62455423c0e284f96f7fd6ac947bf9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scenes/SampleScene.meta


fileFormatVersion: 2
guid: d35e52e80fddfa34e8598be81bb477bb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

648
Assets/Scenes/SampleScene.unity


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 0
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 23800000, guid: c7720ceef5c5df34c98168df9d4f695e, type: 2}
--- !u!1 &532797402
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 532797406}
- component: {fileID: 532797405}
- component: {fileID: 532797404}
- component: {fileID: 532797403}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!64 &532797403
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &532797404
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &532797405
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &532797406
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 532797402}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -1, z: 10}
m_LocalScale: {x: 2, y: 2, z: 2}
m_Children: []
m_Father: {fileID: 1233618361}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 705507995}
- component: {fileID: 705507994}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!108 &705507994
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 1
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &705507995
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 2, z: 10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1233618361}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 963194228}
- component: {fileID: 963194227}
- component: {fileID: 963194226}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &963194226
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
--- !u!20 &963194227
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &963194228
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0.5, y: 0, z: 0, w: 0.8660254}
m_LocalPosition: {x: 0, y: 10, z: -5.62}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 60, y: 0, z: 0}
--- !u!1 &1069853755
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1069853757}
- component: {fileID: 1069853756}
- component: {fileID: 1069853760}
- component: {fileID: 1069853759}
- component: {fileID: 1069853758}
- component: {fileID: 1069853761}
m_Layer: 0
m_Name: NetworkingManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1069853756
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 593a2fe42fa9d37498c96f9a383b6521, type: 3}
m_Name:
m_EditorClassIdentifier:
DontDestroy: 1
RunInBackground: 1
LogLevel: 1
NetworkConfig:
ProtocolVersion: 0
NetworkTransport: {fileID: 1069853760}
RegisteredScenes:
- SampleScene
AllowRuntimeSceneChanges: 0
NetworkedPrefabs:
- Prefab: {fileID: 922472105905938403, guid: e57f88b20c296674cb0c1517a43f99da, type: 3}
PlayerPrefab: 1
PlayerPrefabHash:
id: 0
CreatePlayerPrefab: 1
ReceiveTickrate: 0
MaxReceiveEventsPerTickRate: 1000
EventTickrate: 0
MaxObjectUpdatesPerTick: -1
ClientConnectionBufferTimeout: 10
ConnectionApproval: 0
ConnectionData:
SecondsHistory: 0
EnableTimeResync: 0
TimeResyncInterval: 30
EnableNetworkedVar: 0
EnsureNetworkedVarLengthSafety: 0
EnableSceneManagement: 0
ForceSamePrefabs: 1
UsePrefabSync: 0
RecycleNetworkIds: 1
NetworkIdRecycleDelay: 120
RpcHashSize: 0
LoadSceneTimeOut: 120
EnableMessageBuffering: 0
MessageBufferTimeout: 20
EnableNetworkLogs: 1
EnableEncryption: 0
SignKeyExchange: 0
ServerBase64PfxCertificate:
references:
version: 1
00000000:
type: {class: NullableBoolSerializable, ns: MLAPI.Configuration, asm: Unity.Multiplayer.MLAPI.Runtime}
data:
Value: 6075374942793011955
--- !u!4 &1069853757
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1069853758
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 52c005b32a68a254cbe502a4e5cb8eb6, type: 3}
m_Name:
m_EditorClassIdentifier:
appId: bc5b8b0d-edf3-4c61-9593-ce38da7f0c79
gameVersion: 0.0.0
region: EU
nickName:
roomName:
maxPlayers: 4
batchedTransportEventCode: 129
channelIdCodesStartRange: 130
attachSupportLogger: 1
sendQueueBatchSize: 4096
--- !u!114 &1069853759
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: db28424c2ae12f64da25c9ecccded6b1, type: 3}
m_Name:
m_EditorClassIdentifier:
Port: 7777
Address: 127.0.0.1
PingInterval: 1
DisconnectTimeout: 5
ReconnectDelay: 0.5
MaxConnectAttempts: 10
channels: []
MessageBufferSize: 5120
SimulatePacketLossChance: 0
SimulateMinLatency: 0
SimulateMaxLatency: 0
--- !u!114 &1069853760
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b84c2d8dfe509a34fb59e2b81f8e1319, type: 3}
m_Name:
m_EditorClassIdentifier:
MessageBufferSize: 5120
MaxConnections: 100
MaxSentMessageQueueSize: 128
ConnectAddress: 127.0.0.1
ConnectPort: 7777
ServerListenPort: 7777
ServerWebsocketListenPort: 8887
SupportWebsocket: 0
Channels: []
UseMLAPIRelay: 0
MLAPIRelayAddress: 184.72.104.138
MLAPIRelayPort: 8888
MessageSendMode: 0
--- !u!114 &1069853761
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1069853755}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e26f82009f8f36d45a99adae79eab7b9, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1233618360
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1233618361}
m_Layer: 0
m_Name: Environment
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &1233618361
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1233618360}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 532797406}
- {fileID: 705507995}
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1601651753
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1601651754}
- component: {fileID: 1601651755}
m_Layer: 0
m_Name: SimulationManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1601651754
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601651753}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1601651755
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1601651753}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3e6c31da8c35c2743b0311f50e3e1a69, type: 3}
m_Name:
m_EditorClassIdentifier:
tickRate: 20

2
Assets/Scenes/SampleScene/NavMesh.asset
文件差异内容过多而无法显示
查看文件

8
Assets/Scenes/SampleScene/NavMesh.asset.meta


fileFormatVersion: 2
guid: c7720ceef5c5df34c98168df9d4f695e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

88
Assets/Scripts/Character.cs


using MLAPI;
using MLAPI.Messaging;
using System;
using System.IO;
using System.Linq;
using UnityEngine;
using UnityEngine.AI;
public class Character : NetworkedBehaviour
{
[SerializeField]
private float movementSpeed;
private NavMeshAgent _navMeshAgent;
private NavMeshPath _path;
private PositionInterpolation _interpolation;
public void Awake()
{
_path = new NavMeshPath();
_navMeshAgent = GetComponent<NavMeshAgent>();
_interpolation = GetComponentInChildren<PositionInterpolation>();
}
///<inheritdoc/>
public override void NetworkStart()
{
base.NetworkStart();
SimulationManager.Singleton.OnSimulationUpdate += SimulationUpdate;
SimulationManager.Singleton.OnSyncNetworkEvents += SyncNetworkEvents;
_navMeshAgent.updateRotation = false;
_navMeshAgent.updatePosition = true;
if (!IsServer)
{
Destroy(_navMeshAgent);
}
}
private void SyncNetworkEvents(float time, float deltaTime)
{
if (IsServer)
{
_interpolation.AddValue(time, transform.position);
InvokeClientRpcOnEveryoneExcept<float, Vector3>(ReplicatePosition, NetworkingManager.Singleton.ServerClientId, time, transform.position);
}
}
public void SetMovementTarget(Vector3 position)
{
_navMeshAgent.CalculatePath(position, _path);
}
private void SimulationUpdate(float time, float deltaTime)
{
if (IsServer)
{
NavigationMovement(deltaTime);
}
}
private void NavigationMovement(float deltaTime)
{
var corners = _path.corners; // TODO: maybe use non-alloc version
if (corners.Any() && Vector3.SqrMagnitude(corners[corners.Length - 1]- transform.position) < 1)
{
_path = new NavMeshPath();
corners = _path.corners;
}
var direction = corners.Length > 1 ? (corners[1]- corners[0]).normalized : Vector3.zero;
var movement = direction * movementSpeed * deltaTime;
_navMeshAgent.Move(movement);
}
[ClientRPC]
private void ReplicatePosition(float time, Vector3 value)
{
// The time which we receive here is server time. TODO We need to match it with our client time.
_interpolation.AddValue(time, value);
}
}

11
Assets/Scripts/Character.cs.meta


fileFormatVersion: 2
guid: 5ef335173735a554a98a17d4ef9b21c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client.meta


fileFormatVersion: 2
guid: 422ec0f4d28e6d4468624a9c76adab77
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/UI.meta


fileFormatVersion: 2
guid: 3d8dd27d96315be4c9c7413bc17b82c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/Game.meta


fileFormatVersion: 2
guid: 96e5af1f6fcbe144a99396d22b4f7dbf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Client/Net.meta


fileFormatVersion: 2
guid: 834e4dadbaf194f45a280e71aace6a16
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Client/Game/ClientCharSelectBRState.cs.meta


fileFormatVersion: 2
guid: 5c5d294b879617e448dbe34b7f09616d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Client/Game/ClientGameBRState.cs.meta


fileFormatVersion: 2
guid: fb79a8334ba58754c98a2ee9fc2a5dee
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Client/Game/ClientMainMenuBRState.cs.meta


fileFormatVersion: 2
guid: 5a65bc8be73a02c42a41f5efef95fbae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Assets/Scripts/Client/Game/ClientCharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
class ClientCharSelectBRState : CharSelectBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all client-side logic for the character select BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

28
Assets/Scripts/Client/Game/ClientGameBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
class ClientGameBRState : GameBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all client-side logic for the Game BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

37
Assets/Scripts/Client/Game/ClientMainMenuBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// The BossRoom state logic that runs during MainMenu. Unlike most states, there is only a client variant of this (you are always
/// a client when sitting at the Main Menu screen).
/// </summary>
class ClientMainMenuBRState : IBossRoomState
{
private BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.MAINMENU; } }
public void Destroy()
{
}
public void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
UnityEngine.Application.targetFrameRate = 60;
}
public void Update()
{
}
}
}

11
Assets/Scripts/Client/Net/ClientGNHLogic.cs.meta


fileFormatVersion: 2
guid: 5bd31edc1b1fd1342b3bf8193a5a03b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

78
Assets/Scripts/Client/Net/ClientGNHLogic.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomClient
{
/// <summary>
/// Client logic for the GameNetHub. Contains implementations for all of GameNetHub's S2C RPCs.
/// </summary>
public class ClientGNHLogic
{
private GameNetHub m_hub;
public ClientGNHLogic(GameNetHub hub)
{
m_hub = hub;
}
public void RecvConnectFinished( ConnectStatus status, BossRoomState targetState )
{
//on success, there is nothing to do (the MLAPI scene management system will take us to the next scene).
//on failure, we must raise an event so that the UI layer can display something.
Debug.Log("RecvConnectFinished Got status: " + status);
m_hub.GetComponent<BossRoomStateManager>().ChangeState(targetState, null);
}
/// <summary>
/// Either loads a Guid string from Unity preferences, or creates one and checkpoints it, then returns it.
/// </summary>
/// <returns>The Guid that uniquely identifies this client install, in string form. </returns>
private static string GetOrCreateGuid()
{
if( PlayerPrefs.HasKey("client_guid"))
{
return PlayerPrefs.GetString("client_guid");
}
System.Guid g = System.Guid.NewGuid();
string guid_string = g.ToString();
PlayerPrefs.SetString("client_guid", guid_string);
return guid_string;
}
/// <summary>
/// Wraps the invocation of NetworkingManager.StartClient, including our GUID as the payload.
/// </summary>
/// <remarks>
/// This method must be static because, when it is invoked, the client still doesn't know it's a client yet, and in particular, GameNetHub hasn't
/// yet initialized its client and server GNHLogic objects yet (which it does in NetworkStart, based on the role that the current player is performing).
/// </remarks>
/// <param name="ipaddress">the IP address of the host to connect to. (currently IPV4 only)</param>
/// <param name="port">The port of the host to connect to. </param>
public static void StartClient(GameNetHub hub, string ipaddress, int port)
{
string client_guid = GetOrCreateGuid();
string payload = $"client_guid={client_guid}\n"; //minimal format where key=value pairs are separated by newlines.
byte[] payload_bytes = System.Text.Encoding.UTF8.GetBytes(payload);
//DMW_NOTE: non-portable. We need to be updated when moving to UTP transport.
var transport = hub.NetworkingManagerGO.GetComponent<MLAPI.Transports.UNET.UnetTransport>();
transport.ConnectAddress = ipaddress;
transport.ConnectPort = port;
hub.NetManager.NetworkConfig.ConnectionData = payload_bytes;
//and...we're off! MLAPI will establish a socket connection to the host.
// If the socket connection fails, we'll hear back by [???] (FIXME: GOMPS-79, need to handle transport layer failures too).
// If the socket connection succeeds, we'll get our RecvConnectFinished invoked. This is where game-layer failures will be reported.
hub.NetManager.StartClient();
}
}
}

11
Assets/Scripts/Client/UI/MainMenuUI.cs.meta


fileFormatVersion: 2
guid: f6144e8dd0fc8ec4cb23a1a49059aa08
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

60
Assets/Scripts/Client/UI/MainMenuUI.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoomViz
{
/// <summary>
/// Provides backing logic for all of the UI that runs in the MainMenu stage.
/// </summary>
public class MainMenuUI : MonoBehaviour
{
public GameObject GameHubGO;
public GameObject InputTextGO;
private BossRoom.GameNetHub m_netHub;
// Start is called before the first frame update
void Start()
{
m_netHub = GameHubGO.GetComponent<BossRoom.GameNetHub>();
}
// Update is called once per frame
void Update()
{
}
/// <summary>
/// Gets the IP Address the user set in the UI, or returns 127.0.0.1 if IP is not present.
/// </summary>
/// <returns>IP address entered by user, in string form. </returns>
private string GetIPAddress()
{
string iptext = InputTextGO.GetComponent<UnityEngine.UI.Text>().text;
if( iptext == "" )
{
return "127.0.0.1";
}
return iptext;
}
public void OnHostClicked()
{
Debug.Log("Host Clicked");
GetIPAddress();
m_netHub.StartHost(GetIPAddress(), 9998);
}
public void OnConnectClicked()
{
Debug.Log("Connect Clicked");
m_netHub.StartClient(GetIPAddress(), 9998);
}
}
}

25
Assets/Scripts/Interpolation.cs


using System;
using UnityEngine;
public abstract class Interpolation<T> : MonoBehaviour
{
public abstract Func<T, T, float, T> LerpFunction { get;}
private (float, T) _last;
private (float, T) _previous;
public T GetValueForTime(float time)
{
float timeSincePrevious = time - _previous.Item1;
float t = (timeSincePrevious / (_last.Item1 - _previous.Item1) - 1f);
return LerpFunction(_previous.Item2, _last.Item2, t);
}
public void AddValue(float time, T value)
{
_previous = _last;
_last = (time, value);
}
}

11
Assets/Scripts/Interpolation.cs.meta


fileFormatVersion: 2
guid: 4be874942db508e4bb7c4481d0ffb727
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

40
Assets/Scripts/PlayerInput.cs


using MLAPI;
using MLAPI.Messaging;
using System;
using UnityEngine;
public class PlayerInput : NetworkedBehaviour
{
private Character character;
public void Awake()
{
character = GetComponent<Character>();
}
public override void NetworkStart()
{
if (IsClient)
{
SimulationManager.Singleton.OnSimulationUpdate += SimulationUpdate;
}
}
private void SimulationUpdate(float time, float deltaTime)
{
if (Input.GetMouseButton(0))
{
RaycastHit hit;
if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit))
{
InvokeServerRpc(SendPlayerInput, hit.point);
}
}
}
[ServerRPC]
public void SendPlayerInput(Vector3 position)
{
character.SetMovementTarget(position);
}
}

11
Assets/Scripts/PlayerInput.cs.meta


fileFormatVersion: 2
guid: 0eaaa5f4790dfc64ebc62ee85984bab9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

19
Assets/Scripts/PositionInterpolation.cs


using System;
using UnityEngine;
using MLAPI;
[DefaultExecutionOrder(200)]
public class PositionInterpolation : Interpolation<Vector3>
{
public override Func<Vector3, Vector3, float, Vector3> LerpFunction => Vector3.LerpUnclamped;
private void Update()
{
var value = GetValueForTime(NetworkingManager.Singleton.NetworkTime);
if (!float.IsNaN(value.x))
{
transform.position = value;
}
}
}

11
Assets/Scripts/PositionInterpolation.cs.meta


fileFormatVersion: 2
guid: 7dac193e15c19dd47bcfb78c85bd6d8d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server.meta


fileFormatVersion: 2
guid: fea36b5492aa19d4f88d4dd297330468
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server/Game.meta


fileFormatVersion: 2
guid: 75639e6fb8c2e4b4aac37138c9601db1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Server/Net.meta


fileFormatVersion: 2
guid: b49db31b9d52a4e499fc7edbb83dcbc7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

102
Assets/Scripts/Server/Net/ServerGNHLogic.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoomServer
{
/// <summary>
/// Server logic plugin for the GameNetHub. Contains implementations for all GameNetHub's C2S RPCs.
/// </summary>
public class ServerGNHLogic
{
private GameNetHub m_Hub;
// used in ApprovalCheck. This is intended as a bit of light protection against DOS attacks that rely on sending silly big buffers of garbage.
private const int k_MaxConnectPayload = 1024;
public ServerGNHLogic(GameNetHub hub)
{
m_Hub = hub;
m_Hub.NetManager.ConnectionApprovalCallback += this.ApprovalCheck;
}
/// <summary>
/// Initializes host mode on this client. Call this and then other clients should connect to us!
/// </summary>
/// <remarks>
/// See notes in GNH_Client.StartClient about why this must be static.
/// </remarks>
/// <param name="hub">The GameNetHub that is invoking us. </param>
/// <param name="ipaddress">The IP address to connect to (currently IPV4 only).</param>
/// <param name="port">The port to connect to. </param>
public static void StartHost(GameNetHub hub, string ipaddress, int port )
{
//DMW_NOTE: non-portable. We need to be updated when moving to UTP transport.
var transport = hub.NetworkingManagerGO.GetComponent<MLAPI.Transports.UNET.UnetTransport>();
transport.ConnectAddress = ipaddress;
transport.ServerListenPort = port;
hub.NetManager.StartHost();
}
/// <summary>
/// This logic plugs into the "ConnectionApprovalCallback" exposed by MLAPI.NetworkingManager, and is run every time a client connects to us.
/// See GNH_Client.StartClient for the complementary logic that runs when the client starts its connection.
/// </summary>
/// <remarks>
/// Since our game doesn't have to interact with some third party authentication service to validate the identity of the new connection, our ApprovalCheck
/// method is simple, and runs synchronously, invoking "callback" to signal approval at the end of the method. MLAPI currently doesn't support the ability
/// to send back more than a "true/false", which means we have to work a little harder to provide a useful error return to the client. To do that, we invoke a
/// client RPC in the same channel that MLAPI uses for its connection callback. Since that channel ("MLAPI_INTERNAL") is both reliable and sequenced, we can be
/// confident that our login result message will execute before any disconnect message.
/// </remarks>
/// <param name="connectionData">binary data passed into StartClient. In our case this is the client's GUID, which is a unique identifier for their install of the game that persists across app restarts. </param>
/// <param name="clientId">This is the clientId that MLAPI assigned us on login. It does not persist across multiple logins from the same client. </param>
/// <param name="callback">The delegate we must invoke to signal that the connection was approved or not. </param>
private void ApprovalCheck( byte[] connectionData, ulong clientId, MLAPI.NetworkingManager.ConnectionApprovedDelegate callback )
{
if( connectionData.Length > k_MaxConnectPayload )
{
callback(false, 0, false, null, null );
return;
}
string payload = System.Text.Encoding.UTF8.GetString(connectionData);
string[] config_lines = payload.Split('\n');
var payload_config = new Dictionary<string, string>();
foreach( var line in config_lines )
{
//key-value pair.
if( line.Contains("=") )
{
string[] kv = line.Split('=');
payload_config.Add(kv[0], kv[1]);
}
else if( line.Trim() != "" )
{
//single token, with no value present.
payload_config.Add(line, null);
}
}
//TODO: GOMPS-78. We'll need to save our client guid so that we can handle reconnect.
Debug.Log("host ApprovalCheck: client payload was: " + payload);
Debug.Log("host ApprovalCheck: client guid was: " + payload_config["client_guid"]);
//TODO: GOMPS-79 handle different error cases.
callback(false, 0, true, null, null);
//FIXME_DMW: it is weird to do this after the callback, but the custom message won't be delivered if we call it beforehand.
//This creates an "honor system" scenario where it is up to the client to politely leave on failure. Probably
//we should add a NetManager.DisconnectClient call directly below this line, when we are rejecting the connection.
m_Hub.S2C_ConnectResult(clientId, ConnectStatus.SUCCESS, BossRoomState.CHARSELECT);
}
}
}

11
Assets/Scripts/Server/Net/ServerGNHLogic.cs.meta


fileFormatVersion: 2
guid: 54b0859a1da930541adf0b2d1bb8d977
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Server/Game/ServerCharSelectBRState.cs.meta


fileFormatVersion: 2
guid: 425e77ec23730374bbbe2ee01d6e1e7c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Server/Game/ServerGameBRState.cs.meta


fileFormatVersion: 2
guid: 48a8e5e3f2de1a74889818336559cf4a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

31
Assets/Scripts/Server/Game/ServerCharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomServer
{
class ServerCharSelectBRState : CharSelectBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all server-side logic for the character select BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
base.Initialize(manager, stateParams);
}
public override void Update()
{
base.Update();
}
}
}

33
Assets/Scripts/Server/Game/ServerGameBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoomServer
{
class ServerGameBRState : GameBRState
{
// !! STUB CLASS !!
// this will be fleshed out with all server-side logic for the Game BossRoom state.
public override void Destroy()
{
base.Destroy();
}
public override void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams )
{
base.Initialize(manager, stateParams);
//NOTE: it's very important to use MLAPI's scene switching logic, and not switch the scene yourself. If you do,
//MLAPI will get confused internally about which scene is active.
//MLAPI_WISHLIST: could MLAPI listen to scene change events and then handle the networked switch itself, internally?
MLAPI.SceneManagement.NetworkSceneManager.SwitchScene("SampleScene");
}
public override void Update()
{
base.Update();
}
}
}

8
Assets/Scripts/Shared.meta


fileFormatVersion: 2
guid: 43b21ee40bbd5b642a7ba927b1ae59fb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Scripts/Shared/Net.meta


fileFormatVersion: 2
guid: aa3c75122fab71d4189f666de0192dc6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Shared/Net/GameNetHub.cs.meta


fileFormatVersion: 2
guid: 7ba4a1d598313d94a81a08ceae147b57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

149
Assets/Scripts/Shared/Net/GameNetHub.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MLAPI.Serialization.Pooled;
namespace BossRoom
{
public enum ConnectStatus
{
SUCCESS, //client successfully connected. This may also be a successful reconnect.
ESERVERFULL, //can't join, server is already at capacity.
EMATCHSTARTED, //can't join, match is already in progress.
EUNKNOWN, //can't join, reason unknown.
}
/// <summary>
/// The GameNetHub is the general purpose entry-point for game network messages between the client and server. It is available
/// as soon as the initial network connection has completed, and persists across all scenes. Its purpose is to move non-GameObject-specific
/// methods between server and client. Generally these have to do with connection, and match end conditions.
/// </summary>
///
/// <remarks
/// Why is there a C2S_ConnectFinished event here? How is that different from the "ApprovalCheck" logic that MLAPI optionally runs
/// when establishing a new client connection?
/// MLAPI's ApprovalCheck logic doesn't offer a way to return rich data. We need to know certain things directly upon logging in, such as
/// whether the game-layer even wants us to join (we could fail because the server is full, or some other non network related reason), and also
/// what BossRoomState to transition to. We do this with a Custom Named Message, which fires on the server immediately after the approval check delegate
/// has run.
///
/// Why do we need to send a client GUID? What is it? Don't we already have a clientID?
/// ClientIDs are assigned on login. If you connect to a server, then your connection drops, and you reconnect, you get a new ClientID. This
/// makes it awkward to get back your old character, which the server is going to hold onto for a fixed timeout. To properly reconnect and recover
/// your character, you need a persistent identifier for your own client install. We solve that by generating a random GUID and storing it
/// in player prefs, so it persists across sessions of the game.
/// </remarks>
///
public class GameNetHub : MonoBehaviour
{
public GameObject NetworkingManagerGO;
private BossRoomClient.ClientGNHLogic m_ClientLogic;
private BossRoomServer.ServerGNHLogic m_ServerLogic;
public MLAPI.NetworkingManager NetManager { get; private set; }
// Start is called before the first frame update
void Start()
{
Object.DontDestroyOnLoad(this.gameObject);
NetManager = NetworkingManagerGO.GetComponent<MLAPI.NetworkingManager>();
//because we are not a true NetworkedBehavior, we don't get NetworkStart messages. But we still need to run at that point
//where we know if we're a host or client. So we fake a "NetworkingManager.OnNetworkStarted" event out of the existing OnServerStarted
//and OnClientConnectedCallback events.
//FIXME_DMW could this be improved?
NetManager.OnServerStarted += () =>
{
NetworkStart();
};
NetManager.OnClientConnectedCallback += (clientId) =>
{
if (clientId == NetManager.LocalClientId)
{
NetworkStart();
}
};
}
private void RegisterClientMessageHandlers()
{
MLAPI.Messaging.CustomMessagingManager.RegisterNamedMessageHandler("S2C_ConnectResult", (senderClientId, stream) =>
{
using (PooledBitReader reader = PooledBitReader.Get(stream))
{
ConnectStatus status = (ConnectStatus)reader.ReadInt32();
BossRoomState state = (BossRoomState)reader.ReadInt32();
m_ClientLogic.RecvConnectFinished(status, state);
}
});
}
private void RegisterServerMessageHandlers()
{
//TODO: plug in any C->S message handlers here.
}
/// <summary>
/// This method runs when NetworkingManager has started up (following a succesful connect on the client, or directly after StartHost is invoked
/// on the host). It is named to match NetworkedBehaviour.NetworkStart, and serves the same role, even though GameNetHub itself isn't a NetworkedBehaviour.
/// </summary>
public void NetworkStart()
{
if (NetManager.IsClient)
{
m_ClientLogic = new BossRoomClient.ClientGNHLogic(this);
RegisterClientMessageHandlers();
}
if ( NetManager.IsServer )
{
m_ServerLogic = new BossRoomServer.ServerGNHLogic(this);
RegisterServerMessageHandlers();
}
if( NetManager.IsHost )
{
//special host code. This is what kicks off the flow that happens on a regular client
//when it has finished connecting successfully. A dedicated server would remove this.
m_ClientLogic.RecvConnectFinished(ConnectStatus.SUCCESS, BossRoomState.CHARSELECT);
}
}
/// <summary>
/// Wraps the invocation of NetworkingManager.StartClient, including our GUID as the payload.
/// </summary>
/// <param name="ipaddress">the IP address of the host to connect to. (IPV4 only)</param>
/// <param name="port">The port of the host to connect to. </param>
public void StartClient(string ipaddress, int port)
{
BossRoomClient.ClientGNHLogic.StartClient(this, ipaddress, port);
}
/// <summary>
/// Wraps the invocation of NetworkingManager.StartHost.
/// </summary>
/// <param name="ipaddress">The IP address of the network interface we should listen to connections on. (IPV4 only)</param>
/// <param name="port">The port we should listen on. </param>
public void StartHost(string ipaddress, int port )
{
BossRoomServer.ServerGNHLogic.StartHost(this, ipaddress, port);
}
//Server->Client RPCs
public void S2C_ConnectResult( ulong netId, ConnectStatus status, BossRoomState targetState )
{
using (PooledBitStream stream = PooledBitStream.Get())
{
using (PooledBitWriter writer = PooledBitWriter.Get(stream))
{
writer.WriteInt32((int)status);
writer.WriteInt32((int)targetState);
MLAPI.Messaging.CustomMessagingManager.SendNamedMessage("S2C_ConnectResult", netId, stream, "MLAPI_INTERNAL");
}
}
}
}
}

8
Assets/Scripts/Shared/Game.meta


fileFormatVersion: 2
guid: 3cd90654bfd4b4d448c23aefbf8174ca
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

152
Assets/Scripts/Shared/Game/BossRoomStateManager.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoom
{
/// <summary>
/// enum for the top-level game FSM.
/// </summary>
public enum BossRoomState
{
NONE, // no state is actively running. Currently this only happens prior to BossRoomStateManager.Start having run.
MAINMENU, // main menu logic is running.
CHARSELECT, // character select logic is running.
GAME, // core game logic is running.
}
/// <summary>
/// The BossRoomStateManager manages the top-level logic for each gamestate.
/// </summary>
/// <remarks>
/// This class is intended as the top-level FSM for the game. Because of that, it runs both before and after
/// the time when the client has an active connection to the host.
/// On the Host, server and client logic run concurrently (with server logic preceding client on every update tic).
/// On the Client, only client logic runs.
/// </remarks>
public class BossRoomStateManager : MonoBehaviour
{
public GameNetHub NetHub { get; private set; }
/// <summary>
/// Gets the active state that BossRoomStateManager is in.
/// </summary>
public BossRoomState ActiveState
{
get
{
//There is always a client state, and client and server states must always match. See ChangeState.
//Note: if converting to a dedicated server, you would need to change this to an #IF BUILD_SERVER #ELSE block
//that checked either client or server states. See note in ChangeState about converting to a dedicated server.
return m_clientState != null ? m_clientState.State : BossRoomState.NONE;
}
}
private IBossRoomState m_serverState;
private IBossRoomState m_clientState;
/// <summary>
/// Transitions from one active state to another. Will no-op if transitioning to the current active state.
/// </summary>
/// <remarks>
/// On the Host, Server and Client BossRoomState objects run concurrently. On clients, only the "client" version of each
/// state is instantiated, and for a hypothetical dedicated server, only the server object would be instantiated. If you were
/// moving to a dedicated server model and stripping out server code from the client, this is one method you would need to change
/// (for example by making a client and server factory components that plug themselves into the BossRoomStateManager, and are
/// guarded by #IF !BUILD_SERVER or #IF BUILD_SERVER, respectively)
/// </remarks>
/// <param name="target">the target state to transition to</param>
/// <param name="stateParams">Any special parameters to inform the next state about, or null for none.</param>
public void ChangeState(BossRoomState target, Dictionary<string,System.Object> stateParams )
{
if( target == ActiveState ) { return; }
Debug.Log("transitioning from state " + ActiveState + " to " + target);
switch(target)
{
case BossRoomState.NONE:
{
DestroyStates();
m_serverState = null;
m_clientState = null;
break;
}
case BossRoomState.MAINMENU:
{
DestroyStates();
m_clientState = new BossRoomClient.ClientMainMenuBRState();
m_clientState.Initialize(this, stateParams);
break;
}
case BossRoomState.CHARSELECT:
{
DestroyStates();
if( NetHub.NetManager.IsServer )
{
m_serverState = new BossRoomServer.ServerCharSelectBRState();
m_serverState.Initialize(this, stateParams);
}
if( NetHub.NetManager.IsClient )
{
m_clientState = new BossRoomClient.ClientCharSelectBRState();
m_clientState.Initialize(this, stateParams);
}
break;
}
case BossRoomState.GAME:
{
DestroyStates();
if( NetHub.NetManager.IsServer )
{
m_serverState = new BossRoomServer.ServerGameBRState();
m_serverState.Initialize(this, stateParams);
}
if( NetHub.NetManager.IsClient )
{
m_clientState = new BossRoomClient.ClientGameBRState();
m_clientState.Initialize(this, stateParams);
}
break;
}
default:
throw new System.Exception("unimplemented gamestate detected: " + target);
}
}
/// <summary>
/// Helper method for ChangeState that destroys the active states if they exist.
/// </summary>
private void DestroyStates()
{
if (m_serverState != null) { m_serverState.Destroy(); }
if (m_clientState != null) { m_clientState.Destroy(); }
m_serverState = null;
m_clientState = null;
}
// Start is called before the first frame update
void Start()
{
NetHub = this.GetComponent<GameNetHub>();
ChangeState(BossRoomState.MAINMENU, null);
}
// Update is called once per frame
void FixedUpdate()
{
if( m_serverState != null ) { m_serverState.Update(); }
if( m_clientState != null ) { m_clientState.Update(); }
}
}
}

11
Assets/Scripts/Shared/Game/BossRoomStateManager.cs.meta


fileFormatVersion: 2
guid: 39332c63269f3f34db37df122adcc57b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

35
Assets/Scripts/Shared/Game/CharSelectBRState.cs


using System;
using System.Collections.Generic;
using BossRoom;
namespace BossRoom
{
/// <summary>
/// The BossRoomState that runs during Character Select.
/// </summary>
class CharSelectBRState : IBossRoomState
{
protected BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.CHARSELECT; } }
public virtual void Destroy()
{
}
public virtual void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
}
public virtual void Update()
{
//FIXME_DMW (temp): as we don't have a CharacterSelect scene yet, we just advance directly to the Game state.
m_manager.ChangeState(BossRoomState.GAME, null);
}
}
}

11
Assets/Scripts/Shared/Game/CharSelectBRState.cs.meta


fileFormatVersion: 2
guid: fe598b22e9599b540a40723c8d48686a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

11
Assets/Scripts/Shared/Game/GameBRState.cs.meta


fileFormatVersion: 2
guid: 19b55cfbf40aa244f9bd90143d441ee4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

33
Assets/Scripts/Shared/Game/IBossRoomState.cs


using System;
using System.Collections.Generic;
using UnityEngine;
namespace BossRoom
{
/// <summary>
/// Interface that models a single state of the BossRoom game. See BossRoomStateManager for more information.
/// </summary>
interface IBossRoomState
{
/// <summary>
/// Called when this BossRoomState is transitioned to.
/// <param name="stateParams"/>optional dictionary of parameters to be used by the new gamestate. </param>
/// </summary>
void Initialize( BossRoomStateManager manager, Dictionary<string,System.Object> stateParams=null );
/// <summary>
/// Called once per Update by the BossRoomStateManager.
/// </summary>
void Update();
/// <summary>
/// Called when this BossRoomState ends.
/// </summary>
void Destroy();
/// <summary>
/// What BossRoomState this object represents.
/// </summary>
BossRoomState State { get; }
}
}

11
Assets/Scripts/Shared/Game/IBossRoomState.cs.meta


fileFormatVersion: 2
guid: d6956349616d0304abbd589d59a797f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

36
Assets/Scripts/Shared/Game/GameBRState.cs


using System;
using System.Collections.Generic;
using UnityEngine;
using BossRoom;
namespace BossRoom
{
/// <summary>
/// The BossRoomState that runs during primary gameplay.
/// </summary>
class GameBRState : IBossRoomState
{
protected BossRoomStateManager m_manager;
public BossRoomState State { get { return BossRoomState.GAME; } }
//!! STUB !! will be filled out with any gamestate logic shared between server and client.
public virtual void Destroy()
{
}
public virtual void Initialize(BossRoomStateManager manager, Dictionary<string, object> stateParams)
{
m_manager = manager;
}
public virtual void Update()
{
}
}
}

49
Assets/Scripts/SimulationManager.cs


using MLAPI;
using UnityEngine;
[DefaultExecutionOrder(100)]
public class SimulationManager : MonoBehaviour
{
public static SimulationManager Singleton { get; private set; }
public delegate void SimulationUpdateDelegate(float time, float deltaTime);
/// <summary>
/// Main game simulation such as processing inputs, running AI, ticking state machines etc. An event is definitely not what we want to use because we have no order, but FixedUpdate isn't as well.
/// </summary>
public event SimulationUpdateDelegate OnSimulationUpdate;
/// <summary>
/// Called after simulation is done replicate game state such as positions to the client.
/// </summary>
public event SimulationUpdateDelegate OnSyncNetworkEvents;
[SerializeField]
private int tickRate = 20;
private float _networkTickDelta;
private float _lastNetworkTickTime;
private void OnEnable()
{
Singleton = this;
_networkTickDelta = 1f / tickRate;
}
// Update is called once per frame
void Update()
{
// The goal here is to sync this up with MLAPIs synchronization but the current network tick model in MLAPI is broken.
while (NetworkingManager.Singleton.NetworkTime - _lastNetworkTickTime >= _networkTickDelta)
{
_lastNetworkTickTime += _networkTickDelta;
Physics.Simulate(_networkTickDelta);
OnSimulationUpdate?.Invoke(_lastNetworkTickTime,_networkTickDelta);
OnSyncNetworkEvents?.Invoke(_lastNetworkTickTime, _networkTickDelta);
}
}
}

11
Assets/Scripts/SimulationManager.cs.meta


fileFormatVersion: 2
guid: 3e6c31da8c35c2743b0311f50e3e1a69
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

5
Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md


Changelog
All notable changes to this package will be documented in this file. The format is based on Keep a Changelog
[0.0.1-preview.1] - 2020-10-05
This is the first release of Enet MLAPI Package

7
Packages/com.unity.multiplayer.transport.photon-realtime/CHANGELOG.md.meta


fileFormatVersion: 2
guid: 9d6ccdb72b9b37548a841fcc1c4dee76
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

9
Packages/com.unity.multiplayer.transport.photon-realtime/README.md


Photon Realtime transport for MLAPI
---
We do NOT have a license for the photon source so keep this internal.
Original `license.txt` in the realtime sdk:
See the License Agreement at
https://www.photonengine.com/terms

7
Packages/com.unity.multiplayer.transport.photon-realtime/README.md.meta


fileFormatVersion: 2
guid: ea5e2ac1b219ffb428dc8f61477267d2
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime.meta


fileFormatVersion: 2
guid: caaee5b70b02eae44b04ad8149d1ba63
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon.meta


fileFormatVersion: 2
guid: ef193029478e7d84692c98b909eaaa00
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat.meta


fileFormatVersion: 2
guid: 02fbda138c6cf9143aacd0267c5db552
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code.meta


fileFormatVersion: 2
guid: 29466ff33d534e74baaef92e3459e59f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

18
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs


// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChannelCreationOptions is a parameter used when subscribing to a public channel for the first time.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2018 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
public class ChannelCreationOptions
{
/// <summary>Default values of channel creation options.</summary>
public static ChannelCreationOptions Default = new ChannelCreationOptions();
/// <summary>Whether or not the channel to be created will allow client to keep a list of users.</summary>
public bool PublishSubscribers { get; set; }
/// <summary>Limit of the number of users subscribed to the channel to be created.</summary>
public int MaxSubscribers { get; set; }
}
}

11
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelCreationOptions.cs.meta


fileFormatVersion: 2
guid: 8f478e74d7c37554ea2edebe1300c2f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

14
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs


// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChannelWellKnownProperties contains the list of well-known channel properties.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2018 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
public class ChannelWellKnownProperties
{
public const byte MaxSubscribers = 255;
public const byte PublishSubscribers = 254;
}
}

11
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChannelWellKnownProperties.cs.meta


fileFormatVersion: 2
guid: 9ff211198d3295e4ca2a4fa56babeb3a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

191
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs


// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
#if UNITY_4_7 || UNITY_5 || UNITY_5_3_OR_NEWER
#define SUPPORTED_UNITY
#endif
namespace Photon.Chat
{
using System.Collections.Generic;
using System.Text;
#if SUPPORTED_UNITY || NETFX_CORE
using Hashtable = ExitGames.Client.Photon.Hashtable;
using SupportClass = ExitGames.Client.Photon.SupportClass;
#endif
/// <summary>
/// A channel of communication in Photon Chat, updated by ChatClient and provided as READ ONLY.
/// </summary>
/// <remarks>
/// Contains messages and senders to use (read!) and display by your GUI.
/// Access these by:
/// ChatClient.PublicChannels
/// ChatClient.PrivateChannels
/// </remarks>
public class ChatChannel
{
/// <summary>Name of the channel (used to subscribe and unsubscribe).</summary>
public readonly string Name;
/// <summary>Senders of messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
public readonly List<string> Senders = new List<string>();
/// <summary>Messages in chronological order. Senders and Messages refer to each other by index. Senders[x] is the sender of Messages[x].</summary>
public readonly List<object> Messages = new List<object>();
/// <summary>If greater than 0, this channel will limit the number of messages, that it caches locally.</summary>
public int MessageLimit;
/// <summary>Unique channel ID.</summary>
public int ChannelID;
/// <summary>Is this a private 1:1 channel?</summary>
public bool IsPrivate { get; protected internal set; }
/// <summary>Count of messages this client still buffers/knows for this channel.</summary>
public int MessageCount { get { return this.Messages.Count; } }
/// <summary>
/// ID of the last message received.
/// </summary>
public int LastMsgId { get; protected set; }
private Dictionary<object, object> properties;
/// <summary>Whether or not this channel keeps track of the list of its subscribers.</summary>
public bool PublishSubscribers { get; protected set; }
/// <summary>Maximum number of channel subscribers. 0 means infinite.</summary>
public int MaxSubscribers { get; protected set; }
/// <summary>Subscribed users.</summary>
public readonly HashSet<string> Subscribers = new HashSet<string>();
/// <summary>Used internally to create new channels. This does NOT create a channel on the server! Use ChatClient.Subscribe.</summary>
public ChatChannel(string name)
{
this.Name = name;
}
public bool TryGetProperty(string key, out object value)
{
if (properties == null)
{
value = default(object);
return false;
}
return properties.TryGetValue(key, out value);
}
/// <summary>Used internally to add messages to this channel.</summary>
public void Add(string sender, object message, int msgId)
{
this.Senders.Add(sender);
this.Messages.Add(message);
this.LastMsgId = msgId;
this.TruncateMessages();
}
/// <summary>Used internally to add messages to this channel.</summary>
public void Add(string[] senders, object[] messages, int lastMsgId)
{
this.Senders.AddRange(senders);
this.Messages.AddRange(messages);
this.LastMsgId = lastMsgId;
this.TruncateMessages();
}
/// <summary>Reduces the number of locally cached messages in this channel to the MessageLimit (if set).</summary>
public void TruncateMessages()
{
if (this.MessageLimit <= 0 || this.Messages.Count <= this.MessageLimit)
{
return;
}
int excessCount = this.Messages.Count - this.MessageLimit;
this.Senders.RemoveRange(0, excessCount);
this.Messages.RemoveRange(0, excessCount);
}
/// <summary>Clear the local cache of messages currently stored. This frees memory but doesn't affect the server.</summary>
public void ClearMessages()
{
this.Senders.Clear();
this.Messages.Clear();
}
/// <summary>Provides a string-representation of all messages in this channel.</summary>
/// <returns>All known messages in format "Sender: Message", line by line.</returns>
public string ToStringMessages()
{
StringBuilder txt = new StringBuilder();
for (int i = 0; i < this.Messages.Count; i++)
{
txt.AppendLine(string.Format("{0}: {1}", this.Senders[i], this.Messages[i]));
}
return txt.ToString();
}
internal void ReadProperties(Dictionary<object, object> newProperties)
{
if (newProperties != null && newProperties.Count > 0)
{
if (this.properties == null)
{
this.properties = new Dictionary<object, object>(newProperties.Count);
}
foreach (var k in newProperties.Keys)
{
if (newProperties[k] == null)
{
if (this.properties.ContainsKey(k))
{
this.properties.Remove(k);
}
}
else
{
this.properties[k] = newProperties[k];
}
}
object temp;
if (this.properties.TryGetValue(ChannelWellKnownProperties.PublishSubscribers, out temp))
{
this.PublishSubscribers = (bool)temp;
}
if (this.properties.TryGetValue(ChannelWellKnownProperties.MaxSubscribers, out temp))
{
this.MaxSubscribers = (int)temp;
}
}
}
internal void AddSubscribers(string[] users)
{
if (users == null)
{
return;
}
for (int i = 0; i < users.Length; i++)
{
this.Subscribers.Add(users[i]);
}
}
internal void ClearProperties()
{
if (this.properties != null && this.properties.Count > 0)
{
this.properties.Clear();
}
}
}
}

11
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatChannel.cs.meta


fileFormatVersion: 2
guid: d84ef73471cfacf4daee3a333fb0039a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

1001
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs
文件差异内容过多而无法显示
查看文件

11
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatClient.cs.meta


fileFormatVersion: 2
guid: 3dc58b7807acc4d488636fa1d4019f2b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

36
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs


// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>Enumeration of causes for Disconnects (used in <see cref="ChatClient.DisconnectedCause"/>).</summary>
/// <remarks>Read the individual descriptions to find out what to do about this type of disconnect.</remarks>
public enum ChatDisconnectCause
{
/// <summary>No error was tracked.</summary>
None,
/// <summary>OnStatusChanged: The CCUs count of your Photon Server License is exhausted (temporarily).</summary>
DisconnectByServerUserLimit,
/// <summary>OnStatusChanged: The server is not available or the address is wrong. Make sure the port is provided and the server is up.</summary>
ExceptionOnConnect,
/// <summary>OnStatusChanged: The server disconnected this client. Most likely the server's send buffer is full (receiving too much from other clients).</summary>
DisconnectByServer,
/// <summary>OnStatusChanged: This client detected that the server's responses are not received in due time. Maybe you send / receive too much?</summary>
TimeoutDisconnect,
/// <summary>OnStatusChanged: Some internal exception caused the socket code to fail. Contact Exit Games.</summary>
Exception,
/// <summary>OnOperationResponse: Authenticate in the Photon Cloud with invalid AppId. Update your subscription or contact Exit Games.</summary>
InvalidAuthentication,
/// <summary>OnOperationResponse: Authenticate (temporarily) failed when using a Photon Cloud subscription without CCU Burst. Update your subscription.</summary>
MaxCcuReached,
/// <summary>OnOperationResponse: Authenticate when the app's Photon Cloud subscription is locked to some (other) region(s). Update your subscription or change region.</summary>
InvalidRegion,
/// <summary>OnOperationResponse: Operation that's (currently) not available for this client (not authorized usually). Only tracked for op Authenticate.</summary>
OperationNotAllowedInCurrentState,
/// <summary>OnOperationResponse: Authenticate in the Photon Cloud with invalid client values or custom authentication setup in Cloud Dashboard.</summary>
CustomAuthenticationFailed,
}
}

11
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatDisconnectCause.cs.meta


fileFormatVersion: 2
guid: cb82ca173d68bbf45bdc93c4c827d4f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

33
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs


// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>
/// Wraps up internally used constants in Photon Chat events. You don't have to use them directly usually.
/// </summary>
public class ChatEventCode
{
/// <summary>(0) Event code for messages published in public channels.</summary>
public const byte ChatMessages = 0;
/// <summary>(1) Not Used. </summary>
public const byte Users = 1;// List of users or List of changes for List of users
/// <summary>(2) Event code for messages published in private channels</summary>
public const byte PrivateMessage = 2;
/// <summary>(3) Not Used. </summary>
public const byte FriendsList = 3;
/// <summary>(4) Event code for status updates. </summary>
public const byte StatusUpdate = 4;
/// <summary>(5) Event code for subscription acks. </summary>
public const byte Subscribe = 5;
/// <summary>(6) Event code for unsubscribe acks. </summary>
public const byte Unsubscribe = 6;
/// <summary>(8) Event code for new user subscription to a channel where <see cref="ChatChannel.PublishSubscribers"/> is enabled. </summary>
public const byte UserSubscribed = 8;
/// <summary>(9) Event code for when user unsubscribes from a channel where <see cref="ChatChannel.PublishSubscribers"/> is enabled. </summary>
public const byte UserUnsubscribed = 9;
}
}

11
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatEventCode.cs.meta


fileFormatVersion: 2
guid: b1fd08cfa8721bf4c8ec428885ae1c39
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

36
Packages/com.unity.multiplayer.transport.photon-realtime/Runtime/Photon/PhotonChat/Code/ChatOperationCode.cs


// ----------------------------------------------------------------------------------------------------------------------
// <summary>The Photon Chat Api enables clients to connect to a chat server and communicate with other clients.</summary>
// <remarks>ChatClient is the main class of this api.</remarks>
// <copyright company="Exit Games GmbH">Photon Chat Api - Copyright (C) 2014 Exit Games GmbH</copyright>
// ----------------------------------------------------------------------------------------------------------------------
namespace Photon.Chat
{
/// <summary>
/// Wraps up codes for operations used internally in Photon Chat. You don't have to use them directly usually.
/// </summary>
public class ChatOperationCode
{
/// <summary>(230) Operation Authenticate.</summary>
public const byte Authenticate = 230;
/// <summary>(0) Operation to subscribe to chat channels.</summary>
public const byte Subscribe = 0;
/// <summary>(1) Operation to unsubscribe from chat channels.</summary>
public const byte Unsubscribe = 1;
/// <summary>(2) Operation to publish a message in a chat channel.</summary>
public const byte Publish = 2;
/// <summary>(3) Operation to send a private message to some other user.</summary>
public const byte SendPrivate = 3;
/// <summary>(4) Not used yet.</summary>
public const byte ChannelHistory = 4;
/// <summary>(5) Set your (client's) status.</summary>
public const byte UpdateStatus = 5;
/// <summary>(6) Add friends the list of friends that should update you of their status.</summary>
public const byte AddFriends = 6;
/// <summary>(7) Remove friends from list of friends that should update you of their status.</summary>
public const byte RemoveFriends = 7;
}
}

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存