diff options
author | chai <chaifix@163.com> | 2022-06-06 09:19:36 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-06-06 09:19:36 +0800 |
commit | b944d9d963f3a03d445b34f67916810c9ca1c8c2 (patch) | |
tree | 346274a65e70ee1d15d217d253936b18be395f79 | |
parent | 22891bf59032ba88262824255a706d652031384b (diff) |
* misc
121 files changed, 6796 insertions, 2701 deletions
diff --git a/Documents/编辑器.xlsx b/Documents/编辑器.xlsx Binary files differnew file mode 100644 index 00000000..15e22351 --- /dev/null +++ b/Documents/编辑器.xlsx diff --git a/Erika/Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta b/Erika/Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta deleted file mode 100644 index fa9e76cd..00000000 --- a/Erika/Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e38cb65072bb4a64cbe162792de9bec2 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Art/Models/Characters/Default.meta b/Erika/Assets/Bundle/Materials/Unit/Common.meta index 43499fc7..7b37a6e8 100644 --- a/Erika/Assets/Art/Models/Characters/Default.meta +++ b/Erika/Assets/Bundle/Materials/Unit/Common.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e8a40298dd4efd14c9f90a63734ca39b +guid: 5b7ecc44a82c14749b382be1ed15c799 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/Bundle/Materials/Unit/Effect.meta b/Erika/Assets/Bundle/Materials/Unit/Effect.meta deleted file mode 100644 index fdf8c1db..00000000 --- a/Erika/Assets/Bundle/Materials/Unit/Effect.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0525fec1eb7cc94458170e9e106955d5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Models.meta b/Erika/Assets/Bundle/Models.meta deleted file mode 100644 index c9b5bf44..00000000 --- a/Erika/Assets/Bundle/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: adab1ca5f61452c4c90f19e7c11adf0e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Prefabs.meta b/Erika/Assets/Bundle/Prefabs.meta deleted file mode 100644 index 82588fb1..00000000 --- a/Erika/Assets/Bundle/Prefabs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dac6442cad7539149a7527510665d510 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene.unity b/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene.unity index 64064813..35830ed0 100644 --- a/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene.unity +++ b/Erika/Assets/Bundle/Scenes/Demo/AnimationEditScene.unity @@ -38,7 +38,7 @@ RenderSettings: m_ReflectionIntensity: 1 m_CustomReflection: {fileID: 0} m_Sun: {fileID: 0} - m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} + m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} m_UseRadianceAmbientProbe: 0 --- !u!157 &3 LightmapSettings: @@ -112,99 +112,6 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &36032044 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 36032045} - m_Layer: 0 - m_Name: Bip01_L_Finger31 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &36032045 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 36032044} - m_LocalRotation: {x: 0.105993934, y: -0.6124063, z: 0.23843834, w: -0.746238} - m_LocalPosition: {x: -0.024786739, y: 0.00000007663179, z: 0.00000010266465} - m_LocalScale: {x: 1.0000002, y: 0.99999976, z: 1} - m_Children: - - {fileID: 1609580354} - m_Father: {fileID: 66730497} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &42517458 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 42517459} - m_Layer: 0 - m_Name: Bip01_L_UpperArm - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &42517459 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 42517458} - m_LocalRotation: {x: 0.25669208, y: -0.13786253, z: 0.30221045, w: 0.9076189} - m_LocalPosition: {x: -0.081466004, y: -0.000000004399934, z: -0.00000011073173} - m_LocalScale: {x: 1.0000002, y: 0.99999994, z: 1.0000001} - m_Children: - - {fileID: 289668404} - m_Father: {fileID: 298298467} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &48273154 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 48273155} - m_Layer: 0 - m_Name: body - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &48273155 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 48273154} - m_LocalRotation: {x: -0.27411792, y: 0.6518124, z: 0.65181243, w: 0.27411783} - m_LocalPosition: {x: 0.13741475, y: 1.6859171, z: 0.014655997} - m_LocalScale: {x: 2.539999, y: 2.5399995, z: 2.5399997} - m_Children: - - {fileID: 815500685} - m_Father: {fileID: 1807710024} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &53681805 GameObject: m_ObjectHideFlags: 0 @@ -4960,68 +4867,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &66730496 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 66730497} - m_Layer: 0 - m_Name: Bip01_L_Finger3 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &66730497 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 66730496} - m_LocalRotation: {x: -0.018196877, y: 0.45576787, z: -0.26483753, w: 0.84959143} - m_LocalPosition: {x: -0.081515536, y: 0.013640816, z: 0.016015444} - m_LocalScale: {x: 1.0000005, y: 0.99999976, z: 1.0000001} - m_Children: - - {fileID: 36032045} - m_Father: {fileID: 676438535} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &79449998 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 79449999} - m_Layer: 0 - m_Name: Bip01_Spine1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &79449999 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 79449998} - m_LocalRotation: {x: -0.035798647, y: -0.025070062, z: -0.031351734, w: 0.9985525} - m_LocalPosition: {x: -0.09309901, y: -0.00010160353, z: -0.00001898283} - m_LocalScale: {x: 1.0000001, y: 1.0000001, z: 1.0000001} - m_Children: - - {fileID: 1753783802} - m_Father: {fileID: 1655433092} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &89054486 GameObject: m_ObjectHideFlags: 0 @@ -5067,37 +4912,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ClearTime: 2 ---- !u!1 &97375758 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 97375759} - m_Layer: 0 - m_Name: Bip01_R_Forearm - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &97375759 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 97375758} - m_LocalRotation: {x: 0.4131066, y: -0.010442376, z: -0.008282885, w: 0.9105852} - m_LocalPosition: {x: -0.18664853, y: 0.00000008488206, z: 0.00000008891536} - m_LocalScale: {x: 1, y: 0.9999997, z: 1} - m_Children: - - {fileID: 1633920978} - m_Father: {fileID: 688971102} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &108944114 GameObject: m_ObjectHideFlags: 0 @@ -9900,121 +9714,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ClearTime: 2 ---- !u!1 &121286953 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 121286954} - - component: {fileID: 121286958} - - component: {fileID: 121286957} - - component: {fileID: 121286956} - - component: {fileID: 121286955} - m_Layer: 9 - m_Name: LongSword (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &121286954 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 121286953} - m_LocalRotation: {x: -0.20345572, y: -0.07620924, z: 0.29289585, w: -0.93113375} - m_LocalPosition: {x: -0.049, y: -0.11, z: 0.356} - m_LocalScale: {x: 0.01006957, y: 0.014763792, z: 0.9952188} - m_Children: - - {fileID: 1504358518} - - {fileID: 2117647144} - m_Father: {fileID: 1633920978} - m_RootOrder: 5 - m_LocalEulerAnglesHint: {x: 154.942, y: 181.438, z: 145.397} ---- !u!114 &121286955 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 121286953} - m_Enabled: 0 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f6c2c9828fec98747a1b0680f47bed80, type: 3} - m_Name: - m_EditorClassIdentifier: - UseWith2D: 0 - SortingLayerName: - SortingOrder: 0 - PointStart: {fileID: 2117647144} - PointEnd: {fileID: 1504358518} - MaxFrame: 10 - Granularity: 60 - MyColor: {r: 1, g: 1, b: 1, a: 0.5019608} - MyMaterial: {fileID: 2100000, guid: 9db63a4774ae8954ab6f503f10fb20e4, type: 2} ---- !u!65 &121286956 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 121286953} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: 0, y: 0, z: 0} ---- !u!23 &121286957 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 121286953} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: fb1a6b631853ec045bdfb595c327997c, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 ---- !u!33 &121286958 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 121286953} - m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} --- !u!1 &132093821 GameObject: m_ObjectHideFlags: 0 @@ -24364,128 +24063,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &215122227 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 215122228} - m_Layer: 0 - m_Name: Bip01_L_Finger11 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &215122228 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 215122227} - m_LocalRotation: {x: 0.09969733, y: -0.52908367, z: 0.28141063, w: -0.79431677} - m_LocalPosition: {x: -0.029807413, y: 0.00000017342997, z: 0.000000023466209} - m_LocalScale: {x: 1.0000004, y: 0.9999996, z: 1} - m_Children: - - {fileID: 1069267576} - m_Father: {fileID: 510621838} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &217977286 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 217977287} - m_Layer: 0 - m_Name: Bip01_R_Finger3Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &217977287 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 217977286} - m_LocalRotation: {x: 0.00000047609635, y: 0.000000020656456, z: 0.99999994, w: 0.0003451458} - m_LocalPosition: {x: -0.020666676, y: 2.9842794e-15, z: 0.000000028610229} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 266859127} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &266333388 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 266333389} - m_Layer: 0 - m_Name: Bip01_L_Finger0Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &266333389 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 266333388} - m_LocalRotation: {x: -0.000013783456, y: 0.00004436678, z: 0.000020964444, w: 1} - m_LocalPosition: {x: -0.028186912, y: -0.0000011634835, z: 0.0000025939933} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1045163668} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &266859126 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 266859127} - m_Layer: 0 - m_Name: Bip01_R_Finger31 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &266859127 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 266859126} - m_LocalRotation: {x: 0.22376205, y: -0.16694275, z: 0.5855927, w: -0.76101375} - m_LocalPosition: {x: -0.024786694, y: 0.00000001099981, z: -0.0000000080665234} - m_LocalScale: {x: 1.0000002, y: 0.9999999, z: 1} - m_Children: - - {fileID: 217977287} - m_Father: {fileID: 1299840943} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &278122006 GameObject: m_ObjectHideFlags: 0 @@ -24518,99 +24095,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &286502267 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 286502268} - m_Layer: 0 - m_Name: Bip01_R_Finger01 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &286502268 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 286502267} - m_LocalRotation: {x: 0.23811345, y: -0.5529338, z: -0.096442655, w: -0.7926317} - m_LocalPosition: {x: -0.02408105, y: -0.000000080665345, z: 0.000000032266087} - m_LocalScale: {x: 0.9999999, y: 1.0000001, z: 0.99999994} - m_Children: - - {fileID: 552523740} - m_Father: {fileID: 1683679735} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &289668403 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 289668404} - m_Layer: 0 - m_Name: Bip01_L_Forearm - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &289668404 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 289668403} - m_LocalRotation: {x: -0.04445637, y: 0.49212918, z: 0.78363955, w: 0.37648603} - m_LocalPosition: {x: -0.18664832, y: 0.00000011568154, z: -0.0000001098149} - m_LocalScale: {x: 1.0000004, y: 0.99999964, z: 1} - m_Children: - - {fileID: 676438535} - m_Father: {fileID: 42517459} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &298298466 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 298298467} - m_Layer: 0 - m_Name: Bip01_L_Clavicle - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &298298467 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 298298466} - m_LocalRotation: {x: -0.7188245, y: -0.02095972, z: 0.6036799, w: -0.34412593} - m_LocalPosition: {x: 0.03657107, y: 0.017407324, z: 0.08729733} - m_LocalScale: {x: 0.99999994, y: 0.9999998, z: 1} - m_Children: - - {fileID: 42517459} - m_Father: {fileID: 1753783802} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &299052604 GameObject: m_ObjectHideFlags: 0 @@ -29375,36 +28859,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &303817845 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 303817846} - m_Layer: 0 - m_Name: Bip01_HeadNub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &303817846 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 303817845} - m_LocalRotation: {x: -0.00000022500257, y: 1.7347266e-18, z: -1.3877788e-17, w: 1} - m_LocalPosition: {x: -0.08935898, y: 0.000000019073486, z: 0.000000015497209} - m_LocalScale: {x: 1, y: 1.0000001, z: 1} - m_Children: [] - m_Father: {fileID: 988952928} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &340202959 GameObject: m_ObjectHideFlags: 0 @@ -34265,38 +33719,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &388144010 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 388144011} - m_Layer: 0 - m_Name: Bone03 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &388144011 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 388144010} - m_LocalRotation: {x: -0.40651235, y: -0.44444424, z: -0.796884, w: 0.04682911} - m_LocalPosition: {x: -0.08042663, y: 0.018215375, z: 0.058707643} - m_LocalScale: {x: 1.0000002, y: 0.9999995, z: 1.0000005} - m_Children: - - {fileID: 1815866579} - - {fileID: 705589463} - m_Father: {fileID: 1633920978} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &403046859 GameObject: m_ObjectHideFlags: 0 @@ -48595,109 +48017,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &443448212 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 443448213} - m_Layer: 0 - m_Name: Bip01_L_Foot - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &443448213 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 443448212} - m_LocalRotation: {x: -0.06695342, y: 0.046484172, z: 0.044185713, w: 0.99569285} - m_LocalPosition: {x: -0.26188183, y: 0.00000009386549, z: 0.00000042239392} - m_LocalScale: {x: 0.99999994, y: 1, z: 1} - m_Children: - - {fileID: 1844369621} - m_Father: {fileID: 652543287} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &448876709 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 448876710} - m_Layer: 0 - m_Name: Bip01_R_Finger1Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &448876710 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 448876709} - m_LocalRotation: {x: 0.00000041922317, y: 0.00000031242666, z: 0.99999994, w: 0.0003451458} - m_LocalPosition: {x: -0.025208702, y: -5.8264504e-15, z: 0.000000009536743} - m_LocalScale: {x: 0.99999994, y: 1, z: 1.0000001} - m_Children: [] - m_Father: {fileID: 1616512601} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!221 &464821663 -AnimatorOverrideController: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: override controller - m_Controller: {fileID: 9100000, guid: 47311b4ae25969546aa7fca07ea0405a, type: 2} - m_Clips: - - m_OriginalClip: {fileID: 7400000, guid: d1dee14942f17c745bb953c649ee14e5, type: 2} - m_OverrideClip: {fileID: 7400000, guid: 3af4a4fdd9720044bacfd86b0c3435b1, type: 2} ---- !u!1 &480844065 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 480844066} - m_Layer: 0 - m_Name: Bip01_R_Calf - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &480844066 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 480844065} - m_LocalRotation: {x: 0.11130217, y: -0.26709405, z: 0.78367615, w: 0.5496584} - m_LocalPosition: {x: -0.32738468, y: 0.00000023466373, z: -0.0000010068528} - m_LocalScale: {x: 1.0000001, y: 1, z: 1.0000001} - m_Children: - - {fileID: 1924154902} - m_Father: {fileID: 1942416302} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &483744137 GameObject: m_ObjectHideFlags: 0 @@ -53453,67 +52772,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &504974506 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 504974507} - m_Layer: 0 - m_Name: Bip01_L_Toe0Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &504974507 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 504974506} - m_LocalRotation: {x: 0.00000015925002, y: 0.0000005878736, z: 1, w: 1.2959718e-13} - m_LocalPosition: {x: -0.032491323, y: 0.000000039528786, z: -0.000000125209} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1844369621} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &510621837 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 510621838} - m_Layer: 0 - m_Name: Bip01_L_Finger1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &510621838 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 510621837} - m_LocalRotation: {x: 0.027144738, y: 0.56030494, z: -0.24822746, w: 0.7897498} - m_LocalPosition: {x: -0.08424862, y: 0.012339441, z: -0.037419852} - m_LocalScale: {x: 1.0000002, y: 0.9999998, z: 1} - m_Children: - - {fileID: 215122228} - m_Father: {fileID: 676438535} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &519301909 GameObject: m_ObjectHideFlags: 0 @@ -58315,88 +57573,6 @@ Transform: m_Father: {fileID: 1765961530} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &533563346 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 533563347} - - component: {fileID: 533563348} - m_Layer: 0 - m_Name: 40_06_wuqi_2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 0 ---- !u!4 &533563347 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 533563346} - m_LocalRotation: {x: -0, y: -0.2956758, z: -0, w: 0.95528835} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1807710024} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!137 &533563348 -SkinnedMeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 533563346} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: 2fade982e278c14458a9b05f164944cb, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - serializedVersion: 2 - m_Quality: 0 - m_UpdateWhenOffscreen: 0 - m_SkinnedMotionVectors: 1 - m_Mesh: {fileID: 4300002, guid: 9e88de20522c1b34289699be7c70f503, type: 3} - m_Bones: - - {fileID: 1070062290} - - {fileID: 1815866579} - m_BlendShapeWeights: [] - m_RootBone: {fileID: 1815866579} - m_AABB: - m_Center: {x: 0.1254181, y: -0.065377235, z: 0.000000070780516} - m_Extent: {x: 0.2952843, y: 0.2824861, z: 0.02829496} - m_DirtyAABB: 0 --- !u!1 &550979882 GameObject: m_ObjectHideFlags: 0 @@ -63154,36 +62330,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &552523739 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 552523740} - m_Layer: 0 - m_Name: Bip01_R_Finger0Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &552523740 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 552523739} - m_LocalRotation: {x: 0.00000009668988, y: -0.00000016403918, z: 0.99999994, w: -0.0003452789} - m_LocalPosition: {x: -0.028186798, y: -0.0000000667572, z: -3.289813e-14} - m_LocalScale: {x: 1, y: 1.0000001, z: 0.99999994} - m_Children: [] - m_Father: {fileID: 286502268} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &556013143 GameObject: m_ObjectHideFlags: 0 @@ -68008,68 +67154,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} ---- !u!1 &587897794 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 587897795} - m_Layer: 0 - m_Name: Bip01_R_Toe0 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &587897795 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 587897794} - m_LocalRotation: {x: 0.005790743, y: -0.008622324, z: -0.7664677, w: 0.642199} - m_LocalPosition: {x: -0.08594917, y: 0.066251084, z: -0.00000024639624} - m_LocalScale: {x: 1.0000001, y: 0.99999976, z: 1} - m_Children: - - {fileID: 1458551169} - m_Father: {fileID: 1924154902} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &652543286 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 652543287} - m_Layer: 0 - m_Name: Bip01_L_Calf - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &652543287 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 652543286} - m_LocalRotation: {x: 0.2515655, y: -0.0529513, z: 0.33303216, w: 0.9071938} - m_LocalPosition: {x: -0.32738468, y: 0.00000011733185, z: 0.00000058079183} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 443448213} - m_Father: {fileID: 823226517} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &659412353 GameObject: m_ObjectHideFlags: 0 @@ -72825,132 +71909,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &667458326 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 667458327} - m_Layer: 0 - m_Name: Bip01_R_Finger2Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &667458327 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 667458326} - m_LocalRotation: {x: 0.00000019373944, y: 0.0000005065914, z: 0.99999994, w: 0.00034514573} - m_LocalPosition: {x: -0.025772667, y: -0.00000007629395, z: 0.000000028610224} - m_LocalScale: {x: 1.0000001, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 962864598} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &676438534 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 676438535} - m_Layer: 0 - m_Name: Bip01_L_Hand - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &676438535 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 676438534} - m_LocalRotation: {x: 0.96925277, y: 0.00067764515, z: -0.21973807, w: 0.110742226} - m_LocalPosition: {x: -0.172958, y: 0.000000042165926, z: -0.000000049132503} - m_LocalScale: {x: 0.99999994, y: 1, z: 1} - m_Children: - - {fileID: 948485380} - - {fileID: 510621838} - - {fileID: 759460137} - - {fileID: 66730497} - m_Father: {fileID: 289668404} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &677674809 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 677674810} - m_Layer: 0 - m_Name: Bip01_R_Clavicle - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &677674810 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 677674809} - m_LocalRotation: {x: 0.72391057, y: 0.14373451, z: 0.62841547, w: -0.24573968} - m_LocalPosition: {x: 0.047632538, y: 0.026799843, z: -0.07921414} - m_LocalScale: {x: 0.9999999, y: 0.99999976, z: 0.9999999} - m_Children: - - {fileID: 688971102} - m_Father: {fileID: 1753783802} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &681039196 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 681039197} - m_Layer: 0 - m_Name: Bip01_R_Finger2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &681039197 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 681039196} - m_LocalRotation: {x: 0.05401426, y: -0.27949372, z: 0.38071552, w: -0.8797849} - m_LocalPosition: {x: -0.08509593, y: 0.012511395, z: 0.007837344} - m_LocalScale: {x: 1.0000002, y: 0.9999999, z: 1.0000001} - m_Children: - - {fileID: 962864598} - m_Father: {fileID: 1633920978} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &687023027 GameObject: m_ObjectHideFlags: 0 @@ -73098,67 +72056,6 @@ MonoBehaviour: m_BeforeTransparentBundles: [] m_BeforeStackBundles: [] m_AfterStackBundles: [] ---- !u!1 &688971101 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 688971102} - m_Layer: 0 - m_Name: Bip01_R_UpperArm - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &688971102 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 688971101} - m_LocalRotation: {x: 0.49984238, y: -0.4430682, z: 0.26793587, w: -0.6943044} - m_LocalPosition: {x: -0.081466265, y: 0.00000011293165, z: -0.00000009826532} - m_LocalScale: {x: 1, y: 0.99999994, z: 1.0000001} - m_Children: - - {fileID: 97375759} - m_Father: {fileID: 677674810} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &705589462 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 705589463} - m_Layer: 0 - m_Name: Bone04_2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &705589463 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 705589462} - m_LocalRotation: {x: -0.0000005555558, y: -8.3266733e-17, z: 1.38777415e-17, w: 1} - m_LocalPosition: {x: -0.10880185, y: 0.000000076293944, z: -1.3287149e-14} - m_LocalScale: {x: 1, y: 1.0000001, z: 0.99999994} - m_Children: [] - m_Father: {fileID: 388144011} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &729227977 GameObject: m_ObjectHideFlags: 0 @@ -73263,37 +72160,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c37c88af4ec59ad47ab867ec63cd0d76, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &759460136 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 759460137} - m_Layer: 0 - m_Name: Bip01_L_Finger2 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &759460137 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 759460136} - m_LocalRotation: {x: 0.0064848065, y: 0.49832827, z: -0.29367286, w: 0.81571025} - m_LocalPosition: {x: -0.08509573, y: 0.01251139, z: -0.007837229} - m_LocalScale: {x: 1.0000004, y: 0.9999997, z: 1} - m_Children: - - {fileID: 1175863764} - m_Father: {fileID: 676438535} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &771299854 GameObject: m_ObjectHideFlags: 0 @@ -82852,70 +81718,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &815500684 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 815500685} - m_Layer: 0 - m_Name: Bip01_Pelvis - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &815500685 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 815500684} - m_LocalRotation: {x: 0.7422349, y: -0.31331667, z: -0.49591422, w: -0.32402033} - m_LocalPosition: {x: 0.11208117, y: 0.025757672, z: -0.16086535} - m_LocalScale: {x: 0.9999999, y: 1, z: 1} - m_Children: - - {fileID: 823226517} - - {fileID: 1942416302} - - {fileID: 1655433092} - m_Father: {fileID: 48273155} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &823226516 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 823226517} - m_Layer: 0 - m_Name: Bip01_L_Thigh - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &823226517 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 823226516} - m_LocalRotation: {x: -0.122936785, y: 0.86569756, z: 0.07103291, w: 0.48000902} - m_LocalPosition: {x: 0.00000016793128, y: 0.00000016756452, z: 0.085535005} - m_LocalScale: {x: 1.0000002, y: 0.99999994, z: 1.0000001} - m_Children: - - {fileID: 652543287} - m_Father: {fileID: 815500685} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &861741897 GameObject: m_ObjectHideFlags: 0 @@ -83128,129 +81930,6 @@ MonoBehaviour: m_PostInfinity: 2 m_RotationOrder: 4 threshold: 1 ---- !u!1 &948485379 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 948485380} - m_Layer: 0 - m_Name: Bip01_L_Finger0 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &948485380 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 948485379} - m_LocalRotation: {x: 0.23224977, y: 0.5005134, z: -0.28227732, w: 0.78477126} - m_LocalPosition: {x: -0.05137835, y: 0.008330817, z: -0.03716016} - m_LocalScale: {x: 1.0000002, y: 0.9999998, z: 1.0000004} - m_Children: - - {fileID: 1045163668} - m_Father: {fileID: 676438535} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &957057154 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 957057155} - m_Layer: 0 - m_Name: Bip01_L_Finger2Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &957057155 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 957057154} - m_LocalRotation: {x: -0.0000008387114, y: -6.938891e-17, z: -2.7755635e-17, w: 1} - m_LocalPosition: {x: -0.025772514, y: 0.000000038146972, z: 6.750156e-16} - m_LocalScale: {x: 1, y: 1.0000001, z: 1} - m_Children: [] - m_Father: {fileID: 1175863764} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &962864597 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 962864598} - m_Layer: 0 - m_Name: Bip01_R_Finger21 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &962864598 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 962864597} - m_LocalRotation: {x: 0.21696806, y: -0.2956512, z: 0.5288736, w: -0.765381} - m_LocalPosition: {x: -0.03031253, y: -0.000000016133061, z: 0.000000024932872} - m_LocalScale: {x: 1.0000002, y: 0.9999998, z: 1} - m_Children: - - {fileID: 667458327} - m_Father: {fileID: 681039197} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &988952927 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 988952928} - m_Layer: 0 - m_Name: Bip01_Head - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &988952928 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 988952927} - m_LocalRotation: {x: -0.44733796, y: -0.12505329, z: -0.39497983, w: -0.79261684} - m_LocalPosition: {x: -0.046630166, y: -0.000000023466338, z: -0.000000023466345} - m_LocalScale: {x: 0.99999994, y: 0.9999999, z: 1} - m_Children: - - {fileID: 303817846} - m_Father: {fileID: 1753783802} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &998301198 GameObject: m_ObjectHideFlags: 0 @@ -83341,98 +82020,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ClearTime: 2 ---- !u!1 &1045163667 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1045163668} - m_Layer: 0 - m_Name: Bip01_L_Finger01 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1045163668 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1045163667} - m_LocalRotation: {x: -0.07343124, y: 0.29339227, z: -0.44655848, w: 0.84208935} - m_LocalPosition: {x: -0.02408098, y: -0.0000010002474, z: 0.000001968227} - m_LocalScale: {x: 1.0000004, y: 0.9999997, z: 1} - m_Children: - - {fileID: 266333389} - m_Father: {fileID: 948485380} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1069267575 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1069267576} - m_Layer: 0 - m_Name: Bip01_L_Finger1Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1069267576 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1069267575} - m_LocalRotation: {x: -0.00000079494583, y: -4.1633406e-17, z: 5.5511118e-17, w: 1} - m_LocalPosition: {x: -0.025208663, y: -0.000000076293944, z: 5.968559e-15} - m_LocalScale: {x: 1, y: 1.0000001, z: 1.0000001} - m_Children: [] - m_Father: {fileID: 215122228} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1070062289 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1070062290} - m_Layer: 0 - m_Name: Bone01 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1070062290 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1070062289} - m_LocalRotation: {x: -0.27349356, y: 0.024100432, z: -0.9255484, w: 0.26073113} - m_LocalPosition: {x: 0.041816693, y: -0.010132938, z: 0.000000039598987} - m_LocalScale: {x: 1.0000005, y: 0.9999998, z: 0.9999999} - m_Children: - - {fileID: 1731744583} - m_Father: {fileID: 1815866579} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1077360195 GameObject: m_ObjectHideFlags: 0 @@ -102474,37 +101061,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1108681092 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1108681093} - m_Layer: 0 - m_Name: Bone04 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1108681093 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1108681092} - m_LocalRotation: {x: -0.000000048428763, y: 0.00000013411035, z: -0.00000012775088, - w: 1} - m_LocalPosition: {x: -0.11361407, y: 0.000000012999827, z: 0.000000003504331} - m_LocalScale: {x: 0.99999994, y: 1.0000002, z: 0.9999999} - m_Children: [] - m_Father: {fileID: 1815866579} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1141527490 GameObject: m_ObjectHideFlags: 0 @@ -116849,37 +115405,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1175863763 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1175863764} - m_Layer: 0 - m_Name: Bip01_L_Finger21 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1175863764 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1175863763} - m_LocalRotation: {x: 0.09723771, y: -0.6457654, z: 0.2925997, w: -0.6985107} - m_LocalPosition: {x: -0.030312594, y: 0.000000086164974, z: 0.00000006306543} - m_LocalScale: {x: 1.0000004, y: 0.9999996, z: 1} - m_Children: - - {fileID: 957057155} - m_Father: {fileID: 759460137} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1209790437 GameObject: m_ObjectHideFlags: 0 @@ -121680,37 +120205,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ClearTime: 2 ---- !u!1 &1299840942 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1299840943} - m_Layer: 0 - m_Name: Bip01_R_Finger3 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1299840943 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1299840942} - m_LocalRotation: {x: -0.059120826, y: -0.21540852, z: 0.37622803, w: -0.89919764} - m_LocalPosition: {x: -0.08151567, y: 0.013640919, z: -0.01601535} - m_LocalScale: {x: 1.0000004, y: 0.9999998, z: 1.0000001} - m_Children: - - {fileID: 266859127} - m_Father: {fileID: 1633920978} - m_RootOrder: 3 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1314568543 GameObject: m_ObjectHideFlags: 0 @@ -145605,37 +144099,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c37c88af4ec59ad47ab867ec63cd0d76, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &1458551168 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1458551169} - m_Layer: 0 - m_Name: Bip01_R_Toe0Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1458551169 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1458551168} - m_LocalRotation: {x: 0.000001727194, y: 0.000000037252654, z: 0.00000016340393, - w: 1} - m_LocalPosition: {x: -0.03249138, y: 0.000000011962838, z: 5.1514347e-16} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 587897795} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1468232990 GameObject: m_ObjectHideFlags: 0 @@ -159963,36 +158426,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1504358517 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1504358518} - m_Layer: 0 - m_Name: GameObject - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1504358518 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1504358517} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0.466} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 121286954} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1576806749 GameObject: m_ObjectHideFlags: 0 @@ -169611,185 +168044,6 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: ClearTime: 2 ---- !u!1 &1605409009 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1605409010} - - component: {fileID: 1605409011} - m_Layer: 9 - m_Name: 40_06 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1605409010 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1605409009} - m_LocalRotation: {x: -0, y: -0.2956758, z: -0, w: 0.95528835} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1807710024} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!137 &1605409011 -SkinnedMeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1605409009} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 2100000, guid: d743391c976d45f41be9ace4cf3bc3ac, type: 2} - m_StaticBatchInfo: - firstSubMesh: 0 - subMeshCount: 0 - m_StaticBatchRoot: {fileID: 0} - m_ProbeAnchor: {fileID: 0} - m_LightProbeVolumeOverride: {fileID: 0} - m_ScaleInLightmap: 1 - m_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - m_SelectedEditorRenderState: 3 - m_MinimumChartSize: 4 - m_AutoUVMaxDistance: 0.5 - m_AutoUVMaxAngle: 89 - m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 0 - m_SortingLayer: 0 - m_SortingOrder: 0 - serializedVersion: 2 - m_Quality: 0 - m_UpdateWhenOffscreen: 0 - m_SkinnedMotionVectors: 1 - m_Mesh: {fileID: 4300000, guid: 9e88de20522c1b34289699be7c70f503, type: 3} - m_Bones: - - {fileID: 815500685} - - {fileID: 48273155} - - {fileID: 1655433092} - - {fileID: 79449999} - - {fileID: 1753783802} - - {fileID: 988952928} - - {fileID: 298298467} - - {fileID: 42517459} - - {fileID: 289668404} - - {fileID: 676438535} - - {fileID: 948485380} - - {fileID: 1045163668} - - {fileID: 510621838} - - {fileID: 215122228} - - {fileID: 759460137} - - {fileID: 1175863764} - - {fileID: 66730497} - - {fileID: 36032045} - - {fileID: 677674810} - - {fileID: 688971102} - - {fileID: 97375759} - - {fileID: 1633920978} - - {fileID: 1683679735} - - {fileID: 286502268} - - {fileID: 1858005140} - - {fileID: 1616512601} - - {fileID: 681039197} - - {fileID: 962864598} - - {fileID: 1299840943} - - {fileID: 266859127} - - {fileID: 823226517} - - {fileID: 652543287} - - {fileID: 443448213} - - {fileID: 1844369621} - - {fileID: 1942416302} - - {fileID: 480844066} - - {fileID: 1924154902} - - {fileID: 587897795} - m_BlendShapeWeights: [] - m_RootBone: {fileID: 48273155} - m_AABB: - m_Center: {x: -0.0097737685, y: -0.011292309, z: -0.109718874} - m_Extent: {x: 0.21953902, y: 0.2945871, z: 0.5579216} - m_DirtyAABB: 0 ---- !u!1 &1609580353 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1609580354} - m_Layer: 0 - m_Name: Bip01_L_Finger3Nub - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1609580354 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1609580353} - m_LocalRotation: {x: -0.00000082966125, y: 2.0816675e-16, z: 7.979745e-17, w: 1} - m_LocalPosition: {x: -0.020666694, y: -0.000000019073486, z: -0.000000019073486} - m_LocalScale: {x: 1, y: 0.99999994, z: 0.99999994} - m_Children: [] - m_Father: {fileID: 36032045} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1616512600 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1616512601} - m_Layer: 0 - m_Name: Bip01_R_Finger11 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1616512601 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1616512600} - m_LocalRotation: {x: 0.22282174, y: -0.39188045, z: 0.46784043, w: -0.760201} - m_LocalPosition: {x: -0.029807415, y: 0.0000000043999306, z: 0.0000001129314} - m_LocalScale: {x: 1.0000005, y: 0.9999998, z: 1.0000001} - m_Children: - - {fileID: 448876710} - m_Father: {fileID: 1858005140} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1618251392 GameObject: m_ObjectHideFlags: 0 @@ -179306,42 +177560,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1633920977 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1633920978} - m_Layer: 0 - m_Name: Bip01_R_Hand - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1633920978 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1633920977} - m_LocalRotation: {x: -0.19619876, y: -0.112201065, z: 0.917084, w: -0.32844177} - m_LocalPosition: {x: -0.17295843, y: 0.00000013098686, z: -0.000000053743214} - m_LocalScale: {x: 1.0000002, y: 0.9999997, z: 1.0000004} - m_Children: - - {fileID: 1683679735} - - {fileID: 1858005140} - - {fileID: 681039197} - - {fileID: 1299840943} - - {fileID: 388144011} - - {fileID: 121286954} - m_Father: {fileID: 97375759} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1639626541 GameObject: m_ObjectHideFlags: 0 @@ -193622,37 +191840,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1655433091 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1655433092} - m_Layer: 0 - m_Name: Bip01_Spine - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1655433092 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1655433091} - m_LocalRotation: {x: -0.13580066, y: 0.0089576235, z: -0.09931018, w: 0.98570555} - m_LocalPosition: {x: -0.05737207, y: 0.0035605342, z: 0.0033644496} - m_LocalScale: {x: 1, y: 0.99999994, z: 1} - m_Children: - - {fileID: 79449999} - m_Father: {fileID: 815500685} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1680813692 GameObject: m_ObjectHideFlags: 0 @@ -203174,37 +201361,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1683679734 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1683679735} - m_Layer: 0 - m_Name: Bip01_R_Finger0 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1683679735 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1683679734} - m_LocalRotation: {x: -0.59966224, y: 0.4371646, z: -0.083232, w: 0.66510504} - m_LocalPosition: {x: -0.05137855, y: 0.008330947, z: 0.037160244} - m_LocalScale: {x: 1.0000002, y: 0.99999964, z: 1.0000001} - m_Children: - - {fileID: 286502268} - m_Father: {fileID: 1633920978} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1702070933 GameObject: m_ObjectHideFlags: 0 @@ -212772,37 +210928,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 8 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1731744582 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1731744583} - m_Layer: 0 - m_Name: Bone02 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1731744583 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1731744582} - m_LocalRotation: {x: -0.0000000037253085, y: -1.3877788e-16, z: -1.3010427e-17, - w: 1} - m_LocalPosition: {x: -0.36140585, y: -0.00000009875901, z: -0.0000000035386658} - m_LocalScale: {x: 1, y: 1.0000002, z: 0.9999999} - m_Children: [] - m_Father: {fileID: 1070062290} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1740894742 GameObject: m_ObjectHideFlags: 0 @@ -212907,83 +211032,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c37c88af4ec59ad47ab867ec63cd0d76, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &1748330874 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1748330876} - - component: {fileID: 1748330875} - m_Layer: 0 - m_Name: RootActionTool - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1748330875 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1748330874} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f2a6b1bbe8a21fe44b9a3626c5c94ec2, type: 3} - m_Name: - m_EditorClassIdentifier: ---- !u!4 &1748330876 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1748330874} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1870579874} - m_Father: {fileID: 0} - m_RootOrder: 11 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1753783801 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1753783802} - m_Layer: 0 - m_Name: Bip01_Neck - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1753783802 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1753783801} - m_LocalRotation: {x: -0.2784383, y: -0.04832153, z: -0.33225697, w: 0.899857} - m_LocalPosition: {x: -0.14913236, y: 0.006819147, z: 0.0000020914397} - m_LocalScale: {x: 0.99999994, y: 0.9999999, z: 0.9999999} - m_Children: - - {fileID: 988952928} - - {fileID: 298298467} - - {fileID: 677674810} - m_Father: {fileID: 79449999} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1765961529 GameObject: m_ObjectHideFlags: 0 @@ -217819,148 +215867,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1807710023 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1807710024} - - component: {fileID: 1807710026} - - component: {fileID: 1807710025} - m_Layer: 0 - m_Name: Erika_Robot(Clone) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1807710024 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1807710023} - m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.7500005, y: 0.75, z: 0.7500005} - m_Children: - - {fileID: 1605409010} - - {fileID: 533563347} - - {fileID: 48273155} - m_Father: {fileID: 1870579874} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1807710025 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1807710023} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 75a2e2ebdc58ab940858d821f8a1ffa0, type: 3} - m_Name: - m_EditorClassIdentifier: - showGizmos: 1 - rootBone: {fileID: 48273155} - afterImageAvatarPath: Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot_AfterImage.prefab - snapshotAvatarPath: Assets/Bundle/Unit/PC/Erika/Prefabs/Erika_Robot_Snapshot.prefab - m_Bones: - m_keys: 0000000001000000020000000300000004000000050000000600000007000000080000001400000015000000160000001700000018000000190000001a0000001b0000001c0000001d0000001e0000001f0000002000000021000000220000002300000024000000250000002600000028000000290000002a0000002b0000002c0000002d0000002e0000002f000000300000003100000032000000330000003400000035000000360000003700000038000000390000003a0000003c0000003d0000003e0000003f00000050000000510000005200000053000000 - m_values: - - {fileID: 815500685} - - {fileID: 1655433092} - - {fileID: 79449999} - - {fileID: 0} - - {fileID: 1753783802} - - {fileID: 988952928} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 298298467} - - {fileID: 42517459} - - {fileID: 289668404} - - {fileID: 676438535} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 677674810} - - {fileID: 688971102} - - {fileID: 97375759} - - {fileID: 1633920978} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 0} - - {fileID: 823226517} - - {fileID: 652543287} - - {fileID: 443448213} - - {fileID: 1844369621} - - {fileID: 1942416302} - - {fileID: 480844066} - - {fileID: 1924154902} - - {fileID: 587897795} - m_ReferencePoints: - m_keys: 0100000014000000 - m_values: - - {fileID: 0} - - {fileID: 0} - snapshotBound: 5 - m_MainRenderer: - tag: 0 - renderer: {fileID: 1605409011} - m_Renderers: - - tag: 0 - renderer: {fileID: 1605409011} - - tag: 1 - renderer: {fileID: 121286957} ---- !u!95 &1807710026 -Animator: - serializedVersion: 3 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1807710023} - m_Enabled: 1 - m_Avatar: {fileID: 9000000, guid: 9e88de20522c1b34289699be7c70f503, type: 3} - m_Controller: {fileID: 464821663} - m_CullingMode: 0 - m_UpdateMode: 0 - m_ApplyRootMotion: 0 - m_LinearVelocityBlending: 0 - m_WarningMessage: - m_HasTransformHierarchy: 1 - m_AllowConstantClipSamplingOptimization: 1 - m_KeepAnimatorControllerStateOnDisable: 0 --- !u!1 &1811105936 GameObject: m_ObjectHideFlags: 0 @@ -227473,38 +225379,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1815866578 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1815866579} - m_Layer: 0 - m_Name: 40_06_wuqi - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1815866579 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1815866578} - m_LocalRotation: {x: 0.93394923, y: -0.16590387, z: -0.31509015, w: 0.030545352} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.99999994, y: 1, z: 1} - m_Children: - - {fileID: 1070062290} - - {fileID: 1108681093} - m_Father: {fileID: 388144011} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1819948107 GameObject: m_ObjectHideFlags: 0 @@ -237015,99 +234889,6 @@ ParticleSystem: m_PostInfinity: 2 m_RotationOrder: 4 vectorLabel1_3: W ---- !u!1 &1844369620 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1844369621} - m_Layer: 0 - m_Name: Bip01_L_Toe0 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1844369621 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1844369620} - m_LocalRotation: {x: -0.05532536, y: -0.02546245, z: -0.7192968, w: 0.6920281} - m_LocalPosition: {x: -0.085949264, y: 0.06625112, z: 0.0000001466643} - m_LocalScale: {x: 1.0000002, y: 1, z: 1} - m_Children: - - {fileID: 504974507} - m_Father: {fileID: 443448213} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1858005139 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1858005140} - m_Layer: 0 - m_Name: Bip01_R_Finger1 - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1858005140 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1858005139} - m_LocalRotation: {x: 0.12670393, y: -0.314971, z: 0.27864772, w: -0.89838463} - m_LocalPosition: {x: -0.08424888, y: 0.012339574, z: 0.037419893} - m_LocalScale: {x: 1.0000002, y: 0.99999964, z: 1} - m_Children: - - {fileID: 1616512601} - m_Father: {fileID: 1633920978} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1870579873 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1870579874} - m_Layer: 0 - m_Name: UnitRoot - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1870579874 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1870579873} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0.6930751, y: 0.051607944, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: - - {fileID: 1807710024} - m_Father: {fileID: 1748330876} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1911232878 GameObject: m_ObjectHideFlags: 0 @@ -246731,68 +244512,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c37c88af4ec59ad47ab867ec63cd0d76, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!1 &1924154901 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1924154902} - m_Layer: 0 - m_Name: Bip01_R_Foot - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1924154902 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1924154901} - m_LocalRotation: {x: 0.20757183, y: 0.030622855, z: -0.06844199, w: 0.9753419} - m_LocalPosition: {x: -0.26188183, y: 0.00000014079814, z: -0.0000007274562} - m_LocalScale: {x: 1.0000001, y: 1, z: 1} - m_Children: - - {fileID: 587897795} - m_Father: {fileID: 480844066} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1942416301 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1942416302} - m_Layer: 0 - m_Name: Bip01_R_Thigh - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1942416302 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1942416301} - m_LocalRotation: {x: -0.3942538, y: 0.91147274, z: -0.09165172, w: -0.07335836} - m_LocalPosition: {x: -0.00000030799623, y: -0.0000001176985, z: -0.08553498} - m_LocalScale: {x: 1, y: 0.99999994, z: 1} - m_Children: - - {fileID: 480844066} - m_Father: {fileID: 815500685} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1963377758 GameObject: m_ObjectHideFlags: 0 @@ -261350,36 +259069,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 9 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &2117647143 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2117647144} - m_Layer: 0 - m_Name: GameObject (1) - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2117647144 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2117647143} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0, y: 0, z: -0.489} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 121286954} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2137539566 GameObject: m_ObjectHideFlags: 0 diff --git a/Erika/Assets/Bundle/Shaders/Include.meta b/Erika/Assets/Bundle/Shaders/Include.meta deleted file mode 100644 index 2666365a..00000000 --- a/Erika/Assets/Bundle/Shaders/Include.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dc32af12c5122994d8791378227adeb6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Shaders/Unit/Effect.meta b/Erika/Assets/Bundle/Shaders/Unit/Effect.meta deleted file mode 100644 index 7df9a033..00000000 --- a/Erika/Assets/Bundle/Shaders/Unit/Effect.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9cc4684b9f432f149b16a51f148c9490 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/UI.meta b/Erika/Assets/Bundle/UI.meta deleted file mode 100644 index 0914914c..00000000 --- a/Erika/Assets/Bundle/UI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4392471259b05a74a82a4bc72b510eb1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta b/Erika/Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta deleted file mode 100644 index ca7266b0..00000000 --- a/Erika/Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a1d7b6e0d8fb1a642a65011fb6cd7d89 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta b/Erika/Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta deleted file mode 100644 index 142f5872..00000000 --- a/Erika/Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6ad7401709700f34db2b795830937d76 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/NPC.meta b/Erika/Assets/Bundle/Unit/NPC.meta deleted file mode 100644 index eeea13e1..00000000 --- a/Erika/Assets/Bundle/Unit/NPC.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8ced034d375cdfa488814663ea17a79b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_3.asset b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_3.asset index a418da61..cc0244ea 100644 --- a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_3.asset +++ b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_3.asset @@ -76,13 +76,9 @@ MonoBehaviour: throwBoxes: [] blockBoxes: [] defendBoxes: [] - overrideRootMotion: 1 + overrideRootMotion: 0 rootMotionOverrideData: - positions: - - position: {x: 0, y: 0, z: 0} - frame: 0 - - position: {x: 1.42, y: 0, z: 0} - frame: 25 + positions: [] speedCurve: serializedVersion: 2 m_Curve: @@ -146,8 +142,10 @@ MonoBehaviour: startFrame: 9 effectPath: Assets/Art/Vfx/Sword slash VFX/Prefabs/Sword Slash 9.prefab attached: 1 - attachNode: 0 - bone: + parentNode: 0 + bonePath: + bone: 0 + referencePoint: 0 position: {x: 0, y: 1.2, z: 0} rotation: {x: -85.16, y: 0, z: 0} scale: {x: 0.7, y: 0.7, z: 0.7} diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_4.asset b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_4.asset index 822adaed..884d06a3 100644 --- a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_4.asset +++ b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_4.asset @@ -114,21 +114,9 @@ MonoBehaviour: throwBoxes: [] blockBoxes: [] defendBoxes: [] - overrideRootMotion: 1 + overrideRootMotion: 0 rootMotionOverrideData: - positions: - - position: {x: 0, y: 0, z: 0} - frame: 0 - - position: {x: 0.994, y: 0.214, z: 0} - frame: 9 - - position: {x: 1.245, y: 0.251, z: 0} - frame: 16 - - position: {x: 1.422, y: 0.27, z: 0} - frame: 19 - - position: {x: 1.487, y: 0.27, z: 0} - frame: 30 - - position: {x: 1.552, y: 0.307, z: 0} - frame: 45 + positions: [] speedCurve: serializedVersion: 2 m_Curve: @@ -216,8 +204,10 @@ MonoBehaviour: startFrame: 12 effectPath: Assets/Art/Vfx/Sword slash VFX/Prefabs/Sword Slash 9.prefab attached: 1 - attachNode: 0 - bone: + parentNode: 0 + bonePath: + bone: 0 + referencePoint: 0 position: {x: 0, y: 0.3, z: 0} rotation: {x: 30.204, y: 15.196, z: -14.663} scale: {x: 0.7, y: 0.7, z: 0.7} diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_5.asset b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_5.asset index 86c2fbf8..4734745d 100644 --- a/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_5.asset +++ b/Erika/Assets/Bundle/Unit/PC/Erika/AnimationData/Air_Combo03_Z0_5.asset @@ -129,8 +129,10 @@ MonoBehaviour: startFrame: 17 effectPath: Assets/Art/Vfx/Sword slash VFX/Prefabs/Sword Slash 9.prefab attached: 1 - attachNode: 0 - bone: + parentNode: 0 + bonePath: + bone: 0 + referencePoint: 0 position: {x: 0, y: 1.7, z: 0} rotation: {x: 0, y: 90.00001, z: 270} scale: {x: 0.7, y: 0.7, z: -0.7} diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta b/Erika/Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta deleted file mode 100644 index 8c41a6b2..00000000 --- a/Erika/Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5dc1b71affc68b54594096a1b96a5c00 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/Models.meta b/Erika/Assets/Bundle/Unit/PC/Erika/Models.meta deleted file mode 100644 index 11148d17..00000000 --- a/Erika/Assets/Bundle/Unit/PC/Erika/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d712421d808a43438a43d8a5d34effe -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/Erika/UnitData.meta b/Erika/Assets/Bundle/Unit/PC/Erika/UnitData.meta deleted file mode 100644 index 7d4b13eb..00000000 --- a/Erika/Assets/Bundle/Unit/PC/Erika/UnitData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 922befa8a94692845b88500a23229d7f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta deleted file mode 100644 index f5434a00..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 07c3b2bf6cb8cc2498422bbb105cbad8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta deleted file mode 100644 index 4ed2c938..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 827d77abe87680a47ae2d71a9e953a18 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta deleted file mode 100644 index 43a52cd1..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7a2b72fbb41383047ac45e6c22ea9663 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta deleted file mode 100644 index 85d58a8c..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b2b0838fb0603964e99904eefe81ad7f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta deleted file mode 100644 index dd867045..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1c8a678ea9e801f439a1003d04f33cf5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta deleted file mode 100644 index dc530723..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ebf636c7cf7b1934b885298ce1f5f42e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta deleted file mode 100644 index b28b6f04..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2022e8298d3a8624992143eb57c0f8ac -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta deleted file mode 100644 index eeca0d3b..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f6aa859c834c51f498ef0b3c3b83a0f5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta b/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta deleted file mode 100644 index 7f91da28..00000000 --- a/Erika/Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: df69962f5b01e444a8bea87e31c7d0a4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Bundle/Unit/Prop.meta b/Erika/Assets/Bundle/Unit/Prop.meta deleted file mode 100644 index affd6eed..00000000 --- a/Erika/Assets/Bundle/Unit/Prop.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dafc173db1ebeab4c80641cc3d4fa528 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Art/Models/Characters/Erika2.meta b/Erika/Assets/ConsolePro.meta index fd7369d9..36581d21 100644 --- a/Erika/Assets/Art/Models/Characters/Erika2.meta +++ b/Erika/Assets/ConsolePro.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 077f81003f9fc564791cce182048c2b0 +guid: 4532812c3e71f7d4897599db977b58ce folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/ConsolePro/ConsoleProDebug.cs b/Erika/Assets/ConsolePro/ConsoleProDebug.cs new file mode 100644 index 00000000..629d6266 --- /dev/null +++ b/Erika/Assets/ConsolePro/ConsoleProDebug.cs @@ -0,0 +1,99 @@ +using UnityEngine; +using System; +#if UNITY_EDITOR +using System.Reflection; +#endif + +public static class ConsoleProDebug +{ + // Clear the console and the native console + public static void Clear() + { + #if UNITY_EDITOR + if(ConsoleClearMethod != null) + { + ConsoleClearMethod.Invoke(null, null); + } + #endif + } + + // Send a log to a specific filter regardless of contents + // Ex: ConsoleProDebug.LogToFilter("Hi", "CustomFilter"); + public static void LogToFilter(string inLog, string inFilterName, UnityEngine.Object inContext = null) + { + Debug.Log(inLog + "\nCPAPI:{\"cmd\":\"Filter\", \"name\":\"" + inFilterName + "\"}", inContext); + } + + // Send a log as a regular log but change its type in ConsolePro + // Ex: ConsoleProDebug.LogAsType("Hi", "Error"); + public static void LogAsType(string inLog, string inTypeName, UnityEngine.Object inContext = null) + { + Debug.Log(inLog + "\nCPAPI:{\"cmd\":\"LogType\", \"name\":\"" + inTypeName + "\"}", inContext); + } + + // Watch a variable. This will only produce one log entry regardless of how many times it is logged, allowing you to track variables without spam. + // Ex: + // void Update() { + // ConsoleProDebug.Watch("Player X Position", transform.position.x); + // } + public static void Watch(string inName, string inValue) + { + Debug.Log(inName + " : " + inValue + "\nCPAPI:{\"cmd\":\"Watch\", \"name\":\"" + inName + "\"}"); + } + + public static void Search(string inText) + { + Debug.Log("\nCPAPI:{\"cmd\":\"Search\", \"text\":\"" + inText + "\"}"); + } + + #if UNITY_EDITOR + // Reflection calls to access Console Pro from runtime + private static bool _checkedConsoleClearMethod = false; + private static MethodInfo _consoleClearMethod = null; + private static MethodInfo ConsoleClearMethod + { + get + { + if(_consoleClearMethod == null || !_checkedConsoleClearMethod) + { + _checkedConsoleClearMethod = true; + if(ConsoleWindowType == null) + { + return null; + } + + _consoleClearMethod = ConsoleWindowType.GetMethod("ClearEntries", BindingFlags.Static | BindingFlags.Public); + } + + return _consoleClearMethod; + } + } + + private static bool _checkedConsoleWindowType = false; + private static Type _consoleWindowType = null; + private static Type ConsoleWindowType + { + get + { + if(_consoleWindowType == null || !_checkedConsoleWindowType) + { + _checkedConsoleWindowType = true; + Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); + for(int iAssembly = 0; iAssembly < assemblies.Length; iAssembly++) + { + Type[] types = assemblies[iAssembly].GetTypes(); + for(int iType = 0; iType < types.Length; iType++) + { + if(types[iType].Name == "ConsolePro3Window") + { + _consoleWindowType = types[iType]; + } + } + } + } + + return _consoleWindowType; + } + } + #endif +}
\ No newline at end of file diff --git a/Erika/Assets/ConsolePro/ConsoleProDebug.cs.meta b/Erika/Assets/ConsolePro/ConsoleProDebug.cs.meta new file mode 100644 index 00000000..56fa712f --- /dev/null +++ b/Erika/Assets/ConsolePro/ConsoleProDebug.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 30f42e8a12eb842acbe9a63057fb00e4 +timeCreated: 1469329295 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Editor Console Pro Documentation.pdf b/Erika/Assets/ConsolePro/Editor Console Pro Documentation.pdf Binary files differnew file mode 100644 index 00000000..c57db87e --- /dev/null +++ b/Erika/Assets/ConsolePro/Editor Console Pro Documentation.pdf diff --git a/Erika/Assets/ConsolePro/Editor Console Pro Documentation.pdf.meta b/Erika/Assets/ConsolePro/Editor Console Pro Documentation.pdf.meta new file mode 100644 index 00000000..ba3a58a1 --- /dev/null +++ b/Erika/Assets/ConsolePro/Editor Console Pro Documentation.pdf.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5de782a9528f04b41a8ba70afba32a61 +timeCreated: 1498113024 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Art/Vfx/GrabSquaresEffect/AbstractWiresEffect/Scripts.meta b/Erika/Assets/ConsolePro/Editor.meta index b76e98a5..2495da64 100644 --- a/Erika/Assets/Art/Vfx/GrabSquaresEffect/AbstractWiresEffect/Scripts.meta +++ b/Erika/Assets/ConsolePro/Editor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 20381b3eecfbfe34a9d9222868969d29 +guid: 02a6df6277fde43919070571a5077284 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/ConsolePro/Editor/ConsolePro.Editor.dll b/Erika/Assets/ConsolePro/Editor/ConsolePro.Editor.dll Binary files differnew file mode 100644 index 00000000..287c39c6 --- /dev/null +++ b/Erika/Assets/ConsolePro/Editor/ConsolePro.Editor.dll diff --git a/Erika/Assets/ConsolePro/Editor/ConsolePro.Editor.dll.meta b/Erika/Assets/ConsolePro/Editor/ConsolePro.Editor.dll.meta new file mode 100644 index 00000000..a1b21a16 --- /dev/null +++ b/Erika/Assets/ConsolePro/Editor/ConsolePro.Editor.dll.meta @@ -0,0 +1,30 @@ +fileFormatVersion: 2 +guid: a2284c517ee274c19a6ba4c1a8c96fb6 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + - first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta b/Erika/Assets/ConsolePro/Remote.meta index 41200932..b7ebf4d5 100644 --- a/Erika/Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta +++ b/Erika/Assets/ConsolePro/Remote.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: abff7cb61c760094f8ab9437379e0f2c +guid: 0a8d4e08480874124a70e774ddce39e6 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/ConsolePro/Remote/ConsoleProRemoteServer.cs b/Erika/Assets/ConsolePro/Remote/ConsoleProRemoteServer.cs new file mode 100644 index 00000000..f9ffa3e7 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/ConsoleProRemoteServer.cs @@ -0,0 +1,241 @@ +// Uncomment to use in Editor +// #define USECONSOLEPROREMOTESERVERINEDITOR + +#if (UNITY_WP_8_1 || UNITY_WSA) + #define UNSUPPORTEDCONSOLEPROREMOTESERVER +#endif + +#if (!UNITY_EDITOR && DEBUG) || (UNITY_EDITOR && USECONSOLEPROREMOTESERVERINEDITOR) + #if !UNSUPPORTEDCONSOLEPROREMOTESERVER + #define USECONSOLEPROREMOTESERVER + #endif +#endif + +#if UNITY_EDITOR && !USECONSOLEPROREMOTESERVER +#elif UNSUPPORTEDCONSOLEPROREMOTESERVER +#elif !USECONSOLEPROREMOTESERVER +#else +using System; +using System.Collections.Generic; +#endif + +using UnityEngine; + +#if USECONSOLEPROREMOTESERVER +using FlyingWormConsole3.LiteNetLib; +using FlyingWormConsole3.LiteNetLib.Utils; +#endif + +namespace FlyingWormConsole3 +{ + #if USECONSOLEPROREMOTESERVER +public class ConsoleProRemoteServer : MonoBehaviour, INetEventListener + #else +public class ConsoleProRemoteServer : MonoBehaviour + #endif +{ + public bool useNATPunch = false; + public int port = 51000; + + #if UNITY_EDITOR && !USECONSOLEPROREMOTESERVER + + #elif UNSUPPORTEDCONSOLEPROREMOTESERVER + + public void Awake() + { + Debug.Log("Console Pro Remote Server is not supported on this platform"); + } + + #elif !USECONSOLEPROREMOTESERVER + + public void Awake() + { + Debug.Log("Console Pro Remote Server is disabled in release mode, please use a Development build or define DEBUG to use it"); + } + + #else + + private NetManager _netServer; + private NetPeer _ourPeer; + private NetDataWriter _dataWriter; + + [System.SerializableAttribute] + public class QueuedLog + { + public string timestamp; + public string message; + public string logType; + } + + [NonSerializedAttribute] + public List<QueuedLog> logs = new List<QueuedLog>(); + + private static ConsoleProRemoteServer instance = null; + + void Awake() + { + if(instance != null) + { + Destroy(gameObject); + } + + instance = this; + + DontDestroyOnLoad(gameObject); + + Debug.Log("Starting Console Pro Server on port : " + port); + + _dataWriter = new NetDataWriter(); + _netServer = new NetManager(this, 100, "ConsolePro"); + _netServer.Start(port); + _netServer.DiscoveryEnabled = true; + _netServer.UpdateTime = 15; + _netServer.MergeEnabled = true; + _netServer.NatPunchEnabled = useNATPunch; + } + + void OnDestroy() + { + if(_netServer != null) + { + _netServer.Stop(); + } + } + + public void OnPeerConnected(NetPeer peer) + { + Debug.Log("Connected to " + peer.EndPoint); + _ourPeer = peer; + } + + public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo) + { + Debug.Log("Disconnected from " + peer.EndPoint + ", info: " + disconnectInfo.Reason); + if (peer == _ourPeer) + { + _ourPeer = null; + } + } + + public void OnNetworkReceive(NetPeer peer, NetDataReader reader) + { + + } + + public void OnPeerDisconnected(NetPeer peer, DisconnectReason reason, int socketErrorCode) + { + + } + + public void OnNetworkError(NetEndPoint endPoint, int socketErrorCode) + { + } + + public void OnNetworkReceiveUnconnected(NetEndPoint remoteEndPoint, NetDataReader reader, UnconnectedMessageType messageType) + { + if (messageType == UnconnectedMessageType.DiscoveryRequest) + { + // Debug.Log("[SERVER] Received discovery request. Send discovery response"); + _netServer.SendDiscoveryResponse(new byte[] {1}, remoteEndPoint); + } + } + + public void OnNetworkLatencyUpdate(NetPeer peer, int latency) + { + + } + + + #if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 + + void OnEnable() + { + Application.RegisterLogCallback(LogCallback); + } + + void Update() + { + Application.RegisterLogCallback(LogCallback); + } + + void OnDisable() + { + Application.RegisterLogCallback(null); + } + + #else + + void OnEnable() + { + Application.logMessageReceivedThreaded += LogCallback; + } + + void OnDisable() + { + Application.logMessageReceivedThreaded -= LogCallback; + } + + #endif + + public void LogCallback(string logString, string stackTrace, LogType type) + { + if(!logString.StartsWith("CPIGNORE")) + { + QueueLog(logString, stackTrace, type); + } + } + + void QueueLog(string logString, string stackTrace, LogType type) + { + if(logs.Count > 1000) + { + while(logs.Count > 1000) + { + logs.RemoveAt(0); + } + } + + #if CSHARP_7_3_OR_NEWER + logString = $"{logString}\n{stackTrace}\n"; + logs.Add(new QueuedLog() { message = logString, logType = type.ToString(), timestamp = $"[{DateTime.Now.ToString("HH:mm:ss")}]" } ); + #else + logString = logString + "\n" + stackTrace + "\n"; + logs.Add(new QueuedLog() { message = logString, logType = type.ToString(), timestamp = "[" + DateTime.Now.ToString("HH:mm:ss") + "]" } ); + #endif + } + + void LateUpdate() + { + if(_netServer == null) + { + return; + } + + _netServer.PollEvents(); + + if(_ourPeer == null) + { + return; + } + + if(logs.Count <= 0) + { + return; + } + + string cMessage = ""; + + foreach(var cLog in logs) + { + cMessage = JsonUtility.ToJson(cLog); + _dataWriter.Reset(); + _dataWriter.Put(cMessage); + _ourPeer.Send(_dataWriter, SendOptions.ReliableOrdered); + } + + logs.Clear(); + } + + #endif +} +}
\ No newline at end of file diff --git a/Erika/Assets/ConsolePro/Remote/ConsoleProRemoteServer.cs.meta b/Erika/Assets/ConsolePro/Remote/ConsoleProRemoteServer.cs.meta new file mode 100644 index 00000000..f7064638 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/ConsoleProRemoteServer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d6bcfaced529e418bb75980b297fda2a +timeCreated: 1437614101 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib.meta new file mode 100644 index 00000000..82b978a3 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2c6bd635eeaa04c228b6d342c4758ad7 +folderAsset: yes +timeCreated: 1494014730 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/FastBitConverter.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/FastBitConverter.cs new file mode 100644 index 00000000..173b8223 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/FastBitConverter.cs @@ -0,0 +1,120 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System.Runtime.InteropServices; + +namespace FlyingWormConsole3.LiteNetLib.Utils +{ + public static class FastBitConverter + { + [StructLayout(LayoutKind.Explicit)] + private struct ConverterHelperDouble + { + [FieldOffset(0)] + public ulong Along; + + [FieldOffset(0)] + public double Adouble; + } + + [StructLayout(LayoutKind.Explicit)] + private struct ConverterHelperFloat + { + [FieldOffset(0)] + public int Aint; + + [FieldOffset(0)] + public float Afloat; + } + + private static void WriteLittleEndian(byte[] buffer, int offset, ulong data) + { +#if BIGENDIAN + buffer[offset + 7] = (byte)(data); + buffer[offset + 6] = (byte)(data >> 8); + buffer[offset + 5] = (byte)(data >> 16); + buffer[offset + 4] = (byte)(data >> 24); + buffer[offset + 3] = (byte)(data >> 32); + buffer[offset + 2] = (byte)(data >> 40); + buffer[offset + 1] = (byte)(data >> 48); + buffer[offset ] = (byte)(data >> 56); +#else + buffer[offset] = (byte)(data); + buffer[offset + 1] = (byte)(data >> 8); + buffer[offset + 2] = (byte)(data >> 16); + buffer[offset + 3] = (byte)(data >> 24); + buffer[offset + 4] = (byte)(data >> 32); + buffer[offset + 5] = (byte)(data >> 40); + buffer[offset + 6] = (byte)(data >> 48); + buffer[offset + 7] = (byte)(data >> 56); +#endif + } + + private static void WriteLittleEndian(byte[] buffer, int offset, int data) + { +#if BIGENDIAN + buffer[offset + 3] = (byte)(data); + buffer[offset + 2] = (byte)(data >> 8); + buffer[offset + 1] = (byte)(data >> 16); + buffer[offset ] = (byte)(data >> 24); +#else + buffer[offset] = (byte)(data); + buffer[offset + 1] = (byte)(data >> 8); + buffer[offset + 2] = (byte)(data >> 16); + buffer[offset + 3] = (byte)(data >> 24); +#endif + } + + public static void WriteLittleEndian(byte[] buffer, int offset, short data) + { +#if BIGENDIAN + buffer[offset + 1] = (byte)(data); + buffer[offset ] = (byte)(data >> 8); +#else + buffer[offset] = (byte)(data); + buffer[offset + 1] = (byte)(data >> 8); +#endif + } + + public static void GetBytes(byte[] bytes, int startIndex, double value) + { + ConverterHelperDouble ch = new ConverterHelperDouble { Adouble = value }; + WriteLittleEndian(bytes, startIndex, ch.Along); + } + + public static void GetBytes(byte[] bytes, int startIndex, float value) + { + ConverterHelperFloat ch = new ConverterHelperFloat { Afloat = value }; + WriteLittleEndian(bytes, startIndex, ch.Aint); + } + + public static void GetBytes(byte[] bytes, int startIndex, short value) + { + WriteLittleEndian(bytes, startIndex, value); + } + + public static void GetBytes(byte[] bytes, int startIndex, ushort value) + { + WriteLittleEndian(bytes, startIndex, (short)value); + } + + public static void GetBytes(byte[] bytes, int startIndex, int value) + { + WriteLittleEndian(bytes, startIndex, value); + } + + public static void GetBytes(byte[] bytes, int startIndex, uint value) + { + WriteLittleEndian(bytes, startIndex, (int)value); + } + + public static void GetBytes(byte[] bytes, int startIndex, long value) + { + WriteLittleEndian(bytes, startIndex, (ulong)value); + } + + public static void GetBytes(byte[] bytes, int startIndex, ulong value) + { + WriteLittleEndian(bytes, startIndex, value); + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/FastBitConverter.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/FastBitConverter.cs.meta new file mode 100644 index 00000000..0e199811 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/FastBitConverter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 55df0de9a58e74c9395dfe5ffdab9a5a +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/INetEventListener.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/INetEventListener.cs new file mode 100644 index 00000000..1d4408ef --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/INetEventListener.cs @@ -0,0 +1,128 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using FlyingWormConsole3.LiteNetLib.Utils; + +namespace FlyingWormConsole3.LiteNetLib +{ + public enum UnconnectedMessageType + { + Default, + DiscoveryRequest, + DiscoveryResponse + } + + public enum DisconnectReason + { + SocketReceiveError, + ConnectionFailed, + Timeout, + SocketSendError, + RemoteConnectionClose, + DisconnectPeerCalled + } + + public struct DisconnectInfo + { + public DisconnectReason Reason; + public int SocketErrorCode; + public NetDataReader AdditionalData; + } + + public interface INetEventListener + { + /// <summary> + /// New remote peer connected to host, or client connected to remote host + /// </summary> + /// <param name="peer">Connected peer object</param> + void OnPeerConnected(NetPeer peer); + + /// <summary> + /// Peer disconnected + /// </summary> + /// <param name="peer">disconnected peer</param> + /// <param name="disconnectInfo">additional info about reason, errorCode or data received with disconnect message</param> + void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo); + + /// <summary> + /// Network error (on send or receive) + /// </summary> + /// <param name="endPoint">From endPoint (can be null)</param> + /// <param name="socketErrorCode">Socket error code</param> + void OnNetworkError(NetEndPoint endPoint, int socketErrorCode); + + /// <summary> + /// Received some data + /// </summary> + /// <param name="peer">From peer</param> + /// <param name="reader">DataReader containing all received data</param> + void OnNetworkReceive(NetPeer peer, NetDataReader reader); + + /// <summary> + /// Received unconnected message + /// </summary> + /// <param name="remoteEndPoint">From address (IP and Port)</param> + /// <param name="reader">Message data</param> + /// <param name="messageType">Message type (simple, discovery request or responce)</param> + void OnNetworkReceiveUnconnected(NetEndPoint remoteEndPoint, NetDataReader reader, UnconnectedMessageType messageType); + + /// <summary> + /// Latency information updated + /// </summary> + /// <param name="peer">Peer with updated latency</param> + /// <param name="latency">latency value in milliseconds</param> + void OnNetworkLatencyUpdate(NetPeer peer, int latency); + } + + public class EventBasedNetListener : INetEventListener + { + public delegate void OnPeerConnected(NetPeer peer); + public delegate void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo); + public delegate void OnNetworkError(NetEndPoint endPoint, int socketErrorCode); + public delegate void OnNetworkReceive(NetPeer peer, NetDataReader reader); + public delegate void OnNetworkReceiveUnconnected(NetEndPoint remoteEndPoint, NetDataReader reader, UnconnectedMessageType messageType); + public delegate void OnNetworkLatencyUpdate(NetPeer peer, int latency); + + public event OnPeerConnected PeerConnectedEvent; + public event OnPeerDisconnected PeerDisconnectedEvent; + public event OnNetworkError NetworkErrorEvent; + public event OnNetworkReceive NetworkReceiveEvent; + public event OnNetworkReceiveUnconnected NetworkReceiveUnconnectedEvent; + public event OnNetworkLatencyUpdate NetworkLatencyUpdateEvent; + + void INetEventListener.OnPeerConnected(NetPeer peer) + { + if (PeerConnectedEvent != null) + PeerConnectedEvent(peer); + } + + void INetEventListener.OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo) + { + if (PeerDisconnectedEvent != null) + PeerDisconnectedEvent(peer, disconnectInfo); + } + + void INetEventListener.OnNetworkError(NetEndPoint endPoint, int socketErrorCode) + { + if (NetworkErrorEvent != null) + NetworkErrorEvent(endPoint, socketErrorCode); + } + + void INetEventListener.OnNetworkReceive(NetPeer peer, NetDataReader reader) + { + if (NetworkReceiveEvent != null) + NetworkReceiveEvent(peer, reader); + } + + void INetEventListener.OnNetworkReceiveUnconnected(NetEndPoint remoteEndPoint, NetDataReader reader, UnconnectedMessageType messageType) + { + if (NetworkReceiveUnconnectedEvent != null) + NetworkReceiveUnconnectedEvent(remoteEndPoint, reader, messageType); + } + + void INetEventListener.OnNetworkLatencyUpdate(NetPeer peer, int latency) + { + if (NetworkLatencyUpdateEvent != null) + NetworkLatencyUpdateEvent(peer, latency); + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/INetEventListener.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/INetEventListener.cs.meta new file mode 100644 index 00000000..02148487 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/INetEventListener.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d391f9565d58e44a798d680ec5c11906 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NatPunchModule.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NatPunchModule.cs new file mode 100644 index 00000000..675ff3ac --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NatPunchModule.cs @@ -0,0 +1,231 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Collections.Generic; +using FlyingWormConsole3.LiteNetLib.Utils; + +//Some code parts taked from lidgren-network-gen3 + +namespace FlyingWormConsole3.LiteNetLib +{ + public interface INatPunchListener + { + void OnNatIntroductionRequest(NetEndPoint localEndPoint, NetEndPoint remoteEndPoint, string token); + void OnNatIntroductionSuccess(NetEndPoint targetEndPoint, string token); + } + + public class EventBasedNatPunchListener : INatPunchListener + { + public delegate void OnNatIntroductionRequest(NetEndPoint localEndPoint, NetEndPoint remoteEndPoint, string token); + public delegate void OnNatIntroductionSuccess(NetEndPoint targetEndPoint, string token); + + public event OnNatIntroductionRequest NatIntroductionRequest; + public event OnNatIntroductionSuccess NatIntroductionSuccess; + + void INatPunchListener.OnNatIntroductionRequest(NetEndPoint localEndPoint, NetEndPoint remoteEndPoint, string token) + { + if(NatIntroductionRequest != null) + NatIntroductionRequest(localEndPoint, remoteEndPoint, token); + } + + void INatPunchListener.OnNatIntroductionSuccess(NetEndPoint targetEndPoint, string token) + { + if (NatIntroductionSuccess != null) + NatIntroductionSuccess(targetEndPoint, token); + } + } + + public sealed class NatPunchModule + { + struct RequestEventData + { + public NetEndPoint LocalEndPoint; + public NetEndPoint RemoteEndPoint; + public string Token; + } + + struct SuccessEventData + { + public NetEndPoint TargetEndPoint; + public string Token; + } + + private readonly NetManager _netBase; + private readonly Queue<RequestEventData> _requestEvents; + private readonly Queue<SuccessEventData> _successEvents; + private const byte HostByte = 1; + private const byte ClientByte = 0; + public const int MaxTokenLength = 256; + + private INatPunchListener _natPunchListener; + + internal NatPunchModule(NetManager netBase) + { + _netBase = netBase; + _requestEvents = new Queue<RequestEventData>(); + _successEvents = new Queue<SuccessEventData>(); + } + + public void Init(INatPunchListener listener) + { + _natPunchListener = listener; + } + + public void NatIntroduce( + NetEndPoint hostInternal, + NetEndPoint hostExternal, + NetEndPoint clientInternal, + NetEndPoint clientExternal, + string additionalInfo) + { + NetDataWriter dw = new NetDataWriter(); + + //First packet (server) + //send to client + dw.Put(ClientByte); + dw.Put(hostInternal); + dw.Put(hostExternal); + dw.Put(additionalInfo, MaxTokenLength); + + var packet = _netBase.PacketPool.GetWithData(PacketProperty.NatIntroduction, dw); + _netBase.SendRawAndRecycle(packet, clientExternal); + + //Second packet (client) + //send to server + dw.Reset(); + dw.Put(HostByte); + dw.Put(clientInternal); + dw.Put(clientExternal); + dw.Put(additionalInfo, MaxTokenLength); + + packet = _netBase.PacketPool.GetWithData(PacketProperty.NatIntroduction, dw); + _netBase.SendRawAndRecycle(packet, hostExternal); + } + + public void PollEvents() + { + if (_natPunchListener == null) + return; + lock (_successEvents) + { + while (_successEvents.Count > 0) + { + var evt = _successEvents.Dequeue(); + _natPunchListener.OnNatIntroductionSuccess(evt.TargetEndPoint, evt.Token); + } + } + lock (_requestEvents) + { + while (_requestEvents.Count > 0) + { + var evt = _requestEvents.Dequeue(); + _natPunchListener.OnNatIntroductionRequest(evt.LocalEndPoint, evt.RemoteEndPoint, evt.Token); + } + } + } + + public void SendNatIntroduceRequest(NetEndPoint masterServerEndPoint, string additionalInfo) + { + if (!_netBase.IsRunning) + return; + + //prepare outgoing data + NetDataWriter dw = new NetDataWriter(); + string networkIp = NetUtils.GetLocalIp(LocalAddrType.IPv4); + if (string.IsNullOrEmpty(networkIp)) + { + networkIp = NetUtils.GetLocalIp(LocalAddrType.IPv6); + } + int networkPort = _netBase.LocalEndPoint.Port; + NetEndPoint localEndPoint = new NetEndPoint(networkIp, networkPort); + dw.Put(localEndPoint); + dw.Put(additionalInfo, MaxTokenLength); + + //prepare packet + var packet = _netBase.PacketPool.GetWithData(PacketProperty.NatIntroductionRequest, dw); + _netBase.SendRawAndRecycle(packet, masterServerEndPoint); + } + + private void HandleNatPunch(NetEndPoint senderEndPoint, NetDataReader dr) + { + byte fromHostByte = dr.GetByte(); + if (fromHostByte != HostByte && fromHostByte != ClientByte) + { + //garbage + return; + } + + //Read info + string additionalInfo = dr.GetString(MaxTokenLength); + NetUtils.DebugWrite(ConsoleColor.Green, "[NAT] punch received from {0} - additional info: {1}", senderEndPoint, additionalInfo); + + //Release punch success to client; enabling him to Connect() to msg.Sender if token is ok + lock (_successEvents) + { + _successEvents.Enqueue(new SuccessEventData { TargetEndPoint = senderEndPoint, Token = additionalInfo }); + } + } + + private void HandleNatIntroduction(NetDataReader dr) + { + // read intro + byte hostByte = dr.GetByte(); + NetEndPoint remoteInternal = dr.GetNetEndPoint(); + NetEndPoint remoteExternal = dr.GetNetEndPoint(); + string token = dr.GetString(MaxTokenLength); + + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NAT] introduction received; we are designated " + (hostByte == HostByte ? "host" : "client")); + NetDataWriter writer = new NetDataWriter(); + + // send internal punch + writer.Put(hostByte); + writer.Put(token); + var packet = _netBase.PacketPool.GetWithData(PacketProperty.NatPunchMessage, writer); + _netBase.SendRawAndRecycle(packet, remoteInternal); + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NAT] internal punch sent to " + remoteInternal); + + // send external punch + writer.Reset(); + writer.Put(hostByte); + writer.Put(token); + packet = _netBase.PacketPool.GetWithData(PacketProperty.NatPunchMessage, writer); + _netBase.SendRawAndRecycle(packet, remoteExternal); + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NAT] external punch sent to " + remoteExternal); + } + + private void HandleNatIntroductionRequest(NetEndPoint senderEndPoint, NetDataReader dr) + { + NetEndPoint localEp = dr.GetNetEndPoint(); + string token = dr.GetString(MaxTokenLength); + lock (_requestEvents) + { + _requestEvents.Enqueue(new RequestEventData + { + LocalEndPoint = localEp, + RemoteEndPoint = senderEndPoint, + Token = token + }); + } + } + + internal void ProcessMessage(NetEndPoint senderEndPoint, NetPacket packet) + { + var dr = new NetDataReader(packet.RawData, NetConstants.HeaderSize, packet.Size); + switch (packet.Property) + { + case PacketProperty.NatIntroductionRequest: + //We got request and must introduce + HandleNatIntroductionRequest(senderEndPoint, dr); + break; + case PacketProperty.NatIntroduction: + //We got introduce and must punch + HandleNatIntroduction(dr); + break; + case PacketProperty.NatPunchMessage: + //We got punch and can connect + HandleNatPunch(senderEndPoint, dr); + break; + } + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NatPunchModule.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NatPunchModule.cs.meta new file mode 100644 index 00000000..ba586cc9 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NatPunchModule.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 11f3508667cc14e3797a49d4695ffdd8 +timeCreated: 1497976517 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetConstants.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetConstants.cs new file mode 100644 index 00000000..e030cc1c --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetConstants.cs @@ -0,0 +1,53 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +namespace FlyingWormConsole3.LiteNetLib +{ + public enum SendOptions + { + Unreliable, + ReliableUnordered, + Sequenced, + ReliableOrdered + } + + public static class NetConstants + { + public const int HeaderSize = 1; + public const int SequencedHeaderSize = 3; + public const int FragmentHeaderSize = 6; + public const int DefaultWindowSize = 64; + public const ushort MaxSequence = 32768; + public const ushort HalfMaxSequence = MaxSequence / 2; + + //socket + public const string MulticastGroupIPv4 = "224.0.0.1"; + public const string MulticastGroupIPv6 = "FF02:0:0:0:0:0:0:1"; + public const int SocketBufferSize = 1024*1024; //2mb + public const int SocketTTL = 255; + + //protocol + public const int ProtocolId = 1; + public const int MaxUdpHeaderSize = 68; + public const int PacketSizeLimit = ushort.MaxValue - MaxUdpHeaderSize; + public const int MinPacketSize = 576 - MaxUdpHeaderSize; + public const int MinPacketDataSize = MinPacketSize - HeaderSize; + public const int MinSequencedPacketDataSize = MinPacketSize - SequencedHeaderSize; + + public static readonly int[] PossibleMtu = + { + 576 - MaxUdpHeaderSize, //Internet Path MTU for X.25 (RFC 879) + 1492 - MaxUdpHeaderSize, //Ethernet with LLC and SNAP, PPPoE (RFC 1042) + 1500 - MaxUdpHeaderSize, //Ethernet II (RFC 1191) + 4352 - MaxUdpHeaderSize, //FDDI + 4464 - MaxUdpHeaderSize, //Token ring + 7981 - MaxUdpHeaderSize //WLAN + }; + + public static int MaxPacketSize = PossibleMtu[PossibleMtu.Length - 1]; + + //peer specific + public const int FlowUpdateTime = 1000; + public const int FlowIncreaseThreshold = 4; + public const int DefaultPingInterval = 1000; + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetConstants.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetConstants.cs.meta new file mode 100644 index 00000000..b32e6179 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetConstants.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 02abb4740bff94f28bdd538839339932 +timeCreated: 1497976517 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataReader.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataReader.cs new file mode 100644 index 00000000..7e6ec5ac --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataReader.cs @@ -0,0 +1,444 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Text; + +namespace FlyingWormConsole3.LiteNetLib.Utils +{ + public class NetDataReader + { + protected byte[] _data; + protected int _position; + protected int _dataSize; + + public byte[] Data + { + get { return _data; } + } + + public int Position + { + get { return _position; } + } + + public bool EndOfData + { + get { return _position == _dataSize; } + } + + public int AvailableBytes + { + get { return _dataSize - _position; } + } + + public void SetSource(NetDataWriter dataWriter) + { + _data = dataWriter.Data; + _position = 0; + _dataSize = dataWriter.Length; + } + + public void SetSource(byte[] source) + { + _data = source; + _position = 0; + _dataSize = source.Length; + } + + public void SetSource(byte[] source, int offset) + { + _data = source; + _position = offset; + _dataSize = source.Length; + } + + public void SetSource(byte[] source, int offset, int dataSize) + { + _data = source; + _position = offset; + _dataSize = dataSize; + } + + public NetDataReader() + { + + } + + public NetDataReader(byte[] source) + { + SetSource(source); + } + + public NetDataReader(byte[] source, int offset) + { + SetSource(source, offset); + } + + public NetDataReader(byte[] source, int offset, int maxSize) + { + SetSource(source, offset, maxSize); + } + + #region GetMethods + public NetEndPoint GetNetEndPoint() + { + string host = GetString(1000); + int port = GetInt(); + return new NetEndPoint(host, port); + } + + public byte GetByte() + { + byte res = _data[_position]; + _position += 1; + return res; + } + + public sbyte GetSByte() + { + var b = (sbyte)_data[_position]; + _position++; + return b; + } + + public bool[] GetBoolArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new bool[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetBool(); + } + return arr; + } + + public ushort[] GetUShortArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new ushort[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetUShort(); + } + return arr; + } + + public short[] GetShortArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new short[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetShort(); + } + return arr; + } + + public long[] GetLongArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new long[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetLong(); + } + return arr; + } + + public ulong[] GetULongArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new ulong[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetULong(); + } + return arr; + } + + public int[] GetIntArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new int[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetInt(); + } + return arr; + } + + public uint[] GetUIntArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new uint[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetUInt(); + } + return arr; + } + + public float[] GetFloatArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new float[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetFloat(); + } + return arr; + } + + public double[] GetDoubleArray() + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new double[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetDouble(); + } + return arr; + } + + public string[] GetStringArray(int maxLength) + { + ushort size = BitConverter.ToUInt16(_data, _position); + _position += 2; + var arr = new string[size]; + for (int i = 0; i < size; i++) + { + arr[i] = GetString(maxLength); + } + return arr; + } + + public bool GetBool() + { + bool res = _data[_position] > 0; + _position += 1; + return res; + } + + public ushort GetUShort() + { + ushort result = BitConverter.ToUInt16(_data, _position); + _position += 2; + return result; + } + + public short GetShort() + { + short result = BitConverter.ToInt16(_data, _position); + _position += 2; + return result; + } + + public long GetLong() + { + long result = BitConverter.ToInt64(_data, _position); + _position += 8; + return result; + } + + public ulong GetULong() + { + ulong result = BitConverter.ToUInt64(_data, _position); + _position += 8; + return result; + } + + public int GetInt() + { + int result = BitConverter.ToInt32(_data, _position); + _position += 4; + return result; + } + + public uint GetUInt() + { + uint result = BitConverter.ToUInt32(_data, _position); + _position += 4; + return result; + } + + public float GetFloat() + { + float result = BitConverter.ToSingle(_data, _position); + _position += 4; + return result; + } + + public double GetDouble() + { + double result = BitConverter.ToDouble(_data, _position); + _position += 8; + return result; + } + + public string GetString(int maxLength) + { + int bytesCount = GetInt(); + if (bytesCount <= 0 || bytesCount > maxLength*2) + { + return string.Empty; + } + + int charCount = Encoding.UTF8.GetCharCount(_data, _position, bytesCount); + if (charCount > maxLength) + { + return string.Empty; + } + + string result = Encoding.UTF8.GetString(_data, _position, bytesCount); + _position += bytesCount; + return result; + } + + public string GetString() + { + int bytesCount = GetInt(); + if (bytesCount <= 0) + { + return string.Empty; + } + + string result = Encoding.UTF8.GetString(_data, _position, bytesCount); + _position += bytesCount; + return result; + } + + public byte[] GetRemainingBytes() + { + byte[] outgoingData = new byte[AvailableBytes]; + Buffer.BlockCopy(_data, _position, outgoingData, 0, AvailableBytes); + _position = _data.Length; + return outgoingData; + } + + public void GetRemainingBytes(byte[] destination) + { + Buffer.BlockCopy(_data, _position, destination, 0, AvailableBytes); + _position = _data.Length; + } + + public void GetBytes(byte[] destination, int lenght) + { + Buffer.BlockCopy(_data, _position, destination, 0, lenght); + _position += lenght; + } + + public byte[] GetBytesWithLength() + { + int length = GetInt(); + byte[] outgoingData = new byte[length]; + Buffer.BlockCopy(_data, _position, outgoingData, 0, length); + _position += length; + return outgoingData; + } + #endregion + + #region PeekMethods + + public byte PeekByte() + { + return _data[_position]; + } + + public sbyte PeekSByte() + { + return (sbyte)_data[_position]; + } + + public bool PeekBool() + { + return _data[_position] > 0; + } + + public ushort PeekUShort() + { + return BitConverter.ToUInt16(_data, _position); + } + + public short PeekShort() + { + return BitConverter.ToInt16(_data, _position); + } + + public long PeekLong() + { + return BitConverter.ToInt64(_data, _position); + } + + public ulong PeekULong() + { + return BitConverter.ToUInt64(_data, _position); + } + + public int PeekInt() + { + return BitConverter.ToInt32(_data, _position); + } + + public uint PeekUInt() + { + return BitConverter.ToUInt32(_data, _position); + } + + public float PeekFloat() + { + return BitConverter.ToSingle(_data, _position); + } + + public double PeekDouble() + { + return BitConverter.ToDouble(_data, _position); + } + + public string PeekString(int maxLength) + { + int bytesCount = BitConverter.ToInt32(_data, _position); + if (bytesCount <= 0 || bytesCount > maxLength * 2) + { + return string.Empty; + } + + int charCount = Encoding.UTF8.GetCharCount(_data, _position + 4, bytesCount); + if (charCount > maxLength) + { + return string.Empty; + } + + string result = Encoding.UTF8.GetString(_data, _position + 4, bytesCount); + return result; + } + + public string PeekString() + { + int bytesCount = BitConverter.ToInt32(_data, _position); + if (bytesCount <= 0) + { + return string.Empty; + } + + string result = Encoding.UTF8.GetString(_data, _position + 4, bytesCount); + return result; + } + #endregion + + public void Clear() + { + _position = 0; + _dataSize = 0; + _data = null; + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataReader.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataReader.cs.meta new file mode 100644 index 00000000..108202dc --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataReader.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 37bb0204fc22b499690c4032caf14811 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataWriter.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataWriter.cs new file mode 100644 index 00000000..451bc540 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataWriter.cs @@ -0,0 +1,375 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Text; + +namespace FlyingWormConsole3.LiteNetLib.Utils +{ + public class NetDataWriter + { + protected byte[] _data; + protected int _position; + + private int _maxLength; + private readonly bool _autoResize; + + public NetDataWriter() + { + _maxLength = 64; + _data = new byte[_maxLength]; + _autoResize = true; + } + + public NetDataWriter(bool autoResize) + { + _maxLength = 64; + _data = new byte[_maxLength]; + _autoResize = autoResize; + } + + public NetDataWriter(bool autoResize, int initialSize) + { + _maxLength = initialSize; + _data = new byte[_maxLength]; + _autoResize = autoResize; + } + + public void ResizeIfNeed(int newSize) + { + if (_maxLength < newSize) + { + while (_maxLength < newSize) + { + _maxLength *= 2; + } + Array.Resize(ref _data, _maxLength); + } + } + + public void Reset(int size) + { + ResizeIfNeed(size); + _position = 0; + } + + public void Reset() + { + _position = 0; + } + + public byte[] CopyData() + { + byte[] resultData = new byte[_position]; + Buffer.BlockCopy(_data, 0, resultData, 0, _position); + return resultData; + } + + public byte[] Data + { + get { return _data; } + } + + public int Length + { + get { return _position; } + } + + public void Put(float value) + { + if (_autoResize) + ResizeIfNeed(_position + 4); + FastBitConverter.GetBytes(_data, _position, value); + _position += 4; + } + + public void Put(double value) + { + if (_autoResize) + ResizeIfNeed(_position + 8); + FastBitConverter.GetBytes(_data, _position, value); + _position += 8; + } + + public void Put(long value) + { + if (_autoResize) + ResizeIfNeed(_position + 8); + FastBitConverter.GetBytes(_data, _position, value); + _position += 8; + } + + public void Put(ulong value) + { + if (_autoResize) + ResizeIfNeed(_position + 8); + FastBitConverter.GetBytes(_data, _position, value); + _position += 8; + } + + public void Put(int value) + { + if (_autoResize) + ResizeIfNeed(_position + 4); + FastBitConverter.GetBytes(_data, _position, value); + _position += 4; + } + + public void Put(uint value) + { + if (_autoResize) + ResizeIfNeed(_position + 4); + FastBitConverter.GetBytes(_data, _position, value); + _position += 4; + } + + public void Put(ushort value) + { + if (_autoResize) + ResizeIfNeed(_position + 2); + FastBitConverter.GetBytes(_data, _position, value); + _position += 2; + } + + public void Put(short value) + { + if (_autoResize) + ResizeIfNeed(_position + 2); + FastBitConverter.GetBytes(_data, _position, value); + _position += 2; + } + + public void Put(sbyte value) + { + if (_autoResize) + ResizeIfNeed(_position + 1); + _data[_position] = (byte)value; + _position++; + } + + public void Put(byte value) + { + if (_autoResize) + ResizeIfNeed(_position + 1); + _data[_position] = value; + _position++; + } + + public void Put(byte[] data, int offset, int length) + { + if (_autoResize) + ResizeIfNeed(_position + length); + Buffer.BlockCopy(data, offset, _data, _position, length); + _position += length; + } + + public void Put(byte[] data) + { + if (_autoResize) + ResizeIfNeed(_position + data.Length); + Buffer.BlockCopy(data, 0, _data, _position, data.Length); + _position += data.Length; + } + + public void PutBytesWithLength(byte[] data, int offset, int length) + { + if (_autoResize) + ResizeIfNeed(_position + length); + Put(length); + Buffer.BlockCopy(data, offset, _data, _position, length); + _position += length; + } + + public void PutBytesWithLength(byte[] data) + { + if (_autoResize) + ResizeIfNeed(_position + data.Length); + Put(data.Length); + Buffer.BlockCopy(data, 0, _data, _position, data.Length); + _position += data.Length; + } + + public void Put(bool value) + { + if (_autoResize) + ResizeIfNeed(_position + 1); + _data[_position] = (byte)(value ? 1 : 0); + _position++; + } + + public void PutArray(float[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 4 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(double[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 8 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(long[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 8 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(ulong[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 8 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(int[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 4 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(uint[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 4 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(ushort[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 2 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(short[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len * 2 + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(bool[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + if (_autoResize) + ResizeIfNeed(_position + len + 2); + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i]); + } + } + + public void PutArray(string[] value) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + Put(len); + for (int i = 0; i < value.Length; i++) + { + Put(value[i]); + } + } + + public void PutArray(string[] value, int maxLength) + { + ushort len = value == null ? (ushort)0 : (ushort)value.Length; + Put(len); + for (int i = 0; i < len; i++) + { + Put(value[i], maxLength); + } + } + + public void Put(NetEndPoint endPoint) + { + Put(endPoint.Host); + Put(endPoint.Port); + } + + public void Put(string value) + { + if (string.IsNullOrEmpty(value)) + { + Put(0); + return; + } + + //put bytes count + int bytesCount = Encoding.UTF8.GetByteCount(value); + if (_autoResize) + ResizeIfNeed(_position + bytesCount + 4); + Put(bytesCount); + + //put string + Encoding.UTF8.GetBytes(value, 0, value.Length, _data, _position); + _position += bytesCount; + } + + public void Put(string value, int maxLength) + { + if (string.IsNullOrEmpty(value)) + { + Put(0); + return; + } + + int length = value.Length > maxLength ? maxLength : value.Length; + //calculate max count + int bytesCount = Encoding.UTF8.GetByteCount(value); + if (_autoResize) + ResizeIfNeed(_position + bytesCount + 4); + + //put bytes count + Put(bytesCount); + + //put string + Encoding.UTF8.GetBytes(value, 0, length, _data, _position); + + _position += bytesCount; + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataWriter.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataWriter.cs.meta new file mode 100644 index 00000000..82fb0953 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDataWriter.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 81ecf42c9cc394fc395942030e71bddd +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDebug.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDebug.cs new file mode 100644 index 00000000..7a8b4a79 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDebug.cs @@ -0,0 +1,16 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; + +namespace FlyingWormConsole3.LiteNetLib +{ + public interface INetLogger + { + void WriteNet(ConsoleColor color, string str, params object[] args); + } + + public static class NetDebug + { + public static INetLogger Logger = null; + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDebug.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDebug.cs.meta new file mode 100644 index 00000000..5328f0b0 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetDebug.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 78dc00ceb66ac4fdfa8c3957763522ba +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetEndPoint.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetEndPoint.cs new file mode 100644 index 00000000..9ef9ed79 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetEndPoint.cs @@ -0,0 +1,221 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +#if !WINRT || UNITY_EDITOR +using System; +using System.Net; +using System.Net.Sockets; + +namespace FlyingWormConsole3.LiteNetLib +{ + public sealed class NetEndPoint + { + public string Host { get { return EndPoint.Address.ToString(); } } + public int Port { get { return EndPoint.Port; } } + + internal readonly IPEndPoint EndPoint; + + internal NetEndPoint(IPEndPoint ipEndPoint) + { + EndPoint = ipEndPoint; + } + + public override bool Equals(object obj) + { + if (!(obj is NetEndPoint)) + { + return false; + } + return EndPoint.Equals(((NetEndPoint)obj).EndPoint); + } + + public override string ToString() + { + return EndPoint.ToString(); + } + + public override int GetHashCode() + { + return EndPoint.GetHashCode(); + } + + public NetEndPoint(string hostStr, int port) + { + IPAddress ipAddress; + if (!IPAddress.TryParse(hostStr, out ipAddress)) + { + if (Socket.OSSupportsIPv6) + { + if (hostStr == "localhost") + { + ipAddress = IPAddress.IPv6Loopback; + } + else + { + ipAddress = ResolveAddress(hostStr, AddressFamily.InterNetworkV6); + } + } + if (ipAddress == null) + { + ipAddress = ResolveAddress(hostStr, AddressFamily.InterNetwork); + } + } + if (ipAddress == null) + { + throw new Exception("Invalid address: " + hostStr); + } + EndPoint = new IPEndPoint(ipAddress, port); + } + + private IPAddress ResolveAddress(string hostStr, AddressFamily addressFamily) + { +#if NETCORE + var hostTask = Dns.GetHostEntryAsync(hostStr); + hostTask.Wait(); + var host = hostTask.Result; +#else + var host = Dns.GetHostEntry(hostStr); +#endif + foreach (IPAddress ip in host.AddressList) + { + if (ip.AddressFamily == addressFamily) + { + return ip; + } + } + return null; + } + + internal long GetId() + { + byte[] addr = EndPoint.Address.GetAddressBytes(); + long id = 0; + + if (addr.Length == 4) //IPv4 + { + id = addr[0]; + id |= (long)addr[1] << 8; + id |= (long)addr[2] << 16; + id |= (long)addr[3] << 24; + id |= (long)EndPoint.Port << 32; + } + else if (addr.Length == 16) //IPv6 + { + id = addr[0] ^ addr[8]; + id |= (long)(addr[1] ^ addr[9]) << 8; + id |= (long)(addr[2] ^ addr[10]) << 16; + + + id |= (long)(addr[3] ^ addr[11]) << 24; + id |= (long)(addr[4] ^ addr[12]) << 32; + id |= (long)(addr[5] ^ addr[13]) << 40; + id |= (long)(addr[6] ^ addr[14]) << 48; + id |= (long)(Port ^ addr[7] ^ addr[15]) << 56; + } + + return id; + } + } +} +#else +using System; +using Windows.Networking; +using Windows.Networking.Sockets; + +namespace FlyingWormConsole3.LiteNetLib +{ + public sealed class NetEndPoint + { + public string Host { get { return HostName.DisplayName; } } + public int Port { get; private set; } + internal readonly HostName HostName; + internal readonly string PortStr; + + internal NetEndPoint(int port) + { + HostName = null; + PortStr = port.ToString(); + Port = port; + } + + public override bool Equals(object obj) + { + if (!(obj is NetEndPoint)) + { + return false; + } + NetEndPoint other = (NetEndPoint) obj; + return HostName.IsEqual(other.HostName) && PortStr.Equals(other.PortStr); + } + + public override int GetHashCode() + { + return HostName.CanonicalName.GetHashCode() ^ PortStr.GetHashCode(); + } + + internal long GetId() + { + //Check locals + if (HostName == null) + { + return ParseIpToId("0.0.0.0"); + } + + if (HostName.DisplayName == "localhost") + { + return ParseIpToId("127.0.0.1"); + } + + //Check remote + string hostIp = string.Empty; + var task = DatagramSocket.GetEndpointPairsAsync(HostName, "0").AsTask(); + task.Wait(); + + //IPv4 + foreach (var endpointPair in task.Result) + { + hostIp = endpointPair.RemoteHostName.CanonicalName; + if (endpointPair.RemoteHostName.Type == HostNameType.Ipv4) + { + return ParseIpToId(hostIp); + } + } + + //Else + return hostIp.GetHashCode() ^ Port; + } + + private long ParseIpToId(string hostIp) + { + long id = 0; + string[] ip = hostIp.Split('.'); + id |= long.Parse(ip[0]); + id |= long.Parse(ip[1]) << 8; + id |= long.Parse(ip[2]) << 16; + id |= long.Parse(ip[3]) << 24; + id |= (long)Port << 32; + return id; + } + + public override string ToString() + { + return HostName.CanonicalName + ":" + PortStr; + } + + public NetEndPoint(string hostName, int port) + { + var task = DatagramSocket.GetEndpointPairsAsync(new HostName(hostName), port.ToString()).AsTask(); + task.Wait(); + HostName = task.Result[0].RemoteHostName; + Port = port; + PortStr = port.ToString(); + } + + internal NetEndPoint(HostName hostName, string port) + { + HostName = hostName; + Port = int.Parse(port); + PortStr = port; + } + } +} +#endif +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetEndPoint.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetEndPoint.cs.meta new file mode 100644 index 00000000..93ef448e --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetEndPoint.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 33fb66c3ba5b8429fbbb0a2f5e7ceb57 +timeCreated: 1497976517 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetManager.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetManager.cs new file mode 100644 index 00000000..75745f7e --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetManager.cs @@ -0,0 +1,1039 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +#if DEBUG +#define STATS_ENABLED +#endif + +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; +using FlyingWormConsole3.LiteNetLib.Utils; + +namespace FlyingWormConsole3.LiteNetLib +{ + public sealed class NetManager + { + internal delegate void OnMessageReceived(byte[] data, int length, int errorCode, NetEndPoint remoteEndPoint); + + private struct FlowMode + { + public int PacketsPerSecond; + public int StartRtt; + } + + private enum NetEventType + { + Connect, + Disconnect, + Receive, + ReceiveUnconnected, + Error, + ConnectionLatencyUpdated, + DiscoveryRequest, + DiscoveryResponse + } + + private sealed class NetEvent + { + public NetPeer Peer; + public readonly NetDataReader DataReader = new NetDataReader(); + public NetEventType Type; + public NetEndPoint RemoteEndPoint; + public int AdditionalData; + public DisconnectReason DisconnectReason; + } + +#if DEBUG + private struct IncomingData + { + public byte[] Data; + public NetEndPoint EndPoint; + public DateTime TimeWhenGet; + } + private readonly List<IncomingData> _pingSimulationList = new List<IncomingData>(); + private readonly Random _randomGenerator = new Random(); + private const int MinLatencyTreshold = 5; +#endif + + private readonly NetSocket _socket; + private readonly List<FlowMode> _flowModes; + + private readonly NetThread _logicThread; + + private readonly Queue<NetEvent> _netEventsQueue; + private readonly Stack<NetEvent> _netEventsPool; + private readonly INetEventListener _netEventListener; + + private readonly NetPeerCollection _peers; + private readonly int _maxConnections; + private readonly string _connectKey; + + private readonly NetPacketPool _netPacketPool; + + //config section + public bool UnconnectedMessagesEnabled = false; + public bool NatPunchEnabled = false; + public int UpdateTime { get { return _logicThread.SleepTime; } set { _logicThread.SleepTime = value; } } + public int PingInterval = NetConstants.DefaultPingInterval; + public long DisconnectTimeout = 5000; + public bool SimulatePacketLoss = false; + public bool SimulateLatency = false; + public int SimulationPacketLossChance = 10; + public int SimulationMinLatency = 30; + public int SimulationMaxLatency = 100; + public bool UnsyncedEvents = false; + public bool DiscoveryEnabled = false; + public bool MergeEnabled = false; + public int ReconnectDelay = 500; + public int MaxConnectAttempts = 10; + public bool ReuseAddress = false; + + private const int DefaultUpdateTime = 15; + + //stats + public ulong PacketsSent { get; private set; } + public ulong PacketsReceived { get; private set; } + public ulong BytesSent { get; private set; } + public ulong BytesReceived { get; private set; } + + //modules + public readonly NatPunchModule NatPunchModule; + + /// <summary> + /// Returns true if socket listening and update thread is running + /// </summary> + public bool IsRunning + { + get { return _logicThread.IsRunning; } + } + + /// <summary> + /// Local EndPoint (host and port) + /// </summary> + public NetEndPoint LocalEndPoint + { + get { return _socket.LocalEndPoint; } + } + + /// <summary> + /// Connected peers count + /// </summary> + public int PeersCount + { + get { return _peers.Count; } + } + + public string ConnectKey + { + get { return _connectKey; } + } + + //Flow + public void AddFlowMode(int startRtt, int packetsPerSecond) + { + var fm = new FlowMode {PacketsPerSecond = packetsPerSecond, StartRtt = startRtt}; + + if (_flowModes.Count > 0 && startRtt < _flowModes[0].StartRtt) + { + _flowModes.Insert(0, fm); + } + else + { + _flowModes.Add(fm); + } + } + + internal int GetPacketsPerSecond(int flowMode) + { + if (flowMode < 0 || _flowModes.Count == 0) + return 0; + return _flowModes[flowMode].PacketsPerSecond; + } + + internal int GetMaxFlowMode() + { + return _flowModes.Count - 1; + } + + internal int GetStartRtt(int flowMode) + { + if (flowMode < 0 || _flowModes.Count == 0) + return 0; + return _flowModes[flowMode].StartRtt; + } + + internal NetPacketPool PacketPool + { + get { return _netPacketPool; } + } + + /// <summary> + /// NetManager constructor with maxConnections = 1 (usable for client) + /// </summary> + /// <param name="listener">Network events listener</param> + /// <param name="connectKey">Application key (must be same with remote host for establish connection)</param> + public NetManager(INetEventListener listener, string connectKey) : this(listener, 1, connectKey) + { + + } + + /// <summary> + /// NetManager constructor + /// </summary> + /// <param name="listener">Network events listener</param> + /// <param name="maxConnections">Maximum connections (incoming and outcoming)</param> + /// <param name="connectKey">Application key (must be same with remote host for establish connection)</param> + public NetManager(INetEventListener listener, int maxConnections, string connectKey) + { + _logicThread = new NetThread("LogicThread", DefaultUpdateTime, UpdateLogic); + _socket = new NetSocket(ReceiveLogic); + _netEventListener = listener; + _flowModes = new List<FlowMode>(); + _netEventsQueue = new Queue<NetEvent>(); + _netEventsPool = new Stack<NetEvent>(); + _netPacketPool = new NetPacketPool(); + NatPunchModule = new NatPunchModule(this); + + _connectKey = connectKey; + _peers = new NetPeerCollection(maxConnections); + _maxConnections = maxConnections; + _connectKey = connectKey; + } + + internal void ConnectionLatencyUpdated(NetPeer fromPeer, int latency) + { + var evt = CreateEvent(NetEventType.ConnectionLatencyUpdated); + evt.Peer = fromPeer; + evt.AdditionalData = latency; + EnqueueEvent(evt); + } + + internal bool SendRawAndRecycle(NetPacket packet, NetEndPoint remoteEndPoint) + { + var result = SendRaw(packet.RawData, 0, packet.Size, remoteEndPoint); + _netPacketPool.Recycle(packet); + return result; + } + + internal bool SendRaw(byte[] message, int start, int length, NetEndPoint remoteEndPoint) + { + if (!IsRunning) + return false; + + int errorCode = 0; + bool result = _socket.SendTo(message, start, length, remoteEndPoint, ref errorCode) > 0; + + //10040 message to long... need to check + //10065 no route to host + if (errorCode != 0 && errorCode != 10040 && errorCode != 10065) + { + //Send error + NetPeer fromPeer; + if (_peers.TryGetValue(remoteEndPoint, out fromPeer)) + { + DisconnectPeer(fromPeer, DisconnectReason.SocketSendError, errorCode, false, null, 0, 0); + } + var netEvent = CreateEvent(NetEventType.Error); + netEvent.RemoteEndPoint = remoteEndPoint; + netEvent.AdditionalData = errorCode; + EnqueueEvent(netEvent); + return false; + } + if (errorCode == 10040) + { + NetUtils.DebugWrite(ConsoleColor.Red, "[SRD] 10040, datalen: {0}", length); + return false; + } +#if STATS_ENABLED + PacketsSent++; + BytesSent += (uint)length; +#endif + + return result; + } + + private void DisconnectPeer( + NetPeer peer, + DisconnectReason reason, + int socketErrorCode, + bool sendDisconnectPacket, + byte[] data, + int start, + int count) + { + if (sendDisconnectPacket) + { + if (count + 8 >= peer.Mtu) + { + //Drop additional data + data = null; + count = 0; + NetUtils.DebugWriteError("[NM] Disconnect additional data size more than MTU - 8!"); + } + + var disconnectPacket = _netPacketPool.Get(PacketProperty.Disconnect, 8 + count); + FastBitConverter.GetBytes(disconnectPacket.RawData, 1, peer.ConnectId); + if (data != null) + { + Buffer.BlockCopy(data, start, disconnectPacket.RawData, 9, count); + } + SendRawAndRecycle(disconnectPacket, peer.EndPoint); + } + var netEvent = CreateEvent(NetEventType.Disconnect); + netEvent.Peer = peer; + netEvent.AdditionalData = socketErrorCode; + netEvent.DisconnectReason = reason; + EnqueueEvent(netEvent); + RemovePeer(peer.EndPoint); + } + + private void ClearPeers() + { + lock (_peers) + { +#if WINRT && !UNITY_EDITOR + _socket.ClearPeers(); +#endif + _peers.Clear(); + } + } + + private void RemovePeer(NetEndPoint endPoint) + { + _peers.Remove(endPoint); +#if WINRT && !UNITY_EDITOR + _socket.RemovePeer(endPoint); +#endif + } + + private void RemovePeerAt(int idx) + { +#if WINRT && !UNITY_EDITOR + var endPoint = _peers[idx].EndPoint; + _socket.RemovePeer(endPoint); +#endif + _peers.RemoveAt(idx); + } + + private NetEvent CreateEvent(NetEventType type) + { + NetEvent evt = null; + + lock (_netEventsPool) + { + if (_netEventsPool.Count > 0) + { + evt = _netEventsPool.Pop(); + } + } + if(evt == null) + { + evt = new NetEvent(); + } + evt.Type = type; + return evt; + } + + private void EnqueueEvent(NetEvent evt) + { + if (UnsyncedEvents) + { + ProcessEvent(evt); + } + else + { + lock (_netEventsQueue) + { + _netEventsQueue.Enqueue(evt); + } + } + } + + private void ProcessEvent(NetEvent evt) + { + switch (evt.Type) + { + case NetEventType.Connect: + _netEventListener.OnPeerConnected(evt.Peer); + break; + case NetEventType.Disconnect: + var info = new DisconnectInfo + { + Reason = evt.DisconnectReason, + AdditionalData = evt.DataReader, + SocketErrorCode = evt.AdditionalData + }; + _netEventListener.OnPeerDisconnected(evt.Peer, info); + break; + case NetEventType.Receive: + _netEventListener.OnNetworkReceive(evt.Peer, evt.DataReader); + break; + case NetEventType.ReceiveUnconnected: + _netEventListener.OnNetworkReceiveUnconnected(evt.RemoteEndPoint, evt.DataReader, UnconnectedMessageType.Default); + break; + case NetEventType.DiscoveryRequest: + _netEventListener.OnNetworkReceiveUnconnected(evt.RemoteEndPoint, evt.DataReader, UnconnectedMessageType.DiscoveryRequest); + break; + case NetEventType.DiscoveryResponse: + _netEventListener.OnNetworkReceiveUnconnected(evt.RemoteEndPoint, evt.DataReader, UnconnectedMessageType.DiscoveryResponse); + break; + case NetEventType.Error: + _netEventListener.OnNetworkError(evt.RemoteEndPoint, evt.AdditionalData); + break; + case NetEventType.ConnectionLatencyUpdated: + _netEventListener.OnNetworkLatencyUpdate(evt.Peer, evt.AdditionalData); + break; + } + + //Recycle + evt.DataReader.Clear(); + evt.Peer = null; + evt.AdditionalData = 0; + evt.RemoteEndPoint = null; + + lock (_netEventsPool) + { + _netEventsPool.Push(evt); + } + } + + //Update function + private void UpdateLogic() + { +#if DEBUG + if (SimulateLatency) + { + var time = DateTime.UtcNow; + lock (_pingSimulationList) + { + for (int i = 0; i < _pingSimulationList.Count; i++) + { + var incomingData = _pingSimulationList[i]; + if (incomingData.TimeWhenGet <= time) + { + DataReceived(incomingData.Data, incomingData.Data.Length, incomingData.EndPoint); + _pingSimulationList.RemoveAt(i); + i--; + } + } + } + } +#endif + + //Process acks + lock (_peers) + { + int delta = _logicThread.SleepTime; + for(int i = 0; i < _peers.Count; i++) + { + var netPeer = _peers[i]; + if (netPeer.ConnectionState == ConnectionState.Connected && netPeer.TimeSinceLastPacket > DisconnectTimeout) + { + NetUtils.DebugWrite("[NM] Disconnect by timeout: {0} > {1}", netPeer.TimeSinceLastPacket, DisconnectTimeout); + var netEvent = CreateEvent(NetEventType.Disconnect); + netEvent.Peer = netPeer; + netEvent.DisconnectReason = DisconnectReason.Timeout; + EnqueueEvent(netEvent); + + RemovePeerAt(i); + i--; + } + else if(netPeer.ConnectionState == ConnectionState.Disconnected) + { + var netEvent = CreateEvent(NetEventType.Disconnect); + netEvent.Peer = netPeer; + netEvent.DisconnectReason = DisconnectReason.ConnectionFailed; + EnqueueEvent(netEvent); + + RemovePeerAt(i); + i--; + } + else + { + netPeer.Update(delta); + } + } + } + } + + private void ReceiveLogic(byte[] data, int length, int errorCode, NetEndPoint remoteEndPoint) + { + //Receive some info + if (errorCode == 0) + { +#if DEBUG + bool receivePacket = true; + + if (SimulatePacketLoss && _randomGenerator.Next(100/SimulationPacketLossChance) == 0) + { + receivePacket = false; + } + else if (SimulateLatency) + { + int latency = _randomGenerator.Next(SimulationMinLatency, SimulationMaxLatency); + if (latency > MinLatencyTreshold) + { + byte[] holdedData = new byte[length]; + Buffer.BlockCopy(data, 0, holdedData, 0, length); + + lock (_pingSimulationList) + { + _pingSimulationList.Add(new IncomingData + { + Data = holdedData, + EndPoint = remoteEndPoint, + TimeWhenGet = DateTime.UtcNow.AddMilliseconds(latency) + }); + } + + receivePacket = false; + } + } + + if (receivePacket) //DataReceived +#endif + //ProcessEvents + DataReceived(data, length, remoteEndPoint); + } + else //Error on receive + { + ClearPeers(); + var netEvent = CreateEvent(NetEventType.Error); + netEvent.AdditionalData = errorCode; + EnqueueEvent(netEvent); + } + } + + private void DataReceived(byte[] reusableBuffer, int count, NetEndPoint remoteEndPoint) + { +#if STATS_ENABLED + PacketsReceived++; + BytesReceived += (uint) count; +#endif + + //Try read packet + NetPacket packet = _netPacketPool.GetAndRead(reusableBuffer, 0, count); + if (packet == null) + { + NetUtils.DebugWriteError("[NM] DataReceived: bad!"); + return; + } + + //Check unconnected + switch (packet.Property) + { + case PacketProperty.DiscoveryRequest: + if(DiscoveryEnabled) + { + var netEvent = CreateEvent(NetEventType.DiscoveryRequest); + netEvent.RemoteEndPoint = remoteEndPoint; + netEvent.DataReader.SetSource(packet.RawData, NetConstants.HeaderSize); + EnqueueEvent(netEvent); + } + return; + case PacketProperty.DiscoveryResponse: + { + var netEvent = CreateEvent(NetEventType.DiscoveryResponse); + netEvent.RemoteEndPoint = remoteEndPoint; + netEvent.DataReader.SetSource(packet.RawData, NetConstants.HeaderSize); + EnqueueEvent(netEvent); + } + return; + case PacketProperty.UnconnectedMessage: + if (UnconnectedMessagesEnabled) + { + var netEvent = CreateEvent(NetEventType.ReceiveUnconnected); + netEvent.RemoteEndPoint = remoteEndPoint; + netEvent.DataReader.SetSource(packet.RawData, NetConstants.HeaderSize); + EnqueueEvent(netEvent); + } + return; + case PacketProperty.NatIntroduction: + case PacketProperty.NatIntroductionRequest: + case PacketProperty.NatPunchMessage: + { + if (NatPunchEnabled) + NatPunchModule.ProcessMessage(remoteEndPoint, packet); + return; + } + } + + //Check normal packets + NetPeer netPeer; + + //Check peers + Monitor.Enter(_peers); + int peersCount = _peers.Count; + + if (_peers.TryGetValue(remoteEndPoint, out netPeer)) + { + Monitor.Exit(_peers); + //Send + if (packet.Property == PacketProperty.Disconnect) + { + if (BitConverter.ToInt64(packet.RawData, 1) != netPeer.ConnectId) + { + //Old or incorrect disconnect + _netPacketPool.Recycle(packet); + return; + } + + var netEvent = CreateEvent(NetEventType.Disconnect); + netEvent.Peer = netPeer; + netEvent.DataReader.SetSource(packet.RawData, 5, packet.Size - 5); + netEvent.DisconnectReason = DisconnectReason.RemoteConnectionClose; + EnqueueEvent(netEvent); + + _peers.Remove(netPeer.EndPoint); + //do not recycle because no sense) + } + else if (packet.Property == PacketProperty.ConnectAccept) + { + if (netPeer.ProcessConnectAccept(packet)) + { + var connectEvent = CreateEvent(NetEventType.Connect); + connectEvent.Peer = netPeer; + EnqueueEvent(connectEvent); + } + _netPacketPool.Recycle(packet); + } + else + { + netPeer.ProcessPacket(packet); + } + return; + } + + try + { + if (peersCount < _maxConnections && packet.Property == PacketProperty.ConnectRequest) + { + int protoId = BitConverter.ToInt32(packet.RawData, 1); + if (protoId != NetConstants.ProtocolId) + { + NetUtils.DebugWrite(ConsoleColor.Cyan, + "[NM] Peer connect reject. Invalid protocol ID: " + protoId); + return; + } + + string peerKey = Encoding.UTF8.GetString(packet.RawData, 13, packet.Size - 13); + if (peerKey != _connectKey) + { + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NM] Peer connect reject. Invalid key: " + peerKey); + return; + } + + //Getting new id for peer + long connectionId = BitConverter.ToInt64(packet.RawData, 5); + //response with id + netPeer = new NetPeer(this, remoteEndPoint, connectionId); + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NM] Received peer connect request Id: {0}, EP: {1}", + netPeer.ConnectId, remoteEndPoint); + + //clean incoming packet + _netPacketPool.Recycle(packet); + + _peers.Add(remoteEndPoint, netPeer); + + var netEvent = CreateEvent(NetEventType.Connect); + netEvent.Peer = netPeer; + EnqueueEvent(netEvent); + } + } + finally + { + Monitor.Exit(_peers); + } + } + + internal void ReceiveFromPeer(NetPacket packet, NetEndPoint remoteEndPoint) + { + NetPeer fromPeer; + if (_peers.TryGetValue(remoteEndPoint, out fromPeer)) + { + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NM] Received message"); + var netEvent = CreateEvent(NetEventType.Receive); + netEvent.Peer = fromPeer; + netEvent.RemoteEndPoint = fromPeer.EndPoint; + netEvent.DataReader.SetSource(packet.GetPacketData()); + EnqueueEvent(netEvent); + } + } + + /// <summary> + /// Send data to all connected peers + /// </summary> + /// <param name="writer">DataWriter with data</param> + /// <param name="options">Send options (reliable, unreliable, etc.)</param> + public void SendToAll(NetDataWriter writer, SendOptions options) + { + SendToAll(writer.Data, 0, writer.Length, options); + } + + /// <summary> + /// Send data to all connected peers + /// </summary> + /// <param name="data">Data</param> + /// <param name="options">Send options (reliable, unreliable, etc.)</param> + public void SendToAll(byte[] data, SendOptions options) + { + SendToAll(data, 0, data.Length, options); + } + + /// <summary> + /// Send data to all connected peers + /// </summary> + /// <param name="data">Data</param> + /// <param name="start">Start of data</param> + /// <param name="length">Length of data</param> + /// <param name="options">Send options (reliable, unreliable, etc.)</param> + public void SendToAll(byte[] data, int start, int length, SendOptions options) + { + lock (_peers) + { + for(int i = 0; i < _peers.Count; i++) + { + _peers[i].Send(data, start, length, options); + } + } + } + + /// <summary> + /// Send data to all connected peers + /// </summary> + /// <param name="writer">DataWriter with data</param> + /// <param name="options">Send options (reliable, unreliable, etc.)</param> + /// <param name="excludePeer">Excluded peer</param> + public void SendToAll(NetDataWriter writer, SendOptions options, NetPeer excludePeer) + { + SendToAll(writer.Data, 0, writer.Length, options, excludePeer); + } + + /// <summary> + /// Send data to all connected peers + /// </summary> + /// <param name="data">Data</param> + /// <param name="options">Send options (reliable, unreliable, etc.)</param> + /// <param name="excludePeer">Excluded peer</param> + public void SendToAll(byte[] data, SendOptions options, NetPeer excludePeer) + { + SendToAll(data, 0, data.Length, options, excludePeer); + } + + /// <summary> + /// Send data to all connected peers + /// </summary> + /// <param name="data">Data</param> + /// <param name="start">Start of data</param> + /// <param name="length">Length of data</param> + /// <param name="options">Send options (reliable, unreliable, etc.)</param> + /// <param name="excludePeer">Excluded peer</param> + public void SendToAll(byte[] data, int start, int length, SendOptions options, NetPeer excludePeer) + { + lock (_peers) + { + for (int i = 0; i < _peers.Count; i++) + { + var netPeer = _peers[i]; + if (netPeer != excludePeer) + { + netPeer.Send(data, start, length, options); + } + } + } + } + + /// <summary> + /// Start logic thread and listening on available port + /// </summary> + public bool Start() + { + return Start(0); + } + + /// <summary> + /// Start logic thread and listening on selected port + /// </summary> + /// <param name="port">port to listen</param> + public bool Start(int port) + { + if (IsRunning) + { + return false; + } + + _netEventsQueue.Clear(); + if (!_socket.Bind(port, ReuseAddress)) + return false; + + _logicThread.Start(); + return true; + } + + /// <summary> + /// Send message without connection + /// </summary> + /// <param name="message">Raw data</param> + /// <param name="remoteEndPoint">Packet destination</param> + /// <returns>Operation result</returns> + public bool SendUnconnectedMessage(byte[] message, NetEndPoint remoteEndPoint) + { + return SendUnconnectedMessage(message, 0, message.Length, remoteEndPoint); + } + + /// <summary> + /// Send message without connection + /// </summary> + /// <param name="writer">Data serializer</param> + /// <param name="remoteEndPoint">Packet destination</param> + /// <returns>Operation result</returns> + public bool SendUnconnectedMessage(NetDataWriter writer, NetEndPoint remoteEndPoint) + { + return SendUnconnectedMessage(writer.Data, 0, writer.Length, remoteEndPoint); + } + + /// <summary> + /// Send message without connection + /// </summary> + /// <param name="message">Raw data</param> + /// <param name="start">data start</param> + /// <param name="length">data length</param> + /// <param name="remoteEndPoint">Packet destination</param> + /// <returns>Operation result</returns> + public bool SendUnconnectedMessage(byte[] message, int start, int length, NetEndPoint remoteEndPoint) + { + if (!IsRunning) + return false; + var packet = _netPacketPool.GetWithData(PacketProperty.UnconnectedMessage, message, start, length); + bool result = SendRawAndRecycle(packet, remoteEndPoint); + return result; + } + + public bool SendDiscoveryRequest(NetDataWriter writer, int port) + { + return SendDiscoveryRequest(writer.Data, 0, writer.Length, port); + } + + public bool SendDiscoveryRequest(byte[] data, int port) + { + return SendDiscoveryRequest(data, 0, data.Length, port); + } + + public bool SendDiscoveryRequest(byte[] data, int start, int length, int port) + { + if (!IsRunning) + return false; + var packet = _netPacketPool.GetWithData(PacketProperty.DiscoveryRequest, data, start, length); + bool result = _socket.SendBroadcast(packet.RawData, 0, packet.Size, port); + _netPacketPool.Recycle(packet); + return result; + } + + public bool SendDiscoveryResponse(NetDataWriter writer, NetEndPoint remoteEndPoint) + { + return SendDiscoveryResponse(writer.Data, 0, writer.Length, remoteEndPoint); + } + + public bool SendDiscoveryResponse(byte[] data, NetEndPoint remoteEndPoint) + { + return SendDiscoveryResponse(data, 0, data.Length, remoteEndPoint); + } + + public bool SendDiscoveryResponse(byte[] data, int start, int length, NetEndPoint remoteEndPoint) + { + if (!IsRunning) + return false; + var packet = _netPacketPool.GetWithData(PacketProperty.DiscoveryResponse, data, start, length); + bool result = SendRawAndRecycle(packet, remoteEndPoint); + return result; + } + + /// <summary> + /// Flush all queued packets of all peers + /// </summary> + public void Flush() + { + lock (_peers) + { + for (int i = 0; i < _peers.Count; i++) + { + _peers[i].Flush(); + } + } + } + + /// <summary> + /// Receive all pending events. Call this in game update code + /// </summary> + public void PollEvents() + { + if (UnsyncedEvents) + return; + + while (_netEventsQueue.Count > 0) + { + NetEvent evt; + lock (_netEventsQueue) + { + evt = _netEventsQueue.Dequeue(); + } + ProcessEvent(evt); + } + } + + /// <summary> + /// Connect to remote host + /// </summary> + /// <param name="address">Server IP or hostname</param> + /// <param name="port">Server Port</param> + public void Connect(string address, int port) + { + //Create target endpoint + NetEndPoint ep = new NetEndPoint(address, port); + Connect(ep); + } + + /// <summary> + /// Connect to remote host + /// </summary> + /// <param name="target">Server end point (ip and port)</param> + public void Connect(NetEndPoint target) + { + if (!IsRunning) + { + throw new Exception("Client is not running"); + } + lock (_peers) + { + if (_peers.ContainsAddress(target) || _peers.Count >= _maxConnections) + { + //Already connected + return; + } + + //Create reliable connection + //And request connection + var newPeer = new NetPeer(this, target, 0); + _peers.Add(target, newPeer); + } + } + + /// <summary> + /// Force closes connection and stop all threads. + /// </summary> + public void Stop() + { + //Send disconnect packets + lock (_peers) + { + for (int i = 0; i < _peers.Count; i++) + { + var disconnectPacket = _netPacketPool.Get(PacketProperty.Disconnect, 8); + FastBitConverter.GetBytes(disconnectPacket.RawData, 1, _peers[i].ConnectId); + SendRawAndRecycle(disconnectPacket, _peers[i].EndPoint); + } + } + + //Clear + ClearPeers(); + + //Stop + if (IsRunning) + { + _logicThread.Stop(); + _socket.Close(); + } + } + + /// <summary> + /// Get first peer. Usefull for Client mode + /// </summary> + /// <returns></returns> + public NetPeer GetFirstPeer() + { + lock (_peers) + { + if (_peers.Count > 0) + { + return _peers[0]; + } + } + return null; + } + + /// <summary> + /// Get copy of current connected peers + /// </summary> + /// <returns>Array with connected peers</returns> + public NetPeer[] GetPeers() + { + NetPeer[] peers; + lock (_peers) + { + peers = _peers.ToArray(); + } + return peers; + } + + /// <summary> + /// Get copy of current connected peers (without allocations) + /// </summary> + /// <param name="peers">List that will contain result</param> + public void GetPeersNonAlloc(List<NetPeer> peers) + { + peers.Clear(); + lock (_peers) + { + for(int i = 0; i < _peers.Count; i++) + { + peers.Add(_peers[i]); + } + } + } + + /// <summary> + /// Disconnect peer from server + /// </summary> + /// <param name="peer">peer to disconnect</param> + public void DisconnectPeer(NetPeer peer) + { + DisconnectPeer(peer, null, 0, 0); + } + + /// <summary> + /// Disconnect peer from server and send additional data (Size must be less or equal MTU - 8) + /// </summary> + /// <param name="peer">peer to disconnect</param> + /// <param name="data">additional data</param> + public void DisconnectPeer(NetPeer peer, byte[] data) + { + DisconnectPeer(peer, data, 0, data.Length); + } + + /// <summary> + /// Disconnect peer from server and send additional data (Size must be less or equal MTU - 8) + /// </summary> + /// <param name="peer">peer to disconnect</param> + /// <param name="writer">additional data</param> + public void DisconnectPeer(NetPeer peer, NetDataWriter writer) + { + DisconnectPeer(peer, writer.Data, 0, writer.Length); + } + + /// <summary> + /// Disconnect peer from server and send additional data (Size must be less or equal MTU - 8) + /// </summary> + /// <param name="peer">peer to disconnect</param> + /// <param name="data">additional data</param> + /// <param name="start">data start</param> + /// <param name="count">data length</param> + public void DisconnectPeer(NetPeer peer, byte[] data, int start, int count) + { + if (peer != null && _peers.ContainsAddress(peer.EndPoint)) + { + DisconnectPeer(peer, DisconnectReason.DisconnectPeerCalled, 0, true, data, start, count); + } + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetManager.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetManager.cs.meta new file mode 100644 index 00000000..5097d635 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetManager.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a0197124da84847d8855d5f690b8c653 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacket.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacket.cs new file mode 100644 index 00000000..ccad0e18 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacket.cs @@ -0,0 +1,163 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using FlyingWormConsole3.LiteNetLib.Utils; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal enum PacketProperty : byte + { + Unreliable, //0 + Reliable, //1 + Sequenced, //2 + ReliableOrdered, //3 + AckReliable, //4 + AckReliableOrdered, //5 + Ping, //6 + Pong, //7 + ConnectRequest, //8 + ConnectAccept, //9 + Disconnect, //10 + UnconnectedMessage, //11 + NatIntroductionRequest, //12 + NatIntroduction, //13 + NatPunchMessage, //14 + MtuCheck, //15 + MtuOk, //16 + DiscoveryRequest, //17 + DiscoveryResponse, //18 + Merged //19 + } + + internal sealed class NetPacket + { + private const int LastProperty = 19; + + //Header + public PacketProperty Property + { + get { return (PacketProperty)(RawData[0] & 0x7F); } + set { RawData[0] = (byte)((RawData[0] & 0x80) | ((byte)value & 0x7F)); } + } + + public ushort Sequence + { + get { return BitConverter.ToUInt16(RawData, 1); } + set { FastBitConverter.GetBytes(RawData, 1, value); } + } + + public bool IsFragmented + { + get { return (RawData[0] & 0x80) != 0; } + set + { + if (value) + RawData[0] |= 0x80; //set first bit + else + RawData[0] &= 0x7F; //unset first bit + } + } + + public ushort FragmentId + { + get { return BitConverter.ToUInt16(RawData, 3); } + set { FastBitConverter.GetBytes(RawData, 3, value); } + } + + public ushort FragmentPart + { + get { return BitConverter.ToUInt16(RawData, 5); } + set { FastBitConverter.GetBytes(RawData, 5, value); } + } + + public ushort FragmentsTotal + { + get { return BitConverter.ToUInt16(RawData, 7); } + set { FastBitConverter.GetBytes(RawData, 7, value); } + } + + //Data + public readonly byte[] RawData; + public int Size; + + public NetPacket(int size) + { + RawData = new byte[size]; + Size = 0; + } + + public static bool GetPacketProperty(byte[] data, out PacketProperty property) + { + byte properyByte = (byte)(data[0] & 0x7F); + if (properyByte > LastProperty) + { + property = PacketProperty.Unreliable; + return false; + } + property = (PacketProperty)properyByte; + return true; + } + + public static int GetHeaderSize(PacketProperty property) + { + return IsSequenced(property) + ? NetConstants.SequencedHeaderSize + : NetConstants.HeaderSize; + } + + public int GetHeaderSize() + { + return GetHeaderSize(Property); + } + + public byte[] GetPacketData() + { + int headerSize = GetHeaderSize(Property); + int dataSize = Size - headerSize; + byte[] data = new byte[dataSize]; + Buffer.BlockCopy(RawData, headerSize, data, 0, dataSize); + return data; + } + + public bool IsClientData() + { + var property = Property; + return property == PacketProperty.Reliable || + property == PacketProperty.ReliableOrdered || + property == PacketProperty.Unreliable || + property == PacketProperty.Sequenced; + } + + public static bool IsSequenced(PacketProperty property) + { + return property == PacketProperty.ReliableOrdered || + property == PacketProperty.Reliable || + property == PacketProperty.Sequenced || + property == PacketProperty.Ping || + property == PacketProperty.Pong || + property == PacketProperty.AckReliable || + property == PacketProperty.AckReliableOrdered; + } + + //Packet contstructor from byte array + public bool FromBytes(byte[] data, int start, int packetSize) + { + //Reading property + byte property = (byte)(data[start] & 0x7F); + bool fragmented = (data[start] & 0x80) != 0; + int headerSize = GetHeaderSize((PacketProperty) property); + + if (property > LastProperty || + packetSize > NetConstants.PacketSizeLimit || + packetSize < headerSize || + (fragmented && packetSize < headerSize + NetConstants.FragmentHeaderSize)) + { + return false; + } + + Buffer.BlockCopy(data, start, RawData, 0, packetSize); + Size = packetSize; + return true; + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacket.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacket.cs.meta new file mode 100644 index 00000000..7f2d5527 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacket.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7aa9ed55f53fa48569ccd0963c50d8da +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacketPool.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacketPool.cs new file mode 100644 index 00000000..c4aba1e6 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacketPool.cs @@ -0,0 +1,101 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Collections.Generic; +using FlyingWormConsole3.LiteNetLib.Utils; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal class NetPacketPool + { + private readonly Stack<NetPacket> _pool; + + public NetPacketPool() + { + _pool = new Stack<NetPacket>(); + } + + public NetPacket GetWithData(PacketProperty property, NetDataWriter writer) + { + var packet = Get(property, writer.Length); + Buffer.BlockCopy(writer.Data, 0, packet.RawData, NetPacket.GetHeaderSize(property), writer.Length); + return packet; + } + + public NetPacket GetWithData(PacketProperty property, byte[] data, int start, int length) + { + var packet = Get(property, length); + Buffer.BlockCopy(data, start, packet.RawData, NetPacket.GetHeaderSize(property), length); + return packet; + } + + //Get packet just for read + public NetPacket GetAndRead(byte[] data, int start, int count) + { + NetPacket packet = null; + lock (_pool) + { + if (_pool.Count > 0) + { + packet = _pool.Pop(); + } + } + if (packet == null) + { + //allocate new packet of max size or bigger + packet = new NetPacket(NetConstants.MaxPacketSize); + } + if (!packet.FromBytes(data, start, count)) + { + Recycle(packet); + return null; + } + return packet; + } + + //Get packet with size + public NetPacket Get(PacketProperty property, int size) + { + NetPacket packet = null; + size += NetPacket.GetHeaderSize(property); + if (size <= NetConstants.MaxPacketSize) + { + lock (_pool) + { + if (_pool.Count > 0) + { + packet = _pool.Pop(); + } + } + } + if (packet == null) + { + //allocate new packet of max size or bigger + packet = new NetPacket(size > NetConstants.MaxPacketSize ? size : NetConstants.MaxPacketSize); + } + else + { + Array.Clear(packet.RawData, 0, size); + } + packet.Property = property; + packet.Size = size; + return packet; + } + + public void Recycle(NetPacket packet) + { + if (packet.Size > NetConstants.MaxPacketSize) + { + //Dont pool big packets. Save memory + return; + } + + //Clean fragmented flag + packet.IsFragmented = false; + lock (_pool) + { + _pool.Push(packet); + } + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacketPool.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacketPool.cs.meta new file mode 100644 index 00000000..d7cb731d --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPacketPool.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3637381933a4745b996d4dd48cd71efe +timeCreated: 1497976517 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeer.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeer.cs new file mode 100644 index 00000000..3ed80d12 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeer.cs @@ -0,0 +1,857 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Collections.Generic; +using System.Text; +using FlyingWormConsole3.LiteNetLib.Utils; + +namespace FlyingWormConsole3.LiteNetLib +{ + public enum ConnectionState + { + InProgress, + Connected, + Disconnected + } + + public sealed class NetPeer + { + //Flow control + private int _currentFlowMode; + private int _sendedPacketsCount; + private int _flowTimer; + + //Ping and RTT + private int _ping; + private int _rtt; + private int _avgRtt; + private int _rttCount; + private int _goodRttCount; + private ushort _pingSequence; + private ushort _remotePingSequence; + private double _resendDelay = 27.0; + + private int _pingSendTimer; + private const int RttResetDelay = 1000; + private int _rttResetTimer; + + private DateTime _pingTimeStart; + private int _timeSinceLastPacket; + + //Common + private readonly NetEndPoint _remoteEndPoint; + private readonly NetManager _peerListener; + private readonly NetPacketPool _packetPool; + private readonly object _flushLock = new object(); + + //Channels + private readonly ReliableChannel _reliableOrderedChannel; + private readonly ReliableChannel _reliableUnorderedChannel; + private readonly SequencedChannel _sequencedChannel; + private readonly SimpleChannel _simpleChannel; + + private int _windowSize = NetConstants.DefaultWindowSize; + + //MTU + private int _mtu = NetConstants.PossibleMtu[0]; + private int _mtuIdx; + private bool _finishMtu; + private int _mtuCheckTimer; + private int _mtuCheckAttempts; + private const int MtuCheckDelay = 1000; + private const int MaxMtuCheckAttempts = 4; + private readonly object _mtuMutex = new object(); + + //Fragment + private class IncomingFragments + { + public NetPacket[] Fragments; + public int ReceivedCount; + public int TotalSize; + } + private ushort _fragmentId; + private readonly Dictionary<ushort, IncomingFragments> _holdedFragments; + + //Merging + private readonly NetPacket _mergeData; + private int _mergePos; + private int _mergeCount; + + //Connection + private int _connectAttempts; + private int _connectTimer; + private long _connectId; + private ConnectionState _connectionState; + + public ConnectionState ConnectionState + { + get { return _connectionState; } + } + + public long ConnectId + { + get { return _connectId; } + } + + public NetEndPoint EndPoint + { + get { return _remoteEndPoint; } + } + + public int Ping + { + get { return _ping; } + } + + public int CurrentFlowMode + { + get { return _currentFlowMode; } + } + + public int Mtu + { + get { return _mtu; } + } + + public int TimeSinceLastPacket + { + get { return _timeSinceLastPacket; } + } + + public NetManager NetManager + { + get { return _peerListener; } + } + + public int PacketsCountInReliableQueue + { + get { return _reliableUnorderedChannel.PacketsInQueue; } + } + + public int PacketsCountInReliableOrderedQueue + { + get { return _reliableOrderedChannel.PacketsInQueue; } + } + + internal double ResendDelay + { + get { return _resendDelay; } + } + + /// <summary> + /// Application defined object containing data about the connection + /// </summary> + public object Tag; + + internal NetPeer(NetManager peerListener, NetEndPoint remoteEndPoint, long connectId) + { + _packetPool = peerListener.PacketPool; + _peerListener = peerListener; + _remoteEndPoint = remoteEndPoint; + + _avgRtt = 0; + _rtt = 0; + _pingSendTimer = 0; + + _reliableOrderedChannel = new ReliableChannel(this, true, _windowSize); + _reliableUnorderedChannel = new ReliableChannel(this, false, _windowSize); + _sequencedChannel = new SequencedChannel(this); + _simpleChannel = new SimpleChannel(this); + + _holdedFragments = new Dictionary<ushort, IncomingFragments>(); + + _mergeData = _packetPool.Get(PacketProperty.Merged, NetConstants.MaxPacketSize); + + //if ID != 0 then we already connected + _connectAttempts = 0; + if (connectId == 0) + { + _connectId = DateTime.UtcNow.Ticks; + SendConnectRequest(); + } + else + { + _connectId = connectId; + _connectionState = ConnectionState.Connected; + SendConnectAccept(); + } + + NetUtils.DebugWrite(ConsoleColor.Cyan, "[CC] ConnectId: {0}", _connectId); + } + + private void SendConnectRequest() + { + //Get connect key bytes + byte[] keyData = Encoding.UTF8.GetBytes(_peerListener.ConnectKey); + + //Make initial packet + var connectPacket = _packetPool.Get(PacketProperty.ConnectRequest, 12 + keyData.Length); + + //Add data + FastBitConverter.GetBytes(connectPacket.RawData, 1, NetConstants.ProtocolId); + FastBitConverter.GetBytes(connectPacket.RawData, 5, _connectId); + Buffer.BlockCopy(keyData, 0, connectPacket.RawData, 13, keyData.Length); + + //Send raw + _peerListener.SendRawAndRecycle(connectPacket, _remoteEndPoint); + } + + private void SendConnectAccept() + { + //Reset connection timer + _timeSinceLastPacket = 0; + + //Make initial packet + var connectPacket = _packetPool.Get(PacketProperty.ConnectAccept, 8); + + //Add data + FastBitConverter.GetBytes(connectPacket.RawData, 1, _connectId); + + //Send raw + _peerListener.SendRawAndRecycle(connectPacket, _remoteEndPoint); + } + + internal bool ProcessConnectAccept(NetPacket packet) + { + if (_connectionState != ConnectionState.InProgress) + return false; + + //check connection id + if (BitConverter.ToInt64(packet.RawData, 1) != _connectId) + { + return false; + } + + NetUtils.DebugWrite(ConsoleColor.Cyan, "[NC] Received connection accept"); + _timeSinceLastPacket = 0; + _connectionState = ConnectionState.Connected; + return true; + } + + private static PacketProperty SendOptionsToProperty(SendOptions options) + { + switch (options) + { + case SendOptions.ReliableUnordered: + return PacketProperty.Reliable; + case SendOptions.Sequenced: + return PacketProperty.Sequenced; + case SendOptions.ReliableOrdered: + return PacketProperty.ReliableOrdered; + default: + return PacketProperty.Unreliable; + } + } + + public int GetMaxSinglePacketSize(SendOptions options) + { + return _mtu - NetPacket.GetHeaderSize(SendOptionsToProperty(options)); + } + + public void Send(byte[] data, SendOptions options) + { + Send(data, 0, data.Length, options); + } + + public void Send(NetDataWriter dataWriter, SendOptions options) + { + Send(dataWriter.Data, 0, dataWriter.Length, options); + } + + public void Send(byte[] data, int start, int length, SendOptions options) + { + //Prepare + PacketProperty property = SendOptionsToProperty(options); + int headerSize = NetPacket.GetHeaderSize(property); + + //Check fragmentation + if (length + headerSize > _mtu) + { + if (options == SendOptions.Sequenced || options == SendOptions.Unreliable) + { + throw new Exception("Unreliable packet size > allowed (" + (_mtu - headerSize) + ")"); + } + + int packetFullSize = _mtu - headerSize; + int packetDataSize = packetFullSize - NetConstants.FragmentHeaderSize; + + int fullPacketsCount = length / packetDataSize; + int lastPacketSize = length % packetDataSize; + int totalPackets = fullPacketsCount + (lastPacketSize == 0 ? 0 : 1); + + NetUtils.DebugWrite("FragmentSend:\n" + + " MTU: {0}\n" + + " headerSize: {1}\n" + + " packetFullSize: {2}\n" + + " packetDataSize: {3}\n" + + " fullPacketsCount: {4}\n" + + " lastPacketSize: {5}\n" + + " totalPackets: {6}", + _mtu, headerSize, packetFullSize, packetDataSize, fullPacketsCount, lastPacketSize, totalPackets); + + if (totalPackets > ushort.MaxValue) + { + throw new Exception("Too many fragments: " + totalPackets + " > " + ushort.MaxValue); + } + + int dataOffset = headerSize + NetConstants.FragmentHeaderSize; + for (ushort i = 0; i < fullPacketsCount; i++) + { + NetPacket p = _packetPool.Get(property, packetFullSize); + p.FragmentId = _fragmentId; + p.FragmentPart = i; + p.FragmentsTotal = (ushort)totalPackets; + p.IsFragmented = true; + Buffer.BlockCopy(data, i * packetDataSize, p.RawData, dataOffset, packetDataSize); + SendPacket(p); + } + + if (lastPacketSize > 0) + { + NetPacket p = _packetPool.Get(property, lastPacketSize + NetConstants.FragmentHeaderSize); + p.FragmentId = _fragmentId; + p.FragmentPart = (ushort)fullPacketsCount; //last + p.FragmentsTotal = (ushort)totalPackets; + p.IsFragmented = true; + Buffer.BlockCopy(data, fullPacketsCount * packetDataSize, p.RawData, dataOffset, lastPacketSize); + SendPacket(p); + } + + _fragmentId++; + return; + } + + //Else just send + NetPacket packet = _packetPool.GetWithData(property, data, start, length); + SendPacket(packet); + } + + private void CreateAndSend(PacketProperty property, ushort sequence) + { + NetPacket packet = _packetPool.Get(property, 0); + packet.Sequence = sequence; + SendPacket(packet); + } + + //from user thread, our thread, or recv? + private void SendPacket(NetPacket packet) + { + NetUtils.DebugWrite("[RS]Packet: " + packet.Property); + switch (packet.Property) + { + case PacketProperty.Reliable: + _reliableUnorderedChannel.AddToQueue(packet); + break; + case PacketProperty.Sequenced: + _sequencedChannel.AddToQueue(packet); + break; + case PacketProperty.ReliableOrdered: + _reliableOrderedChannel.AddToQueue(packet); + break; + case PacketProperty.Unreliable: + _simpleChannel.AddToQueue(packet); + break; + case PacketProperty.MtuCheck: + //Must check result for MTU fix + if (!_peerListener.SendRawAndRecycle(packet, _remoteEndPoint)) + { + _finishMtu = true; + } + break; + case PacketProperty.AckReliable: + case PacketProperty.AckReliableOrdered: + case PacketProperty.Ping: + case PacketProperty.Pong: + case PacketProperty.Disconnect: + case PacketProperty.MtuOk: + SendRawData(packet); + _packetPool.Recycle(packet); + break; + default: + throw new Exception("Unknown packet property: " + packet.Property); + } + } + + private void UpdateRoundTripTime(int roundTripTime) + { + //Calc average round trip time + _rtt += roundTripTime; + _rttCount++; + _avgRtt = _rtt/_rttCount; + + //flowmode 0 = fastest + //flowmode max = lowest + + if (_avgRtt < _peerListener.GetStartRtt(_currentFlowMode - 1)) + { + if (_currentFlowMode <= 0) + { + //Already maxed + return; + } + + _goodRttCount++; + if (_goodRttCount > NetConstants.FlowIncreaseThreshold) + { + _goodRttCount = 0; + _currentFlowMode--; + + NetUtils.DebugWrite("[PA]Increased flow speed, RTT: {0}, PPS: {1}", _avgRtt, _peerListener.GetPacketsPerSecond(_currentFlowMode)); + } + } + else if(_avgRtt > _peerListener.GetStartRtt(_currentFlowMode)) + { + _goodRttCount = 0; + if (_currentFlowMode < _peerListener.GetMaxFlowMode()) + { + _currentFlowMode++; + NetUtils.DebugWrite("[PA]Decreased flow speed, RTT: {0}, PPS: {1}", _avgRtt, _peerListener.GetPacketsPerSecond(_currentFlowMode)); + } + } + + //recalc resend delay + double avgRtt = _avgRtt; + if (avgRtt <= 0.0) + avgRtt = 0.1; + _resendDelay = 25 + (avgRtt * 2.1); // 25 ms + double rtt + } + + internal void AddIncomingPacket(NetPacket p) + { + if (p.IsFragmented) + { + NetUtils.DebugWrite("Fragment. Id: {0}, Part: {1}, Total: {2}", p.FragmentId, p.FragmentPart, p.FragmentsTotal); + //Get needed array from dictionary + ushort packetFragId = p.FragmentId; + IncomingFragments incomingFragments; + if (!_holdedFragments.TryGetValue(packetFragId, out incomingFragments)) + { + incomingFragments = new IncomingFragments + { + Fragments = new NetPacket[p.FragmentsTotal] + }; + _holdedFragments.Add(packetFragId, incomingFragments); + } + + //Cache + var fragments = incomingFragments.Fragments; + + //Error check + if (p.FragmentPart >= fragments.Length || fragments[p.FragmentPart] != null) + { + _packetPool.Recycle(p); + NetUtils.DebugWriteError("Invalid fragment packet"); + return; + } + //Fill array + fragments[p.FragmentPart] = p; + + //Increase received fragments count + incomingFragments.ReceivedCount++; + + //Increase total size + int dataOffset = p.GetHeaderSize() + NetConstants.FragmentHeaderSize; + incomingFragments.TotalSize += p.Size - dataOffset; + + //Check for finish + if (incomingFragments.ReceivedCount != fragments.Length) + { + return; + } + + NetUtils.DebugWrite("Received all fragments!"); + NetPacket resultingPacket = _packetPool.Get( p.Property, incomingFragments.TotalSize ); + + int resultingPacketOffset = resultingPacket.GetHeaderSize(); + int firstFragmentSize = fragments[0].Size - dataOffset; + for (int i = 0; i < incomingFragments.ReceivedCount; i++) + { + //Create resulting big packet + int fragmentSize = fragments[i].Size - dataOffset; + Buffer.BlockCopy( + fragments[i].RawData, + dataOffset, + resultingPacket.RawData, + resultingPacketOffset + firstFragmentSize * i, + fragmentSize); + + //Free memory + _packetPool.Recycle(fragments[i]); + fragments[i] = null; + } + + //Send to process + _peerListener.ReceiveFromPeer(resultingPacket, _remoteEndPoint); + + //Clear memory + _packetPool.Recycle(resultingPacket); + _holdedFragments.Remove(packetFragId); + } + else //Just simple packet + { + _peerListener.ReceiveFromPeer(p, _remoteEndPoint); + _packetPool.Recycle(p); + } + } + + private void ProcessMtuPacket(NetPacket packet) + { + if (packet.Size == 1 || + packet.RawData[1] >= NetConstants.PossibleMtu.Length) + return; + + //MTU auto increase + if (packet.Property == PacketProperty.MtuCheck) + { + if (packet.Size != NetConstants.PossibleMtu[packet.RawData[1]]) + { + return; + } + _mtuCheckAttempts = 0; + NetUtils.DebugWrite("MTU check. Resend: " + packet.RawData[1]); + var mtuOkPacket = _packetPool.Get(PacketProperty.MtuOk, 1); + mtuOkPacket.RawData[1] = packet.RawData[1]; + SendPacket(mtuOkPacket); + } + else if(packet.RawData[1] > _mtuIdx) //MtuOk + { + lock (_mtuMutex) + { + _mtuIdx = packet.RawData[1]; + _mtu = NetConstants.PossibleMtu[_mtuIdx]; + } + //if maxed - finish. + if (_mtuIdx == NetConstants.PossibleMtu.Length - 1) + { + _finishMtu = true; + } + NetUtils.DebugWrite("MTU ok. Increase to: " + _mtu); + } + } + + //Process incoming packet + internal void ProcessPacket(NetPacket packet) + { + _timeSinceLastPacket = 0; + + NetUtils.DebugWrite("[RR]PacketProperty: {0}", packet.Property); + switch (packet.Property) + { + case PacketProperty.ConnectRequest: + //response with connect + long newId = BitConverter.ToInt64(packet.RawData, 1); + if (newId > _connectId) + { + _connectId = newId; + } + + NetUtils.DebugWrite("ConnectRequest LastId: {0}, NewId: {1}, EP: {2}", ConnectId, newId, _remoteEndPoint); + SendConnectAccept(); + _packetPool.Recycle(packet); + break; + + case PacketProperty.Merged: + int pos = NetConstants.HeaderSize; + while (pos < packet.Size) + { + ushort size = BitConverter.ToUInt16(packet.RawData, pos); + pos += 2; + NetPacket mergedPacket = _packetPool.GetAndRead(packet.RawData, pos, size); + if (mergedPacket == null) + { + _packetPool.Recycle(packet); + break; + } + pos += size; + ProcessPacket(mergedPacket); + } + break; + //If we get ping, send pong + case PacketProperty.Ping: + if (NetUtils.RelativeSequenceNumber(packet.Sequence, _remotePingSequence) < 0) + { + _packetPool.Recycle(packet); + break; + } + NetUtils.DebugWrite("[PP]Ping receive, send pong"); + _remotePingSequence = packet.Sequence; + _packetPool.Recycle(packet); + + //send + CreateAndSend(PacketProperty.Pong, _remotePingSequence); + break; + + //If we get pong, calculate ping time and rtt + case PacketProperty.Pong: + if (NetUtils.RelativeSequenceNumber(packet.Sequence, _pingSequence) < 0) + { + _packetPool.Recycle(packet); + break; + } + _pingSequence = packet.Sequence; + int rtt = (int)(DateTime.UtcNow - _pingTimeStart).TotalMilliseconds; + UpdateRoundTripTime(rtt); + NetUtils.DebugWrite("[PP]Ping: {0}", rtt); + _packetPool.Recycle(packet); + break; + + //Process ack + case PacketProperty.AckReliable: + _reliableUnorderedChannel.ProcessAck(packet); + _packetPool.Recycle(packet); + break; + + case PacketProperty.AckReliableOrdered: + _reliableOrderedChannel.ProcessAck(packet); + _packetPool.Recycle(packet); + break; + + //Process in order packets + case PacketProperty.Sequenced: + _sequencedChannel.ProcessPacket(packet); + break; + + case PacketProperty.Reliable: + _reliableUnorderedChannel.ProcessPacket(packet); + break; + + case PacketProperty.ReliableOrdered: + _reliableOrderedChannel.ProcessPacket(packet); + break; + + //Simple packet without acks + case PacketProperty.Unreliable: + AddIncomingPacket(packet); + return; + + case PacketProperty.MtuCheck: + case PacketProperty.MtuOk: + ProcessMtuPacket(packet); + break; + + default: + NetUtils.DebugWriteError("Error! Unexpected packet type: " + packet.Property); + break; + } + } + + private static bool CanMerge(PacketProperty property) + { + switch (property) + { + case PacketProperty.ConnectAccept: + case PacketProperty.ConnectRequest: + case PacketProperty.MtuOk: + case PacketProperty.Pong: + case PacketProperty.Disconnect: + return false; + default: + return true; + } + } + + internal void SendRawData(NetPacket packet) + { + //2 - merge byte + minimal packet size + datalen(ushort) + if (_peerListener.MergeEnabled && + CanMerge(packet.Property) && + _mergePos + packet.Size + NetConstants.HeaderSize*2 + 2 < _mtu) + { + FastBitConverter.GetBytes(_mergeData.RawData, _mergePos + NetConstants.HeaderSize, (ushort)packet.Size); + Buffer.BlockCopy(packet.RawData, 0, _mergeData.RawData, _mergePos + NetConstants.HeaderSize + 2, packet.Size); + _mergePos += packet.Size + 2; + _mergeCount++; + + //DebugWriteForce("Merged: " + _mergePos + "/" + (_mtu - 2) + ", count: " + _mergeCount); + return; + } + + NetUtils.DebugWrite(ConsoleColor.DarkYellow, "[P]SendingPacket: " + packet.Property); + _peerListener.SendRaw(packet.RawData, 0, packet.Size, _remoteEndPoint); + } + + private void SendQueuedPackets(int currentMaxSend) + { + int currentSended = 0; + while (currentSended < currentMaxSend) + { + //Get one of packets + if (_reliableOrderedChannel.SendNextPacket() || + _reliableUnorderedChannel.SendNextPacket() || + _sequencedChannel.SendNextPacket() || + _simpleChannel.SendNextPacket()) + { + currentSended++; + } + else + { + //no outgoing packets + break; + } + } + + //Increase counter + _sendedPacketsCount += currentSended; + + //If merging enabled + if (_mergePos > 0) + { + if (_mergeCount > 1) + { + NetUtils.DebugWrite("Send merged: " + _mergePos + ", count: " + _mergeCount); + _peerListener.SendRaw(_mergeData.RawData, 0, NetConstants.HeaderSize + _mergePos, _remoteEndPoint); + } + else + { + //Send without length information and merging + _peerListener.SendRaw(_mergeData.RawData, NetConstants.HeaderSize + 2, _mergePos - 2, _remoteEndPoint); + } + _mergePos = 0; + _mergeCount = 0; + } + } + + /// <summary> + /// Flush all queued packets + /// </summary> + public void Flush() + { + lock (_flushLock) + { + SendQueuedPackets(int.MaxValue); + } + } + + internal void Update(int deltaTime) + { + if (_connectionState == ConnectionState.Disconnected) + { + return; + } + + _timeSinceLastPacket += deltaTime; + if (_connectionState == ConnectionState.InProgress) + { + _connectTimer += deltaTime; + if (_connectTimer > _peerListener.ReconnectDelay) + { + _connectTimer = 0; + _connectAttempts++; + if (_connectAttempts > _peerListener.MaxConnectAttempts) + { + _connectionState = ConnectionState.Disconnected; + return; + } + + //else send connect again + SendConnectRequest(); + } + return; + } + + //Get current flow mode + int maxSendPacketsCount = _peerListener.GetPacketsPerSecond(_currentFlowMode); + int currentMaxSend; + + if (maxSendPacketsCount > 0) + { + int availableSendPacketsCount = maxSendPacketsCount - _sendedPacketsCount; + currentMaxSend = Math.Min(availableSendPacketsCount, (maxSendPacketsCount*deltaTime)/NetConstants.FlowUpdateTime); + } + else + { + currentMaxSend = int.MaxValue; + } + + //DebugWrite("[UPDATE]Delta: {0}ms, MaxSend: {1}", deltaTime, currentMaxSend); + + //Pending acks + _reliableOrderedChannel.SendAcks(); + _reliableUnorderedChannel.SendAcks(); + + //ResetFlowTimer + _flowTimer += deltaTime; + if (_flowTimer >= NetConstants.FlowUpdateTime) + { + NetUtils.DebugWrite("[UPDATE]Reset flow timer, _sendedPackets - {0}", _sendedPacketsCount); + _sendedPacketsCount = 0; + _flowTimer = 0; + } + + //Send ping + _pingSendTimer += deltaTime; + if (_pingSendTimer >= _peerListener.PingInterval) + { + NetUtils.DebugWrite("[PP] Send ping..."); + + //reset timer + _pingSendTimer = 0; + + //send ping + CreateAndSend(PacketProperty.Ping, _pingSequence); + + //reset timer + _pingTimeStart = DateTime.UtcNow; + } + + //RTT - round trip time + _rttResetTimer += deltaTime; + if (_rttResetTimer >= RttResetDelay) + { + _rttResetTimer = 0; + //Rtt update + _rtt = _avgRtt; + _ping = _avgRtt; + _peerListener.ConnectionLatencyUpdated(this, _ping); + _rttCount = 1; + } + + //MTU - Maximum transmission unit + if (!_finishMtu) + { + _mtuCheckTimer += deltaTime; + if (_mtuCheckTimer >= MtuCheckDelay) + { + _mtuCheckTimer = 0; + _mtuCheckAttempts++; + if (_mtuCheckAttempts >= MaxMtuCheckAttempts) + { + _finishMtu = true; + } + else + { + lock (_mtuMutex) + { + //Send increased packet + if (_mtuIdx < NetConstants.PossibleMtu.Length - 1) + { + int newMtu = NetConstants.PossibleMtu[_mtuIdx + 1] - NetConstants.HeaderSize; + var p = _packetPool.Get(PacketProperty.MtuCheck, newMtu); + p.RawData[1] = (byte)(_mtuIdx + 1); + SendPacket(p); + } + } + } + } + } + //MTU - end + + //Pending send + lock (_flushLock) + { + SendQueuedPackets(currentMaxSend); + } + } + + //For channels + internal void Recycle(NetPacket packet) + { + _packetPool.Recycle(packet); + } + + internal NetPacket GetPacketFromPool(PacketProperty property, int bytesCount) + { + return _packetPool.Get(property, bytesCount); + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeer.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeer.cs.meta new file mode 100644 index 00000000..0e046058 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 39ca2e83856ea4ba0a0100a00089e695 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeerCollection.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeerCollection.cs new file mode 100644 index 00000000..a76a5d28 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeerCollection.cs @@ -0,0 +1,81 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Collections.Generic; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal sealed class NetPeerCollection + { + private readonly Dictionary<NetEndPoint, NetPeer> _peersDict; + private readonly NetPeer[] _peersArray; + private int _count; + + public int Count + { + get { return _count; } + } + + public NetPeer this[int index] + { + get { return _peersArray[index]; } + } + + public NetPeerCollection(int maxPeers) + { + _peersArray = new NetPeer[maxPeers]; + _peersDict = new Dictionary<NetEndPoint, NetPeer>(); + } + + public bool TryGetValue(NetEndPoint endPoint, out NetPeer peer) + { + return _peersDict.TryGetValue(endPoint, out peer); + } + + public void Clear() + { + Array.Clear(_peersArray, 0, _count); + _peersDict.Clear(); + _count = 0; + } + + public void Add(NetEndPoint endPoint, NetPeer peer) + { + _peersArray[_count] = peer; + _peersDict.Add(endPoint, peer); + _count++; + } + + public bool ContainsAddress(NetEndPoint endPoint) + { + return _peersDict.ContainsKey(endPoint); + } + + public NetPeer[] ToArray() + { + NetPeer[] result = new NetPeer[_count]; + Array.Copy(_peersArray, 0, result, 0, _count); + return result; + } + + public void RemoveAt(int idx) + { + _peersDict.Remove(_peersArray[idx].EndPoint); + _peersArray[idx] = _peersArray[_count - 1]; + _peersArray[_count - 1] = null; + _count--; + } + + public void Remove(NetEndPoint endPoint) + { + for (int i = 0; i < _count; i++) + { + if (_peersArray[i].EndPoint.Equals(endPoint)) + { + RemoveAt(i); + break; + } + } + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeerCollection.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeerCollection.cs.meta new file mode 100644 index 00000000..c0911888 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetPeerCollection.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ca9b271291848481a86c9b3cb7f07451 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSerializer.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSerializer.cs new file mode 100644 index 00000000..f51299fe --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSerializer.cs @@ -0,0 +1,709 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Reflection; +using System.Collections.Generic; +#if WINRT || NETCORE +using System.Linq; +#endif + +namespace FlyingWormConsole3.LiteNetLib.Utils +{ + public interface INetSerializable + { + void Serialize(NetDataWriter writer); + void Desereialize(NetDataReader reader); + } + + public abstract class NetSerializerHasher + { + public abstract ulong GetHash(string type); + public abstract void WriteHash(ulong hash, NetDataWriter writer); + public abstract ulong ReadHash(NetDataReader reader); + } + + public sealed class FNVHasher : NetSerializerHasher + { + private readonly Dictionary<string, ulong> _hashCache = new Dictionary<string, ulong>(); + private readonly char[] _hashBuffer = new char[1024]; + + public override ulong GetHash(string type) + { + ulong hash; + if (_hashCache.TryGetValue(type, out hash)) + { + return hash; + } + hash = 14695981039346656037UL; //offset + int len = type.Length; + type.CopyTo(0, _hashBuffer, 0, len); + for (var i = 0; i < len; i++) + { + hash = hash ^ _hashBuffer[i]; + hash *= 1099511628211UL; //prime + } + _hashCache.Add(type, hash); + return hash; + } + + public override ulong ReadHash(NetDataReader reader) + { + return reader.GetULong(); + } + + public override void WriteHash(ulong hash, NetDataWriter writer) + { + writer.Put(hash); + } + } + + public sealed class NetSerializer + { + private sealed class CustomType + { + public readonly CustomTypeWrite WriteDelegate; + public readonly CustomTypeRead ReadDelegate; + + public CustomType(CustomTypeWrite writeDelegate, CustomTypeRead readDelegate) + { + WriteDelegate = writeDelegate; + ReadDelegate = readDelegate; + } + } + + private delegate void CustomTypeWrite(NetDataWriter writer, object customObj); + private delegate object CustomTypeRead(NetDataReader reader); + + private sealed class StructInfo + { + public readonly Action<NetDataWriter>[] WriteDelegate; + public readonly Action<NetDataReader>[] ReadDelegate; + public readonly Type[] FieldTypes; + public object Reference; + public Func<object> CreatorFunc; + public Action<object, object> OnReceive; + public readonly ulong Hash; + public readonly int MembersCount; + + public StructInfo(ulong hash, int membersCount) + { + Hash = hash; + MembersCount = membersCount; + WriteDelegate = new Action<NetDataWriter>[membersCount]; + ReadDelegate = new Action<NetDataReader>[membersCount]; + FieldTypes = new Type[membersCount]; + } + + public void Write(NetDataWriter writer, object obj) + { + Reference = obj; + for (int i = 0; i < MembersCount; i++) + { + WriteDelegate[i](writer); + } + } + + public void Read(NetDataReader reader) + { + for (int i = 0; i < MembersCount; i++) + { + ReadDelegate[i](reader); + } + } + } + + private readonly Dictionary<ulong, StructInfo> _cache; + private readonly Dictionary<Type, CustomType> _registeredCustomTypes; + + private static readonly HashSet<Type> BasicTypes = new HashSet<Type> + { + typeof(int), + typeof(uint), + typeof(byte), + typeof(sbyte), + typeof(short), + typeof(ushort), + typeof(long), + typeof(ulong), + typeof(string), + typeof(float), + typeof(double), + typeof(bool) + }; + + private readonly NetDataWriter _writer; + private readonly NetSerializerHasher _hasher; + private const int MaxStringLenght = 1024; + + public NetSerializer() : this(new FNVHasher()) + { + } + + public NetSerializer(NetSerializerHasher hasher) + { + _hasher = hasher; + _cache = new Dictionary<ulong, StructInfo>(); + _registeredCustomTypes = new Dictionary<Type, CustomType>(); + _writer = new NetDataWriter(); + } + + private bool RegisterCustomTypeInternal<T>(Func<T> constructor) where T : INetSerializable + { + var t = typeof(T); + if (_registeredCustomTypes.ContainsKey(t)) + { + return false; + } + + var rwDelegates = new CustomType( + (writer, obj) => + { + ((T)obj).Serialize(writer); + }, + reader => + { + var instance = constructor(); + instance.Desereialize(reader); + return instance; + }); + _registeredCustomTypes.Add(t, rwDelegates); + return true; + } + + /// <summary> + /// Register custom property type + /// </summary> + /// <typeparam name="T">INetSerializable structure</typeparam> + /// <returns>True - if register successful, false - if type already registered</returns> + public bool RegisterCustomType<T>() where T : struct, INetSerializable + { + return RegisterCustomTypeInternal(() => new T()); + } + + /// <summary> + /// Register custom property type + /// </summary> + /// <typeparam name="T">INetSerializable class</typeparam> + /// <returns>True - if register successful, false - if type already registered</returns> + public bool RegisterCustomType<T>(Func<T> constructor) where T : class, INetSerializable + { + return RegisterCustomTypeInternal(constructor); + } + + /// <summary> + /// Register custom property type + /// </summary> + /// <param name="writeDelegate"></param> + /// <param name="readDelegate"></param> + /// <returns>True - if register successful, false - if type already registered</returns> + public bool RegisterCustomType<T>(Action<NetDataWriter, T> writeDelegate, Func<NetDataReader, T> readDelegate) + { + var t = typeof(T); + if (BasicTypes.Contains(t) || _registeredCustomTypes.ContainsKey(t)) + { + return false; + } + + var rwDelegates = new CustomType( + (writer, obj) => writeDelegate(writer, (T)obj), + reader => readDelegate(reader)); + + _registeredCustomTypes.Add(t, rwDelegates); + return true; + } + + private static Delegate CreateDelegate(Type type, MethodInfo info) + { +#if WINRT || NETCORE + return info.CreateDelegate(type); +#else + return Delegate.CreateDelegate(type, info); +#endif + } + + private static Func<TClass, TProperty> ExtractGetDelegate<TClass, TProperty>(MethodInfo info) + { + return (Func<TClass, TProperty>)CreateDelegate(typeof(Func<TClass, TProperty>), info); + } + + private static Action<TClass, TProperty> ExtractSetDelegate<TClass, TProperty>(MethodInfo info) + { + return (Action<TClass, TProperty>)CreateDelegate(typeof(Action<TClass, TProperty>), info); + } + + private StructInfo RegisterInternal<T>() where T : class + { + Type t = typeof(T); + ulong nameHash = _hasher.GetHash(t.Name); + + StructInfo info; + if (_cache.TryGetValue(nameHash, out info)) + { + return info; + } + +#if WINRT || NETCORE + var props = t.GetRuntimeProperties().ToArray(); + int propsCount = props.Count(); +#else + var props = t.GetProperties( + BindingFlags.Instance | + BindingFlags.Public | + BindingFlags.GetProperty | + BindingFlags.SetProperty); + int propsCount = props.Length; +#endif + if (props == null || propsCount < 0) + { + throw new ArgumentException("Type does not contain acceptable fields"); + } + + info = new StructInfo(nameHash, propsCount); + for (int i = 0; i < props.Length; i++) + { + var property = props[i]; + var propertyType = property.PropertyType; + + //Set field type + info.FieldTypes[i] = propertyType.IsArray ? propertyType.GetElementType() : propertyType; +#if WINRT || NETCORE + bool isEnum = propertyType.GetTypeInfo().IsEnum; + var getMethod = property.GetMethod; + var setMethod = property.SetMethod; +#else + bool isEnum = propertyType.IsEnum; + var getMethod = property.GetGetMethod(); + var setMethod = property.GetSetMethod(); +#endif + if (isEnum) + { + var underlyingType = Enum.GetUnderlyingType(propertyType); + if (underlyingType == typeof(byte)) + { + info.ReadDelegate[i] = reader => + { + property.SetValue(info.Reference, Enum.ToObject(propertyType, reader.GetByte()), null); + }; + info.WriteDelegate[i] = writer => + { + writer.Put((byte)property.GetValue(info.Reference, null)); + }; + } + else if (underlyingType == typeof(int)) + { + info.ReadDelegate[i] = reader => + { + property.SetValue(info.Reference, Enum.ToObject(propertyType, reader.GetInt()), null); + }; + info.WriteDelegate[i] = writer => + { + writer.Put((int)property.GetValue(info.Reference, null)); + }; + } + else + { + throw new Exception("Not supported enum underlying type: " + underlyingType.Name); + } + } + else if (propertyType == typeof(string)) + { + var setDelegate = ExtractSetDelegate<T, string>(setMethod); + var getDelegate = ExtractGetDelegate<T, string>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetString(MaxStringLenght)); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference), MaxStringLenght); + } + else if (propertyType == typeof(bool)) + { + var setDelegate = ExtractSetDelegate<T, bool>(setMethod); + var getDelegate = ExtractGetDelegate<T, bool>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetBool()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(byte)) + { + var setDelegate = ExtractSetDelegate<T, byte>(setMethod); + var getDelegate = ExtractGetDelegate<T, byte>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetByte()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(sbyte)) + { + var setDelegate = ExtractSetDelegate<T, sbyte>(setMethod); + var getDelegate = ExtractGetDelegate<T, sbyte>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetSByte()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(short)) + { + var setDelegate = ExtractSetDelegate<T, short>(setMethod); + var getDelegate = ExtractGetDelegate<T, short>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetShort()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(ushort)) + { + var setDelegate = ExtractSetDelegate<T, ushort>(setMethod); + var getDelegate = ExtractGetDelegate<T, ushort>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetUShort()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(int)) + { + var setDelegate = ExtractSetDelegate<T, int>(setMethod); + var getDelegate = ExtractGetDelegate<T, int>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetInt()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(uint)) + { + var setDelegate = ExtractSetDelegate<T, uint>(setMethod); + var getDelegate = ExtractGetDelegate<T, uint>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetUInt()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(long)) + { + var setDelegate = ExtractSetDelegate<T, long>(setMethod); + var getDelegate = ExtractGetDelegate<T, long>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetLong()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(ulong)) + { + var setDelegate = ExtractSetDelegate<T, ulong>(setMethod); + var getDelegate = ExtractGetDelegate<T, ulong>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetULong()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(float)) + { + var setDelegate = ExtractSetDelegate<T, float>(setMethod); + var getDelegate = ExtractGetDelegate<T, float>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetFloat()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(double)) + { + var setDelegate = ExtractSetDelegate<T, double>(setMethod); + var getDelegate = ExtractGetDelegate<T, double>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetDouble()); + info.WriteDelegate[i] = writer => writer.Put(getDelegate((T)info.Reference)); + } + // Array types + else if (propertyType == typeof(string[])) + { + var setDelegate = ExtractSetDelegate<T, string[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, string[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetStringArray(MaxStringLenght)); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference), MaxStringLenght); + } + else if (propertyType == typeof(byte[])) + { + var setDelegate = ExtractSetDelegate<T, byte[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, byte[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetBytesWithLength()); + info.WriteDelegate[i] = writer => writer.PutBytesWithLength(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(short[])) + { + var setDelegate = ExtractSetDelegate<T, short[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, short[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetShortArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(ushort[])) + { + var setDelegate = ExtractSetDelegate<T, ushort[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, ushort[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetUShortArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(int[])) + { + var setDelegate = ExtractSetDelegate<T, int[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, int[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetIntArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(uint[])) + { + var setDelegate = ExtractSetDelegate<T, uint[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, uint[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetUIntArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(long[])) + { + var setDelegate = ExtractSetDelegate<T, long[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, long[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetLongArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(ulong[])) + { + var setDelegate = ExtractSetDelegate<T, ulong[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, ulong[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetULongArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(float[])) + { + var setDelegate = ExtractSetDelegate<T, float[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, float[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetFloatArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else if (propertyType == typeof(double[])) + { + var setDelegate = ExtractSetDelegate<T, double[]>(setMethod); + var getDelegate = ExtractGetDelegate<T, double[]>(getMethod); + info.ReadDelegate[i] = reader => setDelegate((T)info.Reference, reader.GetDoubleArray()); + info.WriteDelegate[i] = writer => writer.PutArray(getDelegate((T)info.Reference)); + } + else + { + CustomType registeredCustomType; + bool array = false; + + if (propertyType.IsArray) + { + array = true; + propertyType = propertyType.GetElementType(); + } + + if (_registeredCustomTypes.TryGetValue(propertyType, out registeredCustomType)) + { + if (array) //Array type serialize/deserialize + { + info.ReadDelegate[i] = reader => + { + ushort arrLength = reader.GetUShort(); + Array arr = Array.CreateInstance(propertyType, arrLength); + for (int k = 0; k < arrLength; k++) + { + arr.SetValue(registeredCustomType.ReadDelegate(reader), k); + } + + property.SetValue(info.Reference, arr, null); + }; + + info.WriteDelegate[i] = writer => + { + Array arr = (Array)property.GetValue(info.Reference, null); + writer.Put((ushort)arr.Length); + for (int k = 0; k < arr.Length; k++) + { + registeredCustomType.WriteDelegate(writer, arr.GetValue(k)); + } + }; + } + else //Simple + { + info.ReadDelegate[i] = reader => + { + property.SetValue(info.Reference, registeredCustomType.ReadDelegate(reader), null); + }; + + info.WriteDelegate[i] = writer => + { + registeredCustomType.WriteDelegate(writer, property.GetValue(info.Reference, null)); + }; + } + } + else + { + throw new Exception("Unknown property type: " + propertyType.Name); + } + } + } + _cache.Add(nameHash, info); + + return info; + } + + /// <summary> + /// Reads all available data from NetDataReader and calls OnReceive delegates + /// </summary> + /// <param name="reader">NetDataReader with packets data</param> + public void ReadAllPackets(NetDataReader reader) + { + while (reader.AvailableBytes > 0) + { + ReadPacket(reader); + } + } + + /// <summary> + /// Reads all available data from NetDataReader and calls OnReceive delegates + /// </summary> + /// <param name="reader">NetDataReader with packets data</param> + /// <param name="userData">Argument that passed to OnReceivedEvent</param> + public void ReadAllPackets<T>(NetDataReader reader, T userData) + { + while (reader.AvailableBytes > 0) + { + ReadPacket(reader, userData); + } + } + + /// <summary> + /// Reads one packet from NetDataReader and calls OnReceive delegate + /// </summary> + /// <param name="reader">NetDataReader with packet</param> + public void ReadPacket(NetDataReader reader) + { + ReadPacket(reader, null); + } + + private StructInfo ReadInfo(NetDataReader reader) + { + ulong hash = _hasher.ReadHash(reader); + StructInfo info; + if (!_cache.TryGetValue(hash, out info)) + { + throw new Exception("Undefined packet received"); + } + return info; + } + + /// <summary> + /// Reads packet with known type + /// </summary> + /// <param name="reader">NetDataReader with packet</param> + /// <returns>Returns packet if packet in reader is matched type</returns> + public T ReadKnownPacket<T>(NetDataReader reader) where T : class, new() + { + var info = ReadInfo(reader); + ulong typeHash = _hasher.GetHash(typeof(T).Name); + if (typeHash != info.Hash) + { + return null; + } + info.Reference = info.CreatorFunc != null ? info.CreatorFunc() : Activator.CreateInstance<T>(); + info.Read(reader); + return (T)info.Reference; + } + + /// <summary> + /// Reads packet with known type (non alloc variant) + /// </summary> + /// <param name="reader">NetDataReader with packet</param> + /// <param name="target">Deserialization target</param> + /// <returns>Returns true if packet in reader is matched type</returns> + public bool ReadKnownPacket<T>(NetDataReader reader, T target) where T : class, new() + { + var info = ReadInfo(reader); + ulong typeHash = _hasher.GetHash(typeof(T).Name); + if (typeHash != info.Hash) + { + return false; + } + + info.Reference = target; + info.Read(reader); + return true; + } + + /// <summary> + /// Reads one packet from NetDataReader and calls OnReceive delegate + /// </summary> + /// <param name="reader">NetDataReader with packet</param> + /// <param name="userData">Argument that passed to OnReceivedEvent</param> + public void ReadPacket(NetDataReader reader, object userData) + { + var info = ReadInfo(reader); + if (info.CreatorFunc != null) + { + info.Reference = info.CreatorFunc(); + } + info.Read(reader); + info.OnReceive(info.Reference, userData); + } + + /// <summary> + /// Register and subscribe to packet receive event + /// </summary> + /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param> + /// <param name="packetConstructor">Method that constructs packet intead of slow Activator.CreateInstance</param> + public void Subscribe<T>(Action<T> onReceive, Func<T> packetConstructor) where T : class, new() + { + var info = RegisterInternal<T>(); + info.CreatorFunc = () => packetConstructor(); + info.OnReceive = (o, userData) => { onReceive((T)o); }; + } + + /// <summary> + /// Register packet type for direct reading (ReadKnownPacket) + /// </summary> + /// <param name="packetConstructor">Method that constructs packet intead of slow Activator.CreateInstance</param> + public void Register<T>(Func<T> packetConstructor = null) where T : class, new() + { + var info = RegisterInternal<T>(); + if (packetConstructor != null) + { + info.CreatorFunc = () => packetConstructor(); + } + info.OnReceive = (o, userData) => { }; + } + + /// <summary> + /// Register and subscribe to packet receive event (with userData) + /// </summary> + /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param> + /// <param name="packetConstructor">Method that constructs packet intead of slow Activator.CreateInstance</param> + public void Subscribe<T, TUserData>(Action<T, TUserData> onReceive, Func<T> packetConstructor) where T : class, new() + { + var info = RegisterInternal<T>(); + info.CreatorFunc = () => packetConstructor(); + info.OnReceive = (o, userData) => { onReceive((T)o, (TUserData)userData); }; + } + + /// <summary> + /// Register and subscribe to packet receive event + /// This metod will overwrite last received packet class on receive (less garbage) + /// </summary> + /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param> + public void SubscribeReusable<T>(Action<T> onReceive) where T : class, new() + { + var info = RegisterInternal<T>(); + info.Reference = new T(); + info.OnReceive = (o, userData) => { onReceive((T)o); }; + } + + /// <summary> + /// Register and subscribe to packet receive event + /// This metod will overwrite last received packet class on receive (less garbage) + /// </summary> + /// <param name="onReceive">event that will be called when packet deserialized with ReadPacket method</param> + public void SubscribeReusable<T, TUserData>(Action<T, TUserData> onReceive) where T : class, new() + { + var info = RegisterInternal<T>(); + info.Reference = new T(); + info.OnReceive = (o, userData) => { onReceive((T)o, (TUserData)userData); }; + } + + /// <summary> + /// Serialize struct to NetDataWriter (fast) + /// </summary> + /// <param name="writer">Serialization target NetDataWriter</param> + /// <param name="obj">Struct to serialize</param> + public void Serialize<T>(NetDataWriter writer, T obj) where T : class, new() + { + var info = RegisterInternal<T>(); + _hasher.WriteHash(info.Hash, writer); + info.Write(writer, obj); + } + + /// <summary> + /// Serialize struct to byte array + /// </summary> + /// <param name="obj">Struct to serialize</param> + /// <returns>byte array with serialized data</returns> + public byte[] Serialize<T>(T obj) where T : class, new() + { + _writer.Reset(); + Serialize(_writer, obj); + return _writer.CopyData(); + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSerializer.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSerializer.cs.meta new file mode 100644 index 00000000..363b33c4 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSerializer.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e26db3a8188754e07b42db31f32e20f7 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSocket.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSocket.cs new file mode 100644 index 00000000..922c9bd2 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSocket.cs @@ -0,0 +1,455 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +#if !WINRT || UNITY_EDITOR +using System; +using System.Net; +using System.Net.Sockets; +using System.Threading; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal sealed class NetSocket + { + private Socket _udpSocketv4; + private Socket _udpSocketv6; + private NetEndPoint _localEndPoint; + private Thread _threadv4; + private Thread _threadv6; + private bool _running; + private readonly NetManager.OnMessageReceived _onMessageReceived; + + private static readonly IPAddress MulticastAddressV6 = IPAddress.Parse (NetConstants.MulticastGroupIPv6); + private static readonly bool IPv6Support; + private const int SocketReceivePollTime = 100000; + private const int SocketSendPollTime = 5000; + + public NetEndPoint LocalEndPoint + { + get { return _localEndPoint; } + } + + static NetSocket() + { + try + { + //Unity3d .NET 2.0 throws exception. + // IPv6Support = Socket.OSSupportsIPv6; + IPv6Support = false; + } + catch + { + IPv6Support = false; + } + } + + public NetSocket(NetManager.OnMessageReceived onMessageReceived) + { + _onMessageReceived = onMessageReceived; + } + + private void ReceiveLogic(object state) + { + Socket socket = (Socket)state; + EndPoint bufferEndPoint = new IPEndPoint(socket.AddressFamily == AddressFamily.InterNetwork ? IPAddress.Any : IPAddress.IPv6Any, 0); + NetEndPoint bufferNetEndPoint = new NetEndPoint((IPEndPoint)bufferEndPoint); + byte[] receiveBuffer = new byte[NetConstants.PacketSizeLimit]; + + while (_running) + { + //wait for data + if (!socket.Poll(SocketReceivePollTime, SelectMode.SelectRead)) + { + continue; + } + + int result; + + //Reading data + try + { + result = socket.ReceiveFrom(receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, ref bufferEndPoint); + if (!bufferNetEndPoint.EndPoint.Equals(bufferEndPoint)) + { + bufferNetEndPoint = new NetEndPoint((IPEndPoint)bufferEndPoint); + } + } + catch (SocketException ex) + { + if (ex.SocketErrorCode == SocketError.ConnectionReset || + ex.SocketErrorCode == SocketError.MessageSize) + { + //10040 - message too long + //10054 - remote close (not error) + //Just UDP + NetUtils.DebugWrite(ConsoleColor.DarkRed, "[R] Ingored error: {0} - {1}", (int)ex.SocketErrorCode, ex.ToString() ); + continue; + } + NetUtils.DebugWriteError("[R]Error code: {0} - {1}", (int)ex.SocketErrorCode, ex.ToString()); + _onMessageReceived(null, 0, (int)ex.SocketErrorCode, bufferNetEndPoint); + continue; + } + + //All ok! + NetUtils.DebugWrite(ConsoleColor.Blue, "[R]Recieved data from {0}, result: {1}", bufferNetEndPoint.ToString(), result); + _onMessageReceived(receiveBuffer, result, 0, bufferNetEndPoint); + } + } + + public bool Bind(int port, bool reuseAddress) + { + _udpSocketv4 = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); + _udpSocketv4.Blocking = false; + _udpSocketv4.ReceiveBufferSize = NetConstants.SocketBufferSize; + _udpSocketv4.SendBufferSize = NetConstants.SocketBufferSize; + _udpSocketv4.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.IpTimeToLive, NetConstants.SocketTTL); + if(reuseAddress) + _udpSocketv4.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); +#if !NETCORE + _udpSocketv4.DontFragment = true; +#endif + + try + { + _udpSocketv4.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1); + } + catch (SocketException e) + { + NetUtils.DebugWriteError("Broadcast error: {0}", e.ToString()); + } + + if (!BindSocket(_udpSocketv4, new IPEndPoint(IPAddress.Any, port))) + { + return false; + } + _localEndPoint = new NetEndPoint((IPEndPoint)_udpSocketv4.LocalEndPoint); + + _running = true; + _threadv4 = new Thread(ReceiveLogic); + _threadv4.Name = "SocketThreadv4(" + port + ")"; + _threadv4.IsBackground = true; + _threadv4.Start(_udpSocketv4); + + //Check IPv6 support + if (!IPv6Support) + return true; + + //Use one port for two sockets + port = _localEndPoint.Port; + + _udpSocketv6 = new Socket(AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp); + _udpSocketv6.Blocking = false; + _udpSocketv6.ReceiveBufferSize = NetConstants.SocketBufferSize; + _udpSocketv6.SendBufferSize = NetConstants.SocketBufferSize; + if (reuseAddress) + _udpSocketv6.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); + + if (BindSocket(_udpSocketv6, new IPEndPoint(IPAddress.IPv6Any, port))) + { + _localEndPoint = new NetEndPoint((IPEndPoint)_udpSocketv6.LocalEndPoint); + + try + { + _udpSocketv6.SetSocketOption( + SocketOptionLevel.IPv6, + SocketOptionName.AddMembership, + new IPv6MulticastOption(MulticastAddressV6)); + } + catch(Exception) + { + // Unity3d throws exception - ignored + } + + _threadv6 = new Thread(ReceiveLogic); + _threadv6.Name = "SocketThreadv6(" + port + ")"; + _threadv6.IsBackground = true; + _threadv6.Start(_udpSocketv6); + } + + return true; + } + + private bool BindSocket(Socket socket, IPEndPoint ep) + { + try + { + socket.Bind(ep); + NetUtils.DebugWrite(ConsoleColor.Blue, "[B]Succesfully binded to port: {0}", ((IPEndPoint)socket.LocalEndPoint).Port); + } + catch (SocketException ex) + { + NetUtils.DebugWriteError("[B]Bind exception: {0}", ex.ToString()); + //TODO: very temporary hack for iOS (Unity3D) + if (ex.SocketErrorCode == SocketError.AddressFamilyNotSupported) + { + return true; + } + return false; + } + return true; + } + + public bool SendBroadcast(byte[] data, int offset, int size, int port) + { + try + { + int result = _udpSocketv4.SendTo(data, offset, size, SocketFlags.None, new IPEndPoint(IPAddress.Broadcast, port)); + if (result <= 0) + return false; + if (IPv6Support) + { + result = _udpSocketv6.SendTo(data, offset, size, SocketFlags.None, new IPEndPoint(MulticastAddressV6, port)); + if (result <= 0) + return false; + } + } + catch (Exception ex) + { + NetUtils.DebugWriteError("[S][MCAST]" + ex); + return false; + } + return true; + } + + public int SendTo(byte[] data, int offset, int size, NetEndPoint remoteEndPoint, ref int errorCode) + { + try + { + int result = 0; + if (remoteEndPoint.EndPoint.AddressFamily == AddressFamily.InterNetwork) + { + if (!_udpSocketv4.Poll(SocketSendPollTime, SelectMode.SelectWrite)) + return -1; + result = _udpSocketv4.SendTo(data, offset, size, SocketFlags.None, remoteEndPoint.EndPoint); + } + else if(IPv6Support) + { + if (!_udpSocketv6.Poll(SocketSendPollTime, SelectMode.SelectWrite)) + return -1; + result = _udpSocketv6.SendTo(data, offset, size, SocketFlags.None, remoteEndPoint.EndPoint); + } + + NetUtils.DebugWrite(ConsoleColor.Blue, "[S]Send packet to {0}, result: {1}", remoteEndPoint.EndPoint, result); + return result; + } + catch (SocketException ex) + { + if (ex.SocketErrorCode != SocketError.MessageSize) + { + NetUtils.DebugWriteError("[S]" + ex); + } + + errorCode = (int)ex.SocketErrorCode; + return -1; + } + catch (Exception ex) + { + NetUtils.DebugWriteError("[S]" + ex); + return -1; + } + } + + private void CloseSocket(Socket s) + { +#if NETCORE + s.Dispose(); +#else + s.Close(); +#endif + } + + public void Close() + { + _running = false; + + //Close IPv4 + if (Thread.CurrentThread != _threadv4) + { + _threadv4.Join(); + } + _threadv4 = null; + if (_udpSocketv4 != null) + { + CloseSocket(_udpSocketv4); + _udpSocketv4 = null; + } + + //No ipv6 + if (_udpSocketv6 == null) + return; + + //Close IPv6 + if (Thread.CurrentThread != _threadv6) + { + _threadv6.Join(); + } + _threadv6 = null; + if (_udpSocketv6 != null) + { + CloseSocket(_udpSocketv6); + _udpSocketv6 = null; + } + } + } +} +#else +using System; +using System.Collections.Generic; +using System.IO; +using System.Runtime.InteropServices.WindowsRuntime; +using System.Threading; +using System.Threading.Tasks; +using Windows.Networking; +using Windows.Networking.Sockets; +using Windows.Storage.Streams; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal sealed class NetSocket + { + private DatagramSocket _datagramSocket; + private readonly Dictionary<NetEndPoint, IOutputStream> _peers = new Dictionary<NetEndPoint, IOutputStream>(); + private readonly NetManager.OnMessageReceived _onMessageReceived; + private readonly byte[] _byteBuffer = new byte[NetConstants.PacketSizeLimit]; + private readonly IBuffer _buffer; + private NetEndPoint _bufferEndPoint; + private NetEndPoint _localEndPoint; + private static readonly HostName BroadcastAddress = new HostName("255.255.255.255"); + private static readonly HostName MulticastAddressV6 = new HostName(NetConstants.MulticastGroupIPv6); + + public NetEndPoint LocalEndPoint + { + get { return _localEndPoint; } + } + + public NetSocket(NetManager.OnMessageReceived onMessageReceived) + { + _onMessageReceived = onMessageReceived; + _buffer = _byteBuffer.AsBuffer(); + } + + private void OnMessageReceived(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args) + { + var result = args.GetDataStream().ReadAsync(_buffer, _buffer.Capacity, InputStreamOptions.None).AsTask().Result; + int length = (int)result.Length; + if (length <= 0) + return; + + if (_bufferEndPoint == null || + !_bufferEndPoint.HostName.IsEqual(args.RemoteAddress) || + !_bufferEndPoint.PortStr.Equals(args.RemotePort)) + { + _bufferEndPoint = new NetEndPoint(args.RemoteAddress, args.RemotePort); + } + _onMessageReceived(_byteBuffer, length, 0, _bufferEndPoint); + } + + public bool Bind(int port, bool reuseAddress) + { + _datagramSocket = new DatagramSocket(); + _datagramSocket.Control.InboundBufferSizeInBytes = NetConstants.SocketBufferSize; + _datagramSocket.Control.DontFragment = true; + _datagramSocket.Control.OutboundUnicastHopLimit = NetConstants.SocketTTL; + _datagramSocket.MessageReceived += OnMessageReceived; + + try + { + _datagramSocket.BindServiceNameAsync(port.ToString()).AsTask().Wait(); + _datagramSocket.JoinMulticastGroup(MulticastAddressV6); + _localEndPoint = new NetEndPoint(_datagramSocket.Information.LocalAddress, _datagramSocket.Information.LocalPort); + } + catch (Exception ex) + { + NetUtils.DebugWriteError("[B]Bind exception: {0}", ex.ToString()); + return false; + } + return true; + } + + public bool SendBroadcast(byte[] data, int offset, int size, int port) + { + var portString = port.ToString(); + try + { + var outputStream = + _datagramSocket.GetOutputStreamAsync(BroadcastAddress, portString) + .AsTask() + .Result; + var writer = outputStream.AsStreamForWrite(); + writer.Write(data, offset, size); + writer.Flush(); + + outputStream = + _datagramSocket.GetOutputStreamAsync(MulticastAddressV6, portString) + .AsTask() + .Result; + writer = outputStream.AsStreamForWrite(); + writer.Write(data, offset, size); + writer.Flush(); + } + catch (Exception ex) + { + NetUtils.DebugWriteError("[S][MCAST]" + ex); + return false; + } + return true; + } + + public int SendTo(byte[] data, int offset, int length, NetEndPoint remoteEndPoint, ref int errorCode) + { + Task<uint> task = null; + try + { + IOutputStream writer; + if (!_peers.TryGetValue(remoteEndPoint, out writer)) + { + writer = + _datagramSocket.GetOutputStreamAsync(remoteEndPoint.HostName, remoteEndPoint.PortStr) + .AsTask() + .Result; + _peers.Add(remoteEndPoint, writer); + } + + task = writer.WriteAsync(data.AsBuffer(offset, length)).AsTask(); + return (int)task.Result; + } + catch (Exception ex) + { + if (task?.Exception?.InnerExceptions != null) + { + ex = task.Exception.InnerException; + } + var errorStatus = SocketError.GetStatus(ex.HResult); + switch (errorStatus) + { + case SocketErrorStatus.MessageTooLong: + errorCode = 10040; + break; + default: + errorCode = (int)errorStatus; + NetUtils.DebugWriteError("[S " + errorStatus + "(" + errorCode + ")]" + ex); + break; + } + + return -1; + } + } + + internal void RemovePeer(NetEndPoint ep) + { + _peers.Remove(ep); + } + + public void Close() + { + _datagramSocket.Dispose(); + _datagramSocket = null; + ClearPeers(); + } + + internal void ClearPeers() + { + _peers.Clear(); + } + } +} +#endif +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSocket.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSocket.cs.meta new file mode 100644 index 00000000..7661576e --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetSocket.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: c517b909a8c704eae91d4eccf06bc8a1 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetThread.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetThread.cs new file mode 100644 index 00000000..cdd433f6 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetThread.cs @@ -0,0 +1,97 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +#if WINRT && !UNITY_EDITOR +#define USE_WINRT +#endif + +using System; +using System.Threading; + +#if USE_WINRT +using Windows.Foundation; +using Windows.System.Threading; +using Windows.System.Threading.Core; +#endif + +namespace FlyingWormConsole3.LiteNetLib +{ + public sealed class NetThread + { +#if USE_WINRT + private readonly ManualResetEvent _updateWaiter = new ManualResetEvent(false); + private readonly ManualResetEvent _joinWaiter = new ManualResetEvent(false); +#else + private Thread _thread; +#endif + + private readonly Action _callback; + + public int SleepTime; + private bool _running; + private readonly string _name; + + public bool IsRunning + { + get { return _running; } + } + + public NetThread(string name, int sleepTime, Action callback) + { + _callback = callback; + SleepTime = sleepTime; + _name = name; + } + + public void Start() + { + if (_running) + return; + _running = true; +#if USE_WINRT + var thread = new PreallocatedWorkItem(ThreadLogic, WorkItemPriority.Normal, WorkItemOptions.TimeSliced); + thread.RunAsync().AsTask(); +#else + _thread = new Thread(ThreadLogic) + { + Name = _name, + IsBackground = true + }; + _thread.Start(); +#endif + } + + public void Stop() + { + if (!_running) + return; + _running = false; + +#if USE_WINRT + _joinWaiter.WaitOne(); +#else + _thread.Join(); +#endif + } + +#if USE_WINRT + private void ThreadLogic(IAsyncAction action) + { + while (_running) + { + _callback(); + _updateWaiter.WaitOne(SleepTime); + } + _joinWaiter.Set(); + } +#else + private void ThreadLogic() + { + while (_running) + { + _callback(); + Thread.Sleep(SleepTime); + } + } +#endif + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetThread.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetThread.cs.meta new file mode 100644 index 00000000..af275bcf --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetThread.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: d1928476aac6242d29fab6849f102494 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetUtils.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetUtils.cs new file mode 100644 index 00000000..c6d36754 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetUtils.cs @@ -0,0 +1,219 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +#define UNITY + +using System; +using System.Collections.Generic; +using System.Diagnostics; +#if WINRT && !UNITY_EDITOR +using Windows.Networking; +using Windows.Networking.Connectivity; +#else +using System.Net; +using System.Net.Sockets; +using System.Net.NetworkInformation; +#endif + +namespace FlyingWormConsole3.LiteNetLib +{ +#if WINRT && !UNITY_EDITOR + public enum ConsoleColor + { + Gray, + Yellow, + Cyan, + DarkCyan, + DarkGreen, + Blue, + DarkRed, + Red, + Green, + DarkYellow + } +#endif + + [Flags] + public enum LocalAddrType + { + IPv4 = 1, + IPv6 = 2, + All = 3 + } + + public static class NetUtils + { + internal static int RelativeSequenceNumber(int number, int expected) + { + return (number - expected + NetConstants.MaxSequence + NetConstants.HalfMaxSequence) % NetConstants.MaxSequence - NetConstants.HalfMaxSequence; + } + + internal static int GetDividedPacketsCount(int size, int mtu) + { + return (size / mtu) + (size % mtu == 0 ? 0 : 1); + } + + public static void PrintInterfaceInfos() + { +#if !WINRT || UNITY_EDITOR + DebugWriteForce(ConsoleColor.Green, "IPv6Support: {0}", Socket.OSSupportsIPv6); + try + { + foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) + { + foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses) + { + if (ip.Address.AddressFamily == AddressFamily.InterNetwork || + ip.Address.AddressFamily == AddressFamily.InterNetworkV6) + { + DebugWriteForce( + ConsoleColor.Green, + "Interface: {0}, Type: {1}, Ip: {2}, OpStatus: {3}", + ni.Name, + ni.NetworkInterfaceType.ToString(), + ip.Address.ToString(), + ni.OperationalStatus.ToString()); + } + } + } + } + catch (Exception e) + { + DebugWriteForce(ConsoleColor.Red, "Error while getting interface infos: {0}", e.ToString()); + } +#endif + } + + public static void GetLocalIpList(List<string> targetList, LocalAddrType addrType) + { + bool ipv4 = (addrType & LocalAddrType.IPv4) == LocalAddrType.IPv4; + bool ipv6 = (addrType & LocalAddrType.IPv6) == LocalAddrType.IPv6; +#if WINRT && !UNITY_EDITOR + foreach (HostName localHostName in NetworkInformation.GetHostNames()) + { + if (localHostName.IPInformation != null && + ((ipv4 && localHostName.Type == HostNameType.Ipv4) || + (ipv6 && localHostName.Type == HostNameType.Ipv6))) + { + targetList.Add(localHostName.ToString()); + } + } +#else + try + { + foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) + { + //Skip loopback + if (ni.NetworkInterfaceType == NetworkInterfaceType.Loopback) + continue; + + var ipProps = ni.GetIPProperties(); + + //Skip address without gateway + if (ipProps.GatewayAddresses.Count == 0) + continue; + + foreach (UnicastIPAddressInformation ip in ipProps.UnicastAddresses) + { + var address = ip.Address; + if ((ipv4 && address.AddressFamily == AddressFamily.InterNetwork) || + (ipv6 && address.AddressFamily == AddressFamily.InterNetworkV6)) + targetList.Add(address.ToString()); + } + } + } + catch + { + //ignored + } + + //Fallback mode (unity android) + if (targetList.Count == 0) + { +#if NETCORE + var hostTask = Dns.GetHostEntryAsync(Dns.GetHostName()); + hostTask.Wait(); + var host = hostTask.Result; +#else + var host = Dns.GetHostEntry(Dns.GetHostName()); +#endif + foreach (IPAddress ip in host.AddressList) + { + if((ipv4 && ip.AddressFamily == AddressFamily.InterNetwork) || + (ipv6 && ip.AddressFamily == AddressFamily.InterNetworkV6)) + targetList.Add(ip.ToString()); + } + } +#endif + if (targetList.Count == 0) + { + if(ipv4) + targetList.Add("127.0.0.1"); + if(ipv6) + targetList.Add("::1"); + } + } + + private static readonly List<string> IpList = new List<string>(); + public static string GetLocalIp(LocalAddrType addrType) + { + lock (IpList) + { + IpList.Clear(); + GetLocalIpList(IpList, addrType); + return IpList.Count == 0 ? string.Empty : IpList[0]; + } + } + + private static readonly object DebugLogLock = new object(); + + private static void DebugWriteLogic(ConsoleColor color, string str, params object[] args) + { + lock (DebugLogLock) + { + + if (NetDebug.Logger == null) + { +#if UNITY +#if !UNITY_4_0 + UnityEngine.Debug.LogFormat(str, args); +#endif +#elif WINRT + Debug.WriteLine(str, args); +#else + Console.ForegroundColor = color; + Console.WriteLine(str, args); + Console.ForegroundColor = ConsoleColor.Gray; +#endif + } + else + { + NetDebug.Logger.WriteNet(color, str, args); + } + } + } + + [Conditional("DEBUG_MESSAGES")] + internal static void DebugWrite(string str, params object[] args) + { + DebugWriteLogic(ConsoleColor.DarkGreen, str, args); + } + + [Conditional("DEBUG_MESSAGES")] + internal static void DebugWrite(ConsoleColor color, string str, params object[] args) + { + DebugWriteLogic(color, str, args); + } + + [Conditional("DEBUG_MESSAGES"), Conditional("DEBUG")] + internal static void DebugWriteForce(ConsoleColor color, string str, params object[] args) + { + DebugWriteLogic(color, str, args); + } + + [Conditional("DEBUG_MESSAGES"), Conditional("DEBUG")] + internal static void DebugWriteError(string str, params object[] args) + { + DebugWriteLogic(ConsoleColor.Red, str, args); + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetUtils.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetUtils.cs.meta new file mode 100644 index 00000000..8f968785 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NetUtils.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 0b27974b2b4714973a8f5a3ea4036677 +timeCreated: 1497976517 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NtpSyncModule.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NtpSyncModule.cs new file mode 100644 index 00000000..83b5d86c --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NtpSyncModule.cs @@ -0,0 +1,59 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Threading; + +namespace FlyingWormConsole3.LiteNetLib +{ + public class NtpSyncModule + { + public DateTime? SyncedTime { get; private set; } + private readonly NetSocket _socket; + private readonly NetEndPoint _ntpEndPoint; + private readonly ManualResetEvent _waiter = new ManualResetEvent(false); + + public NtpSyncModule(string ntpServer) + { + _ntpEndPoint = new NetEndPoint(ntpServer, 123); + _socket = new NetSocket(OnMessageReceived); + _socket.Bind(0, false); + SyncedTime = null; + } + + private void OnMessageReceived(byte[] data, int length, int errorCode, NetEndPoint remoteEndPoint) + { + if (errorCode != 0) + { + _waiter.Set(); + return; + } + + ulong intPart = (ulong)data[40] << 24 | (ulong)data[41] << 16 | (ulong)data[42] << 8 | (ulong)data[43]; + ulong fractPart = (ulong)data[44] << 24 | (ulong)data[45] << 16 | (ulong)data[46] << 8 | (ulong)data[47]; + + var milliseconds = (intPart * 1000) + ((fractPart * 1000) / 0x100000000L); + SyncedTime = (new DateTime(1900, 1, 1)).AddMilliseconds((long)milliseconds); + + _waiter.Set(); + } + + public void GetNetworkTime() + { + if (SyncedTime != null) + return; + + var ntpData = new byte[48]; + //LeapIndicator = 0 (no warning) + //VersionNum = 3 + //Mode = 3 (Client Mode) + ntpData[0] = 0x1B; + + //send + int errorCode = 0; + _socket.SendTo(ntpData, 0, ntpData.Length, _ntpEndPoint, ref errorCode); + + if(errorCode == 0) + _waiter.WaitOne(1000); + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/NtpSyncModule.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NtpSyncModule.cs.meta new file mode 100644 index 00000000..02cf4925 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/NtpSyncModule.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 91e481bf657774228854ba5923470b26 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/ReliableChannel.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/ReliableChannel.cs new file mode 100644 index 00000000..3d4a1abb --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/ReliableChannel.cs @@ -0,0 +1,375 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System; +using System.Collections.Generic; +using System.Threading; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal sealed class ReliableChannel + { + private class PendingPacket + { + public NetPacket Packet; + public DateTime? TimeStamp; + + public NetPacket GetAndClear() + { + var packet = Packet; + Packet = null; + TimeStamp = null; + return packet; + } + } + + private readonly Queue<NetPacket> _outgoingPackets; + private readonly bool[] _outgoingAcks; //for send acks + private readonly PendingPacket[] _pendingPackets; //for unacked packets and duplicates + private readonly NetPacket[] _receivedPackets; //for order + private readonly bool[] _earlyReceived; //for unordered + + private int _localSeqence; + private int _remoteSequence; + private int _localWindowStart; + private int _remoteWindowStart; + + private readonly NetPeer _peer; + private bool _mustSendAcks; + + private readonly bool _ordered; + private readonly int _windowSize; + private const int BitsInByte = 8; + + private int _queueIndex; + + public int PacketsInQueue + { + get { return _outgoingPackets.Count; } + } + + public ReliableChannel(NetPeer peer, bool ordered, int windowSize) + { + _windowSize = windowSize; + _peer = peer; + _ordered = ordered; + + _outgoingPackets = new Queue<NetPacket>(_windowSize); + + _outgoingAcks = new bool[_windowSize]; + _pendingPackets = new PendingPacket[_windowSize]; + for (int i = 0; i < _pendingPackets.Length; i++) + { + _pendingPackets[i] = new PendingPacket(); + } + + if (_ordered) + _receivedPackets = new NetPacket[_windowSize]; + else + _earlyReceived = new bool[_windowSize]; + + _localWindowStart = 0; + _localSeqence = 0; + _remoteSequence = 0; + _remoteWindowStart = 0; + } + + //ProcessAck in packet + public void ProcessAck(NetPacket packet) + { + int validPacketSize = (_windowSize - 1) / BitsInByte + 1 + NetConstants.SequencedHeaderSize; + if (packet.Size != validPacketSize) + { + NetUtils.DebugWrite("[PA]Invalid acks packet size"); + return; + } + + ushort ackWindowStart = packet.Sequence; + if (ackWindowStart > NetConstants.MaxSequence) + { + NetUtils.DebugWrite("[PA]Bad window start"); + return; + } + + //check relevance + if (NetUtils.RelativeSequenceNumber(ackWindowStart, _localWindowStart) <= -_windowSize) + { + NetUtils.DebugWrite("[PA]Old acks"); + return; + } + + byte[] acksData = packet.RawData; + NetUtils.DebugWrite("[PA]AcksStart: {0}", ackWindowStart); + int startByte = NetConstants.SequencedHeaderSize; + + Monitor.Enter(_pendingPackets); + for (int i = 0; i < _windowSize; i++) + { + int ackSequence = (ackWindowStart + i) % NetConstants.MaxSequence; + if (NetUtils.RelativeSequenceNumber(ackSequence, _localWindowStart) < 0) + { + //NetUtils.DebugWrite(ConsoleColor.Cyan, "[PA] SKIP OLD: " + ackSequence); + //Skip old ack + continue; + } + + int currentByte = startByte + i / BitsInByte; + int currentBit = i % BitsInByte; + + if ((acksData[currentByte] & (1 << currentBit)) == 0) + { + //NetUtils.DebugWrite(ConsoleColor.Cyan, "[PA] SKIP FALSE: " + ackSequence); + //Skip false ack + continue; + } + + if (ackSequence == _localWindowStart) + { + //Move window + _localWindowStart = (_localWindowStart + 1) % NetConstants.MaxSequence; + } + + NetPacket removed = _pendingPackets[ackSequence % _windowSize].GetAndClear(); + if (removed != null) + { + _peer.Recycle(removed); + + NetUtils.DebugWrite("[PA]Removing reliableInOrder ack: {0} - true", ackSequence); + } + else + { + NetUtils.DebugWrite("[PA]Removing reliableInOrder ack: {0} - false", ackSequence); + } + } + Monitor.Exit(_pendingPackets); + } + + public void AddToQueue(NetPacket packet) + { + lock (_outgoingPackets) + { + _outgoingPackets.Enqueue(packet); + } + } + + private void ProcessQueuedPackets() + { + //get packets from queue + while (_outgoingPackets.Count > 0) + { + int relate = NetUtils.RelativeSequenceNumber(_localSeqence, _localWindowStart); + if (relate < _windowSize) + { + NetPacket packet; + lock (_outgoingPackets) + { + packet = _outgoingPackets.Dequeue(); + } + packet.Sequence = (ushort)_localSeqence; + _pendingPackets[_localSeqence % _windowSize].Packet = packet; + _localSeqence = (_localSeqence + 1) % NetConstants.MaxSequence; + } + else //Queue filled + { + break; + } + } + } + + public bool SendNextPacket() + { + //check sending acks + DateTime currentTime = DateTime.UtcNow; + + Monitor.Enter(_pendingPackets); + ProcessQueuedPackets(); + + //send + PendingPacket currentPacket; + bool packetFound = false; + int startQueueIndex = _queueIndex; + do + { + currentPacket = _pendingPackets[_queueIndex]; + if (currentPacket.Packet != null) + { + //check send time + if(currentPacket.TimeStamp.HasValue) + { + double packetHoldTime = (currentTime - currentPacket.TimeStamp.Value).TotalMilliseconds; + if (packetHoldTime > _peer.ResendDelay) + { + NetUtils.DebugWrite("[RC]Resend: {0} > {1}", (int)packetHoldTime, _peer.ResendDelay); + packetFound = true; + } + } + else //Never sended + { + packetFound = true; + } + } + + _queueIndex = (_queueIndex + 1) % _windowSize; + } while (!packetFound && _queueIndex != startQueueIndex); + + if (packetFound) + { + currentPacket.TimeStamp = DateTime.UtcNow; + _peer.SendRawData(currentPacket.Packet); + NetUtils.DebugWrite("[RR]Sended"); + } + Monitor.Exit(_pendingPackets); + return packetFound; + } + + public void SendAcks() + { + if (!_mustSendAcks) + return; + _mustSendAcks = false; + + NetUtils.DebugWrite("[RR]SendAcks"); + + //Init packet + int bytesCount = (_windowSize - 1) / BitsInByte + 1; + PacketProperty property = _ordered ? PacketProperty.AckReliableOrdered : PacketProperty.AckReliable; + var acksPacket = _peer.GetPacketFromPool(property, bytesCount); + + //For quick access + byte[] data = acksPacket.RawData; //window start + acks size + + //Put window start + Monitor.Enter(_outgoingAcks); + acksPacket.Sequence = (ushort)_remoteWindowStart; + + //Put acks + int startAckIndex = _remoteWindowStart % _windowSize; + int currentAckIndex = startAckIndex; + int currentBit = 0; + int currentByte = NetConstants.SequencedHeaderSize; + do + { + if (_outgoingAcks[currentAckIndex]) + { + data[currentByte] |= (byte)(1 << currentBit); + } + + currentBit++; + if (currentBit == BitsInByte) + { + currentByte++; + currentBit = 0; + } + currentAckIndex = (currentAckIndex + 1) % _windowSize; + } while (currentAckIndex != startAckIndex); + Monitor.Exit(_outgoingAcks); + + _peer.SendRawData(acksPacket); + _peer.Recycle(acksPacket); + } + + //Process incoming packet + public void ProcessPacket(NetPacket packet) + { + if (packet.Sequence >= NetConstants.MaxSequence) + { + NetUtils.DebugWrite("[RR]Bad sequence"); + return; + } + + int relate = NetUtils.RelativeSequenceNumber(packet.Sequence, _remoteWindowStart); + int relateSeq = NetUtils.RelativeSequenceNumber(packet.Sequence, _remoteSequence); + + if (relateSeq > _windowSize) + { + NetUtils.DebugWrite("[RR]Bad sequence"); + return; + } + + //Drop bad packets + if(relate < 0) + { + //Too old packet doesn't ack + NetUtils.DebugWrite("[RR]ReliableInOrder too old"); + return; + } + if (relate >= _windowSize * 2) + { + //Some very new packet + NetUtils.DebugWrite("[RR]ReliableInOrder too new"); + return; + } + + //If very new - move window + Monitor.Enter(_outgoingAcks); + if (relate >= _windowSize) + { + //New window position + int newWindowStart = (_remoteWindowStart + relate - _windowSize + 1) % NetConstants.MaxSequence; + + //Clean old data + while (_remoteWindowStart != newWindowStart) + { + _outgoingAcks[_remoteWindowStart % _windowSize] = false; + _remoteWindowStart = (_remoteWindowStart + 1) % NetConstants.MaxSequence; + } + } + + //Final stage - process valid packet + //trigger acks send + _mustSendAcks = true; + + if (_outgoingAcks[packet.Sequence % _windowSize]) + { + NetUtils.DebugWrite("[RR]ReliableInOrder duplicate"); + Monitor.Exit(_outgoingAcks); + return; + } + + //save ack + _outgoingAcks[packet.Sequence % _windowSize] = true; + Monitor.Exit(_outgoingAcks); + + //detailed check + if (packet.Sequence == _remoteSequence) + { + NetUtils.DebugWrite("[RR]ReliableInOrder packet succes"); + _peer.AddIncomingPacket(packet); + _remoteSequence = (_remoteSequence + 1) % NetConstants.MaxSequence; + + if (_ordered) + { + NetPacket p; + while ( (p = _receivedPackets[_remoteSequence % _windowSize]) != null) + { + //process holded packet + _receivedPackets[_remoteSequence % _windowSize] = null; + _peer.AddIncomingPacket(p); + _remoteSequence = (_remoteSequence + 1) % NetConstants.MaxSequence; + } + } + else + { + while (_earlyReceived[_remoteSequence % _windowSize]) + { + //process early packet + _earlyReceived[_remoteSequence % _windowSize] = false; + _remoteSequence = (_remoteSequence + 1) % NetConstants.MaxSequence; + } + } + + return; + } + + //holded packet + if (_ordered) + { + _receivedPackets[packet.Sequence % _windowSize] = packet; + } + else + { + _earlyReceived[packet.Sequence % _windowSize] = true; + _peer.AddIncomingPacket(packet); + } + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/ReliableChannel.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/ReliableChannel.cs.meta new file mode 100644 index 00000000..04a8ce20 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/ReliableChannel.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 516bd901eb62f4bb391ef541f9effdec +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/RemoteFix b/Erika/Assets/ConsolePro/Remote/LiteNetLib/RemoteFix new file mode 100644 index 00000000..b594d172 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/RemoteFix @@ -0,0 +1,4 @@ +for file in *.cs; do + echo "#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA" | cat - $file > tempfile && mv tempfile $file + echo '#endif' >> "$file" +done
\ No newline at end of file diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/RemoteFix.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/RemoteFix.meta new file mode 100644 index 00000000..810a23a0 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/RemoteFix.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9f1f24482ff84a25a1188dd49ec4d86 +timeCreated: 1498001160 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/SequencedChannel.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SequencedChannel.cs new file mode 100644 index 00000000..985ca1c4 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SequencedChannel.cs @@ -0,0 +1,53 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System.Collections.Generic; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal sealed class SequencedChannel + { + private ushort _localSequence; + private ushort _remoteSequence; + private readonly Queue<NetPacket> _outgoingPackets; + private readonly NetPeer _peer; + + public SequencedChannel(NetPeer peer) + { + _outgoingPackets = new Queue<NetPacket>(); + _peer = peer; + } + + public void AddToQueue(NetPacket packet) + { + lock (_outgoingPackets) + { + _outgoingPackets.Enqueue(packet); + } + } + + public bool SendNextPacket() + { + NetPacket packet; + lock (_outgoingPackets) + { + if (_outgoingPackets.Count == 0) + return false; + packet = _outgoingPackets.Dequeue(); + } + _localSequence++; + packet.Sequence = _localSequence; + _peer.SendRawData(packet); + _peer.Recycle(packet); + return true; + } + + public void ProcessPacket(NetPacket packet) + { + if (NetUtils.RelativeSequenceNumber(packet.Sequence, _remoteSequence) > 0) + { + _remoteSequence = packet.Sequence; + _peer.AddIncomingPacket(packet); + } + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/SequencedChannel.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SequencedChannel.cs.meta new file mode 100644 index 00000000..1eb5158f --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SequencedChannel.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 84bbbc6c6e45c4287917fc944650e4af +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/SimpleChannel.cs b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SimpleChannel.cs new file mode 100644 index 00000000..1a1ffa10 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SimpleChannel.cs @@ -0,0 +1,40 @@ +#if DEBUG && !UNITY_WP_8_1 && !UNITY_WSA +using System.Collections.Generic; + +namespace FlyingWormConsole3.LiteNetLib +{ + internal sealed class SimpleChannel + { + private readonly Queue<NetPacket> _outgoingPackets; + private readonly NetPeer _peer; + + public SimpleChannel(NetPeer peer) + { + _outgoingPackets = new Queue<NetPacket>(); + _peer = peer; + } + + public void AddToQueue(NetPacket packet) + { + lock (_outgoingPackets) + { + _outgoingPackets.Enqueue(packet); + } + } + + public bool SendNextPacket() + { + NetPacket packet; + lock (_outgoingPackets) + { + if (_outgoingPackets.Count == 0) + return false; + packet = _outgoingPackets.Dequeue(); + } + _peer.SendRawData(packet); + _peer.Recycle(packet); + return true; + } + } +} +#endif diff --git a/Erika/Assets/ConsolePro/Remote/LiteNetLib/SimpleChannel.cs.meta b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SimpleChannel.cs.meta new file mode 100644 index 00000000..a2cb11c2 --- /dev/null +++ b/Erika/Assets/ConsolePro/Remote/LiteNetLib/SimpleChannel.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 6b4cdb673a0094d438a802844a8cc794 +timeCreated: 1497976518 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Data/RootMotionData.meta b/Erika/Assets/Data/RootMotionData.meta new file mode 100644 index 00000000..02bc35e7 --- /dev/null +++ b/Erika/Assets/Data/RootMotionData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31452f76e5d76ac4185b44ec316c4433 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/ProBuilder Data.meta b/Erika/Assets/ProBuilder Data.meta new file mode 100644 index 00000000..8424bd32 --- /dev/null +++ b/Erika/Assets/ProBuilder Data.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 62b452114e207404bacccba32c7da124 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Resources/bundles.json b/Erika/Assets/Resources/bundles.json deleted file mode 100644 index e69de29b..00000000 --- a/Erika/Assets/Resources/bundles.json +++ /dev/null diff --git a/Erika/Assets/Resources/bundles.json.meta b/Erika/Assets/Resources/bundles.json.meta deleted file mode 100644 index ce0ea4a1..00000000 --- a/Erika/Assets/Resources/bundles.json.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: deb765f6aa935ee48a4709fecb301e65 -TextScriptImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Resources/effects.meta b/Erika/Assets/Resources/effects.meta new file mode 100644 index 00000000..0dc955d6 --- /dev/null +++ b/Erika/Assets/Resources/effects.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5006e4ef2b844b489fbd83fb454a154 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Resources/prefabs.meta b/Erika/Assets/Resources/prefabs.meta new file mode 100644 index 00000000..b9636e1e --- /dev/null +++ b/Erika/Assets/Resources/prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c6be3bc1f6e8bbe43b6e5ec429b9c199 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Resources/prefabs/ui.meta b/Erika/Assets/Resources/prefabs/ui.meta new file mode 100644 index 00000000..396594ea --- /dev/null +++ b/Erika/Assets/Resources/prefabs/ui.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 30914a6917746dc4dbcdb09c1eaba4bd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Resources/unit.meta b/Erika/Assets/Resources/unit.meta new file mode 100644 index 00000000..4a9985d4 --- /dev/null +++ b/Erika/Assets/Resources/unit.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4eb81d15d0561f04a95c69a410136edb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Scripts.meta b/Erika/Assets/Scripts.meta index 1cd8d00c..6b2291c4 100644 --- a/Erika/Assets/Scripts.meta +++ b/Erika/Assets/Scripts.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d8d1c29594f023b41a09eafb38674090 +guid: 9b02b25b05db7f4469d64c82529248a2 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/Scripts/Curve3D.meta b/Erika/Assets/Scripts/Curve3D.meta deleted file mode 100644 index fef1c5e7..00000000 --- a/Erika/Assets/Scripts/Curve3D.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ad8b718b6b700d8419838dad07158567 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Drone.meta b/Erika/Assets/Scripts/Drone.meta deleted file mode 100644 index 694cff70..00000000 --- a/Erika/Assets/Scripts/Drone.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ec3412151f8a72a41b2ed21316763399 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Managers/Physics.meta b/Erika/Assets/Scripts/Managers/Physics.meta deleted file mode 100644 index 2296b3f8..00000000 --- a/Erika/Assets/Scripts/Managers/Physics.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 603d4624aaedd794cb89497954a83f4a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Managers/ResourceManager.cs b/Erika/Assets/Scripts/Managers/ResourceManager.cs index 974eb53a..f7904d1e 100644 --- a/Erika/Assets/Scripts/Managers/ResourceManager.cs +++ b/Erika/Assets/Scripts/Managers/ResourceManager.cs @@ -20,6 +20,7 @@ public partial class ResourceManager : Singleton<ResourceManager> T obj = AssetDatabase.LoadAssetAtPath<T>(path);
m_CachedObject.Add(path, obj);
#else
+
#endif
return obj;
}
diff --git a/Erika/Assets/Scripts/Props.meta b/Erika/Assets/Scripts/Props.meta deleted file mode 100644 index bb96602e..00000000 --- a/Erika/Assets/Scripts/Props.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f299520ed9fcf4a45858ad4ef5a8d5d1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Robot.meta b/Erika/Assets/Scripts/Robot.meta deleted file mode 100644 index 0b5a087e..00000000 --- a/Erika/Assets/Scripts/Robot.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7c09ca1609552d24bbe697d1516f8aa9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Test 1.meta b/Erika/Assets/Scripts/Test 1.meta deleted file mode 100644 index ef660dbc..00000000 --- a/Erika/Assets/Scripts/Test 1.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 02d40347e569d05489e932435bcb84ef -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Test2.meta b/Erika/Assets/Scripts/Test2.meta new file mode 100644 index 00000000..e7feed7d --- /dev/null +++ b/Erika/Assets/Scripts/Test2.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1efd025b77f12134b82d58b88b3b164e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Scripts/Test 1/TestErika.cs b/Erika/Assets/Scripts/Test2/TestErika.cs index 4ae41d78..c6025964 100644 --- a/Erika/Assets/Scripts/Test 1/TestErika.cs +++ b/Erika/Assets/Scripts/Test2/TestErika.cs @@ -4,34 +4,34 @@ using System.Collections.Generic; using UnityEngine; [Serializable] -public class UnitSetUp
-{
- public UnitActionData actionData; // 动作配置
-
- public GameObject unitControllerPrefab;
-
- public GameObject unitPrefab;
-
- public RuntimeAnimatorController animController;
-
- public string unitFolder;
-
- [HideInInspector]
- public GameObject unit;
-
- [HideInInspector]
+public class UnitSetUp +{ + public UnitActionData actionData; // 动作配置 + + public GameObject unitControllerPrefab; + + public GameObject unitPrefab; + + public RuntimeAnimatorController animController; + + public string unitFolder; + + [HideInInspector] + public GameObject unit; + + [HideInInspector] public GameObject unitController; - [HideInInspector]
+ [HideInInspector] public UnitController owner; } public class TestErika : SingletonMB<TestErika> { public UnitSetUp erika; - public UnitSetUp monster;
- public GameObject unitEffect;
-
+ public UnitSetUp monster; + public GameObject unitEffect; + protected override void Awake() { base.Awake(); @@ -40,82 +40,82 @@ public class TestErika : SingletonMB<TestErika> UnitImageEffect.effectPlane = unitEffect; } - private void Update()
- {
- if (Input.GetKeyDown("r"))
- {
- erika.unitController.transform.position = Vector3.zero;
- erika.unitController.transform.rotation = Quaternion.identity;
-
- monster.unitController.transform.position = new Vector3(2, 0, 0);
- monster.unitController.transform.rotation = Quaternion.Euler(0, 180, 0);
- }
+ private void Update() + { + if (Input.GetKeyDown("r")) + { + erika.unitController.transform.position = Vector3.zero; + erika.unitController.transform.rotation = Quaternion.identity; + + monster.unitController.transform.position = new Vector3(2, 0, 0); + monster.unitController.transform.rotation = Quaternion.Euler(0, 180, 0); + } } - void SetupErika()
- {
- erika.unitController = GameObject.Instantiate(erika.unitControllerPrefab);
- erika.unitController.transform.position = Vector3.zero;
- erika.unitController.transform.rotation = Quaternion.identity;
-
- erika.unit = GameObject.Instantiate(erika.unitPrefab);
- erika.unit.transform.position = Vector3.zero;
- erika.unit.transform.rotation = Quaternion.Euler(0, 90, 0);
- erika.unit.transform.SetParent(erika.unitController.transform);
-
- UnitController unitCtr = erika.unitController.GetOrAddComponent<UnitController>();
- unitCtr.Initialize(erika.unit, erika.unitFolder);
-
- UnitRootMotion unitRootMotion = unitCtr.unitRootMotion;
-
- RootMotionProxy rootMotionProxy = erika.unit.GetOrAddComponent<RootMotionProxy>();
-
- Animator animator = erika.unit.GetComponent<Animator>();
- //AnimatorOverrideController animCtr = new AnimatorOverrideController(erika.animController);
- //animCtr.name = erika.unitPrefab.name + " Override Controller";
- //foreach(var anim in erika.actionData.actions)
- //{
- // animCtr[anim.Key] = anim.Value;
- //}
- animator.runtimeAnimatorController = erika.animController;
-
- Debug.Assert(animator.runtimeAnimatorController is AnimatorOverrideController);
-
- unitCtr.pcState.ChangeState(PCState.EUnitState.Idle, new PCState.IdleParam(), true);
-
- ////////////////////////////////
-
- UnitManager.Instance.SetPlayerCharacter(unitCtr as PCController);
+ void SetupErika() + { + erika.unitController = GameObject.Instantiate(erika.unitControllerPrefab); + erika.unitController.transform.position = Vector3.zero; + erika.unitController.transform.rotation = Quaternion.identity; + + erika.unit = GameObject.Instantiate(erika.unitPrefab); + erika.unit.transform.position = Vector3.zero; + erika.unit.transform.rotation = Quaternion.Euler(0, 90, 0); + erika.unit.transform.SetParent(erika.unitController.transform); + + UnitController unitCtr = erika.unitController.GetOrAddComponent<UnitController>(); + unitCtr.Initialize(erika.unit, erika.unitFolder); + + UnitRootMotion unitRootMotion = unitCtr.unitRootMotion; + + RootMotionProxy rootMotionProxy = erika.unit.GetOrAddComponent<RootMotionProxy>(); + + Animator animator = erika.unit.GetComponent<Animator>(); + //AnimatorOverrideController animCtr = new AnimatorOverrideController(erika.animController); + //animCtr.name = erika.unitPrefab.name + " Override Controller"; + //foreach(var anim in erika.actionData.actions) + //{ + // animCtr[anim.Key] = anim.Value; + //} + animator.runtimeAnimatorController = erika.animController; + + Debug.Assert(animator.runtimeAnimatorController is AnimatorOverrideController); + + unitCtr.pcState.ChangeState(PCState.EUnitState.Idle, new PCState.IdleParam(), true); + + //////////////////////////////// + + UnitManager.Instance.SetPlayerCharacter(unitCtr as PCController); } - void SetupMonster()
- {
- monster.unitController = GameObject.Instantiate(monster.unitControllerPrefab);
- monster.unitController.transform.position = Vector3.zero;
- monster.unitController.transform.rotation = Quaternion.identity;
-
- monster.unit = GameObject.Instantiate(monster.unitPrefab);
- monster.unit.transform.rotation = Quaternion.Euler(0, 90, 0);
- monster.unit.transform.SetParent(monster.unitController.transform);
-
- UnitController unitCtr = monster.unitController.GetOrAddComponent<UnitController>();
- unitCtr.Initialize(monster.unit, monster.unitFolder);
-
- UnitRootMotion unitRootMotion = unitCtr.unitRootMotion;
-
- RootMotionProxy rootMotionProxy = monster.unit.GetOrAddComponent<RootMotionProxy>();
-
- Animator animator = monster.unit.GetComponent<Animator>();
- AnimatorOverrideController animCtr = new AnimatorOverrideController(monster.animController);
- animCtr.name = monster.unitPrefab.name + " Override Controller";
- animator.runtimeAnimatorController = animCtr;
-
- unitCtr.monsterState.ChangeState(MonsterState.EUnitState.Idle, new MonsterState.IdleParam(), true);
-
- monster.unitController.transform.position = new Vector3(2, 0, 0);
- monster.unitController.transform.rotation *= Quaternion.Euler(0, 180, 0);
-
- monster.owner = unitCtr;
+ void SetupMonster() + { + monster.unitController = GameObject.Instantiate(monster.unitControllerPrefab); + monster.unitController.transform.position = Vector3.zero; + monster.unitController.transform.rotation = Quaternion.identity; + + monster.unit = GameObject.Instantiate(monster.unitPrefab); + monster.unit.transform.rotation = Quaternion.Euler(0, 90, 0); + monster.unit.transform.SetParent(monster.unitController.transform); + + UnitController unitCtr = monster.unitController.GetOrAddComponent<UnitController>(); + unitCtr.Initialize(monster.unit, monster.unitFolder); + + UnitRootMotion unitRootMotion = unitCtr.unitRootMotion; + + RootMotionProxy rootMotionProxy = monster.unit.GetOrAddComponent<RootMotionProxy>(); + + Animator animator = monster.unit.GetComponent<Animator>(); + AnimatorOverrideController animCtr = new AnimatorOverrideController(monster.animController); + animCtr.name = monster.unitPrefab.name + " Override Controller"; + animator.runtimeAnimatorController = animCtr; + + unitCtr.monsterState.ChangeState(MonsterState.EUnitState.Idle, new MonsterState.IdleParam(), true); + + monster.unitController.transform.position = new Vector3(2, 0, 0); + monster.unitController.transform.rotation *= Quaternion.Euler(0, 180, 0); + + monster.owner = unitCtr; } } diff --git a/Erika/Assets/Scripts/Test 1/TestErika.cs.meta b/Erika/Assets/Scripts/Test2/TestErika.cs.meta index 53aeb6eb..53aeb6eb 100644 --- a/Erika/Assets/Scripts/Test 1/TestErika.cs.meta +++ b/Erika/Assets/Scripts/Test2/TestErika.cs.meta diff --git a/Erika/Assets/Scripts/Test 1/TestInput.cs b/Erika/Assets/Scripts/Test2/TestInput.cs index 1a43f108..1a43f108 100644 --- a/Erika/Assets/Scripts/Test 1/TestInput.cs +++ b/Erika/Assets/Scripts/Test2/TestInput.cs diff --git a/Erika/Assets/Scripts/Test 1/TestInput.cs.meta b/Erika/Assets/Scripts/Test2/TestInput.cs.meta index aeb1587e..aeb1587e 100644 --- a/Erika/Assets/Scripts/Test 1/TestInput.cs.meta +++ b/Erika/Assets/Scripts/Test2/TestInput.cs.meta diff --git a/Erika/Assets/Scripts/Unit/AI/Actions.meta b/Erika/Assets/Scripts/Unit/AI/Actions.meta deleted file mode 100644 index 9b4ad463..00000000 --- a/Erika/Assets/Scripts/Unit/AI/Actions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 971e9d55b8bc0894eb6a110fb962000b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Unit/AI/Conditionals.meta b/Erika/Assets/Scripts/Unit/AI/Conditionals.meta deleted file mode 100644 index 70a86da5..00000000 --- a/Erika/Assets/Scripts/Unit/AI/Conditionals.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 85b7e0c7ed1d12f42a5178bfbf3d934c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Erika/Assets/Scripts/Unit/Components/UnitLensEffect.cs b/Erika/Assets/Scripts/Unit/Components/UnitLensEffect.cs index e145c331..0511b1bb 100644 --- a/Erika/Assets/Scripts/Unit/Components/UnitLensEffect.cs +++ b/Erika/Assets/Scripts/Unit/Components/UnitLensEffect.cs @@ -174,6 +174,9 @@ public partial class UnitLensEffect : UnitComponent {
} + /// <summary>
+ /// 清理command buffers
+ /// </summary> void PrepareCommandBuffers()
{
if (m_InUseCommandBuffers.Count != 0)
diff --git a/Erika/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs b/Erika/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs index d5d368d0..9440b448 100644 --- a/Erika/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs +++ b/Erika/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs @@ -43,6 +43,8 @@ public class LensEffect_Dash : LensEffectBase void Before(CommandBuffer cb) {
+ //LogHelper.Log("LensEffect", "LensEffect_Dash.Before()");
+
cb.GetTemporaryRT(tempID, -1, -1, 24, FilterMode.Bilinear); cb.SetRenderTarget(tempID); cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
@@ -68,6 +70,8 @@ public class LensEffect_Dash : LensEffectBase void After(CommandBuffer cb) {
+ //LogHelper.Log("LensEffect", "LensEffect_Dash.After()");
+
curTime += Time.deltaTime;
MaterialEntry blur = GetTempMaterial(StaticDefine.shaders[EShader.MotionBlur].name); diff --git a/Erika/Assets/Scripts/Utils/EventCenter.cs b/Erika/Assets/Scripts/Utils/EventCenter.cs new file mode 100644 index 00000000..39b79097 --- /dev/null +++ b/Erika/Assets/Scripts/Utils/EventCenter.cs @@ -0,0 +1,57 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class EventCenter : Singleton<EventCenter> +{ + public delegate void EventHandler(params object [] param); + + private Dictionary<EventMsgType, List<EventHandler>> m_EventHandlers = new Dictionary<EventMsgType, List<EventHandler>>(); + + public void Register(EventMsgType evt, EventHandler handler) + { + List<EventHandler> handlers; + if (!m_EventHandlers.TryGetValue(evt, out handlers)) + { + handlers = new List<EventHandler>(); + m_EventHandlers.Add(evt, handlers); + } + if (!handlers.Contains(handler)) + { + handlers.Add(handler); + } + else + { + Debug.LogError("Event has already registed, eventType=" + evt); + } + } + + public void UnRegister(EventMsgType evt, EventHandler handler) + { + List<EventHandler> handlers; + if (m_EventHandlers.TryGetValue(evt, out handlers)) + { + if(handlers.Contains(handler)) + handlers.Remove(handler); + } + } + + public void Publish(EventMsgType evt, params object[] objs) + { + List<EventHandler> handlers; + if (m_EventHandlers.TryGetValue(evt, out handlers)) + { + handlers.ForEach(h => h(objs)); + } + } + + public void Publish(EventMsgType evt) + { + List<EventHandler> handlers; + if (m_EventHandlers.TryGetValue(evt, out handlers)) + { + handlers.ForEach(h => h(null)); + } + } + +}
\ No newline at end of file diff --git a/Erika/Assets/Scripts/Utils/EventCenter.cs.meta b/Erika/Assets/Scripts/Utils/EventCenter.cs.meta new file mode 100644 index 00000000..f87c4191 --- /dev/null +++ b/Erika/Assets/Scripts/Utils/EventCenter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 224d79fa30383194d86f18f391400340 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Scripts/Utils/EventType.cs b/Erika/Assets/Scripts/Utils/EventType.cs new file mode 100644 index 00000000..92bc690a --- /dev/null +++ b/Erika/Assets/Scripts/Utils/EventType.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public enum EventMsgType +{ + + // UI + ToggleAutoFire, // Զ + ToggleLockAim, // +} + diff --git a/Erika/Assets/Scripts/Utils/EventType.cs.meta b/Erika/Assets/Scripts/Utils/EventType.cs.meta new file mode 100644 index 00000000..90ea0468 --- /dev/null +++ b/Erika/Assets/Scripts/Utils/EventType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2cca452167d1ce34cb98da00cae563b0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Erika/Assets/Scripts/Utils/LogHelper.cs b/Erika/Assets/Scripts/Utils/LogHelper.cs index 9c835bbe..6dc89921 100644 --- a/Erika/Assets/Scripts/Utils/LogHelper.cs +++ b/Erika/Assets/Scripts/Utils/LogHelper.cs @@ -6,12 +6,22 @@ public static class LogHelper { public static void LogError(string msg) { - Debug.LogError("[Erika] " + msg); + Debug.LogError(msg); + } + + public static void LogError(string tag, string msg) + { + Debug.LogError("[" + tag + "]" + msg); + } + + public static void Log(string tag, string msg) + { + Debug.Log("[" + tag + "]" + msg); } public static void Log(string msg) { - Debug.Log("[Erika] " + msg); + Debug.Log(msg); } } diff --git a/Erika/Assets/ThirdParty.meta b/Erika/Assets/ThirdParty.meta index b41ac75b..533ad42b 100644 --- a/Erika/Assets/ThirdParty.meta +++ b/Erika/Assets/ThirdParty.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6b50234482b445949ad04818eb680b5b +guid: c07a5e11f3e7a37488635584a521b7e8 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/Tools.meta b/Erika/Assets/Tools.meta index 51eda6fa..11bb157a 100644 --- a/Erika/Assets/Tools.meta +++ b/Erika/Assets/Tools.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f0fbca7de791d084d8f17095bdf3ed4b +guid: 84fa71ed0a3a6844098484d9591214bd folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Erika/Assets/ThirdParty/UMotion/UMotionExamples/Example Scene/UMotionExampleScene.unity b/Erika/Assets/UMotionExampleScene.unity index 19dfdcad..19dfdcad 100644 --- a/Erika/Assets/ThirdParty/UMotion/UMotionExamples/Example Scene/UMotionExampleScene.unity +++ b/Erika/Assets/UMotionExampleScene.unity diff --git a/Erika/Assets/ThirdParty/UMotion/UMotionExamples/Example Scene/UMotionExampleScene.unity.meta b/Erika/Assets/UMotionExampleScene.unity.meta index 2fe0b3a0..2fe0b3a0 100644 --- a/Erika/Assets/ThirdParty/UMotion/UMotionExamples/Example Scene/UMotionExampleScene.unity.meta +++ b/Erika/Assets/UMotionExampleScene.unity.meta diff --git a/Erika/ProjectSettings/Packages/com.unity.probuilder/Settings.json b/Erika/ProjectSettings/Packages/com.unity.probuilder/Settings.json index 1051edf7..2ea2f00c 100644 --- a/Erika/ProjectSettings/Packages/com.unity.probuilder/Settings.json +++ b/Erika/ProjectSettings/Packages/com.unity.probuilder/Settings.json @@ -32,11 +32,6 @@ "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "key": "lightmapping.autoUnwrapLightmapUV", "value": "{\"m_Value\":true}" - }, - { - "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", - "key": "editor.toolbarIconGUI", - "value": "{\"m_Value\":false}" } ] } diff --git a/Erika/ProjectSettings/ProjectSettings.asset b/Erika/ProjectSettings/ProjectSettings.asset index 62f4b083..83b2bb2c 100644 --- a/Erika/ProjectSettings/ProjectSettings.asset +++ b/Erika/ProjectSettings/ProjectSettings.asset @@ -47,7 +47,7 @@ PlayerSettings: defaultScreenWidthWeb: 960 defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 - m_ActiveColorSpace: 1 + m_ActiveColorSpace: 0 m_MTRendering: 1 m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 @@ -296,7 +296,7 @@ PlayerSettings: m_APIs: 0b000000 m_Automatic: 1 - m_BuildTarget: WindowsStandaloneSupport - m_APIs: 0b0000001100000002000000 + m_APIs: 020000000b00000011000000 m_Automatic: 0 m_BuildTargetVRSettings: - m_BuildTarget: Standalone |