Esempio n. 1
0
        private void OnChatMemberInfo(SteamFriends.ChatMemberInfoCallback callback)
        {
            var stateChangeInfo = callback.StateChangeInfo;
            var chatRoomID      = callback.ChatRoomID;
            var chatterID       = stateChangeInfo.ChatterActedOn;

            if (!ChatRoomManager.ChatRoomExists(chatRoomID) ||
                !UserManager.UserExists(chatterID))
            {
                return;
            }

            var user     = UserManager.GetUser(chatterID);
            var chatRoom = ChatRoomManager.GetChatRoom(chatRoomID);

            switch (stateChangeInfo.StateChange)
            {
            case EChatMemberStateChange.Banned:
            case EChatMemberStateChange.Disconnected:
            case EChatMemberStateChange.Kicked:
            case EChatMemberStateChange.Left:
                Console.WriteLine("Removing {0} from {1}", user.Name, chatRoom.Name);

                // Trigger LeftChat for each module.
                ModuleManager.LeftChat(callback);

                // Remove this user from the chat room.
                chatRoom.RemoveUser(user);
                break;
            }
        }