每日自动提交 2026-04-15 18:30
This commit is contained in:
@@ -236,5 +236,48 @@ namespace Assets.MyGame.Scripts.Net
|
||||
|
||||
|
||||
}
|
||||
|
||||
// ---------------- Customer ----------------
|
||||
|
||||
/// <summary>
|
||||
/// 发起会话回调(用户端)
|
||||
/// isOk=false 时弹错误提示;isOk=true 时自动加入会话房间
|
||||
/// </summary>
|
||||
public static void Customer_OnConversationStarted(CustomerConversationStartedResult result)
|
||||
{
|
||||
if (!result.isOk)
|
||||
{
|
||||
UIManager.Instance.ShowBoardError(result.msg);
|
||||
return;
|
||||
}
|
||||
// 加入会话房间,之后才能收发消息
|
||||
//WebSocketSendList.Customer_JoinConversation(result.conversation.id);
|
||||
// TODO: 通知客服 UI 显示会话(替换为你的实际 Panel 调用)
|
||||
UIManager.Instance.Get<UIHomeMain>(UIPanel.HomeMainPanel).subUIManager.Get<UIHome_BY_ServicePanel>(UIPanel.ServicePanel)?.OnConversationStarted(result);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息接收回调(用户端 & 客服端)
|
||||
/// </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);
|
||||
Debug.Log($"[Customer] 收到消息 from {msg.senderName}({msg.senderType}): {msg.content}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新会话通知(客服端)
|
||||
/// </summary>
|
||||
public static void Customer_OnNewConversation(CustomerNewConversationNotice notice)
|
||||
{
|
||||
// 客服端自动加入会话房间
|
||||
WebSocketSendList.Customer_JoinConversation(notice.conversationId);
|
||||
// TODO: 通知客服端 UI 显示新会话(替换为你的实际 Panel 调用)
|
||||
// UIManager.Instance.Get<UICustomerServicePanel>(UIPanel.CustomerServicePanel)?.OnNewConversation(notice);
|
||||
Debug.Log($"[Customer] 新会话来了,userId={notice.userId},userName={notice.userName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user