Example #1
0
        public void HandleMessage(Player player, TaggedMessage taggedmsg)
        {
            switch (taggedmsg.tag)
            {
            case Tag.msg:
                Console.WriteLine($"<{player.ID}>" + taggedmsg.tag);
                Console.WriteLine($"<{player.ID}>" + taggedmsg.message);
                break;

            case Tag.sun:
                player.UserName = taggedmsg.message;
                break;

            case Tag.cns:
                int     newSessionID = ++sessionID;
                Session newSession   = new Session(newSessionID);
                newSession.AddPlayer(lobby, player);
                sessions.TryAdd(newSessionID, newSession);
                break;

            case Tag.jas:
                break;

            default:
                Console.WriteLine($"<{player.ID}>" + "Something went Wrong in the Tag...");
                Console.WriteLine($"<{player.ID}>" + taggedmsg.tag);
                break;
            }
        }