改动与优化
This commit is contained in:
@@ -91,12 +91,18 @@ public class roomDetails : MonoBehaviour
|
||||
private Coroutine _songLibraryWaitRoutine;
|
||||
private bool _suppressSongDropdownEvents;
|
||||
private bool _isChangingRoomSong;
|
||||
private bool _isClosingSelf;
|
||||
|
||||
private const float ChatSendCooldownSeconds = 3f;
|
||||
private const int InitialHistoryLoadLimit = 20;
|
||||
private const int MaxDisplayWindowLimit = 20;
|
||||
private const string CooldownPlaceholderFormat = "\u53d1\u9001\u51b7\u5374\u4e2d {0}s";
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
EnsurePopupTween();
|
||||
}
|
||||
|
||||
public void ConfigureRoomRanking(GameObject roomRankingPrefab, Transform roomRankingSpawnParent)
|
||||
{
|
||||
_roomRankingPrefabTemplate = roomRankingPrefab;
|
||||
@@ -105,6 +111,8 @@ public class roomDetails : MonoBehaviour
|
||||
|
||||
public void Bind(ArenaRoomService service)
|
||||
{
|
||||
EnsurePopupTween();
|
||||
|
||||
_service = service;
|
||||
|
||||
UIBackStack.RegisterOrBump(
|
||||
@@ -114,13 +122,11 @@ public class roomDetails : MonoBehaviour
|
||||
{
|
||||
if (_spawnedRoomRankingInstance != null)
|
||||
{
|
||||
UIBackStack.Unregister(_spawnedRoomRankingInstance);
|
||||
Destroy(_spawnedRoomRankingInstance);
|
||||
_spawnedRoomRankingInstance = null;
|
||||
CloseRoomRankingWithExitAnim();
|
||||
return true;
|
||||
}
|
||||
|
||||
Destroy(gameObject);
|
||||
CloseSelfWithExitAnim();
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -311,7 +317,7 @@ public class roomDetails : MonoBehaviour
|
||||
{
|
||||
if (snapshot == null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
CloseSelfWithExitAnim();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -320,12 +326,12 @@ public class roomDetails : MonoBehaviour
|
||||
|
||||
private void HandleKicked(string kickedSteamId, string bySteamId)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
CloseSelfWithExitAnim();
|
||||
}
|
||||
|
||||
private void HandleRoomDismissed(string roomCode, string bySteamId)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
CloseSelfWithExitAnim();
|
||||
}
|
||||
|
||||
private void HandleRoomChatMessagesChanged(IReadOnlyList<ArenaRoomChatMessage> messages)
|
||||
@@ -374,7 +380,7 @@ public class roomDetails : MonoBehaviour
|
||||
{
|
||||
if (_service == null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
CloseSelfWithExitAnim();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -397,7 +403,7 @@ public class roomDetails : MonoBehaviour
|
||||
}
|
||||
finally
|
||||
{
|
||||
Destroy(gameObject);
|
||||
CloseSelfWithExitAnim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,6 +482,7 @@ public class roomDetails : MonoBehaviour
|
||||
{
|
||||
ArenaRoomParticipant participant = snapshot.participants[i];
|
||||
GameObject item = Instantiate(roommatePrefab, roommateParent);
|
||||
UI_OrderedEntryAnimator.PlayFadeOnly(item, i, 0.16f, 0.012f, true);
|
||||
roomPrefab itemController = item.GetComponent<roomPrefab>();
|
||||
if (itemController == null)
|
||||
{
|
||||
@@ -784,6 +791,7 @@ public class roomDetails : MonoBehaviour
|
||||
systemController.Bind(systemEntry.richText);
|
||||
}
|
||||
|
||||
UI_OrderedEntryAnimator.PlayFadeOnly(systemInstance, Mathf.Max(0, messageParent.childCount - 1), 0.14f, 0.01f, true);
|
||||
return systemInstance;
|
||||
}
|
||||
|
||||
@@ -809,6 +817,7 @@ public class roomDetails : MonoBehaviour
|
||||
controller.Bind(senderSteamId, avatarUrl, displayName, title, message.content, bubbleColor);
|
||||
}
|
||||
|
||||
UI_OrderedEntryAnimator.PlayFadeOnly(instance, Mathf.Max(0, messageParent.childCount - 1), 0.14f, 0.01f, true);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -1260,8 +1269,7 @@ public class roomDetails : MonoBehaviour
|
||||
{
|
||||
if (_spawnedRoomRankingInstance != null)
|
||||
{
|
||||
Destroy(_spawnedRoomRankingInstance);
|
||||
_spawnedRoomRankingInstance = null;
|
||||
CloseRoomRankingWithExitAnim();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1284,6 +1292,50 @@ public class roomDetails : MonoBehaviour
|
||||
localSteamId);
|
||||
}
|
||||
|
||||
private void CloseSelfWithExitAnim()
|
||||
{
|
||||
if (_isClosingSelf)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_isClosingSelf = true;
|
||||
UI_PanelExitUtility.PlayExitThen(gameObject, () =>
|
||||
{
|
||||
if (gameObject != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void CloseRoomRankingWithExitAnim()
|
||||
{
|
||||
GameObject rankingInstance = _spawnedRoomRankingInstance;
|
||||
if (rankingInstance == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UIBackStack.Unregister(rankingInstance);
|
||||
_spawnedRoomRankingInstance = null;
|
||||
UI_PanelExitUtility.PlayExitThen(rankingInstance, () =>
|
||||
{
|
||||
if (rankingInstance != null)
|
||||
{
|
||||
Destroy(rankingInstance);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void EnsurePopupTween()
|
||||
{
|
||||
if (GetComponent<UI_PanelPopupTween>() == null)
|
||||
{
|
||||
gameObject.AddComponent<UI_PanelPopupTween>();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateQuitButtonTexts(ArenaRoomSnapshot snapshot)
|
||||
{
|
||||
string localSteamId = NetworkManager.Instance != null ? NetworkManager.Instance.SteamId : string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user