예제 #1
0
    public void ShowChannel(string channelName)
    {
        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        ChatChannel channel = null;
        bool        found   = this.chatClient.TryGetChannel(channelName, out channel);

        if (!found)
        {
            Debug.Log("ShowChannel failed to find channel: " + channelName);
            return;
        }

        this.selectedChannelName     = channelName;
        this.CurrentChannelText.text = channel.ToStringMessages();
        Debug.Log("ShowChannel:" + channel.ToStringMessages());
        //Debug.Log("ShowChannel: " + this.selectedChannelName);

        foreach (KeyValuePair <string, Toggle> pair in channelToggles)
        {
            pair.Value.isOn = pair.Key == channelName ? true : false;
        }
    }
예제 #2
0
    public void ShowChannel(string channelName)
    {
        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }
        ChatChannel chatChannel = null;

        if (!this.chatClient.TryGetChannel(channelName, out chatChannel))
        {
            Debug.Log("ShowChannel failed to find channel: " + channelName);
            return;
        }
        this.selectedChannelName = channelName;
        this.CurrentChannelText.set_text(chatChannel.ToStringMessages());
        Debug.Log("ShowChannel: " + this.selectedChannelName);
        using (Dictionary <string, Toggle> .Enumerator enumerator = this.channelToggles.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                KeyValuePair <string, Toggle> current = enumerator.get_Current();
                current.get_Value().set_isOn(current.get_Key() == channelName);
            }
        }
    }
예제 #3
0
        public void ShowChannel(string channelName)
        {
            if (string.IsNullOrEmpty(channelName))
            {
                return;
            }

            ChatChannel channel = null;
            bool        found   = this.chatClient.TryGetChannel(channelName, out channel);

            if (!found)
            {
                Debug.Log("ShowChannel failed to find channel: " + channelName);
                return;
            }

            this.selectedChannelName     = channelName;
            this.CurrentChannelText.text = channel.ToStringMessages();
            Debug.Log("ShowChannel: " + this.selectedChannelName);

            foreach (KeyValuePair <string, Toggle> pair in this.channelToggles)
            {
                pair.Value.isOn = pair.Key == channelName ? true : false;
            }

            List <ChatInfo> chats = new List <ChatInfo>();

            for (int i = 0; i < channel.Messages.Count; i++)
            {
                chats.Add(new ChatInfo {
                    Sender = channel.Senders[i], Message = (string)channel.Messages[i]
                });
            }
            StartCoroutine(PopulateChat(chats));
        }
예제 #4
0
    public void OnGetMessages(string channelName, string[] senders, object[] messages)
    {
        channelName = this._channel;
        ChatChannel _channel = null;
        bool        found    = this._chatClient.TryGetChannel(this._channel, out _channel);

        if (!found)
        {
            Debug.Log("ShowChannel failed to find channel: " + channelName);
            return;
        }

        this._messagesArea.text = _channel.ToStringMessages();
    }
예제 #5
0
        private void UpdateMessages(string channelName)
        {
            ChatChannel channel = null;
            bool        found   = client.TryGetChannel(channelName, out channel);

            if (!found)
            {
                if (printDebug)
                {
                    Debug.Log("failed to find channel: " + channelName);
                }
                return;
            }

            OnUpdateMessages(channel.ToStringMessages());
        }
예제 #6
0
    void UpdateChatMessage(string channelName)
    {
        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        ChatChannel channel = null;
        bool        isValid = _chatClient.TryGetChannel(channelName, out channel);

        if (!isValid)
        {
            CommonDebug.LogError("채널이 존재하지 않습니다. ChannelName : " + channelName);
            return;
        }

        _chatUI.TxtChatMessage.text = channel.ToStringMessages();
    }
예제 #7
0
파일: ChatBox.cs 프로젝트: ericxl/dragon
    public void ShowChannel(string channelName)
    {
        if (string.IsNullOrEmpty(channelName))
        {
            return;
        }

        ChatChannel channel = null;
        bool        found   = this.chatClient.TryGetChannel(channelName, out channel);

        if (!found)
        {
            Debug.Log("ShowChannel failed to find channel: " + channelName);
            return;
        }

        this.selectedChannelName     = channelName;
        this.CurrentChannelText.text = channel.ToStringMessages();
        Debug.Log("ShowChannel: " + this.selectedChannelName);
    }
예제 #8
0
        /// <summary>
        /// Notifies app that client got new messages from server
        /// Number of senders is equal to number of messages in 'messages'. Sender with number '0' corresponds to message with
        /// number '0', sender with number '1' corresponds to message with number '1' and so on
        /// </summary>
        /// <param name="channelName">channel from where messages came</param>
        /// <param name="senders">list of users who sent messages</param>
        /// <param name="messages">list of messages it self</param>
        public void OnGetMessages(string channelName, string[] senders, object[] messages)
        {
            if (printConsoleMessages)
            {
                Debug.Log("ChatManager::Console Message -> OnGetMessages is being called from channel: " + channelName);
            }

            if (string.IsNullOrEmpty(channelName))
            {
                return;
            }

            ChatChannel channel      = null;
            bool        foundChannel = chatClient.TryGetChannel(channelName, out channel);

            if (foundChannel)
            {
                if (onGetMessagesEvent != null)
                {
                    onGetMessagesEvent(channelName, senders, messages, channel.ToStringMessages());
                }
            }
        }