示例#1
0
        public static IUser FromJson(string json)
        {
            dynamic d         = Newtonsoft.Json.JsonConvert.DeserializeObject(json);
            var     userId    = d.userid.Value;
            var     nick      = d.nickname.Value;
            var     backColor = d.backcolor.Value;
            var     foreColor = d.forecolor.Value;
            var     isNg      = d.is_ng.Value.ToLower() == "true";
            var     name      = d.name;
            var     nameItems = new List <IMessagePart>();

            if (name != null)
            {
                foreach (var nameItem in name)
                {
                    if (nameItem.type == "text")
                    {
                        var val = nameItem.value.Value;
                        nameItems.Add(MessagePartFactory.CreateMessageText(val));
                    }
                }
            }
            var user = new UserTest(userId)
            {
                Name = nameItems, Nickname = nick, BackColorArgb = backColor, ForeColorArgb = foreColor, IsNgUser = isNg
            };

            return(user);
        }
 /// <summary>
 /// 来場者数とかのような特定のユーザが出したものではない場合にこっち
 /// </summary>
 /// <param name="options"></param>
 /// <param name="message"></param>
 public BroadcastInfoCommentViewModel(ICommentOptions options, string message)
     : base(options, DefaultUser, null, false)
 {
     MessageItems = new List <IMessagePart>
     {
         MessagePartFactory.CreateMessageText(message),
     };
 }
 public SystemInfoCommentViewModel(ICommentOptions options, string message, InfoType type)
     : base(options, _user, null, false)
 {
     MessageItems = new List <IMessagePart>
     {
         MessagePartFactory.CreateMessageText(message),
     };
     Type = type;
 }
示例#4
0
 protected virtual void NicknameChanged()
 {
     if (!string.IsNullOrEmpty(User.Nickname))
     {
         NickItemsInternal = new List <IMessagePart> {
             MessagePartFactory.CreateMessageText(User.Nickname)
         };
     }
     else
     {
         NickItemsInternal = null;
     }
 }
 /// <summary>
 /// 投げ銭とかアイテムとかユーザを識別したい場合に使う
 /// </summary>
 /// <param name="options"></param>
 /// <param name="message"></param>
 /// <param name="user"></param>
 public BroadcastInfoCommentViewModel(ICommentOptions options, string message, IUser user, ICommentProvider cp)
     : this(options, new List <IMessagePart> {
     MessagePartFactory.CreateMessageText(message)
 }, user, cp)
 {
 }