diff --git a/Assets/MenuUi/Prefabs/Chat/BaseMessage.prefab b/Assets/MenuUi/Prefabs/Chat/BaseMessage.prefab index 176bd84776..f54e249d4d 100644 --- a/Assets/MenuUi/Prefabs/Chat/BaseMessage.prefab +++ b/Assets/MenuUi/Prefabs/Chat/BaseMessage.prefab @@ -1427,7 +1427,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} m_Name: m_EditorClassIdentifier: - m_HorizontalFit: 0 + m_HorizontalFit: 2 m_VerticalFit: 2 --- !u!1 &8709729911892892704 GameObject: @@ -1440,7 +1440,7 @@ GameObject: - component: {fileID: 6897423349860991160} - component: {fileID: 1748575566865397314} m_Layer: 5 - m_Name: Reactions (1) + m_Name: Reactions m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2551,16 +2551,31 @@ PrefabInstance: propertyPath: _messageObjectHandler value: objectReference: {fileID: 5786829121231365026} + - target: {fileID: 8509604158101261262, guid: 76aa8b7d736fa8e44955cce276908e74, + type: 3} + propertyPath: _reactionData.Array.size + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8509604158101261262, guid: 76aa8b7d736fa8e44955cce276908e74, type: 3} propertyPath: _reactionPaneldata.Array.size value: 1 objectReference: {fileID: 0} + - target: {fileID: 8509604158101261262, guid: 76aa8b7d736fa8e44955cce276908e74, + type: 3} + propertyPath: _reactionPaneldata.ReactionField + value: + objectReference: {fileID: 7999296891796925201} - target: {fileID: 8509604158101261262, guid: 76aa8b7d736fa8e44955cce276908e74, type: 3} propertyPath: _reactionPaneldata._reactionField value: objectReference: {fileID: 7999296891796925201} + - target: {fileID: 8509604158101261262, guid: 76aa8b7d736fa8e44955cce276908e74, + type: 3} + propertyPath: _reactionPaneldata.ReactionsContent + value: + objectReference: {fileID: 7044005991725015127} - target: {fileID: 8509604158101261262, guid: 76aa8b7d736fa8e44955cce276908e74, type: 3} propertyPath: _reactionPaneldata._reactionsContent diff --git a/Assets/MenuUi/Prefabs/Windows/GlobalWindows/ChatView.prefab b/Assets/MenuUi/Prefabs/Windows/GlobalWindows/ChatView.prefab index e703339786..b1bf7b38c4 100644 --- a/Assets/MenuUi/Prefabs/Windows/GlobalWindows/ChatView.prefab +++ b/Assets/MenuUi/Prefabs/Windows/GlobalWindows/ChatView.prefab @@ -340,7 +340,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 386.8, y: -300.74414} + m_AnchoredPosition: {x: 388.8, y: -235.24913} m_SizeDelta: {x: 700, y: 110} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &8012900771599692130 @@ -373,7 +373,7 @@ MonoBehaviour: m_MinWidth: -1 m_MinHeight: -1 m_PreferredWidth: -1 - m_PreferredHeight: 85 + m_PreferredHeight: 110 m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 @@ -731,6 +731,7 @@ GameObject: - component: {fileID: 5116059480852723547} - component: {fileID: 2736510401390861386} - component: {fileID: 2806177258080298227} + - component: {fileID: 5728103865936316895} m_Layer: 0 m_Name: Viewport m_TagString: Untagged @@ -750,6 +751,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 5845669023103182092} - {fileID: 8542177965822184391} m_Father: {fileID: 4740981227950461619} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -809,6 +811,32 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_ShowMaskGraphic: 0 +--- !u!114 &5728103865936316895 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 774704010474596688} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 0 + m_ChildControlHeight: 0 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 --- !u!1 &1035830549583425871 GameObject: m_ObjectHideFlags: 0 @@ -1115,7 +1143,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} + m_Color: {r: 0.88235295, g: 0.88235295, b: 0.88235295, a: 1} m_RaycastTarget: 1 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 @@ -1716,7 +1744,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: -0.00012207031} - m_SizeDelta: {x: -700, y: -650} + m_SizeDelta: {x: -700, y: -600} m_Pivot: {x: 0, y: 1} --- !u!114 &7215285588370245146 MonoBehaviour: @@ -2840,7 +2868,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.1, y: 0.1} m_AnchorMax: {x: 0.9, y: 0.85} - m_AnchoredPosition: {x: 0, y: -25} + m_AnchoredPosition: {x: 0, y: -25.000061} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1485619431382498838 @@ -3238,7 +3266,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 2564540923251323573} - - {fileID: 4349249108874952513} + - {fileID: 4325108700598219797} m_Father: {fileID: 3684371136031284224} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -3389,7 +3417,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 50, y: -61.80227} + m_AnchoredPosition: {x: 50, y: -60.7899} m_SizeDelta: {x: 100, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &7696485582972512613 @@ -3634,6 +3662,62 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 1 m_CallState: 2 +--- !u!1 &3435556442958773812 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5845669023103182092} + - component: {fileID: 9195409789549020322} + m_Layer: 0 + m_Name: Space + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5845669023103182092 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3435556442958773812} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 9004813816187228610} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 5, y: -55} + m_SizeDelta: {x: 10, y: 110} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &9195409789549020322 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3435556442958773812} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 5 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &3493400003683782732 GameObject: m_ObjectHideFlags: 0 @@ -3670,7 +3754,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 386.8, y: -408.24414} + m_AnchoredPosition: {x: 388.8, y: -342.74915} m_SizeDelta: {x: 700, y: 5} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &7912668250702345692 @@ -4443,8 +4527,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.05, y: 0.05} m_AnchorMax: {x: 0.95, y: 0.95} - m_AnchoredPosition: {x: 2, y: 0} - m_SizeDelta: {x: -4, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2029458685561180645 MonoBehaviour: @@ -4468,7 +4552,7 @@ MonoBehaviour: m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 0 - m_ChildControlHeight: 0 + m_ChildControlHeight: 1 m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 @@ -4771,6 +4855,134 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!1 &4711497440853259810 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4325108700598219797} + - component: {fileID: 8638815110373297450} + - component: {fileID: 2053480718372948307} + - component: {fileID: 959950731169273863} + - component: {fileID: 8849115530695733483} + m_Layer: 0 + m_Name: ScrollRect + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4325108700598219797 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4711497440853259810} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 1.4434044} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 7808444925369831179} + m_Father: {fileID: 6937871787955167669} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 417.5, y: -55} + m_SizeDelta: {x: 565, y: 110} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &8638815110373297450 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4711497440853259810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.1792453, g: 0.1792453, b: 0.1792453, a: 0} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &2053480718372948307 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4711497440853259810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 565 + m_PreferredHeight: 110 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!114 &959950731169273863 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4711497440853259810} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Content: {fileID: 0} + m_Horizontal: 1 + m_Vertical: 0 + m_MovementType: 1 + m_Elasticity: 0.1 + m_Inertia: 1 + m_DecelerationRate: 0.135 + m_ScrollSensitivity: 1 + m_Viewport: {fileID: 7808444925369831179} + m_HorizontalScrollbar: {fileID: 0} + m_VerticalScrollbar: {fileID: 0} + m_HorizontalScrollbarVisibility: 0 + m_VerticalScrollbarVisibility: 0 + m_HorizontalScrollbarSpacing: 0 + m_VerticalScrollbarSpacing: -3 + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] +--- !u!222 &8849115530695733483 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4711497440853259810} + m_CullTransparentMesh: 1 --- !u!1 &4748461315105360402 GameObject: m_ObjectHideFlags: 0 @@ -4809,10 +5021,10 @@ RectTransform: - {fileID: 7538245496696105330} m_Father: {fileID: 9004813816187228610} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 10, y: 0} + m_SizeDelta: {x: 630, y: 110} m_Pivot: {x: 0, y: 1} --- !u!114 &1398436554631707718 MonoBehaviour: @@ -5414,6 +5626,96 @@ MonoBehaviour: m_OnValueChanged: m_PersistentCalls: m_Calls: [] +--- !u!1 &5163482810798233842 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7808444925369831179} + - component: {fileID: 7813754295863667734} + - component: {fileID: 729734700785514752} + - component: {fileID: 8702523111131546619} + m_Layer: 0 + m_Name: Viewport + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7808444925369831179 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5163482810798233842} + 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_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 4349249108874952513} + m_Father: {fileID: 4325108700598219797} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 1} +--- !u!222 &7813754295863667734 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5163482810798233842} + m_CullTransparentMesh: 1 +--- !u!114 &729734700785514752 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5163482810798233842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10917, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8702523111131546619 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5163482810798233842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} + m_Name: + m_EditorClassIdentifier: + m_ShowMaskGraphic: 0 --- !u!1 &5282149747019341538 GameObject: m_ObjectHideFlags: 0 @@ -5659,16 +5961,16 @@ RectTransform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 5612372508043473246} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 0, y: 0, z: -1.4434044} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 6937871787955167669} + m_Father: {fileID: 7808444925369831179} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 135, y: -55} - m_SizeDelta: {x: 0, y: 110} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &4225351530599048031 MonoBehaviour: @@ -5941,19 +6243,20 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 477b38ea3c6f9974491f82799fbc1307, type: 3} m_Name: m_EditorClassIdentifier: - ReactionAmounText: {fileID: 1480503946665984614} _closeButtons: - {fileID: 2943311908611794494} - {fileID: 7477148938460072697} - {fileID: 5020424597918123324} _closeAllReactionButton: {fileID: 2014114443139516172} _listOrderButton: {fileID: 3052950907519947448} - ShowUsersPopUp: {fileID: 5763485112562100175} - _messageReactionsHandler: {fileID: 0} + _reactionFieldLocation: {fileID: 4349249108874952513} + _popUpAllReactions: {fileID: 8542177965822184391} + _scrollRect: {fileID: 959950731169273863} _userContent: {fileID: 7215285588370245146} _userData: {fileID: 8844569307860996610, guid: d9e96f8283e71824cadeec334b0a267e, type: 3} _userInfo: [] + _reactionAmounText: {fileID: 1480503946665984614} _reactionList: - Sprite: {fileID: 21300000, guid: 97d495bb5e2207e47b120d397738ae7f, type: 3} Mood: 1 @@ -5968,9 +6271,6 @@ MonoBehaviour: _allReactions: {fileID: 7575259912955991635} _selectedReaction: {fileID: 3062161777963099109} _noReactions: {fileID: 8829262437161837364} - CopiedReactionField: {fileID: 0} - ReactionFieldLocation: {fileID: 4349249108874952513} - PopUpAllReactions: {fileID: 8542177965822184391} _sprites: - {fileID: 0} - {fileID: 0} @@ -5978,7 +6278,8 @@ MonoBehaviour: - {fileID: 0} - {fileID: 21300000, guid: a12221f1d2fd7194dbb2e0620c4fe9b8, type: 3} _image: {fileID: 4777644748716934985} - _OrderButtonText: {fileID: 4953989987484460405} + _orderButtonText: {fileID: 4953989987484460405} + _textLanguageSelectorCaller: {fileID: 5692628913879568637} --- !u!114 &7249710220094630189 MonoBehaviour: m_ObjectHideFlags: 0 @@ -6867,8 +7168,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 386.8, y: -785.74414} - m_SizeDelta: {x: 700, y: 650} + m_AnchoredPosition: {x: 388.8, y: -695.24915} + m_SizeDelta: {x: 700, y: 600} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &2828838990348605202 MonoBehaviour: @@ -6916,7 +7217,7 @@ MonoBehaviour: m_MinWidth: -1 m_MinHeight: -1 m_PreferredWidth: 400 - m_PreferredHeight: 300 + m_PreferredHeight: 600 m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 @@ -7294,9 +7595,8 @@ MonoBehaviour: _InputAreaArrow: {fileID: 8800692130466575762} ShowUsersPopUp: {fileID: 5763485112562100175} ChatShowUsersPopUpData: {fileID: 3137927778324403408} - characterResponseList: {fileID: 11400000, guid: 0c97ef5ec4dd42d49854c48853a3e90c, - type: 2} currentMood: 2 + lasttimeMood: 2 _responsesData: {fileID: 1228178274405547610} _chatType: 0 --- !u!114 &1176563068381732146 @@ -7590,7 +7890,7 @@ MonoBehaviour: m_EditorClassIdentifier: _rectTranformParent: {fileID: 4740981227950461619} _gridLayout: {fileID: 1398436554631707718} - _limitX: 120 + _limitX: 110 _limitY: 0 --- !u!114 &2627813341174848299 MonoBehaviour: @@ -7716,8 +8016,9 @@ GameObject: - component: {fileID: 1685783836498216917} - component: {fileID: 1480503946665984614} - component: {fileID: 7680331713395706728} + - component: {fileID: 5692628913879568637} m_Layer: 5 - m_Name: ReactionAmounText + m_Name: ReactionAmountText m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -7739,8 +8040,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 386.8, y: -145.74414} - m_SizeDelta: {x: 700, y: 100} + m_AnchoredPosition: {x: 388.8, y: -73.27413} + m_SizeDelta: {x: 700, y: 113.95} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1685783836498216917 CanvasRenderer: @@ -7798,7 +8099,7 @@ MonoBehaviour: m_faceColor: serializedVersion: 2 rgba: 4294967295 - m_fontSize: 78.95 + m_fontSize: 90 m_fontSizeBase: 36 m_fontWeight: 400 m_enableAutoSizing: 1 @@ -7862,6 +8163,20 @@ MonoBehaviour: m_FlexibleWidth: -1 m_FlexibleHeight: -1 m_LayoutPriority: 1 +--- !u!114 &5692628913879568637 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8292671902318602454} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 99bef45c2704bb147a99ddcb380f3986, type: 3} + m_Name: + m_EditorClassIdentifier: + _finnishText: + _englishText: --- !u!1 &8465531718494878061 GameObject: m_ObjectHideFlags: 0 @@ -9810,7 +10125,7 @@ PrefabInstance: - target: {fileID: 2641932565321544379, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_AnchorMin.y - value: 0.94188035 + value: 0.9542763 objectReference: {fileID: 0} - target: {fileID: 2664587007262820359, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} @@ -9896,12 +10211,12 @@ PrefabInstance: - target: {fileID: 3472046463813142143, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_AnchorMax.y - value: 0.8468803 + value: 0.8582763 objectReference: {fileID: 0} - target: {fileID: 3472046463813142143, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_AnchorMin.y - value: 0.1975 + value: 0.201 objectReference: {fileID: 0} - target: {fileID: 3472046463813142143, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} @@ -11278,7 +11593,7 @@ PrefabInstance: - target: {fileID: 6891754130952581934, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_fontSize - value: 29.85 + value: 29.4 objectReference: {fileID: 0} - target: {fileID: 6908065752443577215, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} @@ -11790,7 +12105,7 @@ PrefabInstance: - target: {fileID: 7827142668286818857, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_AnchorMax.y - value: 0.1975 + value: 0.201 objectReference: {fileID: 0} - target: {fileID: 7887861368517116277, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} @@ -12025,17 +12340,17 @@ PrefabInstance: - target: {fileID: 9009743781400064838, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_AnchorMax.y - value: 0.94188035 + value: 0.9542763 objectReference: {fileID: 0} - target: {fileID: 9009743781400064838, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_AnchorMin.y - value: 0.8468803 + value: 0.8582763 objectReference: {fileID: 0} - target: {fileID: 9011883256918754321, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} propertyPath: m_fontSize - value: 43.85 + value: 42.75 objectReference: {fileID: 0} - target: {fileID: 9092001840253612742, guid: 57890b7dbec8a984abb7d8148eefe9f6, type: 3} diff --git a/Assets/MenuUi/Scripts/Chat/ChatReactionHandler.cs b/Assets/MenuUi/Scripts/Chat/ChatReactionHandler.cs index 308dc0959a..b614cec1e2 100644 --- a/Assets/MenuUi/Scripts/Chat/ChatReactionHandler.cs +++ b/Assets/MenuUi/Scripts/Chat/ChatReactionHandler.cs @@ -22,7 +22,7 @@ public class ChatReactionHandler : MonoBehaviour public int Count => _count; public bool Selected => _selected; - private Mood _mood; + [SerializeField] private Mood _mood; private string _messageID; private int _count = 0; private bool _selected; diff --git a/Assets/MenuUi/Scripts/Chat/ChatShowUsersPopUpData.cs b/Assets/MenuUi/Scripts/Chat/ChatShowUsersPopUpData.cs index 2e5f05e2c0..86ceae4356 100644 --- a/Assets/MenuUi/Scripts/Chat/ChatShowUsersPopUpData.cs +++ b/Assets/MenuUi/Scripts/Chat/ChatShowUsersPopUpData.cs @@ -1,55 +1,58 @@ using System.Collections; using System.Collections.Generic; -using System.Threading; using UnityEngine; using TMPro; using UnityEngine.UI; -using static MessageReactionsHandler; using System; using Altzone.Scripts.Chat; using Altzone.Scripts.Model.Poco.Player; using static ServerChatMessage; using System.Linq; +using Altzone.Scripts.Language; public class ChatShowUsersPopUpData : MonoBehaviour { - [SerializeField] private TextMeshProUGUI ReactionAmounText; + [Header("Buttons")] [SerializeField] private Button[] _closeButtons; [SerializeField] private Button _closeAllReactionButton; [SerializeField] private Button _listOrderButton; - [SerializeField] private GameObject ShowUsersPopUp; - [Header("Scripts")] - public MessageReactionsHandler _messageReactionsHandler; - [Header("User Info")] + [Header("For Copied Reactions")] + [SerializeField] private Transform _reactionFieldLocation; + private GameObject _copiedReactionField; + [SerializeField] private Transform _popUpAllReactions; + [SerializeField] private ScrollRect _scrollRect; + [Header("User Info")] [SerializeField] private VerticalLayoutGroup _userContent; [SerializeField] private GameObject _userData; private List _usersReactionData = new(); [SerializeField] private List _userInfo; [Header("Reactions")] + [SerializeField] private TextMeshProUGUI _reactionAmounText; [SerializeField] private List _reactionList; [SerializeField] private GameObject _allReactions; - public GameObject _selectedReaction; + [SerializeField] private GameObject _selectedReaction; [SerializeField] private GameObject _noReactions; - public GameObject CopiedReactionField; - public Transform ReactionFieldLocation; - public Transform PopUpAllReactions; + + [Header("List Order")] [SerializeField] private Sprite[] _sprites; [SerializeField] private Image _image; - [SerializeField] private TextMeshProUGUI _OrderButtonText; - private int LineOrder = 0; - private int currentOrder = 1; + [SerializeField] private TextMeshProUGUI _orderButtonText; + + [SerializeField] private TextLanguageSelectorCaller _textLanguageSelectorCaller; + + private string _currentMessage; + private int _lineOrder = 0; //Whats the newest and the oldest reaction set + private int _currentOrder = 1; //What type of order we are on the list - //[SerializeField] private TextLanguageSelectorCaller _reactionAmount; private void Start() { _closeAllReactionButton.onClick.AddListener(LayoutButton); - _listOrderButton.onClick.AddListener(() => currentOrder++); - _listOrderButton.onClick.AddListener(() => ListOrder(currentOrder)); - reactiontext(); + _listOrderButton.onClick.AddListener(() => {_currentOrder++; ListOrderSystem(_currentOrder);}); + Reactiontext(); foreach (Button button in _closeButtons) { button.onClick.AddListener(ClosePopup); @@ -57,10 +60,8 @@ private void Start() } //Puts back the reactions and popup back to messageobject - public void ClosePopup() + private void ClosePopup() { - - //---- Put the new data that been added to popup here ---- for (int i = _userInfo.Count - 1; i >= 0; i--) { Destroy(_userInfo[i].UserDataObj); @@ -68,30 +69,30 @@ public void ClosePopup() _userInfo.Clear(); - Destroy(CopiedReactionField); - CopiedReactionField = null; - _messageReactionsHandler = null; + Destroy(_copiedReactionField); + _copiedReactionField = null; + _scrollRect.content = null; + _currentMessage = null; gameObject.SetActive(false); - LineOrder = 0; - + _lineOrder = 0; + _currentOrder = 1; } void OnEnable() { - reactiontext(); + Reactiontext(); + ListOrderSystem(_currentOrder); } //Incane user leaves the chat private void OnDisable() { - - ListOrder(1); ClosePopup(); } - public void reactiontext() + private void Reactiontext() { int activeChildren = 0; foreach (Transform container in _userContent.transform) @@ -103,49 +104,51 @@ public void reactiontext() } - ReactionAmounText.text = $"{activeChildren} reaktiota"; + //Language System + if (SettingsCarrier.Instance.Language is SettingsCarrier.LanguageType.Finnish) + { + _textLanguageSelectorCaller.SetText("{} reaktiota"); + } + else if (SettingsCarrier.Instance.Language is SettingsCarrier.LanguageType.English) + { + _textLanguageSelectorCaller.SetText("{} reactions"); + } + + _reactionAmounText.text = _reactionAmounText.text.Replace("{}", $"{activeChildren}"); - //_reactionAmount.SetText(SettingsCarrier.Instance.Language, new string[1] { activeChildren.ToString() }); } public void AddUsersReaction(ChatMessage message, ServerReactions Emoji) { - LineOrder++; - Mood mood = (Mood)Enum.Parse(typeof(Mood), Emoji.emoji); - - //halts the system if there's already a same user on the list - for (int i = _userInfo.Count - 1; i >= 0; i--) + //Checks if it's on a correct Message section + if (_currentMessage != null) { - if (_userInfo[i]._id != Emoji.sender_id) - continue; - - - if (_userInfo[i]._id == Emoji.sender_id && _userInfo[i]._mood != mood) - { - RemoveUserReaction(Emoji.sender_id); - continue; - } - else if (_userInfo[i]._id == Emoji.sender_id && _userInfo[i]._mood == mood) - { - + if (_currentMessage != message.Id) return; - } } + else + { + _currentMessage = message.Id; + } + + Mood mood = (Mood)Enum.Parse(typeof(Mood), Emoji.emoji); + + _lineOrder++; //Gets sprite Sprite reactionSprite = _reactionList.FirstOrDefault(x => x.Mood == mood)?.Sprite; //Sets up the Data GameObject newUserData = Instantiate(_userData, _userContent.transform); - _userInfo.Add(new UserReactionInfo { _avatar = message.Avatar, _id = Emoji.sender_id, _name = Emoji.playerName, Emoji = reactionSprite, UserDataObj = newUserData, _mood = mood, _order = LineOrder}); + _userInfo.Add(new UserReactionInfo { _avatar = message.Avatar, _id = Emoji.sender_id, _name = Emoji.playerName, Emoji = reactionSprite, UserDataObj = newUserData, _mood = mood, _order = _lineOrder}); UsersReactionData userData = newUserData.GetComponent(); userData.SetReactionInfo(_userInfo[_userInfo.Count - 1]._avatar, _userInfo[_userInfo.Count - 1]._name, _userInfo[_userInfo.Count - 1]._id, _userInfo[_userInfo.Count - 1].Emoji); _usersReactionData.Add(userData); - reactiontext(); - ListOrder(currentOrder); + Reactiontext(); + ListOrderSystem(_currentOrder); - if (CopiedReactionField.transform.childCount > 0) + if (_copiedReactionField.transform.childCount > 0) { _noReactions.SetActive(false); } @@ -153,10 +156,15 @@ public void AddUsersReaction(ChatMessage message, ServerReactions Emoji) } //removes the userData - public void RemoveUserReaction(string Userid) + public void RemoveUserReaction(string Userid, ChatMessage message) { + //Checks if it's on a correct Message section + if (_currentMessage != null) + { + if (_currentMessage != message.Id) + return; + } - for (int i = _userInfo.Count - 1; i >= 0; i--) { @@ -165,13 +173,15 @@ public void RemoveUserReaction(string Userid) _userInfo[i].UserDataObj.transform.SetParent(null); Destroy(_userInfo[i].UserDataObj); _userInfo.RemoveAt(i); - LineOrder--; + _lineOrder--; } } - reactiontext(); - if(CopiedReactionField.transform.childCount == 0) + + Reactiontext(); + + if(_copiedReactionField.transform.childCount == 0) { _noReactions.SetActive(true); } @@ -186,17 +196,56 @@ void LayoutButton() _selectedReaction.SetActive(true); } } - //Sets the List in certain order + //Copies the Reaction + public void ReactionFieldCopyUpdate(GameObject ReactionField, MessageReactionsHandler ReactionHandler, ChatMessage message) + { + + //Checks if it's on a correct Message section + if (_currentMessage != null) + { + if (_currentMessage != message.Id) + return; + } + + + Destroy(_copiedReactionField); + + _copiedReactionField = Instantiate(ReactionField, _reactionFieldLocation); + + _scrollRect.content = _copiedReactionField.GetComponent(); + + //Changes the reactions object sizes + foreach (RectTransform child in _copiedReactionField.transform) + { + ContentSizeFitter childFitter = child.GetComponent(); + childFitter.enabled = false; + + child.sizeDelta = new Vector2(150, 110); + + ChatReactionHandler Childhandler = child.GetComponent(); + + //Adds the toggle system to the copied button to direct the data to its original place + foreach (ChatReactionHandler i in ReactionHandler.ReactionHandlers) + { + if(Childhandler.Mood == i.Mood) + { + Childhandler.Button.onClick.AddListener(() => ReactionHandler.ToggleReaction(i)); + } + } + } + ReactionHandler.GenarateReactionObjects(_popUpAllReactions); + + } - void ListOrder(int order) + void ListOrderSystem(int order) { if (order >= 6) { - currentOrder = 1; - order = currentOrder; + _currentOrder = 1; + order = _currentOrder; } switch (order) { @@ -204,41 +253,57 @@ void ListOrder(int order) //Oldest => Newest case 1: - Debug.LogWarning("FIND ME Order 1"); + _userInfo = _userInfo.OrderBy(m => m._order).ToList(); - _OrderButtonText.text = "Old"; + + //Language System + if (SettingsCarrier.Instance.Language is SettingsCarrier.LanguageType.Finnish) + { + _orderButtonText.text = "Vanha"; + } + else if (SettingsCarrier.Instance.Language is SettingsCarrier.LanguageType.English) + { + _orderButtonText.text = "Old"; + } + _image.sprite = null; break; //Newest => Oldest case 2: - Debug.LogWarning("FIND ME Order 2"); _userInfo = _userInfo.OrderByDescending(m => m._order).ToList(); - _OrderButtonText.text = "New"; + + //Language System + if (SettingsCarrier.Instance.Language is SettingsCarrier.LanguageType.Finnish) + { + _orderButtonText.text = "Uusi"; + } + else if (SettingsCarrier.Instance.Language is SettingsCarrier.LanguageType.English) + { + _orderButtonText.text = "New"; + } + _image.sprite = null; break; // A => Z By Username case 3: - Debug.LogWarning("FIND ME Order 3"); _userInfo = _userInfo.OrderBy(m => m._name.ToLower().Trim()).ToList(); - _OrderButtonText.text = "A-Z"; + _orderButtonText.text = "A-Z"; _image.sprite = null; break; // Z => A By Username case 4: - Debug.LogWarning("FIND ME Order 4"); _userInfo = _userInfo.OrderByDescending(m => m._name.ToLower().Trim()).ToList(); - _OrderButtonText.text = "Z-A"; + _orderButtonText.text = "Z-A"; _image.sprite = null; break; //Sadness => Love by Reactions case 5: - Debug.LogWarning("FIND ME Order 5"); _userInfo = _userInfo.OrderBy(m => m._mood).ToList(); - _OrderButtonText.text = ""; + _orderButtonText.text = ""; if (_sprites[4] != null) _image.sprite = _sprites[4]; break; diff --git a/Assets/MenuUi/Scripts/Chat/MessageObjectHandler.cs b/Assets/MenuUi/Scripts/Chat/MessageObjectHandler.cs index 79ef30cf6d..461cf8dcf8 100644 --- a/Assets/MenuUi/Scripts/Chat/MessageObjectHandler.cs +++ b/Assets/MenuUi/Scripts/Chat/MessageObjectHandler.cs @@ -159,6 +159,7 @@ public void ReactionChatCall(ServerReactions EmojiId, ChatMessage message) //Gets the set data we need to get to import saved reactions MessageReactionsHandler ChildsScript = ReactionObject.GetComponent(); ChildsScript.AddReaction(EmojiId, (Mood)Enum.Parse(typeof(Mood), EmojiId.emoji), _id, ReactionsPanel, message); + } private void UpdateReactions(ChatChannelType chatChannelType, ChatMessage message) diff --git a/Assets/MenuUi/Scripts/Chat/MessageReactionResize.cs b/Assets/MenuUi/Scripts/Chat/MessageReactionResize.cs index 924e0c7152..212e2aabd3 100644 --- a/Assets/MenuUi/Scripts/Chat/MessageReactionResize.cs +++ b/Assets/MenuUi/Scripts/Chat/MessageReactionResize.cs @@ -1,5 +1,3 @@ -using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; diff --git a/Assets/MenuUi/Scripts/Chat/MessageReactionsHandler.cs b/Assets/MenuUi/Scripts/Chat/MessageReactionsHandler.cs index 688bb1eb55..64adcea059 100644 --- a/Assets/MenuUi/Scripts/Chat/MessageReactionsHandler.cs +++ b/Assets/MenuUi/Scripts/Chat/MessageReactionsHandler.cs @@ -13,7 +13,7 @@ public class MessageReactionsHandler : AltMonoBehaviour [SerializeField] private GameObject _commonReactionsPanel; [SerializeField] private GameObject _allReactionsPanel; - [SerializeField] public reactionPanelGroup _reactionPaneldata; + [SerializeField] private reactionPanelGroup _reactionPaneldata; [Header("Prefabs")] [SerializeField] private GameObject _addedReactionPrefab; @@ -21,7 +21,7 @@ public class MessageReactionsHandler : AltMonoBehaviour [SerializeField] private MessageObjectHandler _selectedMessage; [Header("Reactions")] - [SerializeField] public List _reactionList; + [SerializeField] private List _reactionList; [SerializeField] private GameObject _reactionObject; /*[Header("Added Features")] @@ -32,32 +32,35 @@ public class MessageReactionsHandler : AltMonoBehaviour private List _reactions = new(); private List _reactionHandlers = new(); + public List ReactionHandlers { get => _reactionHandlers; } + private List _commonReactions = new(); private bool _longClick = false; - private ChatShowUsersPopUpData Popup = Chat.instance?.ChatShowUsersPopUpData; - public MessageObjectHandler _messageObjectHandler; + private ChatShowUsersPopUpData _reactionPopup = Chat.instance?.ChatShowUsersPopUpData; + [SerializeField] public List _reactionData = new List(); //Used for addings data to ChatShowUserPopUpData - [SerializeField]public List ReactionData = new List(); //Used for addings data to ChatShowUserPopUpData + private string _pLayerId; ///Used for void Start() { //For "AddReactions" - _openMoreButton.onClick.AddListener((() => { + _openMoreButton.onClick.AddListener((() => + { _allReactionsPanel.SetActive(true); _selectedMessage.SizeCall(); _commonReactionsPanel.SetActive(false); GetComponent().UpdateSize(); })); + StartCoroutine(GetPlayerData(player => + { + _pLayerId = player.Id; + })); + //ReactionObjectHandler.OnReactionPressed += AddReaction; - //ReactionObjectHandler.OnReactionPressed += AddReaction; - - - GenarateReactionObjects(_reactionPaneldata._reactionsContent); - UpdateReactionStatus(_reactionPaneldata._reactionsContent); - + GenarateReactionObjects(_reactionPaneldata.ReactionsContent); PickCommonReactions(); } @@ -69,7 +72,7 @@ private void OnDestroy() //ReactionObjectHandler.OnReactionPressed -= AddReaction; } - private void GenarateReactionObjects(Transform reactionPanel) + public void GenarateReactionObjects(Transform reactionPanel) { _reactions.Clear(); foreach (Transform reaction in reactionPanel) @@ -90,6 +93,7 @@ private void GenarateReactionObjects(Transform reactionPanel) _reactions.Add(handler); } } + UpdateReactionStatus(reactionPanel); } private void UpdateReactionStatus(Transform reactionPanel) @@ -132,6 +136,7 @@ private void PickCommonReactions() randomReaction = UnityEngine.Random.Range(0, availableReactions.Count); } while (_commonReactions.Contains(randomReaction));*/ + if (availableReactions.Count <= i) break; randomReaction = i; @@ -164,142 +169,122 @@ private void PickCommonReactions() /// public void UpdateReactions(List reactions, string messageid, ChatMessage message) { + ResetReactionPopUpData(message); - foreach (ChatReactionHandler addedReaction in _reactionHandlers) - { - addedReaction.ResetReactions(); - + foreach (ChatReactionHandler addedReaction in _reactionHandlers) + { + addedReaction.ResetReactions(); + } + foreach (ServerReactions reaction in reactions) + { + AddReaction(reaction, (Mood)Enum.Parse(typeof(Mood), reaction.emoji), messageid, _reactionPaneldata.ReactionField, message); + } - } - foreach (ServerReactions reaction in reactions) + List removableReactions = new(); + foreach (ChatReactionHandler addedReaction in _reactionHandlers) + { + if (addedReaction.Count <= 0) { - AddReaction(reaction, (Mood)Enum.Parse(typeof(Mood), reaction.emoji), messageid, _reactionPaneldata._reactionField, message); - + removableReactions.Add(addedReaction); } - List removableReactions = new(); - foreach (ChatReactionHandler addedReaction in _reactionHandlers) - { - - if (addedReaction.Count <= 0) - { - removableReactions.Add(addedReaction); - - - } - - } - for (int i = removableReactions.Count - 1; i >= 0; i--) - { - RemoveReaction(removableReactions[i]); + } + for (int i = removableReactions.Count - 1; i >= 0; i--) + { + RemoveReaction(removableReactions[i]); + } + //Used for "ChatShowUserPopUpData" + if (_reactionPopup.gameObject.activeSelf) + { + _reactionPopup.ReactionFieldCopyUpdate(_reactionPaneldata.ReactionField, this, message); + } - } - } /// /// Adds the chosen reaction to the selected message. /// - public void AddReaction(ServerReactions _reaction, Mood mood, string message_id, GameObject ReactionPanel = null, ChatMessage message = null) + public void AddReaction(ServerReactions reaction, Mood mood, string message_id, GameObject ReactionPanel, ChatMessage message) { - - if (_selectedMessage != null) { - string messageID = _selectedMessage.Id; if (messageID != message_id) return; + //Adds the data for reaction popup + _reactionData.Add(reaction); - HorizontalLayoutGroup reactionsFields = ReactionPanel.GetComponent(); - - + if (_reactionPopup.gameObject.activeSelf) + { + _reactionPopup.AddUsersReaction(message, reaction); + } + HorizontalLayoutGroup reactionsFields = ReactionPanel.GetComponent(); Sprite reactionSprite = _reactionList.FirstOrDefault(x => x.Mood == mood)?.Sprite; int i = _reactionList.FindIndex(m => m.Sprite == reactionSprite); - // Checks if chosen reaction is already added to the selected message. If so, deletes it. foreach (ChatReactionHandler addedReaction in _reactionHandlers) { if (addedReaction.Mood == mood) { - addedReaction.AddReaction(_reaction); + addedReaction.AddReaction(reaction); StartCoroutine(GetPlayerData(player => { if (player != null) - if (player.Id == _reaction.sender_id) + if (player.Id == reaction.sender_id) { - //Removes the selected reaction + + //Refreshes the reaction selection + ListReset(); + _reactionList[i].Selected = true; + addedReaction.Select(); + } })); - - _selectedMessage.SetMessageInactive(); + GenarateReactionObjects(_reactionPaneldata.ReactionsContent); + _selectedMessage.SetMessageInactive(); return; } } - // Creates a reaction with the needed info and adds it to the selected message. GameObject newReaction = Instantiate(_addedReactionPrefab, reactionsFields.transform); - //adjusts the imported reactions size if ShowUsersPopUp is active - /*if (_usersWhoAdded.activeSelf == true) - { - RectTransform rt = newReaction.GetComponent(); - ContentSizeFitter SizeFitter = newReaction.GetComponent(); - - SizeFitter.enabled = false; - rt.sizeDelta = new Vector2(150, 110); - }*/ ChatReactionHandler chatReactionHandler = newReaction.GetComponentInChildren(); chatReactionHandler.SetReactionInfo(reactionSprite, messageID, mood); - chatReactionHandler.AddReaction(_reaction); + chatReactionHandler.AddReaction(reaction); _reactionHandlers.Add(chatReactionHandler); - ReactionData.Add(_reaction); - chatReactionHandler.Button.onClick.AddListener(() => ToggleReaction(chatReactionHandler, message, _reaction)); + chatReactionHandler.Button.onClick.AddListener(() => ToggleReaction(chatReactionHandler)); chatReactionHandler.LongClickButton.onLongClick.AddListener(() => ShowUsers(message)); - + StartCoroutine(GetPlayerData(player => { if (player != null) - if (player.Id == _reaction.sender_id) + if (player.Id == reaction.sender_id) { - + chatReactionHandler.Select(); - //Removes the selected Mood from the list by checking what sprite is being used + + //Refreshes the reaction selection + ListReset(); _reactionList[i].Selected = true; - } + } })); - if(Popup.gameObject.activeSelf) - { - Popup.AddUsersReaction(message, _reaction); - } - GenarateReactionObjects(_reactionPaneldata._reactionsContent); - UpdateReactionStatus(_reactionPaneldata._reactionsContent); - + GenarateReactionObjects(_reactionPaneldata.ReactionsContent); + PickCommonReactions(); LayoutRebuilder.ForceRebuildLayoutImmediate(ReactionPanel.GetComponent()); - if(Popup.gameObject.activeSelf) - { - GenarateReactionObjects(Popup.PopUpAllReactions); - UpdateReactionStatus(Popup.PopUpAllReactions); - } - - - - - _selectedMessage.SetMessageInactive(); @@ -312,74 +297,65 @@ public void AddReaction(ServerReactions _reaction, Mood mood, string message_id, /// Toggles the added reactions as selected and unselected. /// /// - public void ToggleReaction(ChatReactionHandler reactionHandler, ChatMessage message, ServerReactions _reaction) + public void ToggleReaction(ChatReactionHandler reactionHandler) { + + ChatListener.Instance.SendReaction(!reactionHandler.Selected ? reactionHandler.Mood.ToString() : string.Empty, reactionHandler.MessageID, ChatListener.Instance.ActiveChatChannel); if (!_longClick) { - _selectedMessage.SetMessageInactive(); - reactionHandler.Deselect(); + ListReset(); if (reactionHandler.Selected) { - - foreach (var i in _reactionList) - { - if (i.Mood == reactionHandler.Mood) - { - //Adds the set sprite back in to reaction selection - i.Selected = false; - - } - } + reactionHandler.Deselect(); } else { reactionHandler.Select(); } - - + GenarateReactionObjects(_reactionPaneldata.ReactionsContent); } } private void ShowUsers(ChatMessage message) { - - //halts the button as when field get copied it the button will rerun the script again duplicating it twice - /*if(Popup.gameObject.activeSelf) + if (_reactionPopup.gameObject.activeSelf) return; - //Gets needed data for ChatShowUserPopUpData - Popup._messageReactionsHandler = gameObject.GetComponent(); - Popup.gameObject.SetActive(true); - Popup.CopiedReactionField = Instantiate(_reactionPaneldata._reactionField, Popup.ReactionFieldLocation); - GenarateReactionObjects(Popup.PopUpAllReactions); - UpdateReactionStatus(Popup.PopUpAllReactions); - foreach (var reactionData in ReactionData) + //Gets needed data for ChatShowUserPopUpData1 + _reactionPopup.gameObject.SetActive(true); + + //Changes the reactions object sizes + _reactionPopup.ReactionFieldCopyUpdate(_reactionPaneldata.ReactionField, this, message); + + foreach (var reactionData in _reactionData) { - Popup.AddUsersReaction(message, reactionData); + _reactionPopup.AddUsersReaction(message, reactionData); } - // RectTransform rtReactionField = _reactionPaneldata[0]._reactionField.GetComponent(); - /*foreach(var i in _reactionHandlers) - { - ContentSizeFitter SizeFitter = i._messageReaction.GetComponent(); - RectTransform transform = i._messageReaction.GetComponent(); - layoutElement.ignoreLayout = false; - SizeFitter.enabled = false; - - transform.sizeDelta = new Vector2(150, 110); - } */ _longClick = true; + Invoke(nameof(ResetLongClick), 2); - //_usersWhoAdded.SetActive(true); - - //_chatScript.OpenUsersWhoAddedReactionPanel(); + } + + //Used for ChatShowUsersPopUpData + private void ResetReactionPopUpData(ChatMessage message) + { + //Empties the data + if (_reactionPopup.gameObject.activeSelf) + { + foreach (var i in _reactionData) + { + _reactionPopup.RemoveUserReaction(i.sender_id, message); + } + } + + _reactionData.Clear(); - Invoke("ResetLongClick", 2); } private void ResetLongClick() @@ -389,68 +365,40 @@ private void ResetLongClick() private void RemoveReaction(ChatReactionHandler reaction) { + reaction.transform.SetParent(null); + _reactionHandlers.Remove(reaction); - //Checks if the set gameObject is on or not - HorizontalLayoutGroup reactionsField = _reactionPaneldata._reactionField.GetComponent(); - - - - foreach (var i in _reactionList) + foreach (var i in _reactionList) + { + if (i.Mood == reaction.Mood) { - if (i.Mood == reaction.Mood) - { - i.Selected = false; + //Resets the reactions selections list back to zero + i.Selected = false; - } } + } + Destroy(reaction.gameObject); + PickCommonReactions(); + _selectedMessage.SizeCall(); + } - - reaction.transform.SetParent(null); - _reactionHandlers.Remove(reaction); - Destroy(reaction.gameObject); + //Restart the reaction selection back to Zero + private void ListReset() + { - StartCoroutine(GetPlayerData(player => + for (int i = 0; i < _reactionData.Count; i++) { - for (int i = 0; i < ReactionData.Count; i++) + if (_reactionData[i].sender_id == _pLayerId) { - if (ReactionData[i].sender_id == player.Id) + foreach (var j in _reactionList) { - ReactionData.Remove(ReactionData[i]); + //Adds the set sprite back in to reaction selection + j.Selected = false; } } - })); - - GenarateReactionObjects(_reactionPaneldata._reactionsContent); - UpdateReactionStatus(_reactionPaneldata._reactionsContent); - if (Popup.gameObject.activeSelf) - { - GenarateReactionObjects(Popup.PopUpAllReactions); - UpdateReactionStatus(Popup.PopUpAllReactions); } - PickCommonReactions(); - _selectedMessage.SizeCall(); - - LayoutRebuilder.ForceRebuildLayoutImmediate(reactionsField.GetComponent()); - - - - } - //_chatScript.UpdateContentLayout(reactionsField); - public void ReactionResize() - { - /* foreach (var i in _reactionHandlers) - { - ContentSizeFitter SizeFitter = i._messageReaction.GetComponent(); - RectTransform transform = i._messageReaction.GetComponent(); - SizeFitter.enabled = true; - - transform.sizeDelta = new Vector2(transform.sizeDelta.x, 70); - - - - }*/ } } @@ -477,7 +425,7 @@ public class ReactionObject [Serializable] public class reactionPanelGroup { - public Transform _reactionsContent; //Imports the reaction - public GameObject _reactionField; //holds the received reactions + public Transform ReactionsContent; //Imports the reaction + public GameObject ReactionField; //holds the received reactions }