Compare commits

...

8 Commits

Author SHA1 Message Date
0b14b754b4 feat: beginning to implement an online lobby in the main menu with fishnet 2024-05-05 17:54:15 +02:00
94863a7eb5 feat: free fly arena, 4-player support, 4-player arena, test-scene option etc.
There is also overhauled camera zoom behavior, an update to the match logic,
tweaks to the main menu scene.
2024-05-05 17:53:56 +02:00
9a9a9c8b21 feat: music which has the same tag(different id) can now be randomly played, new tracks
You can say play a "menu_music" and a random track tagged as such will be played.
2024-05-05 17:50:04 +02:00
5278d5ba81 feat: ship particle effects, base properties, gravity fix
All ships now have their own properties, which are modifiers for the base ship properties.
The base behaviour of all ships can now be easily changed, while the individual differences are still respected.

Ship states now trigger particle emissions & effects. This is still messy and mixed with
sounds. Will be overhauled once ship state machine is introduced.

To calculate gravity you now need to specify the gravity source transform.
2024-05-05 17:48:27 +02:00
17aa5593ff feat: added some effects and particles (used in future commits) 2024-05-05 17:40:07 +02:00
418bf1ed5a feat: added colored variants for nimble zones and ships 2024-05-05 17:37:19 +02:00
dbc66e25f0 chore: added only the used resources from the Sci-Fi Forge3D asset pack 2024-05-05 17:36:07 +02:00
b13e3f617e dependency: added bayou transport layer for WebGL + WSS + FishNet 2024-05-05 17:34:06 +02:00
289 changed files with 65884 additions and 2066 deletions

5
.gitignore vendored
View File

@ -75,4 +75,7 @@ crashlytics-build.properties
/[Aa]ssets/[Ss]treamingAssets/aa/*
# Logging files
*.log
*.log
# Local only Asset Store Libraries & Assets
/[Aa]ssets/FORGE3D/*

View File

@ -1,23 +0,0 @@
fileFormatVersion: 2
guid: f03afcd094e19824e8549f6fec3655ef
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 1
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 1
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,23 +0,0 @@
fileFormatVersion: 2
guid: 82a8d17c2698c834f96370756847edec
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,7 +13,10 @@ MonoBehaviour:
m_Name: DefaultPrefabObjects
m_EditorClassIdentifier:
_prefabs:
- {fileID: 6527384552577148640, guid: 7b71eecaf6568a847b4b8415852f9e98, type: 3}
- {fileID: 4320456058255827552, guid: 65cd4fa5e050652409dd9b062365c7e8, type: 3}
- {fileID: 394654179909484550, guid: 9f3e27e33167d704e941e42ded557111, type: 3}
- {fileID: 394654179909484550, guid: 5934082513feac04a9b875fc86abe70b, type: 3}
- {fileID: 394654179909484550, guid: 46f84e56340e83e4ba7c6abbccd2ae3f, type: 3}
- {fileID: 8475222101369129519, guid: 8cf33e8e99a9b0c4c8f29ff725650de6, type: 3}
- {fileID: 4512293259955182956, guid: 44611030e61220d42ab7c37ba3c0ea92, type: 3}

8
Assets/FORGE3D Used.meta Normal file
View File

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

View File

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

View File

@ -0,0 +1,62 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AlphaBlended
m_Shader: {fileID: -6465566751694194690, guid: 260ae9255e2be314db6940dc91f14e14, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _InvFade: 1
- _QueueControl: 0
- _QueueOffset: 0
m_Colors:
- _Tint: {r: 1, g: 1, b: 1, a: 0}
m_BuildTextureStacks: []
--- !u!114 &9115209113183043710
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c37b82231dc2354449d5e519288c0dc6
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Burnout_Sparks Variant Variant 1
m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: b1d335d56173047478e1e2fb0befa6c8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 518433888a50b744d9d546e70a1cab7c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaToMask: 0
- _Blend: 2
- _BlendOp: 0
- _Blur: 0
- _Boost: 40
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 1
- _DstBlendAlpha: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _InvFade: 1
- _Mode: 0
- _QueueControl: 0
- _QueueOffset: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _ZWrite: 0
- __dirty: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0.044633865, g: 0, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
--- !u!114 &9082613411184629246
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fe83d05d69617814086e819658b0b51c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-8311007885409726925
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Burnout_Sparks Variant Variant 2
m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: b1d335d56173047478e1e2fb0befa6c8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 518433888a50b744d9d546e70a1cab7c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaToMask: 0
- _Blend: 2
- _BlendOp: 0
- _Blur: 0
- _Boost: 40
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 1
- _DstBlendAlpha: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _InvFade: 1
- _Mode: 0
- _QueueControl: 0
- _QueueOffset: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _ZWrite: 0
- __dirty: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0, g: 1, b: 0.0132677555, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 56bd430e327f9994f94434682ee83507
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2441641132022083329
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Burnout_Sparks Variant Variant
m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: b1d335d56173047478e1e2fb0befa6c8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 518433888a50b744d9d546e70a1cab7c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaToMask: 0
- _Blend: 2
- _BlendOp: 0
- _Blur: 0
- _Boost: 40
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 1
- _DstBlendAlpha: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _InvFade: 1
- _Mode: 0
- _QueueControl: 0
- _QueueOffset: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _ZWrite: 0
- __dirty: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 0.08578741, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 41bd73f1999ec5f42a8e9dfac74c19b2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-8063491270301326632
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Burnout_Sparks Variant
m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: b1d335d56173047478e1e2fb0befa6c8, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 518433888a50b744d9d546e70a1cab7c, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaToMask: 0
- _Blend: 2
- _BlendOp: 0
- _Blur: 0
- _Boost: 40
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 1
- _DstBlendAlpha: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _InvFade: 1
- _Mode: 0
- _QueueControl: 0
- _QueueOffset: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _ZWrite: 0
- __dirty: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 0, g: 0.09206629, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a06b4ab16b9366a4ba94a4e85c199062
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,174 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: StarsParticle
m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 1
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
MotionVector: User
disabledShaderPasses:
- MOTIONVECTORS
- DistortionVectors
- TransparentBackface
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 10300, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 89c28e62ca4add74bb5389550e4e0e00, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaCutoff: 0.5
- _AlphaCutoffEnable: 0
- _AlphaDstBlend: 1
- _AlphaSrcBlend: 1
- _BUILTIN_QueueControl: -1
- _BUILTIN_QueueOffset: 0
- _BlendMode: 1
- _Blur: -1
- _Boost: 4
- _BumpScale: 1
- _CullMode: 0
- _CullModeForward: 0
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DistortionEnable: 0
- _DistortionOnly: 0
- _DoubleSidedEnable: 1
- _DoubleSidedNormalMode: 2
- _DstBlend: 1
- _EnableFogOnTransparent: 1
- _Glossiness: 0.5
- _InvFade: 7.7
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _QueueControl: 0
- _QueueOffset: 0
- _ReceivesSSR: 0
- _RenderQueueType: 3
- _RequireSplitLighting: 0
- _SrcBlend: 1
- _StencilRef: 0
- _StencilRefDepth: 0
- _StencilRefDistortionVec: 4
- _StencilRefGBuffer: 2
- _StencilRefMV: 32
- _StencilWriteMask: 6
- _StencilWriteMaskDepth: 8
- _StencilWriteMaskDistortionVec: 4
- _StencilWriteMaskGBuffer: 14
- _StencilWriteMaskMV: 40
- _SurfaceType: 1
- _TransparentBackfaceEnable: 0
- _TransparentCullMode: 2
- _TransparentSortPriority: 0
- _TransparentZWrite: 0
- _UVSec: 0
- _UseShadowThreshold: 0
- _ZTestDepthEqualForOpaque: 4
- _ZTestGBuffer: 4
- _ZTestTransparent: 4
- _ZWrite: 0
- __dirty: 1
m_Colors:
- _Color: {r: 128, g: 128, b: 128, a: 1}
- _DoubleSidedConstants: {r: 1, g: 1, b: -1, a: 0}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _Offset: {r: 0, g: 0, b: 0, a: 0}
- _TintColor: {r: 0.16509432, g: 0.7607762, b: 1, a: 1}
m_BuildTextureStacks: []
--- !u!114 &6049781673269309302
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!114 &7916794814497724445
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b40f8f471dd6b5345a9168d18519e5de
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,133 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: debris_rock
m_Shader: {fileID: -6465566751694194690, guid: b70c29244fb72de4ebed187b5a64fca3, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _Color:
m_Texture: {fileID: 2800000, guid: 7baf91a2448a6914f9ba6366e83a8dc7, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Cubemap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Diffuse:
m_Texture: {fileID: 2800000, guid: 9773c70c5ece04f4b92f15d8e16176ca, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Glow:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 9e69f8e597471ca4195f2e5c72dccde2, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Normal:
m_Texture: {fileID: 2800000, guid: a442689afcc781e418c6dde75d8d7587, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Specular:
m_Texture: {fileID: 2800000, guid: 9773c70c5ece04f4b92f15d8e16176ca, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaCutoff: 0.5
- _BUILTIN_QueueControl: -1
- _BUILTIN_QueueOffset: 0
- _DecalMeshBiasType: 0
- _DecalMeshDepthBias: 0
- _DecalMeshViewBias: 0
- _DiffusePower: 2.4
- _DrawOrder: 0
- _FadeInMax: 10
- _FadeInMin: 1
- _FadeOutMax: 209.5
- _FadeOutMin: 12.28
- _FresnelMult: 0
- _FresnelPower: 1
- _GlowMult: 0
- _Metallic: 0.34
- _QueueControl: 1
- _QueueOffset: 0
- _ReflectionDesaturation: 0
- _ReflectionMult: 0
- _Smoothness: 0.267
- _SpecularA: 1147.72
- _SpecularAdd: 0.05
- _SpecularB: 985.1
- _SpecularMult: 0.06
- _SpecularRatio: 1.46
- __dirty: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color0: {r: 0, g: 0, b: 0, a: 0.016}
- _EmissionColor: {r: 1, g: 1, b: 1, a: 1}
- _FadeInAInBOutAOutB: {r: 1, g: 5, b: 15, a: 33}
- _InMinMaxOutMinMax: {r: 0, g: 5, b: 10, a: 20}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
- _TintRGBAmbientAMult: {r: 0, g: 0, b: 0, a: 0.016}
m_BuildTextureStacks: []
--- !u!114 &2407665231708259802
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 639247ca83abc874e893eb93af2b5e44, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 0
--- !u!114 &4684057110457763703
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b1e0dde045606b7458fc03978b6cf2e9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,125 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-582723601951237333
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: missile_smoke
m_Shader: {fileID: -6465566751694194690, guid: 260ae9255e2be314db6940dc91f14e14, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 1
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: b2cd70fc62da17a498dcfacfd5995b4e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 97a20a23273818d4996922e87e5a2daa, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Mask:
m_Texture: {fileID: 2800000, guid: 9fe49ff3a52806546b7c66638424f1f7, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Noise:
m_Texture: {fileID: 2800000, guid: 28c7aad1372ff114b90d330f8a2dd938, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaToMask: 0
- _Blend: 0
- _BlendOp: 0
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DepthBlend: 0.9642857
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 10
- _DstBlendAlpha: 10
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _InvFade: 1
- _MaskNoiseFactor: 0.053571433
- _Mode: 0
- _NoiseFactor: 0.26785725
- _QueueControl: 1
- _QueueOffset: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _UPan: 0.1
- _VPan: 0.1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
- _TintColor: {r: 0.99999994, g: 0.99999994, b: 0.99999994, a: 0.039215688}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9e5e82acbb1f3184b9c3acd9354008b2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,115 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2748750175331395739
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 7
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: pulsewave_001
m_Shader: {fileID: -6465566751694194690, guid: 89754397a45ebd242a4116119466e163, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: b8f24beb6a134094c99661354f9f9708, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 3b854a490aee560478e88ad7537338a6, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _texcoord:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _AlphaCutoff: 0.5
- _AlphaToMask: 0
- _Blend: 2
- _BlendOp: 0
- _Blur: 1
- _Boost: 2
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ColorMode: 0
- _Cull: 0
- _Cutoff: 0.5
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 1
- _DstBlendAlpha: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _InvFade: 5
- _Mode: 0
- _QueueControl: 0
- _QueueOffset: 0
- _SoftParticlesEnabled: 1
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _ZWrite: 0
- __dirty: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Offset: {r: 1, g: 1, b: 0, a: 0}
- _SoftParticleFadeParams: {r: 0, g: 1, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8802f155c56fb8a4eba9725249b1524d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

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

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 090ee27ee4081804c99eebf810a1d8f7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 4300000
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,65 @@
fileFormatVersion: 2
guid: 729b49d379cab7b41b39fedf012bcff9
ModelImporter:
serializedVersion: 16
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Pulsewave
9500000: //RootNode
materials:
importMaterials: 0
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
optimizeGameObjects: 0
motionNodeName:
animationCompression: 1
animationRotationError: .5
animationPositionError: .5
animationScaleError: .5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: .100000001
meshCompression: 0
addColliders: 0
importBlendShapes: 0
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
tangentSpace:
normalSmoothAngle: 60
splitTangentsAcrossUV: 1
normalImportMode: 0
tangentImportMode: 1
importAnimation: 1
copyAvatar: 0
humanDescription:
human: []
skeleton: []
armTwist: .5
foreArmTwist: .5
upperLegTwist: .5
legTwist: .5
armStretch: .0500000007
legStretch: .0500000007
feetSpacing: 0
rootMotionBoneName:
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
additionalBone: 0
userData:

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 89754397a45ebd242a4116119466e163
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 260ae9255e2be314db6940dc91f14e14
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: b70c29244fb72de4ebed187b5a64fca3
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@ -0,0 +1,902 @@
{
"m_SGVersion": 3,
"m_Type": "UnityEditor.ShaderGraph.GraphData",
"m_ObjectId": "179f4bbd80db4e3496a4bbab24d5c5e1",
"m_Properties": [
{
"m_Id": "dd3ee19c50534bf99c808745e21663cc"
}
],
"m_Keywords": [],
"m_Dropdowns": [],
"m_CategoryData": [
{
"m_Id": "66d378211f3a4b6d83fc0e8edc894b99"
}
],
"m_Nodes": [
{
"m_Id": "0d6040eaa3864ef19a9ff7a3b7e336cf"
},
{
"m_Id": "0c3c4a18305c46968128a6cdbb615fef"
},
{
"m_Id": "303f5fdf649444cfbb0cbdcd7ba36e89"
},
{
"m_Id": "d1d85b7cf57842cd876ebc35fcc623dc"
},
{
"m_Id": "e71cc77fc7b84190a2740c580710c5a7"
},
{
"m_Id": "cc11f2781b6248218bc4bd217f0dc6e4"
},
{
"m_Id": "1258aab5c616455f8b85b74934e7b2ce"
},
{
"m_Id": "9c8d848e8d25423a9a33bced121d4cda"
}
],
"m_GroupDatas": [],
"m_StickyNoteDatas": [],
"m_Edges": [
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "0c3c4a18305c46968128a6cdbb615fef"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "e71cc77fc7b84190a2740c580710c5a7"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "1258aab5c616455f8b85b74934e7b2ce"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "cc11f2781b6248218bc4bd217f0dc6e4"
},
"m_SlotId": 1
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "303f5fdf649444cfbb0cbdcd7ba36e89"
},
"m_SlotId": 0
},
"m_InputSlot": {
"m_Node": {
"m_Id": "d1d85b7cf57842cd876ebc35fcc623dc"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "9c8d848e8d25423a9a33bced121d4cda"
},
"m_SlotId": 1
},
"m_InputSlot": {
"m_Node": {
"m_Id": "0d6040eaa3864ef19a9ff7a3b7e336cf"
},
"m_SlotId": 1
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "cc11f2781b6248218bc4bd217f0dc6e4"
},
"m_SlotId": 2
},
"m_InputSlot": {
"m_Node": {
"m_Id": "9c8d848e8d25423a9a33bced121d4cda"
},
"m_SlotId": 0
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "d1d85b7cf57842cd876ebc35fcc623dc"
},
"m_SlotId": 4
},
"m_InputSlot": {
"m_Node": {
"m_Id": "e71cc77fc7b84190a2740c580710c5a7"
},
"m_SlotId": 1
}
},
{
"m_OutputSlot": {
"m_Node": {
"m_Id": "e71cc77fc7b84190a2740c580710c5a7"
},
"m_SlotId": 2
},
"m_InputSlot": {
"m_Node": {
"m_Id": "cc11f2781b6248218bc4bd217f0dc6e4"
},
"m_SlotId": 0
}
}
],
"m_VertexContext": {
"m_Position": {
"x": 0.0,
"y": 0.0
},
"m_Blocks": []
},
"m_FragmentContext": {
"m_Position": {
"x": 0.0,
"y": 0.0
},
"m_Blocks": []
},
"m_PreviewData": {
"serializedMesh": {
"m_SerializedMesh": "{\"mesh\":{\"instanceID\":0}}",
"m_Guid": ""
},
"preventRotation": false
},
"m_Path": "Sub Graphs",
"m_GraphPrecision": 1,
"m_PreviewMode": 2,
"m_OutputNode": {
"m_Id": "0d6040eaa3864ef19a9ff7a3b7e336cf"
},
"m_SubDatas": [],
"m_ActiveTargets": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "0a7ceb9d445d412fbd013648aa1c2b3a",
"m_Id": 0,
"m_DisplayName": "Distance",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SceneDepthNode",
"m_ObjectId": "0c3c4a18305c46968128a6cdbb615fef",
"m_Group": {
"m_Id": ""
},
"m_Name": "Scene Depth",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -494.0,
"y": -144.0,
"width": 145.0,
"height": 112.0
}
},
"m_Slots": [
{
"m_Id": "49b6458a231e4fea96fd4e76d96f8cd0"
},
{
"m_Id": "409c0f29ce924dc0a68c9554f2de3363"
}
],
"synonyms": [
"zbuffer",
"zdepth"
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_DepthSamplingMode": 2
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubGraphOutputNode",
"m_ObjectId": "0d6040eaa3864ef19a9ff7a3b7e336cf",
"m_Group": {
"m_Id": ""
},
"m_Name": "Output",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 209.0,
"y": -144.0,
"width": 121.0,
"height": 77.0
}
},
"m_Slots": [
{
"m_Id": "1970364794994ad9ae9caff414c3e6e8"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"IsFirstSlotValid": true
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.PropertyNode",
"m_ObjectId": "1258aab5c616455f8b85b74934e7b2ce",
"m_Group": {
"m_Id": ""
},
"m_Name": "Property",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -270.0,
"y": -8.0,
"width": 121.0,
"height": 34.0
}
},
"m_Slots": [
{
"m_Id": "0a7ceb9d445d412fbd013648aa1c2b3a"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_Property": {
"m_Id": "dd3ee19c50534bf99c808745e21663cc"
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "1970364794994ad9ae9caff414c3e6e8",
"m_Id": 1,
"m_DisplayName": "Out_Aplha",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "Out_Aplha",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ScreenPositionNode",
"m_ObjectId": "303f5fdf649444cfbb0cbdcd7ba36e89",
"m_Group": {
"m_Id": ""
},
"m_Name": "Screen Position",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -726.0,
"y": 88.0,
"width": 0.0,
"height": 0.0
}
},
"m_Slots": [
{
"m_Id": "e9a4822733034a86a2a1037854180b45"
}
],
"synonyms": [],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
},
"m_ScreenSpaceType": 1
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "409c0f29ce924dc0a68c9554f2de3363",
"m_Id": 1,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 2,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.ScreenPositionMaterialSlot",
"m_ObjectId": "49b6458a231e4fea96fd4e76d96f8cd0",
"m_Id": 0,
"m_DisplayName": "UV",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "UV",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": [],
"m_ScreenSpaceType": 0
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "5440ec4712a54159be981f7194880bd5",
"m_Id": 2,
"m_DisplayName": "G",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "G",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "5b607265c1c142e886b4b3692fe20dae",
"m_Id": 1,
"m_DisplayName": "R",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "R",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.CategoryData",
"m_ObjectId": "66d378211f3a4b6d83fc0e8edc894b99",
"m_Name": "",
"m_ChildObjectList": [
{
"m_Id": "dd3ee19c50534bf99c808745e21663cc"
}
]
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "7d0963a4d728453ea0900213b59af569",
"m_Id": 0,
"m_DisplayName": "In",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "In",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "7febf57f1c2942789f1c11fd1b359853",
"m_Id": 0,
"m_DisplayName": "In",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "In",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "81449abad26a43fb942badbac3dfb65f",
"m_Id": 0,
"m_DisplayName": "A",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "8a027999f73344da9dc463d26254d29a",
"m_Id": 1,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "8fd443316c344fe6a51e951921761daa",
"m_Id": 1,
"m_DisplayName": "B",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 3,
"m_Value": {
"x": 1.0,
"y": 1.0,
"z": 1.0,
"w": 1.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "944bc1d71e3d4e18b8a59a0c50b66799",
"m_Id": 3,
"m_DisplayName": "B",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SaturateNode",
"m_ObjectId": "9c8d848e8d25423a9a33bced121d4cda",
"m_Group": {
"m_Id": ""
},
"m_Name": "Saturate",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": 52.0,
"y": -144.0,
"width": 128.0,
"height": 94.0
}
},
"m_Slots": [
{
"m_Id": "7febf57f1c2942789f1c11fd1b359853"
},
{
"m_Id": "8a027999f73344da9dc463d26254d29a"
}
],
"synonyms": [
"clamp"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "b0321c4b22fc40d69b14449021890c23",
"m_Id": 1,
"m_DisplayName": "B",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "B",
"m_StageCapability": 3,
"m_Value": {
"x": 2.0,
"y": 2.0,
"z": 2.0,
"w": 2.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector1MaterialSlot",
"m_ObjectId": "b6472f9d1913420da8c0b9237e80e1be",
"m_Id": 4,
"m_DisplayName": "A",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 3,
"m_Value": 0.0,
"m_DefaultValue": 0.0,
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DivideNode",
"m_ObjectId": "cc11f2781b6248218bc4bd217f0dc6e4",
"m_Group": {
"m_Id": ""
},
"m_Name": "Divide",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -109.0,
"y": -144.0,
"width": 126.0,
"height": 118.0
}
},
"m_Slots": [
{
"m_Id": "81449abad26a43fb942badbac3dfb65f"
},
{
"m_Id": "b0321c4b22fc40d69b14449021890c23"
},
{
"m_Id": "f31d2ef6bb424b95be8f664682c00db0"
}
],
"synonyms": [
"division",
"divided by"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SplitNode",
"m_ObjectId": "d1d85b7cf57842cd876ebc35fcc623dc",
"m_Group": {
"m_Id": ""
},
"m_Name": "Split",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -469.0,
"y": 88.0,
"width": 120.0,
"height": 149.0
}
},
"m_Slots": [
{
"m_Id": "7d0963a4d728453ea0900213b59af569"
},
{
"m_Id": "5b607265c1c142e886b4b3692fe20dae"
},
{
"m_Id": "5440ec4712a54159be981f7194880bd5"
},
{
"m_Id": "944bc1d71e3d4e18b8a59a0c50b66799"
},
{
"m_Id": "b6472f9d1913420da8c0b9237e80e1be"
}
],
"synonyms": [
"separate"
],
"m_Precision": 0,
"m_PreviewExpanded": true,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 1,
"m_Type": "UnityEditor.ShaderGraph.Internal.Vector1ShaderProperty",
"m_ObjectId": "dd3ee19c50534bf99c808745e21663cc",
"m_Guid": {
"m_GuidSerialized": "ce6cd1e2-1bb1-4b58-aae5-f5ed5797f7f8"
},
"m_Name": "Distance",
"m_DefaultRefNameVersion": 1,
"m_RefNameGeneratedByDisplayName": "Distance",
"m_DefaultReferenceName": "_Distance",
"m_OverrideReferenceName": "",
"m_GeneratePropertyBlock": true,
"m_UseCustomSlotLabel": false,
"m_CustomSlotLabel": "",
"m_DismissedVersion": 0,
"m_Precision": 0,
"overrideHLSLDeclaration": false,
"hlslDeclarationOverride": 0,
"m_Hidden": false,
"m_Value": 0.0,
"m_FloatType": 0,
"m_RangeValues": {
"x": 0.0,
"y": 1.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "e0a1606f54cf49839c642ec9d01e6cd0",
"m_Id": 2,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.SubtractNode",
"m_ObjectId": "e71cc77fc7b84190a2740c580710c5a7",
"m_Group": {
"m_Id": ""
},
"m_Name": "Subtract",
"m_DrawState": {
"m_Expanded": true,
"m_Position": {
"serializedVersion": "2",
"x": -275.0,
"y": -144.0,
"width": 208.0,
"height": 302.0
}
},
"m_Slots": [
{
"m_Id": "f528f9dc8ffe440e92febba8ab75fea6"
},
{
"m_Id": "8fd443316c344fe6a51e951921761daa"
},
{
"m_Id": "e0a1606f54cf49839c642ec9d01e6cd0"
}
],
"synonyms": [
"subtraction",
"remove",
"minus",
"take away"
],
"m_Precision": 0,
"m_PreviewExpanded": false,
"m_DismissedVersion": 0,
"m_PreviewMode": 0,
"m_CustomColors": {
"m_SerializableColors": []
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.Vector4MaterialSlot",
"m_ObjectId": "e9a4822733034a86a2a1037854180b45",
"m_Id": 0,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_Labels": []
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "f31d2ef6bb424b95be8f664682c00db0",
"m_Id": 2,
"m_DisplayName": "Out",
"m_SlotType": 1,
"m_Hidden": false,
"m_ShaderOutputName": "Out",
"m_StageCapability": 3,
"m_Value": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}
{
"m_SGVersion": 0,
"m_Type": "UnityEditor.ShaderGraph.DynamicVectorMaterialSlot",
"m_ObjectId": "f528f9dc8ffe440e92febba8ab75fea6",
"m_Id": 0,
"m_DisplayName": "A",
"m_SlotType": 0,
"m_Hidden": false,
"m_ShaderOutputName": "A",
"m_StageCapability": 3,
"m_Value": {
"x": 1.0,
"y": 1.0,
"z": 1.0,
"w": 1.0
},
"m_DefaultValue": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"w": 0.0
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 39ec9fbece3e2d641952155174cf07c9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e9f137529120abe428adc9c9cd641383
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 60072b568d64c40a485e0fc55012dc9f, type: 3}

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 MiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 7baf91a2448a6914f9ba6366e83a8dc7
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 16
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 MiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: a442689afcc781e418c6dde75d8d7587
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 0
linearTexture: 1
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 16
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 1
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 KiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: b8f24beb6a134094c99661354f9f9708
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 16
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 97a20a23273818d4996922e87e5a2daa
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 256
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 16
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 256
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 256
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: b1d335d56173047478e1e2fb0befa6c8
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 128
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 16
mipBias: -100
wrapU: -1
wrapV: -1
wrapW: -1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 1
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 2
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

8
Assets/FORGE3D.meta Normal file
View File

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

View File

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

View File

@ -0,0 +1,17 @@
{
"name": "Bayou",
"rootNamespace": "",
"references": [
"GUID:3b5390adca4e2bb4791cb930316d6f3e",
"GUID:7c88a4a7926ee5145ad2dfa06f454c67"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7bf834368d865d943b0569a8ab0aa1f7
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,460 @@
using FishNet.Managing;
using FishNet.Managing.Logging;
using FishNet.Managing.Transporting;
using JamesFrowen.SimpleWeb;
using System;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace FishNet.Transporting.Bayou
{
[DisallowMultipleComponent]
public class Bayou : Transport
{
#region Serialized.
[Header("Security")]
/// <summary>
/// True to connect using WSS.
/// </summary>
[Tooltip("True to connect using WSS.")]
[SerializeField]
private bool _useWss = false;
#if UNITY_SERVER || UNITY_EDITOR
/// <summary>
/// Configuration to use for SSL.
/// </summary>
[Tooltip("Configuration to use for SSL.")]
[SerializeField]
private SslConfiguration _sslConfiguration;
#endif
[Header("Channels")]
/// <summary>
/// Maximum transmission unit for this transport.
/// </summary>
[Tooltip("Maximum transmission unit for the unreliable channel.")]
[Range(MINIMUM_MTU, MAXIMUM_MTU)]
[SerializeField]
private int _mtu = 1023;
[Header("Server")]
/// <summary>
/// Port to use.
/// </summary>
[Tooltip("Port to use.")]
[SerializeField]
private ushort _port = 7770;
/// <summary>
/// Maximum number of players which may be connected at once.
/// </summary>
[Tooltip("Maximum number of players which may be connected at once.")]
[Range(1, 9999)]
[SerializeField]
private int _maximumClients = 2000;
[Header("Client")]
/// <summary>
/// Address to connect.
/// </summary>
[Tooltip("Address to connect.")]
[SerializeField]
private string _clientAddress = "localhost";
#endregion
#region Private.
/// <summary>
/// Server socket and handler.
/// </summary>
private Server.ServerSocket _server = new Server.ServerSocket();
/// <summary>
/// Client socket and handler.
/// </summary>
private Client.ClientSocket _client = new Client.ClientSocket();
#endregion
#region Const.
/// <summary>
/// Minimum UDP packet size allowed.
/// </summary>
private const int MINIMUM_MTU = 576;
/// <summary>
/// Maximum UDP packet size allowed.
/// </summary>
private const int MAXIMUM_MTU = ushort.MaxValue;
#endregion
#region Initialization and unity.
protected void OnDestroy()
{
Shutdown();
}
#endregion
#region ConnectionStates.
/// <summary>
/// Gets the address of a remote connection Id.
/// </summary>
/// <param name="connectionId"></param>
/// <returns></returns>
public override string GetConnectionAddress(int connectionId)
{
return _server.GetConnectionAddress(connectionId);
}
/// <summary>
/// Called when a connection state changes for the local client.
/// </summary>
public override event Action<ClientConnectionStateArgs> OnClientConnectionState;
/// <summary>
/// Called when a connection state changes for the local server.
/// </summary>
public override event Action<ServerConnectionStateArgs> OnServerConnectionState;
/// <summary>
/// Called when a connection state changes for a remote client.
/// </summary>
public override event Action<RemoteConnectionStateArgs> OnRemoteConnectionState;
/// <summary>
/// Gets the current local ConnectionState.
/// </summary>
/// <param name="server">True if getting ConnectionState for the server.</param>
public override LocalConnectionState GetConnectionState(bool server)
{
if (server)
return _server.GetConnectionState();
else
return _client.GetConnectionState();
}
/// <summary>
/// Gets the current ConnectionState of a remote client on the server.
/// </summary>
/// <param name="connectionId">ConnectionId to get ConnectionState for.</param>
public override RemoteConnectionState GetConnectionState(int connectionId)
{
return _server.GetConnectionState(connectionId);
}
/// <summary>
/// Handles a ConnectionStateArgs for the local client.
/// </summary>
/// <param name="connectionStateArgs"></param>
public override void HandleClientConnectionState(ClientConnectionStateArgs connectionStateArgs)
{
OnClientConnectionState?.Invoke(connectionStateArgs);
}
/// <summary>
/// Handles a ConnectionStateArgs for the local server.
/// </summary>
/// <param name="connectionStateArgs"></param>
public override void HandleServerConnectionState(ServerConnectionStateArgs connectionStateArgs)
{
OnServerConnectionState?.Invoke(connectionStateArgs);
}
/// <summary>
/// Handles a ConnectionStateArgs for a remote client.
/// </summary>
/// <param name="connectionStateArgs"></param>
public override void HandleRemoteConnectionState(RemoteConnectionStateArgs connectionStateArgs)
{
OnRemoteConnectionState?.Invoke(connectionStateArgs);
}
#endregion
#region Iterating.
/// <summary>
/// Processes data received by the socket.
/// </summary>
/// <param name="server">True to process data received on the server.</param>
public override void IterateIncoming(bool server)
{
if (server)
_server.IterateIncoming();
else
_client.IterateIncoming();
}
/// <summary>
/// Processes data to be sent by the socket.
/// </summary>
/// <param name="server">True to process data received on the server.</param>
public override void IterateOutgoing(bool server)
{
if (server)
_server.IterateOutgoing();
else
_client.IterateOutgoing();
}
#endregion
#region ReceivedData.
/// <summary>
/// Called when client receives data.
/// </summary>
public override event Action<ClientReceivedDataArgs> OnClientReceivedData;
/// <summary>
/// Handles a ClientReceivedDataArgs.
/// </summary>
/// <param name="receivedDataArgs"></param>
public override void HandleClientReceivedDataArgs(ClientReceivedDataArgs receivedDataArgs)
{
OnClientReceivedData?.Invoke(receivedDataArgs);
}
/// <summary>
/// Called when server receives data.
/// </summary>
public override event Action<ServerReceivedDataArgs> OnServerReceivedData;
/// <summary>
/// Handles a ClientReceivedDataArgs.
/// </summary>
/// <param name="receivedDataArgs"></param>
public override void HandleServerReceivedDataArgs(ServerReceivedDataArgs receivedDataArgs)
{
OnServerReceivedData?.Invoke(receivedDataArgs);
}
#endregion
#region Sending.
/// <summary>
/// Sends to the server or all clients.
/// </summary>
/// <param name="channelId">Channel to use.</param>
/// <param name="segment">Data to send.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void SendToServer(byte channelId, ArraySegment<byte> segment)
{
SanitizeChannel(ref channelId);
_client.SendToServer(channelId, segment);
}
/// <summary>
/// Sends data to a client.
/// </summary>
/// <param name="channelId"></param>
/// <param name="segment"></param>
/// <param name="connectionId"></param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void SendToClient(byte channelId, ArraySegment<byte> segment, int connectionId)
{
SanitizeChannel(ref channelId);
_server.SendToClient(channelId, segment, connectionId);
}
#endregion
#region Configuration.
/// <summary>
/// Sets UseWSS value.
/// </summary>
/// <param name="useWss"></param>
public void SetUseWSS(bool useWss)
{
_useWss = useWss;
}
/// <summary>
/// How long in seconds until either the server or client socket must go without data before being timed out.
/// </summary>
/// <param name="asServer">True to get the timeout for the server socket, false for the client socket.</param>
/// <returns></returns>
public override float GetTimeout(bool asServer)
{
return -1f;
}
/// <summary>
/// Returns the maximum number of clients allowed to connect to the server. If the transport does not support this method the value -1 is returned.
/// </summary>
/// <returns></returns>
public override int GetMaximumClients()
{
return _server.GetMaximumClients();
}
/// <summary>
/// Sets maximum number of clients allowed to connect to the server. If applied at runtime and clients exceed this value existing clients will stay connected but new clients may not connect.
/// </summary>
/// <param name="value"></param>
public override void SetMaximumClients(int value)
{
if (_server.GetConnectionState() != LocalConnectionState.Stopped)
base.NetworkManager.LogWarning($"Cannot set maximum clients when server is running.");
else
_maximumClients = value;
}
/// <summary>
/// Sets which address the client will connect to.
/// </summary>
/// <param name="address"></param>
public override void SetClientAddress(string address)
{
_clientAddress = address;
}
/// <summary>
/// Gets which address the client will connect to.
/// </summary>
public override string GetClientAddress()
{
return _clientAddress;
}
/// <summary>
/// Sets which address the server will bind to.
/// </summary>
/// <param name="address"></param>
public override void SetServerBindAddress(string address, IPAddressType addressType) { }
/// <summary>
/// Gets which address the server will bind to.
/// </summary>
/// <param name="address"></param>
public override string GetServerBindAddress(IPAddressType addressType)
{
return "localhost";
}
/// <summary>
/// Sets which port to use.
/// </summary>
/// <param name="port"></param>
public override void SetPort(ushort port)
{
_port = port;
}
/// <summary>
/// Gets which port to use.
/// </summary>
/// <param name="port"></param>
public override ushort GetPort()
{
return _port;
}
#endregion
#region Start and stop.
/// <summary>
/// Starts the local server or client using configured settings.
/// </summary>
/// <param name="server">True to start server.</param>
public override bool StartConnection(bool server)
{
if (server)
return StartServer();
else
return StartClient(_clientAddress);
}
/// <summary>
/// Stops the local server or client.
/// </summary>
/// <param name="server">True to stop server.</param>
public override bool StopConnection(bool server)
{
if (server)
return StopServer();
else
return StopClient();
}
/// <summary>
/// Stops a remote client from the server, disconnecting the client.
/// </summary>
/// <param name="connectionId">ConnectionId of the client to disconnect.</param>
/// <param name="immediately">True to abrutly stp the client socket without waiting socket thread.</param>
public override bool StopConnection(int connectionId, bool immediately)
{
return StopClient(connectionId, immediately);
}
/// <summary>
/// Stops both client and server.
/// </summary>
public override void Shutdown()
{
//Stops client then server connections.
StopConnection(false);
StopConnection(true);
}
#region Privates.
/// <summary>
/// Starts server.
/// </summary>
private bool StartServer()
{
SslConfiguration config;
#if UNITY_SERVER
config = _sslConfiguration;
#else
config = new SslConfiguration();
#endif
_server.Initialize(this, _mtu, config);
return _server.StartConnection(_port, _maximumClients);
}
/// <summary>
/// Stops server.
/// </summary>
private bool StopServer()
{
return _server.StopConnection();
}
/// <summary>
/// Starts the client.
/// </summary>
/// <param name="address"></param>
private bool StartClient(string address)
{
_client.Initialize(this, _mtu);
return _client.StartConnection(address, _port, _useWss);
}
/// <summary>
/// Stops the client.
/// </summary>
private bool StopClient()
{
return _client.StopConnection();
}
/// <summary>
/// Stops a remote client on the server.
/// </summary>
/// <param name="connectionId"></param>
/// <param name="immediately">True to abrutly stp the client socket without waiting socket thread.</param>
private bool StopClient(int connectionId, bool immediately)
{
return _server.StopConnection(connectionId, immediately);
}
#endregion
#endregion
#region Channels.
/// <summary>
/// If channelId is invalid then channelId becomes forced to reliable.
/// </summary>
/// <param name="channelId"></param>
private void SanitizeChannel(ref byte channelId)
{
if (channelId < 0 || channelId >= TransportManager.CHANNEL_COUNT)
{
base.NetworkManager.LogWarning($"Channel of {channelId} is out of range of supported channels. Channel will be defaulted to reliable.");
channelId = 0;
}
}
/// <summary>
/// Gets the MTU for a channel. This should take header size into consideration.
/// For example, if MTU is 1200 and a packet header for this channel is 10 in size, this method should return 1190.
/// </summary>
/// <param name="channel"></param>
/// <returns></returns>
public override int GetMTU(byte channel)
{
return _mtu;
}
#endregion
#region Editor.
#if UNITY_EDITOR
private void OnValidate()
{
if (_mtu < 0)
_mtu = MINIMUM_MTU;
else if (_mtu > MAXIMUM_MTU)
_mtu = MAXIMUM_MTU;
}
#endif
#endregion
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 362dfd7e6009fb44c90beec3df0ad853
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: bf9191e2e07d29749bca3a1ae44e4bc8, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
4.1.0
- Fish-Networking 4.1.0 support. Not compatible with V3.
4.0.0
- Fish-Networking 4.0.0 support. Backwards compatible to V3.
- Added an assembly definition.
- Moved Bayou folder to FishNet/Plugins.
2.0.0
- Fish-Networking 2.0.0 support.
1.2.5
- Added SSL support.
1.2.4
- Fixed maximum clients allowing 1 additional client to connect.
- UseWSS is now false by default.
1.2.3
- Really fixed index issue in AddChannel.
- Updated namespaces to reflect other Fish-Networking namespaces.
1.2.2
- Fixed rare index out of range error in AddChannel.
1.2.1
- More fixes to support Multipass transport.
- Removed ServerBindAddress as it was not being used.
1.2.0
- WSS can now be toggled in the inspector and set through Bayou.SetUseWss.
1.1.0
- FishNetworking 1.3.1 Multipass transport support.
- SimpleWebTransport fix (Runtime is not defined for unity 2021) https://github.com/James-Frowen/SimpleWebTransport/commit/945b50dbad5b71c43e2bdaa4033f87d3f62c5572
1.0.0
- Initial release.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 48f07f72fa094094bb70b7a69debae89
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,115 @@
//using System.Collections;
//using System.Collections.Generic;
//namespace FishNet.Transporting.Bayou
//{
// internal class BidirectionalDictionary<T1, T2> : IEnumerable
// {
// private Dictionary<T1, T2> t1ToT2Dict = new Dictionary<T1, T2>();
// private Dictionary<T2, T1> t2ToT1Dict = new Dictionary<T2, T1>();
// public IEnumerable<T1> FirstTypes => t1ToT2Dict.Keys;
// public IEnumerable<T2> SecondTypes => t2ToT1Dict.Keys;
// public IEnumerator GetEnumerator() => t1ToT2Dict.GetEnumerator();
// public int Count => t1ToT2Dict.Count;
// public Dictionary<T1, T2> First => t1ToT2Dict;
// public Dictionary<T2, T1> Second => t2ToT1Dict;
// public void Add(T1 key, T2 value)
// {
// if (t1ToT2Dict.ContainsKey(key))
// {
// Remove(key);
// }
// t1ToT2Dict[key] = value;
// t2ToT1Dict[value] = key;
// }
// public void Add(T2 key, T1 value)
// {
// if (t2ToT1Dict.ContainsKey(key))
// {
// Remove(key);
// }
// t2ToT1Dict[key] = value;
// t1ToT2Dict[value] = key;
// }
// public T2 Get(T1 key) => t1ToT2Dict[key];
// public T1 Get(T2 key) => t2ToT1Dict[key];
// public bool TryGetValue(T1 key, out T2 value) => t1ToT2Dict.TryGetValue(key, out value);
// public bool TryGetValue(T2 key, out T1 value) => t2ToT1Dict.TryGetValue(key, out value);
// public bool Contains(T1 key) => t1ToT2Dict.ContainsKey(key);
// public bool Contains(T2 key) => t2ToT1Dict.ContainsKey(key);
// public void Remove(T1 key)
// {
// if (First.TryGetValue(key, out T2 value))
// {
// t1ToT2Dict.Remove(key);
// t2ToT1Dict.Remove(value);
// }
// }
// public void Clear()
// {
// First.Clear();
// Second.Clear();
// }
// public void Remove(T2 key)
// {
// if (Second.TryGetValue(key, out T1 value))
// {
// t1ToT2Dict.Remove(value);
// t2ToT1Dict.Remove(key);
// }
// }
// public void RemoveFirst(T1 key)
// {
// if (First.TryGetValue(key, out T2 value))
// {
// Second.Remove(value);
// First.Remove(key);
// }
// }
// public void RemoveSecond(T2 key)
// {
// if (Second.TryGetValue(key, out T1 value))
// {
// First.Remove(value);
// Second.Remove(key);
// }
// }
// public T1 this[T2 key]
// {
// get => t2ToT1Dict[key];
// set
// {
// Add(key, value);
// }
// }
// public T2 this[T1 key]
// {
// get => t1ToT2Dict[key];
// set
// {
// Add(key, value);
// }
// }
// }
//}

View File

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

View File

@ -0,0 +1,202 @@
using JamesFrowen.SimpleWeb;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace FishNet.Transporting.Bayou.Client
{
public class ClientSocket : CommonSocket
{
~ClientSocket()
{
StopConnection();
}
#region Private.
#region Configuration.
/// <summary>
/// Address to bind server to.
/// </summary>
private string _address = string.Empty;
/// <summary>
/// Port used by server.
/// </summary>
private ushort _port;
/// <summary>
/// MTU sizes for each channel.
/// </summary>
private int _mtu;
#endregion
#region Queues.
/// <summary>
/// Outbound messages which need to be handled.
/// </summary>
private Queue<Packet> _outgoing = new Queue<Packet>();
#endregion
/// <summary>
/// Client socket manager.
/// </summary>
private SimpleWebClient _client;
#endregion
/// <summary>
/// Initializes this for use.
/// </summary>
/// <param name="t"></param>
internal void Initialize(Transport t, int mtu)
{
base.Transport = t;
_mtu = mtu;
}
/// <summary>
/// Threaded operation to process client actions.
/// </summary>
private void Socket(bool useWss)
{
TcpConfig tcpConfig = new TcpConfig(false, 5000, 20000);
_client = SimpleWebClient.Create(ushort.MaxValue, 5000, tcpConfig);
_client.onConnect += _client_onConnect;
_client.onDisconnect += _client_onDisconnect;
_client.onData += _client_onData;
_client.onError += _client_onError;
string scheme = (useWss) ? "wss" : "ws";
UriBuilder builder = new UriBuilder
{
Scheme = scheme,
Host = _address,
Port = _port
};
base.SetConnectionState(LocalConnectionState.Starting, false);
_client.Connect(builder.Uri);
}
private void _client_onError(Exception obj)
{
StopConnection();
}
private void _client_onData(ArraySegment<byte> data)
{
if (_client == null || _client.ConnectionState != ClientState.Connected)
return;
Channel channel;
data = base.RemoveChannel(data, out channel);
ClientReceivedDataArgs dataArgs = new ClientReceivedDataArgs(data, channel, base.Transport.Index);
base.Transport.HandleClientReceivedDataArgs(dataArgs);
}
private void _client_onDisconnect()
{
StopConnection();
}
private void _client_onConnect()
{
base.SetConnectionState(LocalConnectionState.Started, false);
}
/// <summary>
/// Starts the client connection.
/// </summary>
/// <param name="address"></param>
/// <param name="port"></param>
/// <param name="channelsCount"></param>
/// <param name="pollTime"></param>
internal bool StartConnection(string address, ushort port, bool useWss)
{
if (base.GetConnectionState() != LocalConnectionState.Stopped)
return false;
base.SetConnectionState(LocalConnectionState.Starting, false);
//Assign properties.
_port = port;
_address = address;
ResetQueues();
Socket(useWss);
return true;
}
/// <summary>
/// Stops the local socket.
/// </summary>
internal bool StopConnection()
{
if (base.GetConnectionState() == LocalConnectionState.Stopped || base.GetConnectionState() == LocalConnectionState.Stopping)
return false;
base.SetConnectionState(LocalConnectionState.Stopping, false);
_client.Disconnect();
base.SetConnectionState(LocalConnectionState.Stopped, false);
return true;
}
/// <summary>
/// Resets queues.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void ResetQueues()
{
base.ClearPacketQueue(ref _outgoing);
}
/// <summary>
/// Dequeues and processes outgoing.
/// </summary>
private void DequeueOutgoing()
{
int count = _outgoing.Count;
for (int i = 0; i < count; i++)
{
Packet outgoing = _outgoing.Dequeue();
base.AddChannel(ref outgoing);
_client.Send(outgoing.GetArraySegment());
outgoing.Dispose();
}
}
/// <summary>
/// Allows for Outgoing queue to be iterated.
/// </summary>
internal void IterateOutgoing()
{
DequeueOutgoing();
}
/// <summary>
/// Iterates the Incoming queue.
/// </summary>
internal void IterateIncoming()
{
if (_client == null)
return;
/* This has to be called even if not connected because it will also poll events such as
* Connected, or Disconnected, ect. */
_client.ProcessMessageQueue();
}
/// <summary>
/// Sends a packet to the server.
/// </summary>
internal void SendToServer(byte channelId, ArraySegment<byte> segment)
{
//Not started, cannot send.
if (base.GetConnectionState() != LocalConnectionState.Started)
return;
base.Send(ref _outgoing, channelId, segment, -1);
}
}
}

View File

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

View File

@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
namespace FishNet.Transporting.Bayou
{
public abstract class CommonSocket
{
#region Public.
/// <summary>
/// Current ConnectionState.
/// </summary>
private LocalConnectionState _connectionState = LocalConnectionState.Stopped;
/// <summary>
/// Returns the current ConnectionState.
/// </summary>
/// <returns></returns>
internal LocalConnectionState GetConnectionState()
{
return _connectionState;
}
/// <summary>
/// Sets a new connection state.
/// </summary>
/// <param name="connectionState"></param>
protected void SetConnectionState(LocalConnectionState connectionState, bool asServer)
{
//If state hasn't changed.
if (connectionState == _connectionState)
return;
_connectionState = connectionState;
if (asServer)
Transport.HandleServerConnectionState(new ServerConnectionStateArgs(connectionState, Transport.Index));
else
Transport.HandleClientConnectionState(new ClientConnectionStateArgs(connectionState, Transport.Index));
}
#endregion
#region Protected.
/// <summary>
/// Transport controlling this socket.
/// </summary>
protected Transport Transport = null;
#endregion
/// <summary>
/// Sends data to connectionId.
/// </summary>
internal void Send(ref Queue<Packet> queue, byte channelId, ArraySegment<byte> segment, int connectionId)
{
if (GetConnectionState() != LocalConnectionState.Started)
return;
//ConnectionId isn't used from client to server.
Packet outgoing = new Packet(connectionId, segment, channelId);
queue.Enqueue(outgoing);
}
/// <summary>
/// Clears a queue using Packet type.
/// </summary>
/// <param name="queue"></param>
internal void ClearPacketQueue(ref Queue<Packet> queue)
{
int count = queue.Count;
for (int i = 0; i < count; i++)
{
Packet p = queue.Dequeue();
p.Dispose();
}
}
/// <summary>
/// Adds channel to the end of the data.
/// </summary>
internal void AddChannel(ref Packet packet)
{
int writePosition = packet.Length;
packet.AddLength(1);
packet.Data[writePosition] = (byte)packet.Channel;
}
/// <summary>
/// Removes the channel, outputting it and returning a new ArraySegment.
/// </summary>
internal ArraySegment<byte> RemoveChannel(ArraySegment<byte> segment, out Channel channel)
{
byte[] array = segment.Array;
int count = segment.Count;
channel = (Channel)array[count - 1];
return new ArraySegment<byte>(array, 0, count - 1);
}
}
}

View File

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

View File

@ -0,0 +1,355 @@
using JamesFrowen.SimpleWeb;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace FishNet.Transporting.Bayou.Server
{
public class ServerSocket : CommonSocket
{
#region Public.
/// <summary>
/// Gets the current ConnectionState of a remote client on the server.
/// </summary>
/// <param name="connectionId">ConnectionId to get ConnectionState for.</param>
internal RemoteConnectionState GetConnectionState(int connectionId)
{
RemoteConnectionState state = _clients.Contains(connectionId) ? RemoteConnectionState.Started : RemoteConnectionState.Stopped;
return state;
}
#endregion
#region Private.
#region Configuration.
/// <summary>
/// Port used by server.
/// </summary>
private ushort _port;
/// <summary>
/// Maximum number of allowed clients.
/// </summary>
private int _maximumClients;
/// <summary>
/// MTU sizes for each channel.
/// </summary>
private int _mtu;
#endregion
#region Queues.
/// <summary>
/// Outbound messages which need to be handled.
/// </summary>
private Queue<Packet> _outgoing = new Queue<Packet>();
/// <summary>
/// Ids to disconnect next iteration. This ensures data goes through to disconnecting remote connections. This may be removed in a later release.
/// </summary>
private List<int> _disconnectingNext = new List<int>();
/// <summary>
/// Ids to disconnect immediately.
/// </summary>
private List<int> _disconnectingNow = new List<int>();
/// <summary>
/// ConnectionEvents which need to be handled.
/// </summary>
private Queue<RemoteConnectionEvent> _remoteConnectionEvents = new Queue<RemoteConnectionEvent>();
#endregion
/// <summary>
/// Currently connected clients.
/// </summary>
private HashSet<int> _clients = new HashSet<int>();
/// <summary>
/// Server socket manager.
/// </summary>
private SimpleWebServer _server;
/// <summary>
/// SslConfiguration to use.
/// </summary>
private SslConfiguration _sslConfiguration;
#endregion
~ServerSocket()
{
StopConnection();
}
/// <summary>
/// Initializes this for use.
/// </summary>
/// <param name="t"></param>
internal void Initialize(Transport t, int unreliableMTU, SslConfiguration config)
{
_sslConfiguration = config;
base.Transport = t;
_mtu = unreliableMTU;
}
/// <summary>
/// Threaded operation to process server actions.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void Socket()
{
TcpConfig tcpConfig = new TcpConfig(false, 5000, 20000);
SslConfig config;
if (!_sslConfiguration.Enabled)
config = new SslConfig();
else
config = new SslConfig(_sslConfiguration.Enabled, _sslConfiguration.CertificatePath, _sslConfiguration.CertificatePassword,
_sslConfiguration.SslProtocol);
_server = new SimpleWebServer(5000, tcpConfig, _mtu, 5000, config);
_server.onConnect += _server_onConnect;
_server.onDisconnect += _server_onDisconnect;
_server.onData += _server_onData;
_server.onError += _server_onError;
base.SetConnectionState(LocalConnectionState.Starting, true);
_server.Start(_port);
base.SetConnectionState(LocalConnectionState.Started, true);
}
/// <summary>
/// Called when a client connection errors.
/// </summary>
private void _server_onError(int clientId, Exception arg2)
{
StopConnection(clientId, true);
}
/// <summary>
/// Called when receiving data.
/// </summary>
private void _server_onData(int clientId, ArraySegment<byte> data)
{
if (_server == null || !_server.Active)
return;
Channel channel;
ArraySegment<byte> segment = base.RemoveChannel(data, out channel);
ServerReceivedDataArgs dataArgs = new ServerReceivedDataArgs(segment, channel, clientId, base.Transport.Index);
base.Transport.HandleServerReceivedDataArgs(dataArgs);
}
/// <summary>
/// Called when a client connects.
/// </summary>
private void _server_onConnect(int clientId)
{
if (_server == null || !_server.Active)
return;
if (_clients.Count >= _maximumClients)
_server.KickClient(clientId);
else
_remoteConnectionEvents.Enqueue(new RemoteConnectionEvent(true, clientId));
}
/// <summary>
/// Called when a client disconnects.
/// </summary>
private void _server_onDisconnect(int clientId)
{
StopConnection(clientId, true);
}
/// <summary>
/// Gets the address of a remote connection Id.
/// </summary>
/// <param name="connectionId"></param>
/// <returns>Returns string.empty if Id is not found.</returns>
internal string GetConnectionAddress(int connectionId)
{
if (_server == null || !_server.Active)
return string.Empty;
return _server.GetClientAddress(connectionId);
}
/// <summary>
/// Starts the server.
/// </summary>
internal bool StartConnection(ushort port, int maximumClients)
{
if (base.GetConnectionState() != LocalConnectionState.Stopped)
return false;
base.SetConnectionState(LocalConnectionState.Starting, true);
//Assign properties.
_port = port;
_maximumClients = maximumClients;
ResetQueues();
Socket();
return true;
}
/// <summary>
/// Stops the local socket.
/// </summary>
internal bool StopConnection()
{
if (_server == null || base.GetConnectionState() == LocalConnectionState.Stopped || base.GetConnectionState() == LocalConnectionState.Stopping)
return false;
ResetQueues();
base.SetConnectionState(LocalConnectionState.Stopping, true);
_server.Stop();
base.SetConnectionState(LocalConnectionState.Stopped, true);
return true;
}
/// <summary>
/// Stops a remote client disconnecting the client from the server.
/// </summary>
/// <param name="connectionId">ConnectionId of the client to disconnect.</param>
internal bool StopConnection(int connectionId, bool immediately)
{
if (_server == null || base.GetConnectionState() != LocalConnectionState.Started)
return false;
//Don't disconnect immediately, wait until next command iteration.
if (!immediately)
{
_disconnectingNext.Add(connectionId);
}
//Disconnect immediately.
else
{
_server.KickClient(connectionId);
_clients.Remove(connectionId);
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(RemoteConnectionState.Stopped, connectionId, base.Transport.Index));
}
return true;
}
/// <summary>
/// Resets queues.
/// </summary>
private void ResetQueues()
{
_clients.Clear();
base.ClearPacketQueue(ref _outgoing);
_disconnectingNext.Clear();
_disconnectingNow.Clear();
_remoteConnectionEvents.Clear();
}
/// <summary>
/// Dequeues and processes commands.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void DequeueDisconnects()
{
int count;
count = _disconnectingNow.Count;
//If there are disconnect nows.
if (count > 0)
{
for (int i = 0; i < count; i++)
StopConnection(_disconnectingNow[i], true);
_disconnectingNow.Clear();
}
count = _disconnectingNext.Count;
//If there are disconnect next.
if (count > 0)
{
for (int i = 0; i < count; i++)
_disconnectingNow.Add(_disconnectingNext[i]);
_disconnectingNext.Clear();
}
}
/// <summary>
/// Dequeues and processes outgoing.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private void DequeueOutgoing()
{
if (base.GetConnectionState() != LocalConnectionState.Started || _server == null)
{
//Not started, clear outgoing.
base.ClearPacketQueue(ref _outgoing);
}
else
{
int count = _outgoing.Count;
for (int i = 0; i < count; i++)
{
Packet outgoing = _outgoing.Dequeue();
int connectionId = outgoing.ConnectionId;
AddChannel(ref outgoing);
ArraySegment<byte> segment = outgoing.GetArraySegment();
//Send to all clients.
if (connectionId == -1)
_server.SendAll(_clients, segment);
//Send to one client.
else
_server.SendOne(connectionId, segment);
outgoing.Dispose();
}
}
}
/// <summary>
/// Allows for Outgoing queue to be iterated.
/// </summary>
internal void IterateOutgoing()
{
if (_server == null)
return;
DequeueOutgoing();
DequeueDisconnects();
}
/// <summary>
/// Iterates the Incoming queue.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void IterateIncoming()
{
if (_server == null)
return;
//Handle connection and disconnection events.
while (_remoteConnectionEvents.Count > 0)
{
RemoteConnectionEvent connectionEvent = _remoteConnectionEvents.Dequeue();
if (connectionEvent.Connected)
_clients.Add(connectionEvent.ConnectionId);
RemoteConnectionState state = (connectionEvent.Connected) ? RemoteConnectionState.Started : RemoteConnectionState.Stopped;
base.Transport.HandleRemoteConnectionState(new RemoteConnectionStateArgs(state, connectionEvent.ConnectionId, base.Transport.Index));
}
//Read data from clients.
_server.ProcessMessageQueue();
}
/// <summary>
/// Sends a packet to a single, or all clients.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void SendToClient(byte channelId, ArraySegment<byte> segment, int connectionId)
{
Send(ref _outgoing, channelId, segment, connectionId);
}
/// <summary>
/// Returns the maximum number of clients allowed to connect to the server. If the transport does not support this method the value -1 is returned.
/// </summary>
/// <returns></returns>
internal int GetMaximumClients()
{
return _maximumClients;
}
}
}

View File

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

View File

@ -0,0 +1,23 @@
using System.Security.Authentication;
namespace FishNet.Transporting.Bayou
{
[System.Serializable]
public struct SslConfiguration
{
public bool Enabled;
public string CertificatePath;
public string CertificatePassword;
public SslProtocols SslProtocol;
public SslConfiguration(bool enabled, string certPath, string certPassword, SslProtocols sslProtocols)
{
Enabled = enabled;
CertificatePath = certPath;
CertificatePassword = certPassword;
SslProtocol = sslProtocols;
}
}
}

View File

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

View File

@ -0,0 +1,78 @@
using FishNet.Utility.Performance;
using System;
namespace FishNet.Transporting.Bayou
{
internal struct Packet
{
public readonly int ConnectionId;
public byte[] Data;
public int Length;
public readonly byte Channel;
public Packet(int connectionId, byte[] data, int length, byte channel)
{
ConnectionId = connectionId;
Data = data;
Length = length;
Channel = channel;
}
public Packet(int sender, ArraySegment<byte> segment, byte channel)
{
Data = ByteArrayPool.Retrieve(segment.Count);
Buffer.BlockCopy(segment.Array, segment.Offset, Data, 0, segment.Count);
ConnectionId = sender;
Length = segment.Count;
Channel = channel;
}
public ArraySegment<byte> GetArraySegment()
{
return new ArraySegment<byte>(Data, 0, Length);
}
/// <summary>
/// Adds on length and resizes Data if needed.
/// </summary>
/// <param name="length"></param>
public void AddLength(int length)
{
int totalNeeded = (Length + length);
if (Data.Length < totalNeeded)
Array.Resize(ref Data, totalNeeded);
Length += length;
}
public void Dispose()
{
ByteArrayPool.Store(Data);
}
}
}
namespace FishNet.Transporting.Bayou.Server
{
internal struct RemoteConnectionEvent
{
public readonly bool Connected;
public readonly int ConnectionId;
public RemoteConnectionEvent(bool connected, int connectionId)
{
Connected = connected;
ConnectionId = connectionId;
}
}
}

View File

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

View File

@ -0,0 +1,23 @@
MIT License
Copyright (c) 2020 Mirror Networking
Copyright (c) 2020 James Frowen
Copyright (c) 2022, Benjamin Berwick of FirstGearGames LLC, registered 2018, North Carolina.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 179e84ac4879de74fb51966e6c161a51
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyVersion("1.2.4")]
[assembly: InternalsVisibleTo("SimpleWebTransport.Tests.Runtime")]
[assembly: InternalsVisibleTo("SimpleWebTransport.Tests.Editor")]

View File

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

View File

@ -0,0 +1,20 @@
## [1.2.4](https://github.com/James-Frowen/SimpleWebTransport/compare/v1.2.3...v1.2.4) (2021-12-16)
### Bug Fixes
* adding meta file for changelog ([ba5b164](https://github.com/James-Frowen/SimpleWebTransport/commit/ba5b1647aa5cc69ca80f5b52c542a9b5ee749c7f))
## [1.2.3](https://github.com/James-Frowen/SimpleWebTransport/compare/v1.2.2...v1.2.3) (2021-12-16)
### Bug Fixes
* fixing compile error in assemblyInfo ([7ee8380](https://github.com/James-Frowen/SimpleWebTransport/commit/7ee8380b4daf34d4e12017de55d8be481690046f))
## [1.2.2](https://github.com/James-Frowen/SimpleWebTransport/compare/v1.2.1...v1.2.2) (2021-12-16)
### Bug Fixes
* fixing release with empty commit ([068af74](https://github.com/James-Frowen/SimpleWebTransport/commit/068af74f7399354081f25181f90fb060b0fa1524))

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b0ef23ac1c6a62546bbad5529b3bfdad
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,99 @@
using System;
using System.Collections.Concurrent;
using UnityEngine;
namespace JamesFrowen.SimpleWeb
{
public enum ClientState
{
NotConnected = 0,
Connecting = 1,
Connected = 2,
Disconnecting = 3,
}
/// <summary>
/// Client used to control websockets
/// <para>Base class used by WebSocketClientWebGl and WebSocketClientStandAlone</para>
/// </summary>
public abstract class SimpleWebClient
{
public static SimpleWebClient Create(int maxMessageSize, int maxMessagesPerTick, TcpConfig tcpConfig)
{
#if UNITY_WEBGL && !UNITY_EDITOR
return new WebSocketClientWebGl(maxMessageSize, maxMessagesPerTick);
#else
return new WebSocketClientStandAlone(maxMessageSize, maxMessagesPerTick, tcpConfig);
#endif
}
readonly int maxMessagesPerTick;
protected readonly int maxMessageSize;
public readonly ConcurrentQueue<Message> receiveQueue = new ConcurrentQueue<Message>();
protected readonly BufferPool bufferPool;
protected ClientState state;
protected SimpleWebClient(int maxMessageSize, int maxMessagesPerTick)
{
this.maxMessageSize = maxMessageSize;
this.maxMessagesPerTick = maxMessagesPerTick;
bufferPool = new BufferPool(5, 20, maxMessageSize);
}
public ClientState ConnectionState => state;
public event Action onConnect;
public event Action onDisconnect;
public event Action<ArraySegment<byte>> onData;
public event Action<Exception> onError;
/// <summary>
/// Processes all new messages
/// </summary>
public void ProcessMessageQueue()
{
ProcessMessageQueue(null);
}
/// <summary>
/// Processes all messages while <paramref name="behaviour"/> is enabled
/// </summary>
/// <param name="behaviour"></param>
public void ProcessMessageQueue(MonoBehaviour behaviour)
{
int processedCount = 0;
bool skipEnabled = behaviour == null;
// check enabled every time incase behaviour was disabled after data
while (
(skipEnabled || behaviour.enabled) &&
processedCount < maxMessagesPerTick &&
// Dequeue last
receiveQueue.TryDequeue(out Message next)
)
{
processedCount++;
switch (next.type)
{
case EventType.Connected:
onConnect?.Invoke();
break;
case EventType.Data:
onData?.Invoke(next.data.ToSegment());
next.data.Release();
break;
case EventType.Disconnected:
onDisconnect?.Invoke();
break;
case EventType.Error:
onError?.Invoke(next.exception);
break;
}
}
}
public abstract void Connect(Uri serverAddress);
public abstract void Disconnect();
public abstract void Send(ArraySegment<byte> segment);
}
}

View File

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

View File

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

View File

@ -0,0 +1,77 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace JamesFrowen.SimpleWeb
{
/// <summary>
/// Handles Handshake to the server when it first connects
/// <para>The client handshake does not need buffers to reduce allocations since it only happens once</para>
/// </summary>
internal class ClientHandshake
{
public bool TryHandshake(Connection conn, Uri uri)
{
try
{
Stream stream = conn.stream;
byte[] keyBuffer = new byte[16];
using (RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider())
{
rng.GetBytes(keyBuffer);
}
string key = Convert.ToBase64String(keyBuffer);
string keySum = key + Constants.HandshakeGUID;
byte[] keySumBytes = Encoding.ASCII.GetBytes(keySum);
Log.Verbose($"Handshake Hashing {Encoding.ASCII.GetString(keySumBytes)}");
byte[] keySumHash = SHA1.Create().ComputeHash(keySumBytes);
string expectedResponse = Convert.ToBase64String(keySumHash);
string handshake =
$"GET {uri.PathAndQuery} HTTP/1.1\r\n" +
$"Host: {uri.Host}:{uri.Port}\r\n" +
$"Upgrade: websocket\r\n" +
$"Connection: Upgrade\r\n" +
$"Sec-WebSocket-Key: {key}\r\n" +
$"Sec-WebSocket-Version: 13\r\n" +
"\r\n";
byte[] encoded = Encoding.ASCII.GetBytes(handshake);
stream.Write(encoded, 0, encoded.Length);
byte[] responseBuffer = new byte[1000];
int? lengthOrNull = ReadHelper.SafeReadTillMatch(stream, responseBuffer, 0, responseBuffer.Length, Constants.endOfHandshake);
if (!lengthOrNull.HasValue)
{
Log.Error("Connected closed before handshake");
return false;
}
string responseString = Encoding.ASCII.GetString(responseBuffer, 0, lengthOrNull.Value);
string acceptHeader = "Sec-WebSocket-Accept: ";
int startIndex = responseString.IndexOf(acceptHeader, StringComparison.InvariantCultureIgnoreCase) + acceptHeader.Length;
int endIndex = responseString.IndexOf("\r\n", startIndex);
string responseKey = responseString.Substring(startIndex, endIndex - startIndex);
if (responseKey != expectedResponse)
{
Log.Error($"Response key incorrect, Response:{responseKey} Expected:{expectedResponse}");
return false;
}
return true;
}
catch (Exception e)
{
Log.Exception(e);
return false;
}
}
}
}

View File

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

View File

@ -0,0 +1,47 @@
using System;
using System.IO;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Cryptography.X509Certificates;
namespace JamesFrowen.SimpleWeb
{
internal class ClientSslHelper
{
internal bool TryCreateStream(Connection conn, Uri uri)
{
NetworkStream stream = conn.client.GetStream();
if (uri.Scheme != "wss")
{
conn.stream = stream;
return true;
}
try
{
conn.stream = CreateStream(stream, uri);
return true;
}
catch (Exception e)
{
Log.Error($"Create SSLStream Failed: {e}", false);
return false;
}
}
Stream CreateStream(NetworkStream stream, Uri uri)
{
SslStream sslStream = new SslStream(stream, true, ValidateServerCertificate);
sslStream.AuthenticateAsClient(uri.Host);
return sslStream;
}
static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
// Do not allow this client to communicate with unauthenticated servers.
// only accept if no errors
return sslPolicyErrors == SslPolicyErrors.None;
}
}
}

View File

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

View File

@ -0,0 +1,149 @@
using System;
using System.Net.Sockets;
using System.Threading;
namespace JamesFrowen.SimpleWeb
{
public class WebSocketClientStandAlone : SimpleWebClient
{
readonly ClientSslHelper sslHelper;
readonly ClientHandshake handshake;
readonly TcpConfig tcpConfig;
Connection conn;
internal WebSocketClientStandAlone(int maxMessageSize, int maxMessagesPerTick, TcpConfig tcpConfig) : base(maxMessageSize, maxMessagesPerTick)
{
#if UNITY_WEBGL && !UNITY_EDITOR
throw new NotSupportedException();
#else
sslHelper = new ClientSslHelper();
handshake = new ClientHandshake();
this.tcpConfig = tcpConfig;
#endif
}
public override void Connect(Uri serverAddress)
{
state = ClientState.Connecting;
// create connection here before thread so that send queue exist for MiragePeer to send to
var client = new TcpClient();
tcpConfig.ApplyTo(client);
// create connection object here so dispose correctly disconnects on failed connect
conn = new Connection(client, AfterConnectionDisposed);
var receiveThread = new Thread(() => ConnectAndReceiveLoop(serverAddress));
receiveThread.IsBackground = true;
receiveThread.Start();
}
void ConnectAndReceiveLoop(Uri serverAddress)
{
try
{
// connection created above
TcpClient client = conn.client;
//TcpClient client = new TcpClient();
//tcpConfig.ApplyTo(client);
//// create connection object here so dispose correctly disconnects on failed connect
//conn = new Connection(client, AfterConnectionDisposed);
conn.receiveThread = Thread.CurrentThread;
try
{
client.Connect(serverAddress.Host, serverAddress.Port);
}
catch (SocketException)
{
client.Dispose();
throw;
}
bool success = sslHelper.TryCreateStream(conn, serverAddress);
if (!success)
{
Log.Warn("Failed to create Stream");
conn.Dispose();
return;
}
success = handshake.TryHandshake(conn, serverAddress);
if (!success)
{
Log.Warn("Failed Handshake");
conn.Dispose();
return;
}
Log.Info("HandShake Successful");
state = ClientState.Connected;
receiveQueue.Enqueue(new Message(EventType.Connected));
var sendThread = new Thread(() =>
{
var sendConfig = new SendLoop.Config(
conn,
bufferSize: Constants.HeaderSize + Constants.MaskSize + maxMessageSize,
setMask: true);
SendLoop.Loop(sendConfig);
});
conn.sendThread = sendThread;
sendThread.IsBackground = true;
sendThread.Start();
var config = new ReceiveLoop.Config(conn,
maxMessageSize,
false,
receiveQueue,
bufferPool);
ReceiveLoop.Loop(config);
}
catch (ThreadInterruptedException e) { Log.InfoException(e); }
catch (ThreadAbortException e) { Log.InfoException(e); }
catch (Exception e) { Log.Exception(e); }
finally
{
// close here incase connect fails
conn?.Dispose();
}
}
void AfterConnectionDisposed(Connection conn)
{
state = ClientState.NotConnected;
// make sure Disconnected event is only called once
receiveQueue.Enqueue(new Message(EventType.Disconnected));
}
public override void Disconnect()
{
state = ClientState.Disconnecting;
Log.Info("Disconnect Called");
if (conn == null)
{
state = ClientState.NotConnected;
}
else
{
conn?.Dispose();
}
}
public override void Send(ArraySegment<byte> segment)
{
ArrayBuffer buffer = bufferPool.Take(segment.Count);
buffer.CopyFrom(segment);
conn.sendQueue.Enqueue(buffer);
conn.sendPending.Set();
}
}
}

View File

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

View File

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

View File

@ -0,0 +1,34 @@
using System;
#if UNITY_WEBGL
using System.Runtime.InteropServices;
#endif
namespace JamesFrowen.SimpleWeb
{
internal static class SimpleWebJSLib
{
#if UNITY_WEBGL
[DllImport("__Internal")]
internal static extern bool IsConnected(int index);
#pragma warning disable CA2101 // Specify marshaling for P/Invoke string arguments
[DllImport("__Internal")]
#pragma warning restore CA2101 // Specify marshaling for P/Invoke string arguments
internal static extern int Connect(string address, Action<int> openCallback, Action<int> closeCallBack, Action<int, IntPtr, int> messageCallback, Action<int> errorCallback);
[DllImport("__Internal")]
internal static extern void Disconnect(int index);
[DllImport("__Internal")]
internal static extern bool Send(int index, byte[] array, int offset, int length);
#else
internal static bool IsConnected(int index) => throw new NotSupportedException();
internal static int Connect(string address, Action<int> openCallback, Action<int> closeCallBack, Action<int, IntPtr, int> messageCallback, Action<int> errorCallback) => throw new NotSupportedException();
internal static void Disconnect(int index) => throw new NotSupportedException();
internal static bool Send(int index, byte[] array, int offset, int length) => throw new NotSupportedException();
#endif
}
}

View File

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

View File

@ -0,0 +1,125 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AOT;
namespace JamesFrowen.SimpleWeb
{
public class WebSocketClientWebGl : SimpleWebClient
{
static readonly Dictionary<int, WebSocketClientWebGl> instances = new Dictionary<int, WebSocketClientWebGl>();
/// <summary>
/// key for instances sent between c# and js
/// </summary>
int index;
/// <summary>
/// Message sent by high level while still connecting, they will be send after onOpen is called
/// <para>this is a workaround for mirage where send it called right after Connect</para>
/// </summary>
Queue<byte[]> ConnectingSendQueue;
internal WebSocketClientWebGl(int maxMessageSize, int maxMessagesPerTick) : base(maxMessageSize, maxMessagesPerTick)
{
#if !UNITY_WEBGL || UNITY_EDITOR
throw new NotSupportedException();
#endif
}
public bool CheckJsConnected() => SimpleWebJSLib.IsConnected(index);
public override void Connect(Uri serverAddress)
{
index = SimpleWebJSLib.Connect(serverAddress.ToString(), OpenCallback, CloseCallBack, MessageCallback, ErrorCallback);
instances.Add(index, this);
state = ClientState.Connecting;
}
public override void Disconnect()
{
state = ClientState.Disconnecting;
// disconnect should cause closeCallback and OnDisconnect to be called
SimpleWebJSLib.Disconnect(index);
}
public override void Send(ArraySegment<byte> segment)
{
if (segment.Count > maxMessageSize)
{
Log.Error($"Cant send message with length {segment.Count} because it is over the max size of {maxMessageSize}");
return;
}
if (state == ClientState.Connected)
{
SimpleWebJSLib.Send(index, segment.Array, segment.Offset, segment.Count);
}
else
{
if (ConnectingSendQueue == null)
ConnectingSendQueue = new Queue<byte[]>();
ConnectingSendQueue.Enqueue(segment.ToArray());
}
}
void onOpen()
{
receiveQueue.Enqueue(new Message(EventType.Connected));
state = ClientState.Connected;
if (ConnectingSendQueue != null)
{
while (ConnectingSendQueue.Count > 0)
{
byte[] next = ConnectingSendQueue.Dequeue();
SimpleWebJSLib.Send(index, next, 0, next.Length);
}
ConnectingSendQueue = null;
}
}
void onClose()
{
// this code should be last in this class
receiveQueue.Enqueue(new Message(EventType.Disconnected));
state = ClientState.NotConnected;
instances.Remove(index);
}
void onMessage(IntPtr bufferPtr, int count)
{
try
{
ArrayBuffer buffer = bufferPool.Take(count);
buffer.CopyFrom(bufferPtr, count);
receiveQueue.Enqueue(new Message(buffer));
}
catch (Exception e)
{
Log.Error($"onData {e.GetType()}: {e.Message}\n{e.StackTrace}");
receiveQueue.Enqueue(new Message(e));
}
}
void onErr()
{
receiveQueue.Enqueue(new Message(new Exception("Javascript Websocket error")));
Disconnect();
}
[MonoPInvokeCallback(typeof(Action<int>))]
static void OpenCallback(int index) => instances[index].onOpen();
[MonoPInvokeCallback(typeof(Action<int>))]
static void CloseCallBack(int index) => instances[index].onClose();
[MonoPInvokeCallback(typeof(Action<int, IntPtr, int>))]
static void MessageCallback(int index, IntPtr bufferPtr, int count) => instances[index].onMessage(bufferPtr, count);
[MonoPInvokeCallback(typeof(Action<int>))]
static void ErrorCallback(int index) => instances[index].onErr();
}
}

View File

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

View File

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

View File

@ -0,0 +1,115 @@
// this will create a global object
const SimpleWeb = {
webSockets: [],
next: 1,
GetWebSocket: function (index) {
return SimpleWeb.webSockets[index]
},
AddNextSocket: function (webSocket) {
var index = SimpleWeb.next;
SimpleWeb.next++;
SimpleWeb.webSockets[index] = webSocket;
return index;
},
RemoveSocket: function (index) {
SimpleWeb.webSockets[index] = undefined;
},
};
function IsConnected(index) {
var webSocket = SimpleWeb.GetWebSocket(index);
if (webSocket) {
return webSocket.readyState === webSocket.OPEN;
}
else {
return false;
}
}
function Connect(addressPtr, openCallbackPtr, closeCallBackPtr, messageCallbackPtr, errorCallbackPtr) {
// fix for unity 2021 because unity bug in .jslib
if (typeof Runtime === "undefined") {
// if unity doesn't create Runtime, then make it here
// dont ask why this works, just be happy that it does
Runtime = {
dynCall: dynCall
}
}
const address = UTF8ToString(addressPtr);
console.log("Connecting to " + address);
// Create webSocket connection.
webSocket = new WebSocket(address);
webSocket.binaryType = 'arraybuffer';
const index = SimpleWeb.AddNextSocket(webSocket);
// Connection opened
webSocket.addEventListener('open', function (event) {
console.log("Connected to " + address);
Runtime.dynCall('vi', openCallbackPtr, [index]);
});
webSocket.addEventListener('close', function (event) {
console.log("Disconnected from " + address);
Runtime.dynCall('vi', closeCallBackPtr, [index]);
});
// Listen for messages
webSocket.addEventListener('message', function (event) {
if (event.data instanceof ArrayBuffer) {
// TODO dont alloc each time
var array = new Uint8Array(event.data);
var arrayLength = array.length;
var bufferPtr = _malloc(arrayLength);
var dataBuffer = new Uint8Array(HEAPU8.buffer, bufferPtr, arrayLength);
dataBuffer.set(array);
Runtime.dynCall('viii', messageCallbackPtr, [index, bufferPtr, arrayLength]);
_free(bufferPtr);
}
else {
console.error("message type not supported")
}
});
webSocket.addEventListener('error', function (event) {
console.error('Socket Error', event);
Runtime.dynCall('vi', errorCallbackPtr, [index]);
});
return index;
}
function Disconnect(index) {
var webSocket = SimpleWeb.GetWebSocket(index);
if (webSocket) {
webSocket.close(1000, "Disconnect Called by Mirror");
}
SimpleWeb.RemoveSocket(index);
}
function Send(index, arrayPtr, offset, length) {
var webSocket = SimpleWeb.GetWebSocket(index);
if (webSocket) {
const start = arrayPtr + offset;
const end = start + length;
const data = HEAPU8.buffer.slice(start, end);
webSocket.send(data);
return true;
}
return false;
}
const SimpleWebLib = {
$SimpleWeb: SimpleWeb,
IsConnected,
Connect,
Disconnect,
Send
};
autoAddDeps(SimpleWebLib, '$SimpleWeb');
mergeInto(LibraryManager.library, SimpleWebLib);

View File

@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 54452a8c6d2ca9b49a8c79f81b50305c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Facebook: WebGL
second:
enabled: 1
settings: {}
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

Some files were not shown because too many files have changed in this diff Show More