UI update 02
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using DG.Tweening;
|
||||
using GameServer.Client;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -62,6 +63,7 @@ public class globalChatSystem : MonoBehaviour
|
||||
[SerializeField] Button back_to_worldwideChatButton;
|
||||
[SerializeField] Toggle globalChatToggle;
|
||||
[SerializeField] Toggle friendChatToggle;
|
||||
[SerializeField] private CanvasGroup chatCanvasGroup;
|
||||
|
||||
private ArenaRoomService _service;
|
||||
private ScrollRect _scrollRect;
|
||||
@@ -94,6 +96,7 @@ public class globalChatSystem : MonoBehaviour
|
||||
private bool _suppressModeToggleEvents;
|
||||
private bool _modeTogglesAutoCreated;
|
||||
private ToggleGroup _chatModeToggleGroup;
|
||||
private Tween _visibilityTween;
|
||||
public static globalChatSystem Instance { get; private set; }
|
||||
public static event Action<string> ActivePrivateConversationChanged;
|
||||
|
||||
@@ -148,6 +151,7 @@ public class globalChatSystem : MonoBehaviour
|
||||
{
|
||||
Instance = this;
|
||||
_lastPrivatePartnerId = PlayerPrefs.GetString(LastPrivatePartnerPrefKey, string.Empty);
|
||||
EnsureCanvasGroupReference();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@@ -212,6 +216,9 @@ public class globalChatSystem : MonoBehaviour
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
EnsureCanvasGroupReference();
|
||||
PlayOpenFadeIfNeeded();
|
||||
|
||||
if (_service == null)
|
||||
{
|
||||
_service = ArenaRoomService.Instance;
|
||||
@@ -283,6 +290,8 @@ public class globalChatSystem : MonoBehaviour
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
KillVisibilityTween();
|
||||
|
||||
if (closeButton != null)
|
||||
{
|
||||
closeButton.onClick.RemoveListener(CloseSelf);
|
||||
@@ -1200,7 +1209,80 @@ public class globalChatSystem : MonoBehaviour
|
||||
|
||||
private void CloseSelf()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
HideWithFade();
|
||||
}
|
||||
|
||||
private void EnsureCanvasGroupReference()
|
||||
{
|
||||
if (chatCanvasGroup == null)
|
||||
{
|
||||
chatCanvasGroup = GetComponent<CanvasGroup>();
|
||||
}
|
||||
}
|
||||
|
||||
private void KillVisibilityTween()
|
||||
{
|
||||
if (_visibilityTween != null && _visibilityTween.IsActive())
|
||||
{
|
||||
_visibilityTween.Kill(false);
|
||||
}
|
||||
|
||||
_visibilityTween = null;
|
||||
}
|
||||
|
||||
private void PlayOpenFadeIfNeeded()
|
||||
{
|
||||
if (chatCanvasGroup == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
KillVisibilityTween();
|
||||
chatCanvasGroup.gameObject.SetActive(true);
|
||||
chatCanvasGroup.alpha = 0f;
|
||||
chatCanvasGroup.interactable = false;
|
||||
chatCanvasGroup.blocksRaycasts = false;
|
||||
_visibilityTween = chatCanvasGroup.DOFade(1f, 0.25f)
|
||||
.SetEase(Ease.Linear)
|
||||
.SetUpdate(true)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
if (chatCanvasGroup == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
chatCanvasGroup.alpha = 1f;
|
||||
chatCanvasGroup.interactable = true;
|
||||
chatCanvasGroup.blocksRaycasts = true;
|
||||
_visibilityTween = null;
|
||||
});
|
||||
}
|
||||
|
||||
private void HideWithFade()
|
||||
{
|
||||
if (chatCanvasGroup == null)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
return;
|
||||
}
|
||||
|
||||
KillVisibilityTween();
|
||||
chatCanvasGroup.interactable = false;
|
||||
chatCanvasGroup.blocksRaycasts = false;
|
||||
_visibilityTween = chatCanvasGroup.DOFade(0f, 0.25f)
|
||||
.SetEase(Ease.Linear)
|
||||
.SetUpdate(true)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
if (chatCanvasGroup != null)
|
||||
{
|
||||
chatCanvasGroup.alpha = 0f;
|
||||
}
|
||||
|
||||
gameObject.SetActive(false);
|
||||
_visibilityTween = null;
|
||||
});
|
||||
}
|
||||
|
||||
public static bool IsViewingPrivateConversation(string steamId)
|
||||
|
||||
Reference in New Issue
Block a user