diff --git a/Assets/Scenes/TestMap.unity b/Assets/Scenes/TestMap.unity index e695e26..9a1eedf 100644 --- a/Assets/Scenes/TestMap.unity +++ b/Assets/Scenes/TestMap.unity @@ -303,6 +303,80 @@ MeshFilter: m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 248140502} m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!1 &269324197 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 269324198} + - component: {fileID: 269324200} + - component: {fileID: 269324199} + m_Layer: 5 + m_Name: PacketsReceivedNumber + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &269324198 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 269324197} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9999967, y: 0.9999967, z: 0.9999967} + m_Children: [] + m_Father: {fileID: 1519408168} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 166.5, y: 30.64998} + m_SizeDelta: {x: 72.2, y: 30} + m_Pivot: {x: 0.50000024, y: 0.49999967} +--- !u!114 &269324199 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 269324197} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0 +--- !u!222 &269324200 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 269324197} --- !u!1 &270758321 GameObject: m_ObjectHideFlags: 0 @@ -524,6 +598,80 @@ MonoBehaviour: ID: 0 DoorRoot: {fileID: 1708261007} IsOpen: 0 +--- !u!1 &326257202 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 326257203} + - component: {fileID: 326257205} + - component: {fileID: 326257204} + m_Layer: 5 + m_Name: PacketsReceived + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &326257203 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 326257202} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9999967, y: 0.9999967, z: 0.9999967} + m_Children: [] + m_Father: {fileID: 1519408168} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 68.2, y: 30.399998} + m_SizeDelta: {x: 122.6, y: 29.5} + m_Pivot: {x: 0.50000006, y: 0.5000002} +--- !u!114 &326257204 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 326257202} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Packets Received:' +--- !u!222 &326257205 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 326257202} --- !u!1 &344272454 GameObject: m_ObjectHideFlags: 0 @@ -1024,6 +1172,80 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9d715320baa1f401ab0f46b603399dc3, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1 &743520476 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 743520477} + - component: {fileID: 743520479} + - component: {fileID: 743520478} + m_Layer: 5 + m_Name: PingNumber + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &743520477 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 743520476} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1519408168} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 166.5, y: 89.7} + m_SizeDelta: {x: 72.2, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &743520478 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 743520476} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0 +--- !u!222 &743520479 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 743520476} --- !u!1 &746314094 GameObject: m_ObjectHideFlags: 0 @@ -1415,6 +1637,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 2000206070} + - {fileID: 2132934770} m_Father: {fileID: 1490933147} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1692,6 +1915,82 @@ Transform: m_Father: {fileID: 1490933147} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1144056834 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1144056835} + - component: {fileID: 1144056837} + - component: {fileID: 1144056836} + m_Layer: 5 + m_Name: PacketLoss + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1144056835 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1144056834} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1519408168} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 68.2, y: 59.9} + m_SizeDelta: {x: 122.6, y: 29.5} + m_Pivot: {x: 0.50000006, y: 0.5000002} +--- !u!114 &1144056836 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1144056834} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Packet Loss: + +' +--- !u!222 &1144056837 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1144056834} --- !u!1 &1199326062 GameObject: m_ObjectHideFlags: 0 @@ -1938,6 +2237,82 @@ Transform: m_Father: {fileID: 949094013} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1392110886 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1392110887} + - component: {fileID: 1392110889} + - component: {fileID: 1392110888} + m_Layer: 5 + m_Name: Ping + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1392110887 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1392110886} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0.9999967, y: 0.9999967, z: 0.9999967} + m_Children: [] + m_Father: {fileID: 1519408168} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 68.2, y: 89.4} + m_SizeDelta: {x: 122.6, y: 29.5} + m_Pivot: {x: 0.50000006, y: 0.5000002} +--- !u!114 &1392110888 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1392110886} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Ping: + +' +--- !u!222 &1392110889 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1392110886} --- !u!1 &1444061381 GameObject: m_ObjectHideFlags: 0 @@ -2186,6 +2561,80 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1519408167 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1519408168} + - component: {fileID: 1519408170} + - component: {fileID: 1519408169} + m_Layer: 5 + m_Name: Panel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1519408168 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1519408167} + 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: 1144056835} + - {fileID: 1392110887} + - {fileID: 743520477} + - {fileID: 1628431918} + - {fileID: 326257203} + - {fileID: 269324198} + m_Father: {fileID: 2132934770} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 106.6, y: 55.6} + m_SizeDelta: {x: 212.3, y: 111.1} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1519408169 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1519408167} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.392} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_Sprite: {fileID: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 +--- !u!222 &1519408170 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1519408167} --- !u!1 &1610252928 GameObject: m_ObjectHideFlags: 0 @@ -2230,6 +2679,80 @@ Transform: m_Father: {fileID: 344272455} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1628431917 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1628431918} + - component: {fileID: 1628431920} + - component: {fileID: 1628431919} + m_Layer: 5 + m_Name: PacketLossNumber + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1628431918 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1628431917} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1519408168} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 166.5, y: 58.9} + m_SizeDelta: {x: 72.2, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1628431919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1628431917} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0 +--- !u!222 &1628431920 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1628431917} --- !u!4 &1693409232 stripped Transform: m_PrefabParentObject: {fileID: 4689370038551000, guid: 3da42b42c71f841c2a977cfb5255b00f, @@ -2871,3 +3394,53 @@ Camera: m_StereoConvergence: 10 m_StereoSeparation: 0.022 m_StereoMirrorMode: 0 +--- !u!1 &2132934769 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 2132934770} + - component: {fileID: 2132934771} + m_Layer: 5 + m_Name: DebugNetworkDebugRoot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2132934770 +RectTransform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2132934769} + 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: 1519408168} + m_Father: {fileID: 822377732} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 105.2, y: 56.4} + m_SizeDelta: {x: 210.5, y: 112.9} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2132934771 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2132934769} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 582dedc3d9feabd44bf03f191e5df88a, type: 3} + m_Name: + m_EditorClassIdentifier: + PacketLossNumberText: {fileID: 1628431919} + PingNumberText: {fileID: 743520478} + PacketsReceivedNumberText: {fileID: 269324199} + ActualPanel: {fileID: 1519408168} diff --git a/Assets/Scripts/Controls/NetworkDebugControl.cs b/Assets/Scripts/Controls/NetworkDebugControl.cs new file mode 100644 index 0000000..1f9f7dd --- /dev/null +++ b/Assets/Scripts/Controls/NetworkDebugControl.cs @@ -0,0 +1,32 @@ +using Cyber.Networking.Clientside; +using UnityEngine; +using UnityEngine.UI; + +public class NetworkDebugControl : MonoBehaviour { + + public Text PacketLossNumberText; + public Text PingNumberText; + public Text PacketsReceivedNumberText; + + public RectTransform ActualPanel; + + private bool visible = false; + + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + if (Input.GetButtonDown("ToggleNetworkDebug")) { + visible = !visible && Client.IsRunning(); + ActualPanel.gameObject.SetActive(visible); + } + if (visible) { + PingNumberText.text = ((int) (Client.GetSyncHandler().GetPing())) + "ms"; + PacketLossNumberText.text = ((int) (Client.GetSyncHandler().GetPacketLoss() * 10000) * 1f / 100) + "%"; + PacketsReceivedNumberText.text = Client.GetSyncHandler().GetSyncPacketsReceived() + ""; + } + } +} diff --git a/Assets/Scripts/Controls/NetworkDebugControl.cs.meta b/Assets/Scripts/Controls/NetworkDebugControl.cs.meta new file mode 100644 index 0000000..b016da5 --- /dev/null +++ b/Assets/Scripts/Controls/NetworkDebugControl.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 582dedc3d9feabd44bf03f191e5df88a +timeCreated: 1494966639 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Networking/Clientside/Client.cs b/Assets/Scripts/Networking/Clientside/Client.cs index e4a5441..ad82e5e 100644 --- a/Assets/Scripts/Networking/Clientside/Client.cs +++ b/Assets/Scripts/Networking/Clientside/Client.cs @@ -29,14 +29,14 @@ namespace Cyber.Networking.Clientside { private Spawner Spawner; - private SyncHandler SyncHandler; - /// /// The player of this client /// private CConnectedPlayer Player; private Dictionary Players = new Dictionary(); + private SyncHandler SyncHandler; + /// /// Creates the client and sets it as the signleton. /// @@ -135,6 +135,14 @@ namespace Cyber.Networking.Clientside { } } + /// + /// Get the Client , null if client is not active. + /// + /// + public static SyncHandler GetSyncHandler() { + return Singleton.SyncHandler; + } + private void Start() { Spawner = GetComponent(); SyncHandler = new SyncHandler(Spawner.SyncDB); diff --git a/Assets/Scripts/Networking/Clientside/SyncHandler.cs b/Assets/Scripts/Networking/Clientside/SyncHandler.cs index 8c87d54..7c20a55 100644 --- a/Assets/Scripts/Networking/Clientside/SyncHandler.cs +++ b/Assets/Scripts/Networking/Clientside/SyncHandler.cs @@ -1,9 +1,9 @@  -using Cyber.Console; using Cyber.Entities; using Cyber.Entities.SyncBases; using Cyber.Networking.Messages; using System.Collections.Generic; +using UnityEngine; using UnityEngine.Networking; namespace Cyber.Networking.Clientside { @@ -14,11 +14,15 @@ namespace Cyber.Networking.Clientside { /// public class SyncHandler { - public static double LastTimestamp = NetworkHelper.GetCurrentSystemTime(); + public static double LastTimestamp = NetworkHelper.GetTime(); private SyncDB SyncDB; private int LatestSyncID = -1; + private int SmallestSyncID = -1; + private int LastSyncID = -1; + private int SyncPacketsTotal = -1; + /// /// Creates the SyncHandler with SyncDB. /// @@ -52,13 +56,31 @@ namespace Cyber.Networking.Clientside { if (FailedSyncBases.Count > 0) { Client.Send(PktType.FailedChecksums, new IntListPkt(FailedSyncBases.ToArray())); } - - LastTimestamp = SyncPacket.Timestamp; } + + LastTimestamp = SyncPacket.Timestamp; + + LastSyncID = SyncPacket.SyncPacketID; + if (SmallestSyncID == -1) { + SmallestSyncID = SyncPacket.SyncPacketID; + } + SyncPacketsTotal++; } // Otherwise disregard the sync. } + public float GetPing() { + return (float) ((NetworkHelper.GetTime() - LastTimestamp) / 1000f); + } + + public float GetPacketLoss() { + return 1f - (SyncPacketsTotal * 1f / (LastSyncID - SmallestSyncID)); + } + + public int GetSyncPacketsReceived() { + return SyncPacketsTotal; + } + } } diff --git a/Assets/Scripts/Networking/Messages/SyncPkt.cs b/Assets/Scripts/Networking/Messages/SyncPkt.cs index 46c3b33..fe61699 100644 --- a/Assets/Scripts/Networking/Messages/SyncPkt.cs +++ b/Assets/Scripts/Networking/Messages/SyncPkt.cs @@ -1,5 +1,4 @@  -using Cyber.Console; using Cyber.Entities; using UnityEngine.Networking; @@ -13,7 +12,7 @@ namespace Cyber.Networking.Messages { /// /// Timestamp of the sync packet when sent from the server. /// - public double Timestamp; + public float Timestamp; /// /// The Sync Packet ID of this packet. @@ -45,13 +44,13 @@ namespace Cyber.Networking.Messages { /// /// /// ID of the sync packet itself. - public SyncPkt(SyncDB syncDB, int[] syncBases, int[] checksummedSyncBases, int[] checksums, int syncPacketID, double timestamp) { + public SyncPkt(SyncDB syncDB, int[] syncBases, int[] checksummedSyncBases, int[] checksums, int syncPacketID, float timestamp) { SyncPacketID = syncPacketID; SyncDB = syncDB; SyncedSyncBases = syncBases; ChecksummedSyncBases = checksummedSyncBases; Checksums = checksums; - timestamp = Timestamp; + Timestamp = timestamp; } /// @@ -70,6 +69,8 @@ namespace Cyber.Networking.Messages { /// public override void Deserialize(NetworkReader reader) { SyncPacketID = reader.ReadInt32(); + + Timestamp = (float) reader.ReadDouble(); } /// @@ -77,6 +78,7 @@ namespace Cyber.Networking.Messages { /// /// public void ApplySync(NetworkReader reader) { + byte[][] ByteArray = new byte[4][]; ByteArray[0] = reader.ReadBytesAndSize(); ByteArray[1] = reader.ReadBytesAndSize(); @@ -115,6 +117,8 @@ namespace Cyber.Networking.Messages { public override void Serialize(NetworkWriter writer) { writer.Write(SyncPacketID); + writer.Write((double) Timestamp); + byte[][] SyncedIdsByteArray = NetworkHelper.SerializeIntArray(SyncedSyncBases); writer.WriteBytesFull(SyncedIdsByteArray[0]); writer.WriteBytesFull(SyncedIdsByteArray[1]); diff --git a/Assets/Scripts/Networking/NetworkHelper.cs b/Assets/Scripts/Networking/NetworkHelper.cs index cc12fa3..b6cf45c 100644 --- a/Assets/Scripts/Networking/NetworkHelper.cs +++ b/Assets/Scripts/Networking/NetworkHelper.cs @@ -55,10 +55,8 @@ namespace Cyber.Networking { /// Returns the current system time in seconds. /// /// The system time in seconds. - public static double GetCurrentSystemTime() { - return DateTime.Now.ToUniversalTime().Subtract( - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)) - .TotalMilliseconds * 1.0 / 1000; + public static double GetTime() { + return Network.time; } } diff --git a/Assets/Scripts/Networking/Serverside/ServerSyncer.cs b/Assets/Scripts/Networking/Serverside/ServerSyncer.cs index 4a35393..962e809 100644 --- a/Assets/Scripts/Networking/Serverside/ServerSyncer.cs +++ b/Assets/Scripts/Networking/Serverside/ServerSyncer.cs @@ -63,7 +63,7 @@ namespace Cyber.Networking.Serverside { if (QueuedSyncs.Count > 0) { int[] SyncIDs = QueuedSyncs.ToArray(); SyncPkt SyncPacket = new SyncPkt(Database, SyncIDs, checksummedIds.ToArray(), - checksums.ToArray(), NextSyncID(), NetworkHelper.GetCurrentSystemTime()); + checksums.ToArray(), NextSyncID(), (float) NetworkHelper.GetTime()); Server.SendToAllByChannel(PktType.Sync, SyncPacket, NetworkChannelID.Unreliable); QueuedSyncs.Clear(); diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 02a8d87..29da442 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -85,6 +85,22 @@ InputManager: type: 0 axis: 0 joyNum: 0 + - serializedVersion: 3 + m_Name: ToggleNetworkDebug + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: f6 + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 0 + joyNum: 0 - serializedVersion: 3 m_Name: Equip descriptiveName: