Inheritance: global::ProtoBuf.IExtensible
コード例 #1
0
ファイル: ChatProcessor.cs プロジェクト: hunbernd/RSSSHClient
        private void ProcessLobby(ChatLobbyInfo lobby)
        {
            string ID = lobby.lobby_id, nameToShow = "";
            GuiChatLobby cl = new GuiChatLobby();

            nameToShow =
                    "[" + (lobby.no_peers <= 9 ? "0" : "") + lobby.no_peers + "] " +
                    lobby.lobby_name +
                    // when there is no topic don't add "-"
                    (lobby.lobby_topic != "" ? " - " + lobby.lobby_topic : "");

            if (_chatLobbies.ContainsKey(ID)) //update
            {
                System.Diagnostics.Debug.WriteLineIf(DEBUG, "updating lobby " + lobby.lobby_name + " - state " + lobby.lobby_state);
                System.Diagnostics.Debug.WriteLineIf(DEBUG, "user: "******" - names: " + lobby.nicknames.Count + " - friends: " + lobby.participating_friends.Count);
                cl = _chatLobbies[ID];
                cl.Lobby = lobby;
                cl.ChatUser = lobby.participating_friends;
                _chatLobbies[ID] = cl;
                _b.GUI.clb_chatLobbies.Items[cl.Index] = nameToShow;

                if (lobby.lobby_state == ChatLobbyInfo.LobbyState.LOBBYSTATE_INVITED && !cl.Joined)
                    _b.GUI.clb_chatLobbies.SetItemCheckState(cl.Index, CheckState.Indeterminate);
            }
            else //new
            {
                System.Diagnostics.Debug.WriteLineIf(DEBUG, "adding lobby " + lobby.lobby_name + " - state " + lobby.lobby_state);
                System.Diagnostics.Debug.WriteLineIf(DEBUG, "user: "******" - names: " + lobby.nicknames.Count + " - friends: " + lobby.participating_friends.Count);
                cl.Lobby = lobby;
                cl.Index = (ushort)_b.GUI.clb_chatLobbies.Items.Count;
                cl.Joined = (lobby.lobby_state == ChatLobbyInfo.LobbyState.LOBBYSTATE_JOINED);
                cl.Unread = false;
                cl.ChatText = "======= " + DateTime.Now.ToLongDateString() + " - " + lobby.lobby_name + " =======\n";
                cl.ChatUser = lobby.participating_friends;

                _b.GUI.clb_chatLobbies.Items.Add(nameToShow, cl.Joined);
                if (lobby.lobby_state == ChatLobbyInfo.LobbyState.LOBBYSTATE_INVITED)
                    _b.GUI.clb_chatLobbies.SetItemCheckState(cl.Index, CheckState.Indeterminate);

                _chatLobbies.Add(cl.ID, cl);
            }
        }
コード例 #2
0
ファイル: ChatProcessor.cs プロジェクト: hunbernd/RSSSHClient
        internal void AddBroadcast()
        {
            if (!_chatLobbies.ContainsKey(BROADCAST))
            {
                ChatLobbyInfo lobby = new ChatLobbyInfo();
                lobby.lobby_name = "Broadcast";
                lobby.lobby_id = BROADCAST;

                GuiChatLobby cl = new GuiChatLobby();
                cl.Lobby = lobby;
                cl.Joined = true;
                cl.Unread = false;
                {
                    _b.GUI.clb_chatLobbies.Items.Add(cl.Lobby.lobby_name, true);
                    cl.Index = (ushort)_b.GUI.clb_chatLobbies.Items.IndexOf(cl.Lobby.lobby_name);
                }
                cl.ChatText= DateTime.Now.ToShortDateString() + " - " + DateTime.Now.ToShortTimeString() + "\n";
                cl.ChatUser = new List<string> { };
                _chatLobbies.Add(cl.ID, cl);
                CheckChatRegistration();
            }
        }