확인결과 또 안됩니다.
ChannelInfo mChannelInfo = null;
bool m_isConnect;
bool m_isShowConnectMessage;
private void Awake()
{
Inst = this;
}
void Update()
{
ChatClient?.Update();
}
public void Init()
{
mLstTab = new List<Chat_Base.eType>();
Get_Block().Init();
Connect();
OnClick_Tab(0);
}
public void Connect()
{
if (ChatClient != null) return;
switch(Language.Get_Type())
{
case Language.eLanguage.E_KR:
case Language.eLanguage.E_EN:
case Language.eLanguage.E_JP:
case Language.eLanguage.E_TW:
string sAvatar = string.Format("{0}/{1}/{2}", Player.Inst.Get_Server(), Player.Inst.Get_Profile_Equip(), RankMgr.Inst.Get_ChatRank());
ChatClient = new ChatClient(this, new ChatClientArguments
{
Avatar = sAvatar,
});
mPnl_Chat_Preview.SetActive(true);
break;
default:
mPnl_Chat_Preview.SetActive(false);
break;
}
}
public void OnJoinChannel(ChannelInfo channelInfo)
{
mChannelInfo = channelInfo;
if(!m_isShowConnectMessage)
{
m_isShowConnectMessage = true;
MessageInfo info = new MessageInfo();
info.MessageType = MESSAGE_TYPE.SYSTEM_MESSAGE;
info.Message = string.Format("[{0}] {1} {2}", Language.Get_Text(31), Language.Get_Text(32), TimeMgr.Inst.Get_CurrTime().ToShortTimeString());
Show_Message(info);
info = new MessageInfo();
info.MessageType = MESSAGE_TYPE.SYSTEM_MESSAGE;
info.Message = Language.Get_Text(1984);
Show_Message(info);
if(!ContentsLockMgr.Inst.Check_Unlock(eContentsLock.E_CHAT))
{
info = new MessageInfo();
info.MessageType = MESSAGE_TYPE.SYSTEM_MESSAGE;
info.Message = ContentsLockMgr.Inst.Get_Notice(eContentsLock.E_CHAT);
Show_Message(info, true);
}
}
if (!m_isConnect && ContentsLockMgr.Inst.Check_Unlock(eContentsLock.E_CHAT))
{
for (int i = 0; i < channelInfo.Messages.Count; ++i)
Show_Message(channelInfo.Messages[i]);
}
m_isConnect = true;
}
public void OnLeaveChannel(ChannelInfo channelInfo)
{
mChannelInfo = null;
}
public void OnJoinChannelPlayer(string channelGroup, string channelName, ulong channelNumber, string gamerName, string avatar) { }
public void OnLeaveChannelPlayer(string channelGroup, string channelName, ulong channelNumber, string gamerName, string avatar) { }
public void OnChatMessage(MessageInfo messageInfo)
{
if (Get_Block().Check_Block(messageInfo.GamerName))
return;
Show_Message(messageInfo);
}
public void OnWhisperMessage(WhisperMessageInfo messageInfo) { }
public void OnHideMessage(MessageInfo messageInfo) { }
public void OnDeleteMessage(MessageInfo messageInfo) { }
public void OnTranslateMessage(List<MessageInfo> messages) { }
public void OnSuccess(SUCCESS_MESSAGE success, object param)
{
switch (success)
{
case SUCCESS_MESSAGE.CHANGE_AVATAR:
Debug.LogError("아바타 변경 완료");
break;
case SUCCESS_MESSAGE.REPORT:
NoticeMgr.Inst.Open_Notice(Language.Get_Text(38));
break;
default:
break;
}
}
public void OnError(ERROR_MESSAGE error, object param)
{
switch (error)
{
case ERROR_MESSAGE.CHAT_BAN:
{
ErrorMessageChatBanParam errorMessageChatBanParam = (ErrorMessageChatBanParam)param;
if (errorMessageChatBanParam == null) return;
System.DateTime banTime = System.DateTime.Now.AddSeconds(errorMessageChatBanParam.RemainSeconds);
MessageInfo info = new MessageInfo();
info.MessageType = MESSAGE_TYPE.SYSTEM_MESSAGE;
info.Message = string.Format("{0} [{1}]", Language.Get_Text(82), banTime.ToString("yyyy-MM-dd HH:mm:ss"));
Show_Message(info);
}
break;
case ERROR_MESSAGE.TOO_MANY_REPORT: NoticeMgr.Inst.Open_Notice(Language.Get_Text(42)); break;
default:
break;
}
}
private void OnApplicationQuit()
{
ChatClient?.Dispose();
}
코드 공유 드립니다