| | 1 | | using DCL; |
| | 2 | | using DCL.Controllers; |
| | 3 | | using DCL.HelpAndSupportHUD; |
| | 4 | | using DCL.Helpers; |
| | 5 | | using DCL.Interface; |
| | 6 | | using System; |
| | 7 | | using System.Collections.Generic; |
| | 8 | | using System.Linq; |
| | 9 | | using UnityEngine; |
| | 10 | | using UnityEngine.EventSystems; |
| | 11 | |
|
| | 12 | | public class TaskbarHUDController : IHUD |
| | 13 | | { |
| | 14 | | [Serializable] |
| | 15 | | public struct Configuration |
| | 16 | | { |
| | 17 | | public bool enableVoiceChat; |
| | 18 | | public bool enableQuestPanel; |
| | 19 | | } |
| | 20 | |
|
| | 21 | | public TaskbarHUDView view; |
| | 22 | | public WorldChatWindowHUDController worldChatWindowHud; |
| | 23 | | public PrivateChatWindowHUDController privateChatWindowHud; |
| | 24 | | public FriendsHUDController friendsHud; |
| | 25 | | public HelpAndSupportHUDController helpAndSupportHud; |
| | 26 | |
|
| | 27 | | IMouseCatcher mouseCatcher; |
| | 28 | | protected IChatController chatController; |
| | 29 | | protected IFriendsController friendsController; |
| | 30 | |
|
| | 31 | | private InputAction_Trigger toggleFriendsTrigger; |
| | 32 | | private InputAction_Trigger closeWindowTrigger; |
| | 33 | | private InputAction_Trigger toggleWorldChatTrigger; |
| | 34 | | private Transform experiencesViewerTransform; |
| | 35 | |
|
| | 36 | | public event System.Action OnAnyTaskbarButtonClicked; |
| | 37 | |
|
| 0 | 38 | | public RectTransform socialTooltipReference { get => view.socialTooltipReference; } |
| | 39 | |
|
| 12 | 40 | | internal BaseVariable<Transform> isExperiencesViewerInitialized => DataStore.i.experiencesViewer.isInitialized; |
| 12 | 41 | | internal BaseVariable<bool> isExperiencesViewerOpen => DataStore.i.experiencesViewer.isOpen; |
| 12 | 42 | | internal BaseVariable<int> numOfLoadedExperiences => DataStore.i.experiencesViewer.numOfLoadedExperiences; |
| | 43 | |
|
| 4 | 44 | | protected internal virtual TaskbarHUDView CreateView() { return TaskbarHUDView.Create(this, chatController, friendsC |
| | 45 | |
|
| | 46 | | public void Initialize( |
| | 47 | | IMouseCatcher mouseCatcher, |
| | 48 | | IChatController chatController, |
| | 49 | | IFriendsController friendsController) |
| | 50 | | { |
| 4 | 51 | | this.friendsController = friendsController; |
| 4 | 52 | | this.mouseCatcher = mouseCatcher; |
| 4 | 53 | | this.chatController = chatController; |
| | 54 | |
|
| 4 | 55 | | view = CreateView(); |
| | 56 | |
|
| 4 | 57 | | if (mouseCatcher != null) |
| | 58 | | { |
| 1 | 59 | | mouseCatcher.OnMouseLock -= MouseCatcher_OnMouseLock; |
| 1 | 60 | | mouseCatcher.OnMouseUnlock -= MouseCatcher_OnMouseUnlock; |
| 1 | 61 | | mouseCatcher.OnMouseLock += MouseCatcher_OnMouseLock; |
| 1 | 62 | | mouseCatcher.OnMouseUnlock += MouseCatcher_OnMouseUnlock; |
| | 63 | | } |
| | 64 | |
|
| 4 | 65 | | view.chatHeadsGroup.OnHeadToggleOn += ChatHeadsGroup_OnHeadOpen; |
| 4 | 66 | | view.chatHeadsGroup.OnHeadToggleOff += ChatHeadsGroup_OnHeadClose; |
| | 67 | |
|
| 4 | 68 | | view.leftWindowContainerLayout.enabled = false; |
| | 69 | |
|
| 4 | 70 | | view.OnChatToggleOff += View_OnChatToggleOff; |
| 4 | 71 | | view.OnChatToggleOn += View_OnChatToggleOn; |
| 4 | 72 | | view.OnFriendsToggleOff += View_OnFriendsToggleOff; |
| 4 | 73 | | view.OnFriendsToggleOn += View_OnFriendsToggleOn; |
| 4 | 74 | | view.OnExperiencesToggleOff += View_OnExperiencesToggleOff; |
| 4 | 75 | | view.OnExperiencesToggleOn += View_OnExperiencesToggleOn; |
| | 76 | |
|
| 4 | 77 | | toggleFriendsTrigger = Resources.Load<InputAction_Trigger>("ToggleFriends"); |
| 4 | 78 | | toggleFriendsTrigger.OnTriggered -= ToggleFriendsTrigger_OnTriggered; |
| 4 | 79 | | toggleFriendsTrigger.OnTriggered += ToggleFriendsTrigger_OnTriggered; |
| | 80 | |
|
| 4 | 81 | | closeWindowTrigger = Resources.Load<InputAction_Trigger>("CloseWindow"); |
| 4 | 82 | | closeWindowTrigger.OnTriggered -= CloseWindowTrigger_OnTriggered; |
| 4 | 83 | | closeWindowTrigger.OnTriggered += CloseWindowTrigger_OnTriggered; |
| | 84 | |
|
| 4 | 85 | | toggleWorldChatTrigger = Resources.Load<InputAction_Trigger>("ToggleWorldChat"); |
| 4 | 86 | | toggleWorldChatTrigger.OnTriggered -= ToggleWorldChatTrigger_OnTriggered; |
| 4 | 87 | | toggleWorldChatTrigger.OnTriggered += ToggleWorldChatTrigger_OnTriggered; |
| | 88 | |
|
| 4 | 89 | | isExperiencesViewerOpen.OnChange += IsExperiencesViewerOpenChanged; |
| | 90 | |
|
| 4 | 91 | | if (chatController != null) |
| | 92 | | { |
| 3 | 93 | | chatController.OnAddMessage -= OnAddMessage; |
| 3 | 94 | | chatController.OnAddMessage += OnAddMessage; |
| | 95 | | } |
| | 96 | |
|
| 4 | 97 | | view.leftWindowContainerAnimator.Show(); |
| | 98 | |
|
| 4 | 99 | | CommonScriptableObjects.isTaskbarHUDInitialized.Set(true); |
| 4 | 100 | | DataStore.i.builderInWorld.showTaskBar.OnChange += SetVisibility; |
| | 101 | |
|
| 4 | 102 | | isExperiencesViewerInitialized.OnChange += InitializeExperiencesViewer; |
| 4 | 103 | | InitializeExperiencesViewer(isExperiencesViewerInitialized.Get(), null); |
| | 104 | |
|
| 4 | 105 | | numOfLoadedExperiences.OnChange += NumOfLoadedExperiencesChanged; |
| 4 | 106 | | NumOfLoadedExperiencesChanged(numOfLoadedExperiences.Get(), 0); |
| 4 | 107 | | } |
| | 108 | |
|
| 2 | 109 | | private void ChatHeadsGroup_OnHeadClose(TaskbarButton obj) { privateChatWindowHud.SetVisibility(false); } |
| | 110 | |
|
| | 111 | | private void View_OnFriendsToggleOn() |
| | 112 | | { |
| 2 | 113 | | friendsHud?.SetVisibility(true); |
| 2 | 114 | | OnAnyTaskbarButtonClicked?.Invoke(); |
| 0 | 115 | | } |
| | 116 | |
|
| 4 | 117 | | private void View_OnFriendsToggleOff() { friendsHud?.SetVisibility(false); } |
| | 118 | |
|
| | 119 | | private void View_OnExperiencesToggleOn() |
| | 120 | | { |
| 0 | 121 | | isExperiencesViewerOpen.Set(true); |
| 0 | 122 | | OnAnyTaskbarButtonClicked?.Invoke(); |
| 0 | 123 | | } |
| | 124 | |
|
| 8 | 125 | | private void View_OnExperiencesToggleOff() { isExperiencesViewerOpen.Set(false); } |
| | 126 | |
|
| | 127 | | private void ToggleFriendsTrigger_OnTriggered(DCLAction_Trigger action) |
| | 128 | | { |
| 0 | 129 | | if (!view.friendsButton.transform.parent.gameObject.activeSelf) |
| 0 | 130 | | return; |
| | 131 | |
|
| 0 | 132 | | OnFriendsToggleInputPress(); |
| 0 | 133 | | } |
| | 134 | |
|
| 0 | 135 | | private void ToggleWorldChatTrigger_OnTriggered(DCLAction_Trigger action) { OnWorldChatToggleInputPress(); } |
| | 136 | |
|
| 0 | 137 | | private void CloseWindowTrigger_OnTriggered(DCLAction_Trigger action) { OnCloseWindowToggleInputPress(); } |
| | 138 | |
|
| | 139 | | private void View_OnChatToggleOn() |
| | 140 | | { |
| 3 | 141 | | worldChatWindowHud.SetVisibility(true); |
| 3 | 142 | | worldChatWindowHud.MarkWorldChatMessagesAsRead(); |
| 3 | 143 | | worldChatWindowHud.view.DeactivatePreview(); |
| 3 | 144 | | worldChatWindowHud.OnPressReturn(); |
| 3 | 145 | | OnAnyTaskbarButtonClicked?.Invoke(); |
| 0 | 146 | | } |
| | 147 | |
|
| | 148 | | private void View_OnChatToggleOff() |
| | 149 | | { |
| 2 | 150 | | if (view.AllButtonsToggledOff()) |
| | 151 | | { |
| 2 | 152 | | worldChatWindowHud.SetVisibility(true); |
| 2 | 153 | | worldChatWindowHud.view.ActivatePreview(); |
| 2 | 154 | | } |
| | 155 | | else |
| | 156 | | { |
| 0 | 157 | | worldChatWindowHud.SetVisibility(false); |
| | 158 | | } |
| 0 | 159 | | } |
| | 160 | |
|
| | 161 | | private void ChatHeadsGroup_OnHeadOpen(TaskbarButton taskbarBtn) |
| | 162 | | { |
| 1 | 163 | | ChatHeadButton head = taskbarBtn as ChatHeadButton; |
| | 164 | |
|
| 1 | 165 | | if (taskbarBtn == null) |
| 0 | 166 | | return; |
| | 167 | |
|
| 1 | 168 | | OpenPrivateChatWindow(head.profile.userId); |
| 1 | 169 | | } |
| | 170 | |
|
| 0 | 171 | | private void MouseCatcher_OnMouseUnlock() { view.leftWindowContainerAnimator.Show(); } |
| | 172 | |
|
| | 173 | | private void MouseCatcher_OnMouseLock() |
| | 174 | | { |
| 0 | 175 | | view.leftWindowContainerAnimator.Hide(); |
| | 176 | |
|
| 0 | 177 | | foreach (var btn in view.GetButtonList()) |
| | 178 | | { |
| 0 | 179 | | btn.SetToggleState(false); |
| | 180 | | } |
| | 181 | |
|
| 0 | 182 | | worldChatWindowHud.SetVisibility(true); |
| 0 | 183 | | worldChatWindowHud.view.ActivatePreview(); |
| | 184 | |
|
| 0 | 185 | | MarkWorldChatAsReadIfOtherWindowIsOpen(); |
| 0 | 186 | | } |
| | 187 | |
|
| | 188 | | public void AddWorldChatWindow(WorldChatWindowHUDController controller) |
| | 189 | | { |
| 2 | 190 | | if (controller == null || controller.view == null) |
| | 191 | | { |
| 0 | 192 | | Debug.LogWarning("AddChatWindow >>> World Chat Window doesn't exist yet!"); |
| 0 | 193 | | return; |
| | 194 | | } |
| | 195 | |
|
| 2 | 196 | | if (controller.view.transform.parent == view.leftWindowContainer) |
| 0 | 197 | | return; |
| | 198 | |
|
| 2 | 199 | | controller.view.transform.SetParent(view.leftWindowContainer, false); |
| 2 | 200 | | experiencesViewerTransform?.SetAsLastSibling(); |
| | 201 | |
|
| 2 | 202 | | worldChatWindowHud = controller; |
| | 203 | |
|
| 2 | 204 | | view.OnAddChatWindow(); |
| 2 | 205 | | worldChatWindowHud.view.OnClose += () => { view.friendsButton.SetToggleState(false, false); }; |
| | 206 | |
|
| 2 | 207 | | view.chatButton.SetToggleState(true); |
| 2 | 208 | | view.chatButton.SetToggleState(false); |
| 2 | 209 | | } |
| | 210 | |
|
| 0 | 211 | | public void OpenFriendsWindow() { view.friendsButton.SetToggleState(true); } |
| | 212 | |
|
| | 213 | | public void OpenPrivateChatTo(string userId) |
| | 214 | | { |
| 0 | 215 | | var button = view.chatHeadsGroup.AddChatHead(userId, (ulong) System.DateTimeOffset.UtcNow.ToUnixTimeMilliseconds |
| 0 | 216 | | button.toggleButton.onClick.Invoke(); |
| 0 | 217 | | } |
| | 218 | |
|
| | 219 | | public void AddPrivateChatWindow(PrivateChatWindowHUDController controller) |
| | 220 | | { |
| 2 | 221 | | if (controller == null || controller.view == null) |
| | 222 | | { |
| 0 | 223 | | Debug.LogWarning("AddPrivateChatWindow >>> Private Chat Window doesn't exist yet!"); |
| 0 | 224 | | return; |
| | 225 | | } |
| | 226 | |
|
| 2 | 227 | | if (controller.view.transform.parent == view.leftWindowContainer) |
| 0 | 228 | | return; |
| | 229 | |
|
| 2 | 230 | | controller.view.transform.SetParent(view.leftWindowContainer, false); |
| 2 | 231 | | experiencesViewerTransform?.SetAsLastSibling(); |
| | 232 | |
|
| 2 | 233 | | privateChatWindowHud = controller; |
| | 234 | |
|
| 2 | 235 | | privateChatWindowHud.view.OnMinimize += () => |
| | 236 | | { |
| 0 | 237 | | ChatHeadButton btn = view.GetButtonList() |
| | 238 | | .FirstOrDefault( |
| 0 | 239 | | (x) => x is ChatHeadButton && |
| | 240 | | (x as ChatHeadButton).profile.userId == privateChatWindowHud.conversatio |
| | 241 | | ChatHeadButton; |
| | 242 | |
|
| 0 | 243 | | if (btn != null) |
| 0 | 244 | | btn.SetToggleState(false, false); |
| | 245 | |
|
| 0 | 246 | | MarkWorldChatAsReadIfOtherWindowIsOpen(); |
| 0 | 247 | | }; |
| | 248 | |
|
| 2 | 249 | | privateChatWindowHud.view.OnClose += () => |
| | 250 | | { |
| 0 | 251 | | ChatHeadButton btn = view.GetButtonList() |
| | 252 | | .FirstOrDefault( |
| 0 | 253 | | (x) => x is ChatHeadButton && |
| | 254 | | (x as ChatHeadButton).profile.userId == privateChatWindowHud.conversatio |
| | 255 | | ChatHeadButton; |
| | 256 | |
|
| 0 | 257 | | if (btn != null) |
| | 258 | | { |
| 0 | 259 | | btn.SetToggleState(false, false); |
| 0 | 260 | | view.chatHeadsGroup.RemoveChatHead(btn); |
| | 261 | | } |
| | 262 | |
|
| 0 | 263 | | MarkWorldChatAsReadIfOtherWindowIsOpen(); |
| 0 | 264 | | }; |
| 2 | 265 | | } |
| | 266 | |
|
| | 267 | | public void AddFriendsWindow(FriendsHUDController controller) |
| | 268 | | { |
| 3 | 269 | | if (controller == null || controller.view == null) |
| | 270 | | { |
| 0 | 271 | | Debug.LogWarning("AddFriendsWindow >>> Friends window doesn't exist yet!"); |
| 0 | 272 | | return; |
| | 273 | | } |
| | 274 | |
|
| 3 | 275 | | if (controller.view.transform.parent == view.leftWindowContainer) |
| 0 | 276 | | return; |
| | 277 | |
|
| 3 | 278 | | controller.view.transform.SetParent(view.leftWindowContainer, false); |
| 3 | 279 | | experiencesViewerTransform?.SetAsLastSibling(); |
| | 280 | |
|
| 3 | 281 | | friendsHud = controller; |
| 3 | 282 | | view.OnAddFriendsWindow(); |
| 3 | 283 | | friendsHud.view.OnClose += () => |
| | 284 | | { |
| 0 | 285 | | view.friendsButton.SetToggleState(false, false); |
| 0 | 286 | | MarkWorldChatAsReadIfOtherWindowIsOpen(); |
| 0 | 287 | | }; |
| | 288 | |
|
| 3 | 289 | | friendsHud.view.friendsList.OnDeleteConfirmation += (userIdToRemove) => { view.chatHeadsGroup.RemoveChatHead(use |
| 3 | 290 | | } |
| | 291 | |
|
| | 292 | | internal void InitializeExperiencesViewer(Transform currentViewTransform, Transform previousViewTransform) |
| | 293 | | { |
| 4 | 294 | | if (currentViewTransform == null) |
| 4 | 295 | | return; |
| | 296 | |
|
| 0 | 297 | | experiencesViewerTransform = currentViewTransform; |
| 0 | 298 | | experiencesViewerTransform.SetParent(view.leftWindowContainer, false); |
| 0 | 299 | | experiencesViewerTransform.SetAsLastSibling(); |
| | 300 | |
|
| 0 | 301 | | view.OnAddExperiencesWindow(); |
| 0 | 302 | | } |
| | 303 | |
|
| | 304 | | private void IsExperiencesViewerOpenChanged(bool current, bool previous) |
| | 305 | | { |
| 0 | 306 | | if (current) |
| 0 | 307 | | return; |
| | 308 | |
|
| 0 | 309 | | view.experiencesButton.SetToggleState(false, false); |
| 0 | 310 | | MarkWorldChatAsReadIfOtherWindowIsOpen(); |
| 0 | 311 | | } |
| | 312 | |
|
| | 313 | | private void NumOfLoadedExperiencesChanged(int current, int previous) |
| | 314 | | { |
| 4 | 315 | | view.SetExperiencesVisbility(current > 0); |
| | 316 | |
|
| 4 | 317 | | if (current == 0) |
| 4 | 318 | | View_OnExperiencesToggleOff(); |
| 4 | 319 | | } |
| | 320 | |
|
| 0 | 321 | | public void OnAddVoiceChat() { view.OnAddVoiceChat(); } |
| | 322 | |
|
| | 323 | | public void DisableFriendsWindow() |
| | 324 | | { |
| 0 | 325 | | view.friendsButton.transform.parent.gameObject.SetActive(false); |
| 0 | 326 | | view.chatHeadsGroup.ClearChatHeads(); |
| 0 | 327 | | } |
| | 328 | |
|
| | 329 | | private void OpenPrivateChatWindow(string userId) |
| | 330 | | { |
| 1 | 331 | | privateChatWindowHud.Configure(userId); |
| 1 | 332 | | privateChatWindowHud.SetVisibility(true); |
| 1 | 333 | | privateChatWindowHud.ForceFocus(); |
| 1 | 334 | | OnAnyTaskbarButtonClicked?.Invoke(); |
| 0 | 335 | | } |
| | 336 | |
|
| | 337 | | public void Dispose() |
| | 338 | | { |
| 4 | 339 | | if (view != null) |
| | 340 | | { |
| 4 | 341 | | view.chatHeadsGroup.OnHeadToggleOn -= ChatHeadsGroup_OnHeadOpen; |
| 4 | 342 | | view.chatHeadsGroup.OnHeadToggleOff -= ChatHeadsGroup_OnHeadClose; |
| | 343 | |
|
| 4 | 344 | | view.OnChatToggleOff -= View_OnChatToggleOff; |
| 4 | 345 | | view.OnChatToggleOn -= View_OnChatToggleOn; |
| 4 | 346 | | view.OnFriendsToggleOff -= View_OnFriendsToggleOff; |
| 4 | 347 | | view.OnFriendsToggleOn -= View_OnFriendsToggleOn; |
| 4 | 348 | | view.OnExperiencesToggleOff -= View_OnExperiencesToggleOff; |
| 4 | 349 | | view.OnExperiencesToggleOn -= View_OnExperiencesToggleOn; |
| | 350 | |
|
| 4 | 351 | | UnityEngine.Object.Destroy(view.gameObject); |
| | 352 | | } |
| | 353 | |
|
| 4 | 354 | | if (mouseCatcher != null) |
| | 355 | | { |
| 1 | 356 | | mouseCatcher.OnMouseLock -= MouseCatcher_OnMouseLock; |
| 1 | 357 | | mouseCatcher.OnMouseUnlock -= MouseCatcher_OnMouseUnlock; |
| | 358 | | } |
| | 359 | |
|
| 4 | 360 | | if (toggleFriendsTrigger != null) |
| 4 | 361 | | toggleFriendsTrigger.OnTriggered -= ToggleFriendsTrigger_OnTriggered; |
| | 362 | |
|
| 4 | 363 | | if (closeWindowTrigger != null) |
| 4 | 364 | | closeWindowTrigger.OnTriggered -= CloseWindowTrigger_OnTriggered; |
| | 365 | |
|
| 4 | 366 | | if (toggleWorldChatTrigger != null) |
| 4 | 367 | | toggleWorldChatTrigger.OnTriggered -= ToggleWorldChatTrigger_OnTriggered; |
| | 368 | |
|
| 4 | 369 | | if (chatController != null) |
| 3 | 370 | | chatController.OnAddMessage -= OnAddMessage; |
| | 371 | |
|
| 4 | 372 | | DataStore.i.builderInWorld.showTaskBar.OnChange -= SetVisibility; |
| 4 | 373 | | isExperiencesViewerOpen.OnChange -= IsExperiencesViewerOpenChanged; |
| 4 | 374 | | isExperiencesViewerInitialized.OnChange -= InitializeExperiencesViewer; |
| 4 | 375 | | numOfLoadedExperiences.OnChange -= NumOfLoadedExperiencesChanged; |
| 4 | 376 | | } |
| | 377 | |
|
| 0 | 378 | | public void SetVisibility(bool visible, bool previus) { SetVisibility(visible); } |
| | 379 | |
|
| 2 | 380 | | public void SetVisibility(bool visible) { view.SetVisibility(visible); } |
| | 381 | |
|
| | 382 | | public void OnWorldChatToggleInputPress() |
| | 383 | | { |
| 0 | 384 | | bool anyInputFieldIsSelected = EventSystem.current != null && |
| | 385 | | EventSystem.current.currentSelectedGameObject != null && |
| | 386 | | EventSystem.current.currentSelectedGameObject.GetComponent<TMPro.TMP_InputField>( |
| | 387 | |
|
| 0 | 388 | | if (anyInputFieldIsSelected) |
| 0 | 389 | | return; |
| | 390 | |
|
| 0 | 391 | | worldChatWindowHud.OnPressReturn(); |
| | 392 | |
|
| 0 | 393 | | if (AnyWindowsDifferentThanChatIsOpen()) |
| | 394 | | { |
| 0 | 395 | | foreach (var btn in view.GetButtonList()) |
| | 396 | | { |
| 0 | 397 | | btn.SetToggleState(btn == view.chatButton); |
| | 398 | | } |
| | 399 | | } |
| 0 | 400 | | } |
| | 401 | |
|
| | 402 | | public void OnCloseWindowToggleInputPress() |
| | 403 | | { |
| 0 | 404 | | if (mouseCatcher.isLocked) |
| 0 | 405 | | return; |
| | 406 | |
|
| 0 | 407 | | view.chatButton.SetToggleState(false, false); |
| 0 | 408 | | worldChatWindowHud.view.chatHudView.ResetInputField(); |
| 0 | 409 | | worldChatWindowHud.view.ActivatePreview(); |
| 0 | 410 | | } |
| | 411 | |
|
| 0 | 412 | | public void SetVoiceChatRecording(bool recording) { view?.voiceChatButton.SetOnRecording(recording); } |
| | 413 | |
|
| 0 | 414 | | public void SetVoiceChatEnabledByScene(bool enabled) { view?.voiceChatButton.SetEnabledByScene(enabled); } |
| | 415 | |
|
| | 416 | | private void OnFriendsToggleInputPress() |
| | 417 | | { |
| 0 | 418 | | bool anyInputFieldIsSelected = EventSystem.current != null && |
| | 419 | | EventSystem.current.currentSelectedGameObject != null && |
| | 420 | | EventSystem.current.currentSelectedGameObject.GetComponent<TMPro.TMP_InputField>( |
| | 421 | | (!worldChatWindowHud.view.chatHudView.inputField.isFocused || !worldChatWindowHud |
| | 422 | |
|
| 0 | 423 | | if (anyInputFieldIsSelected) |
| 0 | 424 | | return; |
| | 425 | |
|
| 0 | 426 | | Utils.UnlockCursor(); |
| 0 | 427 | | view.leftWindowContainerAnimator.Show(); |
| 0 | 428 | | view.friendsButton.SetToggleState(!view.friendsButton.toggledOn); |
| 0 | 429 | | } |
| | 430 | |
|
| | 431 | | void OnAddMessage(ChatMessage message) |
| | 432 | | { |
| 1 | 433 | | if (!AnyWindowsDifferentThanChatIsOpen() && message.messageType == ChatMessage.Type.PUBLIC) |
| 0 | 434 | | worldChatWindowHud.MarkWorldChatMessagesAsRead((long) message.timestamp); |
| 1 | 435 | | } |
| | 436 | |
|
| | 437 | | private bool AnyWindowsDifferentThanChatIsOpen() |
| | 438 | | { |
| 1 | 439 | | return (friendsHud != null && friendsHud.view.gameObject.activeSelf) || |
| | 440 | | (privateChatWindowHud != null && privateChatWindowHud.view.gameObject.activeSelf); |
| | 441 | | } |
| | 442 | |
|
| | 443 | | private void MarkWorldChatAsReadIfOtherWindowIsOpen() |
| | 444 | | { |
| 0 | 445 | | if (!AnyWindowsDifferentThanChatIsOpen()) |
| 0 | 446 | | worldChatWindowHud.MarkWorldChatMessagesAsRead(); |
| 0 | 447 | | } |
| | 448 | | } |