Browse Source

Can send list over network

Josh_Dev_branch
Joshua Reason 5 years ago
parent
commit
9eac5192b7
31 changed files with 1042 additions and 37 deletions
  1. +334
    -0
      Assets/Scenes/Networking Test Scenes/ClientLogin.unity
  2. +7
    -0
      Assets/Scenes/Networking Test Scenes/ClientLogin.unity.meta
  3. +196
    -34
      Assets/Scenes/Networking Test Scenes/ClientScene.unity
  4. +1
    -1
      Assets/Scenes/Networking Test Scenes/ClientScene.unity.meta
  5. +8
    -0
      Assets/Scripts/Components.meta
  6. +1
    -0
      Assets/Scripts/Logic/Blocks/CombinedBlock.cs
  7. +18
    -0
      Assets/Scripts/Logic/Blocks/Jump.cs
  8. +57
    -0
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  9. +27
    -0
      Assets/Scripts/Logic/Blocks/Move.cs
  10. +18
    -0
      Assets/Scripts/Logic/Blocks/Rotate.cs
  11. +24
    -0
      Assets/Scripts/NetworkOutput.cs
  12. +11
    -0
      Assets/Scripts/NetworkOutput.cs.meta
  13. +2
    -2
      Assets/Scripts/Networking/Client/ClientLoginManager.cs
  14. +0
    -0
      Assets/Scripts/Networking/Client/ClientLoginManager.cs.meta
  15. +2
    -0
      Assets/Scripts/Networking/Client/ClientObject.cs
  16. +18
    -0
      Assets/Scripts/Networking/Client/ClientOutputManager.cs
  17. +11
    -0
      Assets/Scripts/Networking/Client/ClientOutputManager.cs.meta
  18. +8
    -0
      Assets/Scripts/Networking/Core/BlockTokens.meta
  19. +5
    -0
      Assets/Scripts/Networking/Core/BlockTokens/BlockToken.cs
  20. +11
    -0
      Assets/Scripts/Networking/Core/BlockTokens/BlockToken.cs.meta
  21. +56
    -0
      Assets/Scripts/Networking/Core/Protocols/LogicProtocols.cs
  22. +11
    -0
      Assets/Scripts/Networking/Core/Protocols/LogicProtocols.cs.meta
  23. +20
    -0
      Assets/Scripts/Networking/Core/Protocols/TransportConfigure.cs
  24. +11
    -0
      Assets/Scripts/Networking/Core/Protocols/TransportConfigure.cs.meta
  25. +66
    -0
      Assets/Scripts/Networking/Core/Utility/SerialisationSurrogates.cs
  26. +11
    -0
      Assets/Scripts/Networking/Core/Utility/SerialisationSurrogates.cs.meta
  27. +52
    -0
      Assets/Scripts/Networking/Core/Utility/Utility.cs
  28. +11
    -0
      Assets/Scripts/Networking/Core/Utility/Utility.cs.meta
  29. +32
    -0
      Assets/Scripts/Networking/Server/NetworkedClient.cs
  30. +11
    -0
      Assets/Scripts/Networking/Server/NetworkedClient.cs.meta
  31. +2
    -0
      Assets/Scripts/Networking/Server/ServerObject.cs

+ 334
- 0
Assets/Scenes/Networking Test Scenes/ClientLogin.unity View File

@ -0,0 +1,334 @@
%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: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 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_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !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
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &631914030
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 631914032}
- component: {fileID: 631914031}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &631914031
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 631914030}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
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_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &631914032
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 631914030}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &875866895
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 875866898}
- component: {fileID: 875866897}
- component: {fileID: 875866896}
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 &875866896
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875866895}
m_Enabled: 1
--- !u!20 &875866897
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875866895}
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_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
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 &875866898
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875866895}
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: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1630438942
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1630438944}
- component: {fileID: 1630438943}
- component: {fileID: 1630438945}
m_Layer: 0
m_Name: ClientManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1630438943
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1630438942}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba11049d7524f774eb34622bbf83084b, type: 3}
m_Name:
m_EditorClassIdentifier:
ServerIP: 127.0.0.1
Port: 2222
StartClientOnAwake: 1
DisplayName: Ellie
PlayerColor: {r: 0.8490566, g: 0.03604484, b: 0.41602722, a: 1}
Client: {fileID: 11400000, guid: 8dca4719b56d91143b236583a436c911, type: 2}
--- !u!4 &1630438944
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1630438942}
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: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1630438945
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1630438942}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e6313fcffd0e2049b7d88847b61233d, type: 3}
m_Name:
m_EditorClassIdentifier:
reader:
LogicChain:
- {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2}
- {fileID: 11400000, guid: aa238796cf1886244951ec8c2fed1855, type: 2}
- {fileID: 11400000, guid: 41f4cb946475b2849a802a8297d81e25, type: 2}
- {fileID: 11400000, guid: 48f0ea7af28c10846b5b76ce70d06b60, type: 2}
Client: {fileID: 11400000, guid: 8dca4719b56d91143b236583a436c911, type: 2}

+ 7
- 0
Assets/Scenes/Networking Test Scenes/ClientLogin.unity.meta View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5dfdfd16afd13c746a261404b00a2538
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 196
- 34
Assets/Scenes/Networking Test Scenes/ClientScene.unity View File

@ -112,7 +112,7 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &631914030
--- !u!1 &1254212986
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -120,8 +120,8 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 631914032}
- component: {fileID: 631914031}
- component: {fileID: 1254212988}
- component: {fileID: 1254212987}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
@ -129,13 +129,13 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &631914031
--- !u!108 &1254212987
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 631914030}
m_GameObject: {fileID: 1254212986}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
@ -167,13 +167,13 @@ Light:
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &631914032
--- !u!4 &1254212988
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 631914030}
m_GameObject: {fileID: 1254212986}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
@ -181,7 +181,7 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &875866895
--- !u!1 &1352513146
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -189,9 +189,9 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 875866898}
- component: {fileID: 875866897}
- component: {fileID: 875866896}
- component: {fileID: 1352513149}
- component: {fileID: 1352513148}
- component: {fileID: 1352513147}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -199,25 +199,25 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &875866896
--- !u!81 &1352513147
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875866895}
m_GameObject: {fileID: 1352513146}
m_Enabled: 1
--- !u!20 &875866897
--- !u!20 &1352513148
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875866895}
m_GameObject: {fileID: 1352513146}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_ClearFlags: 2
m_BackGroundColor: {r: 0.011480933, g: 0.7870813, b: 0.8113208, a: 0}
m_projectionMatrixMode: 1
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
@ -249,13 +249,13 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &875866898
--- !u!4 &1352513149
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 875866895}
m_GameObject: {fileID: 1352513146}
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}
@ -263,7 +263,7 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1630438942
--- !u!1 &1902492079
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -271,43 +271,205 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1630438944}
- component: {fileID: 1630438943}
- component: {fileID: 1902492082}
- component: {fileID: 1902492081}
- component: {fileID: 1902492080}
m_Layer: 0
m_Name: ClientManager
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1630438943
--- !u!114 &1902492080
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1630438942}
m_GameObject: {fileID: 1902492079}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba11049d7524f774eb34622bbf83084b, type: 3}
m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
ServerIP: 127.0.0.1
Port: 2222
StartClientOnAwake: 1
DisplayName: Josh
PlayerColor: {r: 0.8490566, g: 0.03604484, b: 0.41602722, a: 1}
--- !u!4 &1630438944
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1902492081
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1902492079}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1902492082
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1630438942}
m_GameObject: {fileID: 1902492079}
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: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &5195354181466942481
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 5195354182462625300, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_Name
value: Player Canvas
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354182462625304, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -0.000038173177
objectReference: {fileID: 0}
- target: {fileID: 5195354181806561359, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354183101525346, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_AspectRatio
value: 8.548341
objectReference: {fileID: 0}
- target: {fileID: 5195354181796512270, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_havePropertiesChanged
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5195354181796512270, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f,
type: 3}
propertyPath: m_isInputParsingRequired
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 3fbc9b76d5c4f7348b60a029bc2ba63f, type: 3}

+ 1
- 1
Assets/Scenes/Networking Test Scenes/ClientScene.unity.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5dfdfd16afd13c746a261404b00a2538
guid: 2d02e595053ac224c991b81f0c856bc4
DefaultImporter:
externalObjects: {}
userData:

+ 8
- 0
Assets/Scripts/Components.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d7394d70ec233849a60a26da5f23b75
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 0
Assets/Scripts/Logic/Blocks/CombinedBlock.cs View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Combined Block")]
[System.Serializable]
public class CombinedBlock : LogicBlock
{
#region Inspector Variables

+ 18
- 0
Assets/Scripts/Logic/Blocks/Jump.cs View File

@ -6,6 +6,7 @@ using UnityEngine;
/// Logic block which deals with jumping a character in a direction
/// </summary>
[CreateAssetMenu(menuName = "Major Project/Jump Block")]
[System.Serializable]
public class Jump : LogicBlock
{
@ -24,5 +25,22 @@ public class Jump : LogicBlock
player.Jump(direction, animationTime);
}
public override void CopyToken(BlockToken token)
{
base.CopyToken(token);
direction = ((DirectionToken)token).direction;
}
public override BlockToken ToToken(BlockToken token = null)
{
if (token == null)
token = new DirectionToken(this);
DirectionToken retVal = (DirectionToken)base.ToToken(token);
retVal.direction = direction;
return retVal;
}
#endregion Class Functions
}

+ 57
- 0
Assets/Scripts/Logic/Blocks/LogicBlock.cs View File

@ -90,5 +90,62 @@ public abstract class LogicBlock : ScriptableObject
return (RepeatCount == RepeatAmount);
}
public virtual void CopyToken(BlockToken token)
{
Color = token.Color;
_DisplayName = token._DisplayName;
WaitUntilFinished = token.WaitUntilFinished;
RepeatAmount = token.RepeatAmount;
name = token.ObjectName;
}
public virtual BlockToken ToToken(BlockToken token = null)
{
if (token == null)
token = new BlockToken(this);
token.Color = Color;
token._DisplayName = _DisplayName;
token.WaitUntilFinished = WaitUntilFinished;
token.RepeatAmount = RepeatAmount;
token.ObjectName = name;
return token;
}
#endregion Class Functions
}
[System.Serializable]
public class BlockToken
{
public System.Type blockType;
public Color Color;
public string _DisplayName;
public string ObjectName;
public bool WaitUntilFinished;
public int RepeatAmount;
public BlockToken(LogicBlock block)
{
blockType = block.GetType();
}
public LogicBlock ToLogicBlock()
{
LogicBlock retVal = (LogicBlock) ScriptableObject.CreateInstance(blockType);
Debug.Log("type: " + retVal.GetType());
retVal.CopyToken(this);
return retVal;
}
}

+ 27
- 0
Assets/Scripts/Logic/Blocks/Move.cs View File

@ -6,6 +6,7 @@ using UnityEngine;
/// Logic block which deals with moving a character in a direction
/// </summary>
[CreateAssetMenu(menuName = "Major Project/Move Block")]
[System.Serializable]
public class Move : LogicBlock
{
@ -23,5 +24,31 @@ public class Move : LogicBlock
player.Move(direction, animationTime);
}
public override void CopyToken(BlockToken token)
{
base.CopyToken(token);
direction = ((DirectionToken)token).direction;
}
public override BlockToken ToToken(BlockToken token = null)
{
if (token == null)
token = new DirectionToken(this);
DirectionToken retVal = (DirectionToken) base.ToToken(token);
retVal.direction = direction;
return retVal;
}
#endregion Class Functions
}
[System.Serializable]
public class DirectionToken : BlockToken
{
public Direction direction;
public DirectionToken(LogicBlock block) : base(block) { }
}

+ 18
- 0
Assets/Scripts/Logic/Blocks/Rotate.cs View File

@ -6,6 +6,7 @@ using UnityEngine;
/// Logic block which deals with moving a character in a direction
/// </summary>
[CreateAssetMenu(menuName = "Major Project/Rotate Block")]
[System.Serializable]
public class Rotate : LogicBlock
{
#region Inspector Fields
@ -27,5 +28,22 @@ public class Rotate : LogicBlock
player.Rotate(direction, animationTime);
}
public override void CopyToken(BlockToken token)
{
base.CopyToken(token);
direction = ((DirectionToken)token).direction;
}
public override BlockToken ToToken(BlockToken token = null)
{
if (token == null)
token = new DirectionToken(this);
DirectionToken retVal = (DirectionToken)base.ToToken(token);
retVal.direction = direction;
return retVal;
}
#endregion Class Functions
}

+ 24
- 0
Assets/Scripts/NetworkOutput.cs View File

@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Client;
using Networking;
public class NetworkOutput : MonoBehaviour
{
public BlockReader reader;
[SerializeField]
protected ClientObject Client;
[ContextMenu("Send list")]
public void SendList()
{
LogicProtocols.LogicMsg msg = new LogicProtocols.LogicMsg(reader.LogicChain.ToArray());
Debug.Log("sending on " + LogicProtocols.SendLogicList);
Client.client.SendByChannel(LogicProtocols.SendLogicList, msg,TransportConfigure.ReliableFragmented);
}
}

+ 11
- 0
Assets/Scripts/NetworkOutput.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e6313fcffd0e2049b7d88847b61233d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Assets/Scripts/Networking/Client/ClientManager.cs → Assets/Scripts/Networking/Client/ClientLoginManager.cs View File

@ -6,7 +6,7 @@ using UnityEngine.Networking;
namespace Networking.Client
{
public class ClientManager : MonoBehaviour
public class ClientLoginManager : MonoBehaviour
{
#region Inspector Fields
@ -80,7 +80,7 @@ namespace Networking.Client
public void LoginRecieved(NetworkMessage msg)
{
Debug.Log("Connected to Server. Sending login details");
Client.client.Send(LoginProtocols.SendingLoginDetails, new LoginProtocols.LoginMsg(DisplayName, Color.white));
Client.client.Send(LoginProtocols.SendingLoginDetails, new LoginProtocols.LoginMsg(DisplayName, PlayerColor));
}
public void LoginSucess(NetworkMessage msg)

Assets/Scripts/Networking/Client/ClientManager.cs.meta → Assets/Scripts/Networking/Client/ClientLoginManager.cs.meta View File


+ 2
- 0
Assets/Scripts/Networking/Client/ClientObject.cs View File

@ -42,6 +42,8 @@ namespace Networking.Client
this.ServerIP = serverAddress;
this.Port = port;
client = new NetworkClient();
client.Configure(TransportConfigure.CreateConfigure(), 1);
client.Connect(serverAddress, port);
}

+ 18
- 0
Assets/Scripts/Networking/Client/ClientOutputManager.cs View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ClientOutputManager : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

+ 11
- 0
Assets/Scripts/Networking/Client/ClientOutputManager.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 171e4e6cdd32c214fb7468088156620a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Scripts/Networking/Core/BlockTokens.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7f1e2358790ed864cad79f5c6d6c4cff
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 5
- 0
Assets/Scripts/Networking/Core/BlockTokens/BlockToken.cs View File

@ -0,0 +1,5 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

+ 11
- 0
Assets/Scripts/Networking/Core/BlockTokens/BlockToken.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5df4c4319407ed247a3eebba71b880a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 56
- 0
Assets/Scripts/Networking/Core/Protocols/LogicProtocols.cs View File

@ -0,0 +1,56 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
namespace Networking
{
public class LogicProtocols
{
public const short SendLogicList = 200;
public class LogicMsg : MessageBase
{
public LogicBlock[] elements;
public LogicMsg() { }
public LogicMsg(LogicBlock[] elements)
{
this.elements = elements;
}
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(elements.Length);
foreach (LogicBlock block in elements)
{
BlockToken token = block.ToToken();
byte[] bytes = Utility.ObjectToByteArray(token);
writer.WriteBytesAndSize(bytes,bytes.Length);
}
}
public override void Deserialize(NetworkReader reader)
{
base.Deserialize(reader);
int count = reader.ReadInt32();
elements = new LogicBlock[count];
for (int i = 0; i < count; i++)
{
BlockToken token = Utility.ByteArrayToObject<BlockToken>(reader.ReadBytesAndSize());
elements[i] = token.ToLogicBlock();
}
}
}
}
}

+ 11
- 0
Assets/Scripts/Networking/Core/Protocols/LogicProtocols.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6543d5a60c6f77849ab9f0ca16f0bd97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 20
- 0
Assets/Scripts/Networking/Core/Protocols/TransportConfigure.cs View File

@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public static class TransportConfigure
{
public static int Reliable = 0;
public static int ReliableFragmented = 1;
public static ConnectionConfig CreateConfigure()
{
ConnectionConfig newConfigure = new ConnectionConfig();
newConfigure.AddChannel(QosType.Reliable);
newConfigure.AddChannel(QosType.ReliableFragmented);
return newConfigure;
}
}

+ 11
- 0
Assets/Scripts/Networking/Core/Protocols/TransportConfigure.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 21f31bbe7baa04b4b9d5162082807122
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 66
- 0
Assets/Scripts/Networking/Core/Utility/SerialisationSurrogates.cs View File

@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using UnityEngine;
namespace Networking {
public class Vector3SerializationSurrogate : ISerializationSurrogate
{
// Method called to serialize a Vector3 object
public void GetObjectData(System.Object obj, SerializationInfo info, StreamingContext context)
{
Vector3 v3 = (Vector3)obj;
info.AddValue("x", v3.x);
info.AddValue("y", v3.y);
info.AddValue("z", v3.z);
}
// Method called to deserialize a Vector3 object
public System.Object SetObjectData(System.Object obj, SerializationInfo info,
StreamingContext context, ISurrogateSelector selector)
{
Vector3 v3 = (Vector3)obj;
v3.x = (float)info.GetValue("x", typeof(float));
v3.y = (float)info.GetValue("y", typeof(float));
v3.z = (float)info.GetValue("z", typeof(float));
obj = v3;
return obj;
}
}
public class ColorSerializationSurrogate : ISerializationSurrogate
{
// Method called to serialize a Vector3 object
public void GetObjectData(System.Object obj, SerializationInfo info, StreamingContext context)
{
Color col = (Color)obj;
info.AddValue("r", col.r);
info.AddValue("g", col.g);
info.AddValue("b", col.b);
info.AddValue("a", col.a);
}
// Method called to deserialize a Vector3 object
public System.Object SetObjectData(System.Object obj, SerializationInfo info,
StreamingContext context, ISurrogateSelector selector)
{
Color col = (Color)obj;
col.r = (float)info.GetValue("r", typeof(float));
col.g = (float)info.GetValue("g", typeof(float));
col.b = (float)info.GetValue("b", typeof(float));
col.a = (float)info.GetValue("a", typeof(float));
obj = col;
return obj;
}
}
}

+ 11
- 0
Assets/Scripts/Networking/Core/Utility/SerialisationSurrogates.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3b536fecd2d51ed4bbfcb65233871411
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 52
- 0
Assets/Scripts/Networking/Core/Utility/Utility.cs View File

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using System.IO;
using UnityEngine;
namespace Networking
{
public static class Utility
{
public static byte[] ObjectToByteArray<T>(T obj)
{
if (obj == null)
return null;
BinaryFormatter bf = new BinaryFormatter();
SurrogateSelector surrogateSelector = new SurrogateSelector();
Vector3SerializationSurrogate vector3SS = new Vector3SerializationSurrogate();
ColorSerializationSurrogate colorSS = new ColorSerializationSurrogate();
surrogateSelector.AddSurrogate(typeof(Vector3), new StreamingContext(StreamingContextStates.All), vector3SS);
surrogateSelector.AddSurrogate(typeof(Color), new StreamingContext(StreamingContextStates.All), colorSS);
bf.SurrogateSelector = surrogateSelector;
MemoryStream ms = new MemoryStream();
bf.Serialize(ms, obj);
return ms.ToArray();
}
public static T ByteArrayToObject<T>(byte[] arrBytes)
{
MemoryStream memStream = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
SurrogateSelector surrogateSelector = new SurrogateSelector();
Vector3SerializationSurrogate vector3SS = new Vector3SerializationSurrogate();
ColorSerializationSurrogate colorSS = new ColorSerializationSurrogate();
surrogateSelector.AddSurrogate(typeof(Vector3), new StreamingContext(StreamingContextStates.All), vector3SS);
surrogateSelector.AddSurrogate(typeof(Color), new StreamingContext(StreamingContextStates.All), colorSS);
bf.SurrogateSelector = surrogateSelector;
memStream.Write(arrBytes, 0, arrBytes.Length);
memStream.Seek(0, SeekOrigin.Begin);
T obj = (T)bf.Deserialize(memStream);
return obj;
}
}
}

+ 11
- 0
Assets/Scripts/Networking/Core/Utility/Utility.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3c7b85d93367d5d4a981f0c01e31be08
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 32
- 0
Assets/Scripts/Networking/Server/NetworkedClient.cs View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Networking.Server;
using Networking;
public class NetworkedClient : MonoBehaviour
{
public ServerObject server;
public BlockReader reader;
// Start is called before the first frame update
void Start()
{
Debug.Log("Registering: " + LogicProtocols.SendLogicList);
server.server.RegisterHandler(LogicProtocols.SendLogicList, RecieveLogicList);
}
public void RecieveLogicList(NetworkMessage msg)
{
LogicProtocols.LogicMsg logicMsg;
if (!msg.TryRead(out logicMsg))
{
Debug.Log("Recieved unknown message");
return;
}
reader.LogicChain = new List<LogicBlock>(logicMsg.elements);
}
}

+ 11
- 0
Assets/Scripts/Networking/Server/NetworkedClient.cs.meta View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 77e0f9f175af31a4ba73a060da4829e5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 0
Assets/Scripts/Networking/Server/ServerObject.cs View File

@ -32,6 +32,8 @@ namespace Networking.Server {
Debug.Log("Starting Server on " + port);
server = new NetworkServerSimple();
server.Configure(TransportConfigure.CreateConfigure(),32);
LoginHandler.SetUp(this);
server.Listen(port);
}

Loading…
Cancel
Save