public async Task InitializeChatChannelsAsync() { try { var data = await _dataStoreProvider.GetDataStoreAsync(_chatChannelsDbc); for (int i = 0, loopTo = data.Rows - 1; i <= loopTo; i++) { var chatChannels = new ChatChannelInfo { Index = data.ReadInt(i, 0), Flags = data.ReadInt(i, 1), Name = data.ReadString(i, 3), }; ChatChannelsInfo.Add(chatChannels.Index, chatChannels); } _clusterServiceLocator.WorldCluster.Log.WriteLine(LogType.INFORMATION, "DBC: {0} ChatChannels Initialized.", data.Rows - 1); } catch (DirectoryNotFoundException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("DBC File : ChatChannels.dbc missing."); Console.ForegroundColor = ConsoleColor.Gray; } }
public void OnNotifyUpdateChannnelInfo(ChatChannelInfo info) { chatChannelInfo = info; if (currentChannel == null || currentChannel == invalidChannel) { int recommend = chatChannelInfo.recommend; SelectChannel(recommend); } }
void IChatCallbacks.ChatChannelMembershipCallback(TTV_ChatEvent evt, ChatChannelInfo channelInfo) { switch (evt) { case TTV_ChatEvent.TTV_CHAT_JOINED_CHANNEL: { m_ChatState = ChatState.Connected; FireConnected(); break; } case TTV_ChatEvent.TTV_CHAT_LEFT_CHANNEL: { m_ChatState = ChatState.Disconnected; break; } default: { break; } } }
void IChatChannelListener.ChatChannelMembershipCallback(string channelName, ChatEvent evt, ChatChannelInfo channelInfo) { switch (evt) { case ChatEvent.TTV_CHAT_JOINED_CHANNEL: { SetChannelState(ChannelState.Connected); FireConnected(channelName); break; } case ChatEvent.TTV_CHAT_LEFT_CHANNEL: { DisconnectionComplete(); break; } default: { break; } } }
public void CreateClanChat(ChatChannelInfo info, int clanId, Action <bool> callback = null) { if (info == null) { Log.Error(LOG.NETWORK, "clanChat info is null!!"); if (callback != null) { callback(false); } } else if (clanChat != null && clanChat.HasConnect) { Log.Error(LOG.NETWORK, "ClanChat has already connected!"); if (callback != null) { callback(true); } } else if (clanChat != null) { Log.Warning(LOG.NETWORK, "ClanChat reconnect!"); clanChat.JoinRoom(clanId); if (callback != null) { callback(true); } } else { clanChat = new ClanChatRoom(); Protocol.Force(delegate { SendClanChannelEnter(info.recommend, delegate(ChatChannel chatChannel) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) if (chatChannel == null) { Log.Error(LOG.NETWORK, "Clan Chat channel is null"); clanChat.LeaveRoom(clanId); if (callback != null) { callback(false); } } else if (chatChannel == invalidChannel || chatChannel == offlineChannel) { clanChat.SetConnection(new ClanChatOfflineConnection()); Log.Error(LOG.NETWORK, "Use Clan chat Offline Connection"); if (callback != null) { callback(true); } } else { ClanChatWebSocketConnection clanChatWebSocketConnection = this.get_gameObject().AddComponent <ClanChatWebSocketConnection>(); clanChatWebSocketConnection.Setup(chatChannel.host, chatChannel.port, chatChannel.path, true); clanChat.SetConnection(clanChatWebSocketConnection); clanChat.JoinRoom(clanId); Log.Error(LOG.NETWORK, "Create Clan Chat Successful !"); if (callback != null) { callback(true); } } }); }); } }
public void Set(ChatChannelInfo channelInfo) { iconImage.sprite = null; titleText.text = $"{channelInfo.Name} ({channelInfo.OnlineCount})"; }