功能批量实现 优化 服务端 新浮动小游戏框架 新界面UI

This commit is contained in:
2026-04-24 13:20:16 +08:00
parent e0bc0bbf08
commit 5eec879582
257 changed files with 38481 additions and 1288 deletions
@@ -7,6 +7,7 @@ using System.Collections.Generic;
using UnityEngine.Audio;
using Bansonic;
using Steamworks;
using GameServer.Client;
public class btmandtopController : MonoBehaviour, ICancelHandler
{
@@ -67,6 +68,9 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
public GameObject notice_prefab;
public GameObject userBag_prefab;
[Header("mail red pot")]
public Image mailRedPot;
[Header("New Back Buttons")]
[SerializeField] private Button back_navButton;
[SerializeField] private Button home_navButton;
@@ -204,6 +208,7 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
button_Music.onClick.AddListener(ToggleMusicPicLocal);
UpdateSteamUserInfo();
InitializeMailRedPot();
var binder = BgmUiBinder.Instance != null ? BgmUiBinder.Instance : Object.FindAnyObjectByType<BgmUiBinder>();
if (binder != null && musicPicRoot != null)
@@ -517,6 +522,11 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
}
PlayerRksService.OnRksChanged -= HandleRksChanged;
UI_Panel_Mail.OnUnreadStateChanged -= HandleMailUnreadStateChanged;
if (MailHttpService.Instance != null)
{
MailHttpService.Instance.OnMailListChanged -= HandleMailListChanged;
}
if (ReferenceEquals(activeInstance, this))
{
@@ -539,6 +549,65 @@ public class btmandtopController : MonoBehaviour, ICancelHandler
UpdatePlayerRksText(rksAmount);
}
private void InitializeMailRedPot()
{
if (mailRedPot == null)
{
return;
}
bool useServerMail = false;
if (email_prefab != null)
{
UI_Panel_Mail mailPanel = email_prefab.GetComponent<UI_Panel_Mail>();
if (mailPanel != null)
{
useServerMail = mailPanel.UsesServerMail;
}
}
if (useServerMail && MailHttpService.Instance != null)
{
MailHttpService.Instance.SetServerModeEnabled(true);
MailHttpService.Instance.OnMailListChanged -= HandleMailListChanged;
MailHttpService.Instance.OnMailListChanged += HandleMailListChanged;
}
UI_Panel_Mail.OnUnreadStateChanged -= HandleMailUnreadStateChanged;
UI_Panel_Mail.OnUnreadStateChanged += HandleMailUnreadStateChanged;
UpdateMailRedPot();
}
private void HandleMailUnreadStateChanged()
{
UpdateMailRedPot();
}
private void HandleMailListChanged(IReadOnlyList<MailApiEntry> _)
{
UpdateMailRedPot();
}
private void UpdateMailRedPot()
{
if (mailRedPot == null)
{
return;
}
bool useServerMail = false;
if (email_prefab != null)
{
UI_Panel_Mail mailPanel = email_prefab.GetComponent<UI_Panel_Mail>();
if (mailPanel != null)
{
useServerMail = mailPanel.UsesServerMail;
}
}
mailRedPot.enabled = UI_Panel_Mail.HasUnreadMails(useServerMail);
}
private void UpdatePlayerCoinsLegacyText(int coinAmount)
{
if (playerCoins_legacy != null)