基本设置
要使用 PlayNANOO 聊天服务,需要优先完成 PlayNANOO 插件的配置。
要接收消息,需要在应用程序中通过回调实现方法。 在 Unity(C#) 中已定义了 IChatListner 接口,请使用该接口实现方法。
源代码
using UnityEngine;
using PlayNANOO.ChatServer;
using PlayNANOO.ChatServer.Models;
public class PlayNANOOChatExample : MonoBehaviour, IChatListener
{
public void OnChannels(ChatChannelModel[] channels)
{
throw new System.NotImplementedException();
}
public void OnConntected()
{
throw new System.NotImplementedException();
}
public void OnDisconnected()
{
throw new System.NotImplementedException();
}
public void OnError(ChatErrorModel error)
{
throw new System.NotImplementedException();
}
public void OnNotifyMessage(ChatInfoModel chatInfo, string message)
{
throw new System.NotImplementedException();
}
public void OnPlayerOnline(ChatPlayerModel[] players)
{
throw new System.NotImplementedException();
}
public void OnPrivateMessage(ChatInfoModel chatInfo, string message)
{
throw new System.NotImplementedException();
}
public void OnPublicMessage(ChatInfoModel chatInfo, string message)
{
throw new System.NotImplementedException();
}
public void OnSubscribed(ChatInfoModel chatInfo)
{
throw new System.NotImplementedException();
}
public void OnUnSubscribed(ChatInfoModel chatInfo)
{
throw new System.NotImplementedException();
}
}