1
This commit is contained in:
@@ -1004,9 +1004,7 @@ namespace Assets.MyGame.Scripts.Net
|
||||
}
|
||||
// 加入会话房间,之后才能收发消息
|
||||
//WebSocketSendList.Customer_JoinConversation(result.conversation.id);
|
||||
// TODO: 通知客服 UI 显示会话(替换为你的实际 Panel 调用)
|
||||
UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel).subUIManager.Get<UIHome_BY_ServicePanel>(UIPanel.ServicePanel)?.OnConversationStarted(result);
|
||||
|
||||
GetActiveServicePanel()?.OnConversationStarted(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1014,12 +1012,31 @@ namespace Assets.MyGame.Scripts.Net
|
||||
/// </summary>
|
||||
public static void Customer_OnMessageReceived(CustomerMessageReceived msg)
|
||||
{
|
||||
|
||||
// TODO: 通知客服 UI 追加消息(替换为你的实际 Panel 调用)
|
||||
UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel).subUIManager.Get<UIHome_BY_ServicePanel>(UIPanel.ServicePanel)?.OnMessageReceived(msg);
|
||||
GetActiveServicePanel()?.OnMessageReceived(msg);
|
||||
Debug.Log($"[Customer] 收到消息 from {msg.senderName}({msg.senderType}): {msg.content}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前活动的客服面板(主界面或登录界面打开的)
|
||||
/// </summary>
|
||||
private static UIHome_BY_ServicePanel GetActiveServicePanel()
|
||||
{
|
||||
// 先尝试主界面
|
||||
var home = UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel);
|
||||
if (home != null && home.subUIManager != null)
|
||||
{
|
||||
var panel = home.subUIManager.Get<UIHome_BY_ServicePanel>(UIPanel.ServicePanel);
|
||||
if (panel != null) return panel;
|
||||
}
|
||||
// 再尝试登录界面(游客模式)
|
||||
var login = UIManager.Instance.Get<UILoginPanel>(UIPanel.LoginPanel);
|
||||
if (login != null && login.uIManager != null)
|
||||
{
|
||||
return login.uIManager.Get<UIHome_BY_ServicePanel>(UIPanel.ServicePanel);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新会话通知(客服端)
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user