Exemple #1
0
        public LeaveLine(string userName)
        {
            UserName = userName;
            Date     = DateTime.Now;
            var icon = TextImage.GetUserImageCode(userName);

            Text = TextColor.Text + "[" + TextColor.Date + Date.ToShortTimeString() + TextColor.Text + "] " + icon + " " + TextColor.Leave + UserName +
                   TextColor.Text + " left.";
        }
        public SaidExLine(string author, string message)
        {
            AuthorName = author;
            Date       = DateTime.Now;
            Message    = message;
            var icon = TextImage.GetUserImageCode(author);

            Text = TextColor.Text + "[" + TextColor.Date + Date.ToShortTimeString() + TextColor.Text + "] " + icon + " " + TextColor.Emote + "* " +
                   AuthorName + " " + Message;
        }
        public FriendJoinedBattleLine(string userName, Battle battle)
        {
            Battle   = battle;
            UserName = userName;
            Date     = DateTime.Now;
            var icon = TextImage.GetUserImageCode(userName);

            Text = string.Format("{0}[{1}{2}{3}] {4} {5}{6} has joined {7} ({8}) - zk://@join_battle:{9}",
                                 TextColor.Text,
                                 TextColor.Date,
                                 Date.ToShortTimeString(),
                                 TextColor.Text,
                                 icon,
                                 TextColor.Emote,
                                 UserName,
                                 battle.Title,
                                 battle.ModName.Trim(),
                                 battle.FounderName);
        }
        public SaidLine(string author, [NotNull] string message, DateTime?date = null)
        {
            if (message == null)
            {
                throw new ArgumentNullException("message");
            }
            var myName = Program.Conf.LobbyPlayerName;
            var me     = myName == author;
            var hilite = message.Contains(myName) && !message.StartsWith(string.Format("[{0}]", myName));

            AuthorName = author;
            if (date != null)
            {
                Date = date.Value;
            }
            else
            {
                Date = DateTime.Now;
            }
            Message = message;
            var icon = TextImage.GetUserImageCode(author);

            var textColor = TextColor.Text;

            if (me)
            {
                textColor = TextColor.History;
            }
            else if (hilite)
            {
                textColor = TextColor.Error;
            }

            Text = TextColor.Text + "[" + TextColor.Date + Date.ToLocalTime().ToShortTimeString() + TextColor.Text + "] " + icon + " " + TextColor.Username +
                   AuthorName + textColor + " " + Message;
        }