浏览代码
Merge pull request #3 from Unity-Technologies/zgh/add_chatroom
Merge pull request #3 from Unity-Technologies/zgh/add_chatroom
Zgh/add chatroom/add_hero_sample
GitHub
3 年前
当前提交
8798f33c
共有 76 个文件被更改,包括 11459 次插入 和 111 次删除
-
864AwesomeUIWidgets/Assets/Scenes/ShowRoom.unity
-
99AwesomeUIWidgets/Assets/Scenes/SimpleWorldSpaceUI.unity
-
3AwesomeUIWidgets/Assets/Scripts/CountDemo.cs
-
675AwesomeUIWidgets/Assets/Scenes/ChatRoomScene.unity
-
367AwesomeUIWidgets/Assets/Scripts/ChatPage.cs
-
36AwesomeUIWidgets/Assets/Scripts/ChatPanelDemo.cs
-
99AwesomeUIWidgets/Assets/Scripts/ChatPanelManager.cs
-
144AwesomeUIWidgets/Assets/Scripts/DateAndTimePicker.cs
-
74AwesomeUIWidgets/Assets/Scripts/Utils/FlyCamera.cs
-
64AwesomeUIWidgets/Assets/Scripts/chat_l10n.cs
-
487AwesomeUIWidgets/Assets/Scripts/chat_theme.cs
-
228AwesomeUIWidgets/Assets/Scripts/utils.cs
-
465AwesomeUIWidgets/Assets/StreamingAssets/MaterialIcons-Regular.ttf
-
132AwesomeUIWidgets/Assets/Resources/assets/messages.json
-
250AwesomeUIWidgets/Assets/Resources/wallpaper.jpg
-
525AwesomeUIWidgets/Assets/Scripts/AdditionalWidgets/LinkPreview/linkpreview.cs
-
140AwesomeUIWidgets/Assets/Scripts/AdditionalWidgets/LinkPreview/url_linkifier.cs
-
241AwesomeUIWidgets/Assets/Scripts/AdditionalWidgets/circleavatar.cs
-
135AwesomeUIWidgets/Assets/Scripts/ChatRoom/Message.cs
-
138AwesomeUIWidgets/Assets/Scripts/ChatRoom/Room.cs
-
147AwesomeUIWidgets/Assets/Scripts/ChatRoom/User.cs
-
49AwesomeUIWidgets/Assets/Scripts/ChatRoom/Util.cs
-
134AwesomeUIWidgets/Assets/Scripts/ChatRoom/preview_data.cs
-
156AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/file_message.cs
-
164AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/image_message.cs
-
62AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/partial_file.cs
-
70AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/partial_image.cs
-
36AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/partial_text.cs
-
131AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/text_message.cs
-
102AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/unsupported_message.cs
-
97AwesomeUIWidgets/Assets/Scripts/ChatRoom/Messages/custom_message.cs
-
135AwesomeUIWidgets/Assets/Scripts/Conditional/conditional.cs
-
98AwesomeUIWidgets/Assets/Scripts/Equatable/equatable.cs
-
44AwesomeUIWidgets/Assets/Scripts/Equatable/equatable_config.cs
-
73AwesomeUIWidgets/Assets/Scripts/Equatable/equatable_mixin.cs
-
113AwesomeUIWidgets/Assets/Scripts/Equatable/equatable_utils.cs
-
20AwesomeUIWidgets/Assets/Scripts/Models/date_header.cs
-
25AwesomeUIWidgets/Assets/Scripts/Models/message_spacer.cs
-
27AwesomeUIWidgets/Assets/Scripts/Models/preview_image.cs
-
55AwesomeUIWidgets/Assets/Scripts/Widgets/attachment_button.cs
-
299AwesomeUIWidgets/Assets/Scripts/Widgets/chat_list.cs
-
33AwesomeUIWidgets/Assets/Scripts/Widgets/inherited_l10n.cs
-
33AwesomeUIWidgets/Assets/Scripts/Widgets/inherited_theme.cs
-
33AwesomeUIWidgets/Assets/Scripts/Widgets/inherited_user.cs
-
272AwesomeUIWidgets/Assets/Scripts/Widgets/message.cs
-
45AwesomeUIWidgets/Assets/Scripts/Widgets/send_button.cs
-
156AwesomeUIWidgets/Assets/Scripts/Widgets/text_message.cs
-
455AwesomeUIWidgets/Assets/Scripts/Widgets/chat.cs
-
260AwesomeUIWidgets/Assets/Scripts/Widgets/input.cs
-
78AwesomeUIWidgets/Assets/Smartphone/StandardColorMask.shader
-
82AwesomeUIWidgets/Assets/Smartphone/screen.mat
-
102AwesomeUIWidgets/Assets/Smartphone/smartphone.FBX
-
101AwesomeUIWidgets/Assets/Smartphone/smartphone.mat
-
82AwesomeUIWidgets/Assets/Smartphone/smartphone.prefab
-
664AwesomeUIWidgets/Assets/Smartphone/smartphone_d.jpg
-
702AwesomeUIWidgets/Assets/Smartphone/smartphone_mask.jpg
-
1001AwesomeUIWidgets/Assets/Smartphone/smartphone_screen.jpg
-
257AwesomeUIWidgets/Assets/Smartphone/demo.unity
-
4AwesomeUIWidgets/Assets/StreamingAssets/assets/icon-attachment.png
-
3AwesomeUIWidgets/Assets/StreamingAssets/assets/icon-seen.png
-
4AwesomeUIWidgets/Assets/StreamingAssets/assets/icon-send.png
864
AwesomeUIWidgets/Assets/Scenes/ShowRoom.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
%YAML 1.1 |
|||
%TAG !u! tag:unity3d.com,2011: |
|||
--- !u!29 &1 |
|||
OcclusionCullingSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 2 |
|||
m_OcclusionBakeSettings: |
|||
smallestOccluder: 5 |
|||
smallestHole: 0.25 |
|||
backfaceThreshold: 100 |
|||
m_SceneGUID: 00000000000000000000000000000000 |
|||
m_OcclusionCullingData: {fileID: 0} |
|||
--- !u!104 &2 |
|||
RenderSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 9 |
|||
m_Fog: 0 |
|||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} |
|||
m_FogMode: 3 |
|||
m_FogDensity: 0.01 |
|||
m_LinearFogStart: 0 |
|||
m_LinearFogEnd: 300 |
|||
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} |
|||
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} |
|||
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} |
|||
m_AmbientIntensity: 1 |
|||
m_AmbientMode: 0 |
|||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} |
|||
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_HaloStrength: 0.5 |
|||
m_FlareStrength: 1 |
|||
m_FlareFadeSpeed: 3 |
|||
m_HaloTexture: {fileID: 0} |
|||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} |
|||
m_DefaultReflectionMode: 0 |
|||
m_DefaultReflectionResolution: 128 |
|||
m_ReflectionBounces: 1 |
|||
m_ReflectionIntensity: 1 |
|||
m_CustomReflection: {fileID: 0} |
|||
m_Sun: {fileID: 0} |
|||
m_IndirectSpecularColor: {r: 0.44657826, g: 0.49641263, b: 0.57481676, a: 1} |
|||
m_UseRadianceAmbientProbe: 0 |
|||
--- !u!157 &3 |
|||
LightmapSettings: |
|||
m_ObjectHideFlags: 0 |
|||
serializedVersion: 11 |
|||
m_GIWorkflowMode: 1 |
|||
m_GISettings: |
|||
serializedVersion: 2 |
|||
m_BounceScale: 1 |
|||
m_IndirectOutputScale: 1 |
|||
m_AlbedoBoost: 1 |
|||
m_EnvironmentLightingMode: 0 |
|||
m_EnableBakedLightmaps: 1 |
|||
m_EnableRealtimeLightmaps: 0 |
|||
m_LightmapEditorSettings: |
|||
serializedVersion: 12 |
|||
m_Resolution: 2 |
|||
m_BakeResolution: 40 |
|||
m_AtlasSize: 1024 |
|||
m_AO: 0 |
|||
m_AOMaxDistance: 1 |
|||
m_CompAOExponent: 1 |
|||
m_CompAOExponentDirect: 0 |
|||
m_ExtractAmbientOcclusion: 0 |
|||
m_Padding: 2 |
|||
m_LightmapParameters: {fileID: 0} |
|||
m_LightmapsBakeMode: 1 |
|||
m_TextureCompression: 1 |
|||
m_FinalGather: 0 |
|||
m_FinalGatherFiltering: 1 |
|||
m_FinalGatherRayCount: 256 |
|||
m_ReflectionCompression: 2 |
|||
m_MixedBakeMode: 2 |
|||
m_BakeBackend: 1 |
|||
m_PVRSampling: 1 |
|||
m_PVRDirectSampleCount: 32 |
|||
m_PVRSampleCount: 512 |
|||
m_PVRBounces: 2 |
|||
m_PVREnvironmentSampleCount: 256 |
|||
m_PVREnvironmentReferencePointCount: 2048 |
|||
m_PVRFilteringMode: 1 |
|||
m_PVRDenoiserTypeDirect: 1 |
|||
m_PVRDenoiserTypeIndirect: 1 |
|||
m_PVRDenoiserTypeAO: 1 |
|||
m_PVRFilterTypeDirect: 0 |
|||
m_PVRFilterTypeIndirect: 0 |
|||
m_PVRFilterTypeAO: 0 |
|||
m_PVREnvironmentMIS: 1 |
|||
m_PVRCulling: 1 |
|||
m_PVRFilteringGaussRadiusDirect: 1 |
|||
m_PVRFilteringGaussRadiusIndirect: 5 |
|||
m_PVRFilteringGaussRadiusAO: 2 |
|||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5 |
|||
m_PVRFilteringAtrousPositionSigmaIndirect: 2 |
|||
m_PVRFilteringAtrousPositionSigmaAO: 1 |
|||
m_ExportTrainingData: 0 |
|||
m_TrainingDataDestination: TrainingData |
|||
m_LightProbeSampleCountMultiplier: 4 |
|||
m_LightingDataAsset: {fileID: 0} |
|||
m_UseShadowmask: 1 |
|||
--- !u!196 &4 |
|||
NavMeshSettings: |
|||
serializedVersion: 2 |
|||
m_ObjectHideFlags: 0 |
|||
m_BuildSettings: |
|||
serializedVersion: 2 |
|||
agentTypeID: 0 |
|||
agentRadius: 0.5 |
|||
agentHeight: 2 |
|||
agentSlope: 45 |
|||
agentClimb: 0.4 |
|||
ledgeDropHeight: 0 |
|||
maxJumpAcrossDistance: 0 |
|||
minRegionArea: 2 |
|||
manualCellSize: 0 |
|||
cellSize: 0.16666667 |
|||
manualTileSize: 0 |
|||
tileSize: 256 |
|||
accuratePlacement: 0 |
|||
debug: |
|||
m_Flags: 0 |
|||
m_NavMeshData: {fileID: 0} |
|||
--- !u!1 &1125948832 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1125948836} |
|||
- component: {fileID: 1125948835} |
|||
- component: {fileID: 1125948834} |
|||
- component: {fileID: 1125948833} |
|||
m_Layer: 0 |
|||
m_Name: Cube |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!65 &1125948833 |
|||
BoxCollider: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1125948832} |
|||
m_Material: {fileID: 0} |
|||
m_IsTrigger: 0 |
|||
m_Enabled: 0 |
|||
serializedVersion: 2 |
|||
m_Size: {x: 1, y: 1, z: 1} |
|||
m_Center: {x: 0, y: 0, z: 0} |
|||
--- !u!23 &1125948834 |
|||
MeshRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1125948832} |
|||
m_Enabled: 0 |
|||
m_CastShadows: 1 |
|||
m_ReceiveShadows: 1 |
|||
m_DynamicOccludee: 1 |
|||
m_MotionVectors: 1 |
|||
m_LightProbeUsage: 1 |
|||
m_ReflectionProbeUsage: 1 |
|||
m_RayTracingMode: 2 |
|||
m_RenderingLayerMask: 1 |
|||
m_RendererPriority: 0 |
|||
m_Materials: |
|||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} |
|||
m_StaticBatchInfo: |
|||
firstSubMesh: 0 |
|||
subMeshCount: 0 |
|||
m_StaticBatchRoot: {fileID: 0} |
|||
m_ProbeAnchor: {fileID: 0} |
|||
m_LightProbeVolumeOverride: {fileID: 0} |
|||
m_ScaleInLightmap: 1 |
|||
m_ReceiveGI: 1 |
|||
m_PreserveUVs: 0 |
|||
m_IgnoreNormalsForChartDetection: 0 |
|||
m_ImportantGI: 0 |
|||
m_StitchLightmapSeams: 1 |
|||
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 &1125948835 |
|||
MeshFilter: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1125948832} |
|||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} |
|||
--- !u!4 &1125948836 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1125948832} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: -80, y: -1.166, z: 229} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 1315574209} |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 3 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1252940034 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1252940037} |
|||
- component: {fileID: 1252940036} |
|||
- component: {fileID: 1252940035} |
|||
m_Layer: 0 |
|||
m_Name: Main Camera |
|||
m_TagString: MainCamera |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!81 &1252940035 |
|||
AudioListener: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1252940034} |
|||
m_Enabled: 1 |
|||
--- !u!20 &1252940036 |
|||
Camera: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1252940034} |
|||
m_Enabled: 1 |
|||
serializedVersion: 2 |
|||
m_ClearFlags: 1 |
|||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} |
|||
m_projectionMatrixMode: 1 |
|||
m_GateFitMode: 2 |
|||
m_FOVAxisMode: 0 |
|||
m_SensorSize: {x: 36, y: 24} |
|||
m_LensShift: {x: 0, y: 0} |
|||
m_FocalLength: 50 |
|||
m_NormalizedViewPortRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
near clip plane: 0.3 |
|||
far clip plane: 1000 |
|||
field of view: 60 |
|||
orthographic: 0 |
|||
orthographic size: 5 |
|||
m_Depth: -1 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingPath: -1 |
|||
m_TargetTexture: {fileID: 0} |
|||
m_TargetDisplay: 0 |
|||
m_TargetEye: 3 |
|||
m_HDR: 1 |
|||
m_AllowMSAA: 1 |
|||
m_AllowDynamicResolution: 0 |
|||
m_ForceIntoRT: 0 |
|||
m_OcclusionCulling: 1 |
|||
m_StereoConvergence: 10 |
|||
m_StereoSeparation: 0.022 |
|||
--- !u!4 &1252940037 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1252940034} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 1, z: -10} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1315574208 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1315574209} |
|||
- component: {fileID: 1315574212} |
|||
- component: {fileID: 1315574211} |
|||
- component: {fileID: 1315574210} |
|||
m_Layer: 5 |
|||
m_Name: Canvas |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1315574209 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1315574208} |
|||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 232} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: |
|||
- {fileID: 1558042840} |
|||
m_Father: {fileID: 1125948836} |
|||
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: -46, y: 152} |
|||
m_SizeDelta: {x: 398, y: 784} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1315574210 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1315574208} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_IgnoreReversedGraphics: 1 |
|||
m_BlockingObjects: 0 |
|||
m_BlockingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
--- !u!114 &1315574211 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1315574208} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_UiScaleMode: 0 |
|||
m_ReferencePixelsPerUnit: 100 |
|||
m_ScaleFactor: 1 |
|||
m_ReferenceResolution: {x: 800, y: 600} |
|||
m_ScreenMatchMode: 0 |
|||
m_MatchWidthOrHeight: 0 |
|||
m_PhysicalUnit: 3 |
|||
m_FallbackScreenDPI: 96 |
|||
m_DefaultSpriteDPI: 96 |
|||
m_DynamicPixelsPerUnit: 1 |
|||
--- !u!223 &1315574212 |
|||
Canvas: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1315574208} |
|||
m_Enabled: 1 |
|||
serializedVersion: 3 |
|||
m_RenderMode: 2 |
|||
m_Camera: {fileID: 0} |
|||
m_PlaneDistance: 100 |
|||
m_PixelPerfect: 0 |
|||
m_ReceivesEvents: 1 |
|||
m_OverrideSorting: 0 |
|||
m_OverridePixelPerfect: 0 |
|||
m_SortingBucketNormalizedSize: 0 |
|||
m_AdditionalShaderChannelsFlag: 0 |
|||
m_SortingLayerID: 0 |
|||
m_SortingOrder: 0 |
|||
m_TargetDisplay: 0 |
|||
--- !u!1 &1511805122 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1511805125} |
|||
- component: {fileID: 1511805124} |
|||
- component: {fileID: 1511805123} |
|||
m_Layer: 0 |
|||
m_Name: EventSystem |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!114 &1511805123 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1511805122} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_HorizontalAxis: Horizontal |
|||
m_VerticalAxis: Vertical |
|||
m_SubmitButton: Submit |
|||
m_CancelButton: Cancel |
|||
m_InputActionsPerSecond: 10 |
|||
m_RepeatDelay: 0.5 |
|||
m_ForceModuleActive: 0 |
|||
--- !u!114 &1511805124 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1511805122} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_FirstSelected: {fileID: 0} |
|||
m_sendNavigationEvents: 1 |
|||
m_DragThreshold: 10 |
|||
--- !u!4 &1511805125 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1511805122} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 2 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
--- !u!1 &1542210717 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1542210719} |
|||
- component: {fileID: 1542210718} |
|||
m_Layer: 0 |
|||
m_Name: Directional Light |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!108 &1542210718 |
|||
Light: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1542210717} |
|||
m_Enabled: 1 |
|||
serializedVersion: 10 |
|||
m_Type: 1 |
|||
m_Shape: 0 |
|||
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} |
|||
m_Intensity: 1 |
|||
m_Range: 10 |
|||
m_SpotAngle: 30 |
|||
m_InnerSpotAngle: 21.80208 |
|||
m_CookieSize: 10 |
|||
m_Shadows: |
|||
m_Type: 2 |
|||
m_Resolution: -1 |
|||
m_CustomResolution: -1 |
|||
m_Strength: 1 |
|||
m_Bias: 0.05 |
|||
m_NormalBias: 0.4 |
|||
m_NearPlane: 0.2 |
|||
m_CullingMatrixOverride: |
|||
e00: 1 |
|||
e01: 0 |
|||
e02: 0 |
|||
e03: 0 |
|||
e10: 0 |
|||
e11: 1 |
|||
e12: 0 |
|||
e13: 0 |
|||
e20: 0 |
|||
e21: 0 |
|||
e22: 1 |
|||
e23: 0 |
|||
e30: 0 |
|||
e31: 0 |
|||
e32: 0 |
|||
e33: 1 |
|||
m_UseCullingMatrixOverride: 0 |
|||
m_Cookie: {fileID: 0} |
|||
m_DrawHalo: 0 |
|||
m_Flare: {fileID: 0} |
|||
m_RenderMode: 0 |
|||
m_CullingMask: |
|||
serializedVersion: 2 |
|||
m_Bits: 4294967295 |
|||
m_RenderingLayerMask: 1 |
|||
m_Lightmapping: 4 |
|||
m_LightShadowCasterMode: 0 |
|||
m_AreaSize: {x: 1, y: 1} |
|||
m_BounceIntensity: 1 |
|||
m_ColorTemperature: 6570 |
|||
m_UseColorTemperature: 0 |
|||
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} |
|||
m_UseBoundingSphereOverride: 0 |
|||
m_ShadowRadius: 0 |
|||
m_ShadowAngle: 0 |
|||
--- !u!4 &1542210719 |
|||
Transform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1542210717} |
|||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} |
|||
m_LocalPosition: {x: 0, y: 3, z: 0} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 0} |
|||
m_RootOrder: 1 |
|||
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} |
|||
--- !u!1 &1558042839 |
|||
GameObject: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
serializedVersion: 6 |
|||
m_Component: |
|||
- component: {fileID: 1558042840} |
|||
- component: {fileID: 1558042842} |
|||
- component: {fileID: 1558042841} |
|||
m_Layer: 5 |
|||
m_Name: RawImage |
|||
m_TagString: Untagged |
|||
m_Icon: {fileID: 0} |
|||
m_NavMeshLayer: 0 |
|||
m_StaticEditorFlags: 0 |
|||
m_IsActive: 1 |
|||
--- !u!224 &1558042840 |
|||
RectTransform: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1558042839} |
|||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} |
|||
m_LocalPosition: {x: 0, y: 0, z: -125} |
|||
m_LocalScale: {x: 1, y: 1, z: 1} |
|||
m_Children: [] |
|||
m_Father: {fileID: 1315574209} |
|||
m_RootOrder: 0 |
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
|||
m_AnchorMin: {x: 0.5, y: 0.5} |
|||
m_AnchorMax: {x: 0.5, y: 0.5} |
|||
m_AnchoredPosition: {x: 169, y: -153} |
|||
m_SizeDelta: {x: 300, y: 400} |
|||
m_Pivot: {x: 0.5, y: 0.5} |
|||
--- !u!114 &1558042841 |
|||
MonoBehaviour: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1558042839} |
|||
m_Enabled: 1 |
|||
m_EditorHideFlags: 0 |
|||
m_Script: {fileID: 11500000, guid: 95cfb90e363891b40b68575b9bf6b7dc, type: 3} |
|||
m_Name: |
|||
m_EditorClassIdentifier: |
|||
m_Material: {fileID: 0} |
|||
m_Color: {r: 1, g: 1, b: 1, a: 1} |
|||
m_RaycastTarget: 1 |
|||
m_Maskable: 1 |
|||
m_OnCullStateChanged: |
|||
m_PersistentCalls: |
|||
m_Calls: [] |
|||
m_Texture: {fileID: 1916630145} |
|||
m_UVRect: |
|||
serializedVersion: 2 |
|||
x: 0 |
|||
y: 0 |
|||
width: 1 |
|||
height: 1 |
|||
hardwareAntiAliasing: 0 |
|||
fonts: [] |
|||
--- !u!222 &1558042842 |
|||
CanvasRenderer: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_GameObject: {fileID: 1558042839} |
|||
m_CullTransparentMesh: 0 |
|||
--- !u!28 &1916630145 |
|||
Texture2D: |
|||
m_ObjectHideFlags: 0 |
|||
m_CorrespondingSourceObject: {fileID: 0} |
|||
m_PrefabInstance: {fileID: 0} |
|||
m_PrefabAsset: {fileID: 0} |
|||
m_Name: |
|||
m_ImageContentsHash: |
|||
serializedVersion: 2 |
|||
Hash: 00000000000000000000000000000000 |
|||
m_ForcedFallbackFormat: 4 |
|||
m_DownscaleFallback: 0 |
|||
serializedVersion: 3 |
|||
m_Width: 0 |
|||
m_Height: 0 |
|||
m_CompleteImageSize: 0 |
|||
m_TextureFormat: 0 |
|||
m_MipCount: 1 |
|||
m_IsReadable: 1 |
|||
m_IgnoreMasterTextureLimit: 0 |
|||
m_IsPreProcessed: 0 |
|||
m_StreamingMipmaps: 0 |
|||
m_StreamingMipmapsPriority: 0 |
|||
m_AlphaIsTransparency: 0 |
|||
m_ImageCount: 0 |
|||
m_TextureDimension: 2 |
|||
m_TextureSettings: |
|||
serializedVersion: 2 |
|||
m_FilterMode: 1 |
|||
m_Aniso: 1 |
|||
m_MipBias: 0 |
|||
m_WrapU: 0 |
|||
m_WrapV: 0 |
|||
m_WrapW: 0 |
|||
m_LightmapFormat: 0 |
|||
m_ColorSpace: 0 |
|||
image data: 0 |
|||
_typelessdata: |
|||
m_StreamData: |
|||
offset: 0 |
|||
size: 0 |
|||
path: |
|||
m_OriginalWidth: 0 |
|||
m_OriginalHeight: 0 |
|||
m_OriginalAssetGuid: 00000000000000000000000000000000 |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using ChatComponents; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.async; |
|||
using Unity.UIWidgets.cupertino; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.material; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEditor.Build.Content; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Random = System.Random; |
|||
using TextStyle = Unity.UIWidgets.ui.TextStyle; |
|||
|
|||
namespace UIWidgetsSample |
|||
|
|||
{ |
|||
public class ChatRoomDemo : UIWidgetsPanel |
|||
{ |
|||
protected void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new MyApp()); |
|||
} |
|||
|
|||
class MyApp : StatelessWidget |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new CupertinoApp( |
|||
|
|||
home: new DateAndTimePickerWidget() |
|||
); |
|||
} |
|||
} |
|||
} |
|||
[System.Serializable] |
|||
public class ChatMessages |
|||
{ |
|||
public List<ChatMessage> chatMessages; |
|||
} |
|||
|
|||
[System.Serializable] |
|||
public class ChatMessage |
|||
{ |
|||
public ChatUser author; |
|||
public int createdAt; |
|||
public string id; |
|||
public string status; |
|||
public string text; |
|||
public string type; |
|||
|
|||
} |
|||
|
|||
[System.Serializable] |
|||
public class ChatUser |
|||
{ |
|||
|
|||
public string firstName; |
|||
public string id; |
|||
public string imageUrl; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
public class ChatPage : StatefulWidget |
|||
{ |
|||
public ChatPage(Key key = null) : base(key) |
|||
{ |
|||
} |
|||
|
|||
public override State createState() |
|||
{ |
|||
return new _ChatPageState(); |
|||
} |
|||
} |
|||
|
|||
public class _ChatPageState : State<ChatPage> |
|||
{ |
|||
public readonly ChatComponents.User _user = new ChatComponents.User("06c33e8b-e835-4736-80f4-63f44b66666c"); |
|||
private List<ChatComponents.Message> _messages = new List<ChatComponents.Message>(); |
|||
public int _page = 0; |
|||
|
|||
public override void initState() |
|||
{ |
|||
base.initState(); |
|||
_loadMessages(); |
|||
} |
|||
|
|||
private void _addMessage(ChatComponents.Message message) |
|||
{ |
|||
setState(() => |
|||
{ |
|||
_messages.Insert(0, message); |
|||
}); |
|||
} |
|||
|
|||
private void _handleAtachmentPressed() |
|||
{ |
|||
material_.showModalBottomSheet<object>( |
|||
context, |
|||
context => |
|||
{ |
|||
return new SizedBox( |
|||
height: 144, |
|||
child: new Column( |
|||
crossAxisAlignment: CrossAxisAlignment.stretch, |
|||
children: new List<Widget> |
|||
{ |
|||
new CupertinoButton( |
|||
onPressed: () => |
|||
{ |
|||
Navigator.pop(context); |
|||
//_handleImageSelection();
|
|||
}, |
|||
child: new Align( |
|||
alignment: Alignment.centerLeft, |
|||
child: new Text("Photo") |
|||
) |
|||
), |
|||
new CupertinoButton( |
|||
onPressed: () => |
|||
{ |
|||
Navigator.pop(context); |
|||
//_handleFileSelection();
|
|||
}, |
|||
child: |
|||
new Align( |
|||
alignment: Alignment.centerLeft, |
|||
child: new Text("File") |
|||
) |
|||
), |
|||
new CupertinoButton( |
|||
onPressed: () => Navigator.pop(context), |
|||
child: new Align( |
|||
alignment: Alignment.centerLeft, |
|||
child: new Text("Cancel") |
|||
) |
|||
) |
|||
} |
|||
) |
|||
); |
|||
} |
|||
); |
|||
} |
|||
|
|||
/* private void _handleFileSelection() |
|||
{ |
|||
var result = FilePicker.platform.pickFiles( |
|||
type: FileType.any |
|||
); |
|||
|
|||
if (result != null) |
|||
{ |
|||
var message = new ChatComponents.FileMessage( |
|||
_user, |
|||
createdAt: DateTime.Now.Millisecond, |
|||
name: result.files.single.name, |
|||
id: Uuid().v4(), |
|||
mimeType: |
|||
lookupMimeType(result.files.single.path ?? ""), |
|||
size: |
|||
result.files.single.size, |
|||
uri: |
|||
result.files.single.path ?? "" |
|||
); |
|||
|
|||
_addMessage(message); |
|||
} |
|||
}*/ |
|||
|
|||
/* private void _handleImageSelection() |
|||
{ |
|||
var result = new ImagePicker().getImage( |
|||
imageQuality: 70, |
|||
maxWidth: 1440, |
|||
source: ImageSource.gallery |
|||
); |
|||
|
|||
if (result != null) |
|||
{ |
|||
var bytes = result.readAsBytes(); |
|||
var image = decodeImageFromList(bytes); |
|||
var name = result.path.split("/").last; |
|||
|
|||
var message = new ChatComponents.ImageMessage( |
|||
_user, |
|||
createdAt: DateTime.Now.Millisecond, |
|||
height: image.height.toDouble(), |
|||
id: Uuid().v4(), |
|||
name: |
|||
name, |
|||
size: |
|||
bytes.length, |
|||
uri: |
|||
result.path, |
|||
width: |
|||
image.width.toDouble() |
|||
); |
|||
|
|||
_addMessage(message); |
|||
} |
|||
}*/ |
|||
|
|||
private void _handleMessageTap(ChatComponents.Message message) |
|||
{ |
|||
if (message is ChatComponents.FileMessage) |
|||
//OpenFile.open(message.uri);
|
|||
Debug.Log("OPEN FILE"); |
|||
} |
|||
|
|||
private void _handlePreviewDataFetched( |
|||
ChatComponents.TextMessage message, |
|||
ChatComponents.PreviewData previewData |
|||
) |
|||
{ |
|||
var index = 0; |
|||
foreach (var element in _messages) |
|||
{ |
|||
if (element.id == message.id) |
|||
{ |
|||
index = _messages.IndexOf(element); |
|||
} |
|||
} |
|||
|
|||
|
|||
var updatedMessage = _messages[index].copyWith(previewData: previewData); |
|||
|
|||
WidgetsBinding.instance?.addPostFrameCallback(_ => |
|||
{ |
|||
setState(() => { _messages[index] = updatedMessage; }); |
|||
}); |
|||
} |
|||
|
|||
private void _handleSendPressed(ChatComponents.PartialText message) |
|||
{ |
|||
var textMessage = new ChatComponents.TextMessage( |
|||
_user, |
|||
createdAt: DateTime.Now.Millisecond, |
|||
id: "b4878b96-efbc-479a-8291-474ef323aa" + _messages.Count.ToString(), |
|||
text: message.text |
|||
); |
|||
|
|||
_addMessage(textMessage); |
|||
} |
|||
private Future _handleEndReached() |
|||
{ |
|||
List<ChatComponents.TextMessage> messages = new List<ChatComponents.TextMessage>(); |
|||
List<string> ids = new List<string>() { }; |
|||
for (int i = 1; i < 10; i++) |
|||
{ |
|||
ids.Add(i.ToString()); |
|||
} |
|||
foreach (var id in ids) |
|||
{ |
|||
messages.Add(new ChatComponents.TextMessage( |
|||
_user, |
|||
id: "b4878b96-efbc-479a-8291-474ef323a"+ _page + id, |
|||
text: id + "......" |
|||
) ); |
|||
} |
|||
setState(()=> { |
|||
{ |
|||
_messages.AddRange(messages); |
|||
_page = _page + 1; |
|||
} |
|||
}); |
|||
return Future.value(); |
|||
} |
|||
private void _loadMessages() |
|||
{ |
|||
List<ChatComponents.Message> results = new List<ChatComponents.Message>(); |
|||
TextAsset info = Resources.Load<TextAsset>("assets/messages"); |
|||
|
|||
List<ChatMessage> chatMessages = new List<ChatMessage>(); |
|||
List<string> jsoninfo = info.text.Split('&').ToList(); |
|||
foreach (var _info in jsoninfo) |
|||
{ |
|||
var _message = JsonUtility.FromJson<ChatMessage>(_info); |
|||
chatMessages.Add(_message); |
|||
} |
|||
foreach (var _message in chatMessages) |
|||
{ |
|||
|
|||
results.Add( new ChatComponents.TextMessage( |
|||
author: new User( |
|||
id: _message.author.id, |
|||
firstName: _message.author.firstName, |
|||
imageUrl: _message.author.imageUrl |
|||
), |
|||
createdAt: _message.createdAt, |
|||
id: _message.id, |
|||
status: ChatRoomUtils.getStatusFromString(_message.status), |
|||
text: _message.text |
|||
) |
|||
); |
|||
} |
|||
|
|||
setState(() => { _messages = results; }); |
|||
} |
|||
|
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
// return new Container(
|
|||
// color: Color.fromARGB(0, 0, 0, 0),
|
|||
// child: new Chat(
|
|||
// messages: _messages,
|
|||
// onAttachmentPressed: _handleAtachmentPressed,
|
|||
// onMessageTap: _handleMessageTap,
|
|||
// onPreviewDataFetched: (
|
|||
// previewData,
|
|||
// message) =>
|
|||
// {
|
|||
// _handlePreviewDataFetched(message, previewData);
|
|||
// },
|
|||
// onTextChanged: (_str) => { },
|
|||
// onSendPressed: _handleSendPressed,
|
|||
// onEndReached: _handleEndReached,
|
|||
// //onEndReachedThreshold: 0.65f,
|
|||
// user: _user
|
|||
// )
|
|||
// );
|
|||
|
|||
return new MaterialApp( |
|||
home: new Scaffold( |
|||
backgroundColor:Color.fromARGB(0,0,0,0), |
|||
appBar: new AppBar( |
|||
backgroundColor: Color.white, |
|||
title: new IconButton( |
|||
icon: new Icon(Icons.arrow_back, color: Color.black), |
|||
onPressed: () => { ChatPanelManager.Switch(); }, |
|||
padding: EdgeInsets.zero |
|||
) |
|||
), |
|||
body: new Container( |
|||
child: new Chat( |
|||
messages: _messages, |
|||
onAttachmentPressed: _handleAtachmentPressed, |
|||
onMessageTap: _handleMessageTap, |
|||
onPreviewDataFetched: ( |
|||
previewData, |
|||
message) => |
|||
{ |
|||
_handlePreviewDataFetched(message, previewData); |
|||
}, |
|||
onTextChanged: (_str) => { }, |
|||
onSendPressed: _handleSendPressed, |
|||
onEndReached: _handleEndReached, |
|||
//onEndReachedThreshold: 0.65f,
|
|||
user: _user |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.cupertino; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using Text = Unity.UIWidgets.widgets.Text; |
|||
using ui_ = Unity.UIWidgets.widgets.ui_; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public class ChatPanelDemo : UIWidgetsPanel |
|||
{ |
|||
protected override void onEnable() |
|||
{ |
|||
base.onEnable(); |
|||
AddFont("Material Icons", new List<string> {"MaterialIcons-Regular.ttf"}, new List<int> {0}); |
|||
} |
|||
|
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new ChatRoomApp()); |
|||
} |
|||
|
|||
class ChatRoomApp : StatelessWidget |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new CupertinoApp( |
|||
home: new ChatPage() |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public class ChatPanelManager : MonoBehaviour |
|||
{ |
|||
|
|||
public RectTransform transformPosition; |
|||
public RectTransform transformedPosition; |
|||
public RectTransform canvasPosition; |
|||
public RectTransform imagePosition; |
|||
public Vector2 standerdImageSize; |
|||
public GameObject panel; |
|||
public GameObject dateAndTimePicker; |
|||
private static bool isLerp = false; |
|||
private static bool isOpenPanel = false; |
|||
public float speed = 5.0f; |
|||
private static bool isFirstTime = true; |
|||
private bool wait = false; |
|||
void Update() |
|||
{ |
|||
if(Input.GetKeyDown(KeyCode.Tab)) |
|||
{ |
|||
Switch(); |
|||
} |
|||
|
|||
if (isLerp) |
|||
{ |
|||
|
|||
if (isOpenPanel) |
|||
{ |
|||
canvasPosition.anchoredPosition3D = Vector3.Lerp(canvasPosition.anchoredPosition3D, |
|||
transformedPosition.anchoredPosition3D, speed * Time.deltaTime); |
|||
canvasPosition.localRotation = Quaternion.Lerp(canvasPosition.localRotation, |
|||
transformedPosition.localRotation, speed * Time.deltaTime); |
|||
canvasPosition.localScale = Vector3.Lerp(canvasPosition.localScale, transformedPosition.localScale, |
|||
speed * Time.deltaTime); |
|||
if(Vector3.Distance(canvasPosition.anchoredPosition3D,transformedPosition.anchoredPosition3D) < 0.1f) |
|||
{ |
|||
isLerp = false; |
|||
canvasPosition.GetComponent<Canvas>().renderMode = RenderMode.ScreenSpaceOverlay; |
|||
//canvasPosition.GetComponent<Canvas>().worldCamera = null;
|
|||
imagePosition.sizeDelta = standerdImageSize; |
|||
panel.SetActive(false); |
|||
dateAndTimePicker.SetActive(false); |
|||
} |
|||
} |
|||
else |
|||
{ |
|||
if (isFirstTime) |
|||
{ |
|||
canvasPosition.GetComponent<Canvas>().renderMode = RenderMode.WorldSpace; |
|||
canvasPosition.GetComponent<Canvas>().worldCamera = Camera.main; |
|||
canvasPosition.anchoredPosition3D = transformedPosition.anchoredPosition3D; |
|||
canvasPosition.localRotation = transformedPosition.localRotation; |
|||
canvasPosition.localScale = transformedPosition.localScale; |
|||
panel.SetActive(true); |
|||
dateAndTimePicker.SetActive(true); |
|||
isFirstTime = false; |
|||
wait = true; |
|||
StartCoroutine(SkipForAFrame()); |
|||
} |
|||
|
|||
if (!wait) |
|||
{ |
|||
canvasPosition.anchoredPosition3D = Vector3.Lerp(canvasPosition.anchoredPosition3D, |
|||
transformPosition.anchoredPosition3D, speed * Time.deltaTime); |
|||
canvasPosition.localRotation = Quaternion.Lerp(canvasPosition.localRotation, |
|||
transformPosition.localRotation, speed * Time.deltaTime); |
|||
canvasPosition.localScale = Vector3.Lerp(canvasPosition.localScale, transformPosition.localScale, |
|||
speed * Time.deltaTime); |
|||
if(Vector3.Distance(canvasPosition.anchoredPosition3D, transformedPosition.anchoredPosition3D)<0.1f) |
|||
{ |
|||
isLerp = false; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
IEnumerator SkipForAFrame() |
|||
{ |
|||
yield return new WaitForSeconds(0.1f); |
|||
wait = false; |
|||
} |
|||
|
|||
public static void Switch() |
|||
{ |
|||
isLerp = true; |
|||
isOpenPanel = !isOpenPanel; |
|||
isFirstTime = true; |
|||
} |
|||
|
|||
|
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using uiwidgets; |
|||
using Unity.UIWidgets.cupertino; |
|||
using Unity.UIWidgets.engine; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.rendering; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
using Text = Unity.UIWidgets.widgets.Text; |
|||
using ui_ = Unity.UIWidgets.widgets.ui_; |
|||
using TextStyle = Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
|
|||
|
|||
public class DateAndTimePicker : UIWidgetsPanel |
|||
{ |
|||
protected void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
} |
|||
|
|||
protected override void main() |
|||
{ |
|||
ui_.runApp(new MyApp()); |
|||
} |
|||
|
|||
class MyApp : StatelessWidget |
|||
{ |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new CupertinoApp( |
|||
home: new DateAndTimePickerWidget() |
|||
); |
|||
} |
|||
} |
|||
} |
|||
|
|||
public class DateAndTimePickerWidget : StatefulWidget { |
|||
|
|||
public override State createState() { |
|||
return new DateAndTimePickerWidgetState(); |
|||
} |
|||
} |
|||
|
|||
|
|||
public class DateAndTimePickerWidgetState : State<DateAndTimePickerWidget> |
|||
{ |
|||
|
|||
Widget _buildMenu(List<Widget> children) { |
|||
return new Container( |
|||
decoration: new BoxDecoration( |
|||
color: CupertinoTheme.of(this.context).scaffoldBackgroundColor, |
|||
border: new Border( |
|||
top: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f), |
|||
bottom: new BorderSide(color: new Color(0xFFBCBBC1), width: 0.0f) |
|||
) |
|||
), |
|||
height: 44.0f, |
|||
child: new Padding( |
|||
padding: EdgeInsets.symmetric(horizontal: 16.0f), |
|||
child: new SafeArea( |
|||
top: false, |
|||
bottom: false, |
|||
child: new Row( |
|||
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|||
children: children |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
DateTime dateTime = DateTime.Now; |
|||
|
|||
Widget _buildBottomPicker(Widget picker) { |
|||
return new Container( |
|||
height: 216f, |
|||
width : 500f, |
|||
padding: EdgeInsets.only(top: 6.0f), |
|||
color: Colors.white, |
|||
child: new DefaultTextStyle( |
|||
style: new TextStyle( |
|||
color: Colors.red, |
|||
fontSize: 12.0f |
|||
), |
|||
child: new GestureDetector( |
|||
// Blocks taps from propagating to the modal sheet and popping.
|
|||
onTap: () => { }, |
|||
child: new SafeArea( |
|||
top: false, |
|||
child: picker |
|||
) |
|||
) |
|||
) |
|||
); |
|||
} |
|||
Widget _buildDateAndTimePicker(BuildContext context) { |
|||
return new GestureDetector( |
|||
onTap: () => { |
|||
CupertinoRouteUtils.showCupertinoModalPopup( |
|||
context: context, |
|||
builder: (BuildContext _context) => { |
|||
return this._buildBottomPicker( |
|||
new CupertinoTheme( |
|||
data: new CupertinoThemeData( |
|||
textTheme: new CupertinoTextThemeData( |
|||
dateTimePickerTextStyle: new TextStyle( |
|||
fontSize: 16, |
|||
color: Color.fromARGB(255, 226, 255, 255) |
|||
) |
|||
) |
|||
), |
|||
child :new CupertinoDatePicker( |
|||
backgroundColor: Color.fromARGB(180, 0, 123, 255), |
|||
mode: CupertinoDatePickerMode.dateAndTime, |
|||
initialDateTime: this.dateTime, |
|||
onDateTimeChanged: (DateTime newDateTime) => { |
|||
this.setState(() => this.dateTime = newDateTime); |
|||
} |
|||
) |
|||
)); |
|||
} |
|||
); |
|||
}, |
|||
child: new Text( |
|||
this.dateTime.ToString("MMMM dd, yyyy h:mm tt"), |
|||
style: new TextStyle(color: Colors.white) |
|||
|
|||
) |
|||
); |
|||
} |
|||
public override Widget build(BuildContext context) |
|||
{ |
|||
return new Container( |
|||
color : Color.fromARGB(180, 0, 123, 255), |
|||
child : this._buildDateAndTimePicker(context) |
|||
); |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using System.Collections; |
|||
|
|||
namespace UIWidgetsSample.Utils |
|||
{ |
|||
|
|||
public class FlyCamera : MonoBehaviour { |
|||
/* |
|||
Writen by Windexglow 11-13-10. Use it, edit it, steal it I don't care. |
|||
Converted to C# 27-02-13 - no credit wanted. |
|||
Simple flycam I made, since I couldn't find any others made public. |
|||
Made simple to use (drag and drop, done) for regular keyboard layout |
|||
wasd : basic movement |
|||
shift : Makes camera accelerate |
|||
space : Moves camera on X and Z axis only. So camera doesn't gain any height*/ |
|||
|
|||
|
|||
float mainSpeed = 10.0f; //regular speed
|
|||
float shiftAdd = 25.0f; //multiplied by how long shift is held. Basically running
|
|||
float maxShift = 100.0f; //Maximum speed when holdin gshift
|
|||
float camSens = 0.025f; //How sensitive it with mouse
|
|||
private Vector3 lastMouse = new Vector3(255, 255, 255); //kind of in the middle of the screen, rather than at the top (play)
|
|||
private float totalRun= 1.0f; |
|||
|
|||
void Update () { |
|||
lastMouse = UnityEngine.Input.mousePosition - lastMouse ; |
|||
lastMouse = new Vector3(-lastMouse.y * camSens, lastMouse.x * camSens, 0 ); |
|||
lastMouse = new Vector3(transform.eulerAngles.x + lastMouse.x , transform.eulerAngles.y + lastMouse.y, 0); |
|||
transform.eulerAngles = lastMouse; |
|||
lastMouse = UnityEngine.Input.mousePosition; |
|||
//Mouse camera angle done.
|
|||
|
|||
//Keyboard commands
|
|||
float f = 0.0f; |
|||
Vector3 p = GetBaseInput(); |
|||
if (p.sqrMagnitude > 0){ // only move while a direction key is pressed
|
|||
if (UnityEngine.Input.GetKey (KeyCode.LeftShift)){ |
|||
totalRun += Time.deltaTime; |
|||
p = p * totalRun * shiftAdd; |
|||
p.x = Mathf.Clamp(p.x, -maxShift, maxShift); |
|||
p.y = Mathf.Clamp(p.y, -maxShift, maxShift); |
|||
p.z = Mathf.Clamp(p.z, -maxShift, maxShift); |
|||
} else { |
|||
totalRun = Mathf.Clamp(totalRun * 0.5f, 1f, 1000f); |
|||
p = p * mainSpeed; |
|||
} |
|||
|
|||
p = p * Time.deltaTime; |
|||
Vector3 newPosition = transform.position; |
|||
transform.Translate(p); |
|||
newPosition.x = transform.position.x; |
|||
newPosition.z = transform.position.z; |
|||
transform.position = newPosition; |
|||
} |
|||
} |
|||
|
|||
private Vector3 GetBaseInput() { //returns the basic values, if it's 0 than it's not active.
|
|||
Vector3 p_Velocity = new Vector3(); |
|||
if (UnityEngine.Input.GetKey (KeyCode.W)){ |
|||
p_Velocity += new Vector3(0, 0 , 1); |
|||
} |
|||
if (UnityEngine.Input.GetKey (KeyCode.S)){ |
|||
p_Velocity += new Vector3(0, 0, -1); |
|||
} |
|||
if (UnityEngine.Input.GetKey (KeyCode.A)){ |
|||
p_Velocity += new Vector3(-1, 0, 0); |
|||
} |
|||
if (UnityEngine.Input.GetKey (KeyCode.D)){ |
|||
p_Velocity += new Vector3(1, 0, 0); |
|||
} |
|||
return p_Velocity; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Runtime.CompilerServices; |
|||
using Unity.UIWidgets.foundation; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public abstract class ChatL10n |
|||
{ |
|||
/// Accessibility label (hint) for the attachment button
|
|||
public readonly string attachmentButtonAccessibilityLabel; |
|||
|
|||
/// Placeholder when there are no messages
|
|||
public readonly string emptyChatPlaceholder; |
|||
|
|||
/// Accessibility label (hint) for the tap action on file message
|
|||
public readonly string fileButtonAccessibilityLabel; |
|||
|
|||
/// Placeholder for the text field
|
|||
public readonly string inputPlaceholder; |
|||
|
|||
/// Accessibility label (hint) for the send button
|
|||
public readonly string sendButtonAccessibilityLabel; |
|||
|
|||
/// Creates a new chat l10n based on provided copy
|
|||
public ChatL10n( |
|||
string attachmentButtonAccessibilityLabel = null, |
|||
string emptyChatPlaceholder = null, |
|||
string fileButtonAccessibilityLabel = null, |
|||
string inputPlaceholder = null, |
|||
string sendButtonAccessibilityLabel = null |
|||
) |
|||
{ |
|||
this.inputPlaceholder = inputPlaceholder; |
|||
this.attachmentButtonAccessibilityLabel = attachmentButtonAccessibilityLabel; |
|||
this.emptyChatPlaceholder = emptyChatPlaceholder; |
|||
this.fileButtonAccessibilityLabel = fileButtonAccessibilityLabel; |
|||
this.sendButtonAccessibilityLabel = sendButtonAccessibilityLabel; |
|||
} |
|||
} |
|||
|
|||
/// English l10n which extends [ChatL10n]
|
|||
public class ChatL10nEn : ChatL10n |
|||
{ |
|||
/// Creates English l10n. Use this constructor if you want to
|
|||
/// override only a couple of variables, otherwise create a new class
|
|||
/// which extends [ChatL10n]
|
|||
public ChatL10nEn( |
|||
string attachmentButtonAccessibilityLabel = "Send media", |
|||
string emptyChatPlaceholder = "No messages here yet", |
|||
string fileButtonAccessibilityLabel = "File", |
|||
string inputPlaceholder = "Message", |
|||
string sendButtonAccessibilityLabel = "Send" |
|||
) : base( |
|||
attachmentButtonAccessibilityLabel, |
|||
emptyChatPlaceholder, |
|||
fileButtonAccessibilityLabel, |
|||
inputPlaceholder, |
|||
sendButtonAccessibilityLabel |
|||
) |
|||
{ |
|||
} |
|||
} |
|||
} |
|
|||
using System.Collections.Generic; |
|||
using Unity.UIWidgets.painting; |
|||
using Unity.UIWidgets.ui; |
|||
using Unity.UIWidgets.widgets; |
|||
using TextStyle =Unity.UIWidgets.painting.TextStyle; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public class ChatThemeUtils |
|||
{ |
|||
public static List<Color> COLORS = new List<Color> |
|||
{ |
|||
new Color(0xffff6767), |
|||
new Color(0xff66e0da), |
|||
new Color(0xfff5a2d9), |
|||
new Color(0xfff0c722), |
|||
new Color(0xff6a85e5), |
|||
new Color(0xfffd9a6f), |
|||
new Color(0xff92db6e), |
|||
new Color(0xff73b8e5), |
|||
new Color(0xfffd7590), |
|||
new Color(0xffc78ae5) |
|||
}; |
|||
|
|||
/// Dark
|
|||
public static Color DARK = new Color(0xff1f1c38); |
|||
|
|||
/// Error
|
|||
public static Color ERROR = new Color(0xffff6767); |
|||
|
|||
/// N0
|
|||
public static Color NEUTRAL_0 = new Color(0xff1d1c21); |
|||
|
|||
/// N2
|
|||
public static Color NEUTRAL_2 = new Color(0xff9e9cab); |
|||
|
|||
/// N7
|
|||
public static Color NEUTRAL_7 = new Color(0xffffffff); |
|||
|
|||
/// N7 with opacity
|
|||
public static Color NEUTRAL_7_WITH_OPACITY = new Color(0x80ffffff); |
|||
|
|||
/// Primary
|
|||
public static Color PRIMARY = new Color(0xff6f61e8); |
|||
|
|||
/// Secondary
|
|||
public static Color SECONDARY = new Color(0xfff5f5f7); |
|||
|
|||
/// Secondary dark
|
|||
public static Color SECONDARY_DARK = new Color(0xff2b2250); |
|||
|
|||
public static float ratio = 0.5f; |
|||
} |
|||
|
|||
/// Base chat theme containing all required variables to make a theme.
|
|||
/// Extend this class if you want to create a custom theme.
|
|||
public abstract class ChatTheme |
|||
{ |
|||
/// Icon for select attachment button
|
|||
public readonly Widget attachmentButtonIcon; |
|||
|
|||
/// Used as a background color of a chat widget
|
|||
public readonly Color backgroundColor; |
|||
|
|||
/// Text style of the date dividers
|
|||
public readonly Unity.UIWidgets.painting.TextStyle dateDividerTextStyle; |
|||
|
|||
/// Icon for message's `delivered` status. For the best look use size of 16.
|
|||
public readonly Widget deliveredIcon; |
|||
|
|||
/// Icon inside file message
|
|||
public readonly Widget documentIcon; |
|||
|
|||
/// Text style of the empty chat placeholder
|
|||
public readonly TextStyle emptyChatPlaceholderTextStyle; |
|||
|
|||
/// Color to indicate something bad happened (usually - shades of red)
|
|||
public readonly Color errorColor; |
|||
|
|||
/// Icon for message's `error` status. For the best look use size of 16.
|
|||
public readonly Widget errorIcon; |
|||
|
|||
/// Color of the bottom bar where text field is
|
|||
public readonly Color inputBackgroundColor; |
|||
|
|||
/// Top border radius of the bottom bar where text field is
|
|||
public readonly BorderRadius inputBorderRadius; |
|||
|
|||
/// Color of the text field's text and attachment/send buttons
|
|||
public readonly Color inputTextColor; |
|||
|
|||
/// Text style of the message input. To change the color use [inputTextColor].
|
|||
public readonly TextStyle inputTextStyle; |
|||
|
|||
/// Border radius of message container
|
|||
public readonly float messageBorderRadius; |
|||
|
|||
/// Primary color of the chat used as a background of sent messages
|
|||
/// and statuses
|
|||
public readonly Color primaryColor; |
|||
|
|||
/// Body text style used for displaying text on different types
|
|||
/// of received messages
|
|||
public readonly TextStyle receivedMessageBodyTextStyle; |
|||
|
|||
/// Caption text style used for displaying secondary info (e.g. file size)
|
|||
/// on different types of received messages
|
|||
public readonly TextStyle receivedMessageCaptionTextStyle; |
|||
|
|||
/// Color of the document icon on received messages. Has no effect when
|
|||
/// [documentIcon] is used.
|
|||
public readonly Color receivedMessageDocumentIconColor; |
|||
|
|||
/// Text style used for displaying link description on received messages
|
|||
public readonly TextStyle receivedMessageLinkDescriptionTextStyle; |
|||
|
|||
/// Text style used for displaying link title on received messages
|
|||
public readonly TextStyle receivedMessageLinkTitleTextStyle; |
|||
|
|||
/// Secondary color, used as a background of received messages
|
|||
public readonly Color secondaryColor; |
|||
|
|||
/// Icon for message's `seen` status. For the best look use size of 16.
|
|||
public readonly Widget seenIcon; |
|||
|
|||
/// Icon for send button
|
|||
public readonly Widget sendButtonIcon; |
|||
|
|||
/// Body text style used for displaying text on different types
|
|||
/// of sent messages
|
|||
public readonly TextStyle sentMessageBodyTextStyle; |
|||
|
|||
/// Caption text style used for displaying secondary info (e.g. file size)
|
|||
/// on different types of sent messages
|
|||
public readonly TextStyle sentMessageCaptionTextStyle; |
|||
|
|||
/// Color of the document icon on sent messages. Has no effect when
|
|||
/// [documentIcon] is used.
|
|||
public readonly Color sentMessageDocumentIconColor; |
|||
|
|||
/// Text style used for displaying link description on sent messages
|
|||
public readonly TextStyle sentMessageLinkDescriptionTextStyle; |
|||
|
|||
/// Text style used for displaying link title on sent messages
|
|||
public readonly TextStyle sentMessageLinkTitleTextStyle; |
|||
|
|||
/// Colors used as backgrounds for user avatars and corresponded user names.
|
|||
/// Calculated based on a user ID, so unique across the whole app.
|
|||
public readonly List<Color> userAvatarNameColors; |
|||
|
|||
/// Text style used for displaying initials on user avatar if no
|
|||
/// image is provided
|
|||
public readonly TextStyle userAvatarTextStyle; |
|||
|
|||
/// User names text style. Color will be overwritten with [userAvatarNameColors].
|
|||
public readonly TextStyle userNameTextStyle; |
|||
|
|||
/// Creates a new chat theme based on provided colors and text styles.
|
|||
public ChatTheme( |
|||
Widget attachmentButtonIcon, |
|||
Color backgroundColor, |
|||
TextStyle dateDividerTextStyle, |
|||
Widget deliveredIcon, |
|||
Widget documentIcon, |
|||
TextStyle emptyChatPlaceholderTextStyle, |
|||
Color errorColor, |
|||
Widget errorIcon, |
|||
Color inputBackgroundColor, |
|||
BorderRadius inputBorderRadius, |
|||
TextStyle inputTextStyle, |
|||
Color inputTextColor, |
|||
float messageBorderRadius, |
|||
Color primaryColor, |
|||
TextStyle receivedMessageBodyTextStyle, |
|||
TextStyle receivedMessageCaptionTextStyle, |
|||
Color receivedMessageDocumentIconColor, |
|||
TextStyle receivedMessageLinkDescriptionTextStyle, |
|||
TextStyle receivedMessageLinkTitleTextStyle, |
|||
Color secondaryColor, |
|||
Widget seenIcon, |
|||
Widget sendButtonIcon, |
|||
TextStyle sentMessageBodyTextStyle, |
|||
TextStyle sentMessageCaptionTextStyle, |
|||
Color sentMessageDocumentIconColor, |
|||
TextStyle sentMessageLinkDescriptionTextStyle, |
|||
TextStyle sentMessageLinkTitleTextStyle, |
|||
List<Color> userAvatarNameColors, |
|||
TextStyle userAvatarTextStyle, |
|||
TextStyle userNameTextStyle |
|||
) |
|||
{ |
|||
this.attachmentButtonIcon = attachmentButtonIcon; |
|||
this.backgroundColor = backgroundColor; |
|||
this.dateDividerTextStyle = dateDividerTextStyle; |
|||
this.deliveredIcon = deliveredIcon; |
|||
this.documentIcon = documentIcon; |
|||
this.emptyChatPlaceholderTextStyle = emptyChatPlaceholderTextStyle; |
|||
this.errorColor = errorColor; |
|||
this.errorIcon = errorIcon; |
|||
this.inputBackgroundColor = inputBackgroundColor; |
|||
this.inputBorderRadius = inputBorderRadius; |
|||
this.inputTextStyle = inputTextStyle; |
|||
this.inputTextColor = inputTextColor; |
|||
this.messageBorderRadius = messageBorderRadius; |
|||
this.primaryColor = primaryColor; |
|||
this.receivedMessageBodyTextStyle = receivedMessageBodyTextStyle; |
|||
this.receivedMessageCaptionTextStyle = receivedMessageCaptionTextStyle; |
|||
this.receivedMessageDocumentIconColor = receivedMessageDocumentIconColor; |
|||
this.receivedMessageLinkDescriptionTextStyle = receivedMessageLinkDescriptionTextStyle; |
|||
this.receivedMessageLinkTitleTextStyle = receivedMessageLinkTitleTextStyle; |
|||
this.secondaryColor = secondaryColor; |
|||
this.seenIcon = seenIcon; |
|||
this.sendButtonIcon = sendButtonIcon; |
|||
this.sentMessageBodyTextStyle = sentMessageBodyTextStyle; |
|||
this.sentMessageCaptionTextStyle = sentMessageCaptionTextStyle; |
|||
this.sentMessageDocumentIconColor = sentMessageDocumentIconColor; |
|||
this.sentMessageLinkDescriptionTextStyle = sentMessageLinkDescriptionTextStyle; |
|||
this.sentMessageLinkTitleTextStyle = sentMessageLinkTitleTextStyle; |
|||
this.userAvatarNameColors = userAvatarNameColors; |
|||
this.userAvatarTextStyle = userAvatarTextStyle; |
|||
this.userNameTextStyle = userNameTextStyle; |
|||
} |
|||
} |
|||
|
|||
/// Default chat theme which extends [ChatTheme]
|
|||
internal class DefaultChatTheme : ChatTheme |
|||
{ |
|||
/// Creates a default chat theme. Use this constructor if you want to
|
|||
/// override only a couple of variables, otherwise create a new class
|
|||
/// which extends [ChatTheme]
|
|||
public DefaultChatTheme( |
|||
Widget attachmentButtonIcon =null, |
|||
Widget deliveredIcon = null, |
|||
Widget documentIcon = null, |
|||
Widget seenIcon = null, |
|||
Widget sendButtonIcon = null, |
|||
Widget errorIcon = null, |
|||
TextStyle dateDividerTextStyle = null, |
|||
TextStyle emptyChatPlaceholderTextStyle = null, |
|||
Color inputBackgroundColor = null, |
|||
BorderRadius inputBorderRadius = null, |
|||
Color inputTextColor = null, |
|||
TextStyle inputTextStyle = null, |
|||
float messageBorderRadius = 0.0f, |
|||
Color primaryColor = null, |
|||
TextStyle receivedMessageBodyTextStyle = null, |
|||
TextStyle receivedMessageCaptionTextStyle = null, |
|||
Color receivedMessageDocumentIconColor = null, |
|||
TextStyle receivedMessageLinkDescriptionTextStyle = null, |
|||
TextStyle receivedMessageLinkTitleTextStyle = null, |
|||
Color secondaryColor = null, |
|||
TextStyle sentMessageBodyTextStyle = null, |
|||
TextStyle sentMessageCaptionTextStyle = null, |
|||
Color sentMessageDocumentIconColor = null, |
|||
TextStyle sentMessageLinkDescriptionTextStyle = null, |
|||
TextStyle sentMessageLinkTitleTextStyle = null, |
|||
List<Color> userAvatarNameColors = null, |
|||
TextStyle userAvatarTextStyle = null, |
|||
TextStyle userNameTextStyle = null, |
|||
Color backgroundColor = null, |
|||
Color errorColor = null |
|||
) : base( |
|||
attachmentButtonIcon, |
|||
backgroundColor ?? ChatThemeUtils.NEUTRAL_7, |
|||
dateDividerTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_2, fontFamily: "Avenir", fontSize:ChatThemeUtils.ratio * 50, |
|||
fontWeight: FontWeight.w800, height: 1.333f) |
|||
: dateDividerTextStyle, |
|||
deliveredIcon, |
|||
documentIcon, |
|||
emptyChatPlaceholderTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_2, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w500, height: 1.5f) |
|||
: emptyChatPlaceholderTextStyle, |
|||
errorColor ?? ChatThemeUtils.ERROR, |
|||
errorIcon, |
|||
inputBackgroundColor ?? ChatThemeUtils.NEUTRAL_7, |
|||
inputBorderRadius == null ? BorderRadius.vertical(Radius.circular(20f)) : inputBorderRadius, |
|||
inputTextColor: inputTextColor ?? ChatThemeUtils.NEUTRAL_0, |
|||
inputTextStyle: inputTextStyle == null |
|||
? new TextStyle(fontFamily: "Avenir", fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w500, height: 1.5f) |
|||
: inputTextStyle, |
|||
messageBorderRadius: messageBorderRadius == 0.0 ? 20.0f : messageBorderRadius, |
|||
primaryColor: primaryColor ?? ChatThemeUtils.PRIMARY, |
|||
receivedMessageBodyTextStyle: receivedMessageBodyTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_0, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w500, height: 1.5f) |
|||
: receivedMessageBodyTextStyle, |
|||
receivedMessageCaptionTextStyle: receivedMessageCaptionTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_2, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w500, height: 1.333f) |
|||
: receivedMessageCaptionTextStyle, |
|||
receivedMessageDocumentIconColor: receivedMessageDocumentIconColor ?? ChatThemeUtils.PRIMARY, |
|||
receivedMessageLinkDescriptionTextStyle: |
|||
receivedMessageLinkDescriptionTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_0, |
|||
fontFamily: "Avenir", fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w400, height: 1.428f) |
|||
: receivedMessageLinkDescriptionTextStyle, |
|||
receivedMessageLinkTitleTextStyle: receivedMessageLinkTitleTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_0, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w800, height: 1.375f) |
|||
: receivedMessageLinkTitleTextStyle, |
|||
secondaryColor: secondaryColor ?? ChatThemeUtils.SECONDARY, |
|||
seenIcon: seenIcon, |
|||
sendButtonIcon: sendButtonIcon, |
|||
sentMessageBodyTextStyle: sentMessageBodyTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_7, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w500, height: 1.5f) |
|||
: sentMessageBodyTextStyle, |
|||
sentMessageCaptionTextStyle: sentMessageCaptionTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_7_WITH_OPACITY, |
|||
fontFamily: "Avenir", fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w500, height: 1.333f) |
|||
: sentMessageCaptionTextStyle, |
|||
sentMessageDocumentIconColor: sentMessageDocumentIconColor ?? ChatThemeUtils.NEUTRAL_7, |
|||
sentMessageLinkDescriptionTextStyle: |
|||
sentMessageLinkDescriptionTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_7, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w400, height: 1.428f) |
|||
: sentMessageLinkDescriptionTextStyle, |
|||
sentMessageLinkTitleTextStyle: sentMessageLinkTitleTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_7, fontFamily: "Avenir", |
|||
fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w800, height: 1.375f) |
|||
: sentMessageLinkTitleTextStyle, |
|||
userAvatarNameColors: userAvatarNameColors ?? ChatThemeUtils.COLORS, |
|||
userAvatarTextStyle: userAvatarTextStyle == null |
|||
? new TextStyle(color:ChatThemeUtils.NEUTRAL_7, fontFamily: "Avenir", fontSize:ChatThemeUtils.ratio * 50, |
|||
fontWeight: FontWeight.w800, height: 1.333f) |
|||
: userAvatarTextStyle, |
|||
userNameTextStyle: userNameTextStyle == null |
|||
? new TextStyle(fontFamily: "Avenir", fontSize:ChatThemeUtils.ratio * 50, fontWeight: FontWeight.w800, height: 1.333f) |
|||
: userNameTextStyle |
|||
) |
|||
{ |
|||
} |
|||
} |
|||
/* |
|||
/// Dark chat theme which extends [ChatTheme]
|
|||
@immutable |
|||
class DarkChatTheme extends ChatTheme { |
|||
/// Creates a dark chat theme. Use this constructor if you want to
|
|||
/// override only a couple of variables, otherwise create a new class
|
|||
/// which extends [ChatTheme]
|
|||
const DarkChatTheme({ |
|||
Widget? attachmentButtonIcon, |
|||
Color backgroundColor = DARK, |
|||
TextStyle dateDividerTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 12, |
|||
fontWeight: FontWeight.w800, |
|||
height: 1.333, |
|||
), |
|||
Widget? deliveredIcon, |
|||
Widget? documentIcon, |
|||
TextStyle emptyChatPlaceholderTextStyle = const TextStyle( |
|||
color: NEUTRAL_2, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 16, |
|||
fontWeight: FontWeight.w500, |
|||
height: 1.5, |
|||
), |
|||
Color errorColor = ERROR, |
|||
Widget? errorIcon, |
|||
Color inputBackgroundColor = SECONDARY_DARK, |
|||
BorderRadius inputBorderRadius = const BorderRadius.vertical( |
|||
top: Radius.circular(20), |
|||
), |
|||
Color inputTextColor = NEUTRAL_7, |
|||
TextStyle inputTextStyle = const TextStyle( |
|||
fontFamily: 'Avenir', |
|||
fontSize: 16, |
|||
fontWeight: FontWeight.w500, |
|||
height: 1.5, |
|||
), |
|||
double messageBorderRadius = 20.0, |
|||
Color primaryColor = PRIMARY, |
|||
TextStyle receivedMessageBodyTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 16, |
|||
fontWeight: FontWeight.w500, |
|||
height: 1.5, |
|||
), |
|||
TextStyle receivedMessageCaptionTextStyle = const TextStyle( |
|||
color: NEUTRAL_7_WITH_OPACITY, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 12, |
|||
fontWeight: FontWeight.w500, |
|||
height: 1.333, |
|||
), |
|||
Color receivedMessageDocumentIconColor = PRIMARY, |
|||
TextStyle receivedMessageLinkDescriptionTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 14, |
|||
fontWeight: FontWeight.w400, |
|||
height: 1.428, |
|||
), |
|||
TextStyle receivedMessageLinkTitleTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 16, |
|||
fontWeight: FontWeight.w800, |
|||
height: 1.375, |
|||
), |
|||
Color secondaryColor = SECONDARY_DARK, |
|||
Widget? seenIcon, |
|||
Widget? sendButtonIcon, |
|||
TextStyle sentMessageBodyTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 16, |
|||
fontWeight: FontWeight.w500, |
|||
height: 1.5, |
|||
), |
|||
TextStyle sentMessageCaptionTextStyle = const TextStyle( |
|||
color: NEUTRAL_7_WITH_OPACITY, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 12, |
|||
fontWeight: FontWeight.w500, |
|||
height: 1.333, |
|||
), |
|||
Color sentMessageDocumentIconColor = NEUTRAL_7, |
|||
TextStyle sentMessageLinkDescriptionTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 14, |
|||
fontWeight: FontWeight.w400, |
|||
height: 1.428, |
|||
), |
|||
TextStyle sentMessageLinkTitleTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 16, |
|||
fontWeight: FontWeight.w800, |
|||
height: 1.375, |
|||
), |
|||
List<Color> userAvatarNameColors = COLORS, |
|||
TextStyle userAvatarTextStyle = const TextStyle( |
|||
color: NEUTRAL_7, |
|||
fontFamily: 'Avenir', |
|||
fontSize: 12, |
|||
fontWeight: FontWeight.w800, |
|||
height: 1.333, |
|||
), |
|||
TextStyle userNameTextStyle = const TextStyle( |
|||
fontFamily: 'Avenir', |
|||
fontSize: 12, |
|||
fontWeight: FontWeight.w800, |
|||
height: 1.333, |
|||
), |
|||
}) : super( |
|||
attachmentButtonIcon: attachmentButtonIcon, |
|||
backgroundColor: backgroundColor, |
|||
dateDividerTextStyle: dateDividerTextStyle, |
|||
deliveredIcon: deliveredIcon, |
|||
documentIcon: documentIcon, |
|||
emptyChatPlaceholderTextStyle: emptyChatPlaceholderTextStyle, |
|||
errorColor: errorColor, |
|||
errorIcon: errorIcon, |
|||
inputBackgroundColor: inputBackgroundColor, |
|||
inputBorderRadius: inputBorderRadius, |
|||
inputTextColor: inputTextColor, |
|||
inputTextStyle: inputTextStyle, |
|||
messageBorderRadius: messageBorderRadius, |
|||
primaryColor: primaryColor, |
|||
receivedMessageBodyTextStyle: receivedMessageBodyTextStyle, |
|||
receivedMessageCaptionTextStyle: receivedMessageCaptionTextStyle, |
|||
receivedMessageDocumentIconColor: receivedMessageDocumentIconColor, |
|||
receivedMessageLinkDescriptionTextStyle: |
|||
receivedMessageLinkDescriptionTextStyle, |
|||
receivedMessageLinkTitleTextStyle: receivedMessageLinkTitleTextStyle, |
|||
secondaryColor: secondaryColor, |
|||
seenIcon: seenIcon, |
|||
sendButtonIcon: sendButtonIcon, |
|||
sentMessageBodyTextStyle: sentMessageBodyTextStyle, |
|||
sentMessageCaptionTextStyle: sentMessageCaptionTextStyle, |
|||
sentMessageDocumentIconColor: sentMessageDocumentIconColor, |
|||
sentMessageLinkDescriptionTextStyle: |
|||
sentMessageLinkDescriptionTextStyle, |
|||
sentMessageLinkTitleTextStyle: sentMessageLinkTitleTextStyle, |
|||
userAvatarNameColors: userAvatarNameColors, |
|||
userAvatarTextStyle: userAvatarTextStyle, |
|||
userNameTextStyle: userNameTextStyle, |
|||
); |
|||
}*/ |
|||
} |
|
|||
using System; |
|||
using System.Collections.Generic; |
|||
using ChatComponents; |
|||
using Unity.UIWidgets.foundation; |
|||
using Unity.UIWidgets.ui; |
|||
using UnityEngine; |
|||
using Color = Unity.UIWidgets.ui.Color; |
|||
|
|||
namespace UIWidgetsSample |
|||
{ |
|||
public static class ChatUtils |
|||
{ |
|||
public static string REGEX_LINK = |
|||
@"([\w+]+\:\/\/)?([\w\d-]+\.)*[\w-]+[\.\:]\w+([\/\?\=\&\#\.]?[\w-]+)*\/?"; |
|||
|
|||
public static string formatBytes(int size, int fractionDigits = 2) |
|||
{ |
|||
List<string> profix = new List<string>() |
|||
{ |
|||
|
|||
"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" |
|||
}; |
|||
if (size <= 0) return "0 B"; |
|||
var multiple = (log(size) / log(1024)).floor(); |
|||
|
|||
return (size / Mathf.Pow(1024, multiple)).ToString("D3") + |
|||
" " + profix[multiple]; |
|||
} |
|||
|
|||
public static float log(int num) |
|||
{ |
|||
if (num == 0) |
|||
return float.NegativeInfinity; |
|||
else if (num < 0) |
|||
return Single.NaN; |
|||
else |
|||
return num * 1f; |
|||
} |
|||
|
|||
|
|||
/// Returns user avatar and name color based on the ID
|
|||
public static Color getUserAvatarNameColor(User user, List<Color> colors) |
|||
{ |
|||
var index = user.id.GetHashCode() % colors.Count; |
|||
return colors[0]; |
|||
} |
|||
|
|||
/// Returns user name as joined firstName and lastName
|
|||
public static string getUserName(User user) => |
|||
$"{user.firstName ?? ""} {user.lastName ?? ""}"; |
|||
|
|||
/// Returns formatted date used as a divider between different days in the
|
|||
/// chat history
|
|||
public static string getVerboseDateTimeRepresentation( |
|||
DateTime dateTime, |
|||
DateTime? dateFormat = null, |
|||
string dateLocale = null, |
|||
DateTime? timeFormat = null |
|||
) |
|||
{ |
|||
var formattedDate |
|||
= //dateFormat != null ? dateFormat.ToString().Format(dateTime) : DateTime.MMMd(dateLocale).format(dateTime);
|
|||
dateTime.ToString("MMM-dd"); |
|||
var formattedTime = //timeFormat != null ? timeFormat.format(dateTime) : DateTime.Hm(dateLocale).format(dateTime);
|
|||
dateTime.ToString("hh:mm"); |
|||
var localDateTime = dateTime.ToLocalTime(); |
|||
var now = DateTime.Now; |
|||
|
|||
if (localDateTime.Day == now.Day && |
|||
localDateTime.Month == now.Month && |
|||
localDateTime.Year == now.Year) |
|||
return formattedTime; |
|||
|
|||
return $"{formattedDate}, {formattedTime}"; |
|||
} |
|||
|
|||
/// Parses provided messages to chat messages (with headers and spacers) and
|
|||
/// returns them with a gallery
|
|||
public static List<object> calculateChatMessages( |
|||
List<ChatComponents.Message> messages, |
|||
User user, |
|||
bool showUserNames, |
|||
CustomDateHeaderText customDateHeaderText = null, |
|||
DateTime? dateFormat = null, |
|||
string dateLocale = null, |
|||
DateTime? timeFormat = null |
|||
) |
|||
{ |
|||
var chatMessages = new List<object>(); |
|||
var gallery = new List<PreviewImage>(); |
|||
|
|||
var shouldShowName = false; |
|||
|
|||
for (var i = messages.Count - 1; i >= 0; i--) |
|||
{ |
|||
var isFirst = i == messages.Count - 1; |
|||
var isLast = i == 0; |
|||
var message = messages[i]; |
|||
var messageHasCreatedAt = message.createdAt != null; |
|||
ChatComponents.Message nextMessage = isLast ? null : messages[i - 1]; |
|||
bool nextMessageHasCreatedAt = isLast ? true : nextMessage.createdAt != null; |
|||
bool nextMessageSameAuthor = isLast ? false : message.author.id == nextMessage.author.id; |
|||
bool notMyMessage = message.author.id != user.id; |
|||
bool nextMessageDateThreshold = false; |
|||
bool nextMessageDifferentDay = false; |
|||
bool nextMessageInGroup = false; |
|||
bool showName = false; |
|||
|
|||
if (showUserNames) |
|||
{ |
|||
var previousMessage = isFirst ? null : messages[i + 1]; |
|||
|
|||
var isFirstInGroup = notMyMessage && |
|||
(message.author.id != previousMessage?.author.id || |
|||
message.createdAt != null && |
|||
previousMessage?.createdAt != null && |
|||
(int)message.createdAt - (int)previousMessage.createdAt > 60000); |
|||
|
|||
if (isFirstInGroup) |
|||
{ |
|||
shouldShowName = false; |
|||
if (message.type == MessageType.text) |
|||
showName = true; |
|||
else |
|||
shouldShowName = true; |
|||
} |
|||
|
|||
if (message.type == MessageType.text && shouldShowName) |
|||
{ |
|||
showName = true; |
|||
shouldShowName = false; |
|||
} |
|||
} |
|||
|
|||
if (messageHasCreatedAt && nextMessageHasCreatedAt) |
|||
{ |
|||
|
|||
nextMessageDateThreshold = isLast ? false : (int) nextMessage?.createdAt - (int) message.createdAt >= 900000; |
|||
nextMessageDifferentDay = |
|||
TimeSpan.FromMilliseconds(message.createdAt == null ? 0 : (int)message.createdAt).Days != |
|||
TimeSpan.FromMilliseconds(nextMessage?.createdAt == null ? 0 : (int)nextMessage?.createdAt).Days; |
|||
|
|||
nextMessageInGroup = nextMessageSameAuthor && |
|||
(int)nextMessage?.createdAt - (int)message.createdAt <= 60000; |
|||
} |
|||
|
|||
if (isFirst && messageHasCreatedAt) |
|||
{ |
|||
var epoch = new DateTime(1970, 1, 1, 0, 0, 0, 0); |
|||
var timeSend = epoch.AddTicks((message.createdAt == null ? 0 : (int) message.createdAt) * 1000000000); |
|||
chatMessages.Insert( |
|||
0, |
|||
new DateHeader( |
|||
customDateHeaderText != null |
|||
? customDateHeaderText( |
|||
new DateTime(timeSend.Year,timeSend.Month,timeSend.Day,timeSend.Hour,timeSend.Minute,timeSend.Second) |
|||
) |
|||
: getVerboseDateTimeRepresentation( |
|||
new DateTime(timeSend.Year,timeSend.Month,timeSend.Day,timeSend.Hour,timeSend.Minute,timeSend.Second),//new DateTime((int) TimeSpan.FromMilliseconds(message.createdAt == null ? 0 : (int)message.createdAt).TotalMilliseconds ),//DateTime.FromFileTime(message.createdAt == null ? 0 : (int)message.createdAt),//
|
|||
dateFormat, |
|||
dateLocale, |
|||
timeFormat |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
var _message = |
|||
new Dictionary<string, object> |
|||
{ |
|||
{"message", message}, |
|||
{"nextMessageInGroup", nextMessageInGroup}, |
|||
{"showName", notMyMessage && |
|||
showUserNames && |
|||
showName && getUserName(message.author).isNotEmpty() |
|||
}, |
|||
{"showStatus", true} |
|||
}; |
|||
chatMessages.Insert(0, _message); |
|||
|
|||
if (!nextMessageInGroup) |
|||
{ |
|||
chatMessages.Insert( |
|||
0, |
|||
new MessageSpacer( |
|||
12, |
|||
message.id |
|||
) |
|||
); |
|||
} |
|||
|
|||
if (nextMessageDifferentDay || nextMessageDateThreshold) |
|||
{ |
|||
chatMessages.Insert( |
|||
0, |
|||
new DateHeader( |
|||
customDateHeaderText != null |
|||
? customDateHeaderText( |
|||
DateTime.Now)//DateTime.FromFileTime(isLast ? 0 : (int) nextMessage?.createdAt) )
|
|||
: getVerboseDateTimeRepresentation( |
|||
DateTime.Now,//DateTime.FromFileTime(isLast ? 0 : (int) nextMessage?.createdAt),
|
|||
dateFormat, |
|||
dateLocale, |
|||
timeFormat |
|||
) |
|||
) |
|||
); |
|||
} |
|||
|
|||
if (message is ImageMessage) |
|||
{ |
|||
if (foundation_.kIsWeb) |
|||
{ |
|||
if (((ImageMessage) message).uri.StartsWith("http")) |
|||
gallery.Add(new PreviewImage(message.id, ((ImageMessage) message).uri)); |
|||
} |
|||
|
|||
gallery.Add(new PreviewImage(message.id, ((ImageMessage) message).uri)); |
|||
} |
|||
} |
|||
|
|||
var results = new List<object>(){chatMessages,gallery}; |
|||
//results.AddRange(chatMessages);
|
|||
//results.AddRange(gallery);
|
|||
return results; |
|||
} |
|||
} |
|||
} |
|
|||
|