示例#1
0
        public Dictionary <string, AnimationId> CollectAnimationIds(UserAvatar avatar)
        {
            Contract.Requires(avatar != null);

            var userAnims = avatar.Assets
                            .Where(asset => AssetGroups.IsTypeInGroup(asset.Type, AssetGroup.Animations))
                            .ToDictionary(asset => Rbx2Source.GetEnumName(asset.Type).Replace("Animation", ""));

            var animIds = new Dictionary <string, AnimationId>();

            foreach (string animName in R15_ANIMATION_IDS.Keys)
            {
                AnimationId animId = new AnimationId();

                if (userAnims.ContainsKey(animName))
                {
                    animId.AnimationType = AnimationType.R15AnimFolder;
                    animId.AssetId       = userAnims[animName].Id;
                }
                else
                {
                    animId.AnimationType = AnimationType.KeyframeSequence;
                    animId.AssetId       = R15_ANIMATION_IDS[animName];
                }

                animIds.Add(animName, animId);
            }

            if (userAnims.ContainsKey("Idle"))
            {
                // Remove default lookaround
                if (animIds.ContainsKey("Idle2"))
                {
                    animIds.Remove("Idle2");
                }

                // If this isn't rthro idle...
                long animId = userAnims["Idle"].Id;

                if (animId != 2510235063)
                {
                    // Remove default pose
                    if (animIds.ContainsKey("Pose"))
                    {
                        animIds.Remove("Pose");
                    }

                    // Append the pose animation
                    AnimationId pose = new AnimationId()
                    {
                        AnimationType = AnimationType.R15AnimFolder,
                        AssetId       = animId
                    };

                    animIds.Add("Pose", pose);
                }
            }

            return(animIds);
        }
示例#2
0
        public NewTask(StackPanel currentSection)
        {
            InitializeComponent();

            try
            {
                this.currentSection = currentSection;

                string sectionName = currentSection.Name;

                sectionID = int.Parse(sectionName.Remove(0, "Section".Length));

                StackPanel projectUsers = (StackPanel)FindName("ProjectUsers");
                section = new SectionDAO().Read(sectionID);

                List <User> users = new ProjectDAO().GetProjectUsers(section.ProjectId);

                foreach (User user in users)
                {
                    UserAvatar userAvatar = new UserAvatar(this, user.Id);

                    userAvatar.Uid = user.Id.ToString();
                    userAvatar.UserImage.ImageSource = new BitmapImage(new Uri(user.Picture));
                    userAvatar.ToolTip = user.Firstname + " " + user.Lastname;
                    projectUsers.Children.Add(userAvatar);
                }
            }
            catch (Exception exception)
            {
                utilities.GetNotifier().ShowError(utilities.HandleException(exception));
            }
        }
 public async Task Delete(UserAvatar userAvatar)
 {
     if (userAvatar != null)
     {
         await _userAvatarService.Delete(userAvatar);
     }
 }
示例#4
0
 private void LoadExtensions()
 {
     this.version                = this.im.LoadExtension <SoftwareVersion>();
     this.sdisco                 = this.im.LoadExtension <ServiceDiscovery>();
     this.ecapa                  = this.im.LoadExtension <EntityCapabilities>();
     this.ping                   = this.im.LoadExtension <S22.Xmpp.Extensions.Ping>();
     this.attention              = this.im.LoadExtension <Attention>();
     this.time                   = this.im.LoadExtension <EntityTime>();
     this.block                  = this.im.LoadExtension <BlockingCommand>();
     this.pep                    = this.im.LoadExtension <Pep>();
     this.userTune               = this.im.LoadExtension <UserTune>();
     this.userAvatar             = this.im.LoadExtension <UserAvatar>();
     this.userMood               = this.im.LoadExtension <UserMood>();
     this.dataForms              = this.im.LoadExtension <DataForms>();
     this.featureNegotiation     = this.im.LoadExtension <FeatureNegotiation>();
     this.streamInitiation       = this.im.LoadExtension <StreamInitiation>();
     this.siFileTransfer         = this.im.LoadExtension <SIFileTransfer>();
     this.inBandBytestreams      = this.im.LoadExtension <InBandBytestreams>();
     this.userActivity           = this.im.LoadExtension <UserActivity>();
     this.socks5Bytestreams      = this.im.LoadExtension <Socks5Bytestreams>();
     this.FileTransferSettings   = new S22.Xmpp.Client.FileTransferSettings(this.socks5Bytestreams, this.siFileTransfer);
     this.serverIpCheck          = this.im.LoadExtension <ServerIpCheck>();
     this.inBandRegistration     = this.im.LoadExtension <InBandRegistration>();
     this.chatStateNotifications = this.im.LoadExtension <ChatStateNotifications>();
     this.bitsOfBinary           = this.im.LoadExtension <BitsOfBinary>();
 }
        public static Folder AppendCharacterAssets(UserAvatar avatar, string avatarType)
        {
            Rbx2Source.PrintHeader("GATHERING CHARACTER ASSETS");

            Folder      characterAssets = new Folder();
            List <long> assetIds        = avatar.AccessoryVersionIds;

            foreach (long id in assetIds)
            {
                Asset  asset        = Asset.Get(id, "/asset/?assetversionid=");
                Folder import       = RBXM.LoadFromAsset(asset);
                Folder typeSpecific = import.FindFirstChild <Folder>(avatarType);
                if (typeSpecific != null)
                {
                    import = typeSpecific;
                }

                foreach (Instance obj in import.GetChildren())
                {
                    obj.Parent = characterAssets;
                }
            }

            return(characterAssets);
        }
示例#6
0
        public ActionResult ViewAvatar(long id)
        {
            UserAvatar avatar = this.Users.GetUserAvatar(id);

            if (avatar != null && true)
            {
                byte[] imageData = avatar.Avatar.ToArray();

                string eTag = CalculateMd5(imageData);

                if (this.Request.Headers["If-None-Match"] == eTag)
                {
                    return(this.NotModified(
                               HttpCacheability.Public,
                               DateTime.Now.AddMinutes(2)
                               ));
                }

                string mimeType = ImageUtilities.GetImageMimeType(imageData);

                return(this.Image(
                           imageData,
                           mimeType,
                           HttpCacheability.Public,
                           DateTime.Now.AddMinutes(2),
                           eTag
                           ));
            }
            else
            {
                return(this.HttpError(404, this.View("NotFound")));
            }
        }
示例#7
0
        public async Task <bool> CreateAsync(User user, Avatar avatar, CancellationToken cancellationToken = default)
        {
            cancellationToken.ThrowIfCancellationRequested();
            ThrowIfDisposed();

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }
            if (avatar == null)
            {
                throw new ArgumentNullException(nameof(avatar));
            }

            var newUserAvatar = new UserAvatar()
            {
                UserId = user.Id, AvatarId = avatar.Id
            };

            await AvatarDbContext.UserAvatar.AddAsync(newUserAvatar, cancellationToken);

            await AvatarDbContext.SaveChangesAsync(cancellationToken);

            return(true);
        }
示例#8
0
        /// <summary>
        /// 更新用户头像
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="imageBase64">用户头像</param>
        public void UpdateUserAvatar(long userId, string imageBase64)
        {
            #region save iamge

            string fileName            = "UserAvatar_" + userId;
            string relativePath        = HlxBeConsts.USER_AVATAR_DIR + "\\" + fileName;
            string fullNameNoExtension = AppDomain.CurrentDomain.BaseDirectory + relativePath;


            ImageUtil.Base64StringToImage(imageBase64, fullNameNoExtension);

            var imageFilePath = relativePath;
            #endregion

            var item = _userAvatarRepository.FirstOrDefault(x => x.UserId == userId);
            if (item == null)
            {
                item = new UserAvatar()
                {
                    UserId        = userId,
                    ImageFilePath = imageFilePath
                };
                _userAvatarRepository.Insert(item);
            }
            else
            {
                item.ImageFilePath = imageFilePath;
                _userAvatarRepository.Update(item);
            }

            //_userRepository.Update(userId, x =>
            //{
            //    x.AvatarFilePath = imageFilePath;
            //});
        }
示例#9
0
        /// <summary>
        /// Defines Mappings
        /// </summary>
        public void DefineMappings()
        {
            Mapper.CreateMap <BrewSession, BrewSession>()
            .ForMember(x => x.DateCreated, y => y.Ignore())
            .ForMember(x => x.IsActive, y => y.Ignore())
            .ForMember(x => x.IsPublic, y => y.Ignore())
            .ForMember(x => x.TastingNotes, y => y.Ignore())
            .ForMember(x => x.RecipeSummary, y => y.Ignore())
            .ForMember(x => x.BrewedByUser, y => y.Ignore())
            .ForMember(x => x.UserId, y => y.Ignore())
            .ForMember(x => x.Notes, y => y.MapFrom(z => z.Notes.Replace("\n", Environment.NewLine)));

            Mapper.CreateMap <BrewSession, BrewSessionViewModel>()
            .ForMember(x => x.BrewedByUsername, y => y.MapFrom(z => z.BrewedByUser.CalculatedUsername));

            Mapper.CreateMap <BrewSessionViewModel, BrewSession>()
            .ForMember(x => x.DateCreated, y => y.Ignore())
            .ForMember(x => x.UserId, y => y.Ignore())
            .ForMember(x => x.DateModified, y => y.Ignore())
            .ForMember(x => x.IsActive, y => y.Ignore())
            .ForMember(x => x.IsPublic, y => y.Ignore())
            .ForMember(x => x.BrewedByUser, y => y.Ignore())
            .ForMember(x => x.RecipeSummary, y => y.Ignore());

            Mapper.CreateMap <BrewSessionSummary, BrewSessionSummaryViewModel>();

            Mapper.CreateMap <BrewSessionComment, CommentViewModel>()
            .ForMember(x => x.UserName, y => y.MapFrom(z => z.User.CalculatedUsername))
            .ForMember(x => x.UserAvatarUrl, y => y.MapFrom(z => UserAvatar.GetAvatar(59, z.User.EmailAddress)))
            .ForMember(x => x.CommentText, y => y.MapFrom(z => z.CommentText.Replace("\n", Environment.NewLine)));
        }
        public override ActionResult Create(Activity activity)
        {
            if (activity.UserId != ClientsUserId)
            {
                return(Unauthorized());
            }
            List <string> userIds = new List <string>();

            userIds.Add(activity.UserId);
            UserAvatar      userAvatar        = userProfileService.GetUserAvatars(userIds)[0];
            ForeignActivity othersActivity    = new ForeignActivity();
            List <string>   activityPropNames = new List <string>();

            foreach (PropertyInfo p in typeof(Activity).GetProperties())
            {
                activityPropNames.Add(p.Name);
            }
            foreach (PropertyInfo p in othersActivity.GetType().GetProperties())
            {
                if (activityPropNames.Contains(p.Name))
                {
                    p.SetValue(othersActivity, p.GetValue(activity));
                }
            }
            othersActivity.Firstname = userAvatar.Firstname;
            othersActivity.Username  = userAvatar.Username;
            othersActivity.Lastname  = userAvatar.Lastname;
            othersActivity.Avatar    = userAvatar.Avatar;

            hubContext.Clients.All.SendAsync("newActivity", othersActivity);
            return(base.Create(activity));
        }
示例#11
0
 public static UserAvatar Avatar(long UserID, UserAvatar avatar)
 {
     using (var exodusDB = new exodusEntities())
     {
         int rezult = exodusDB.stp_User_Avatar_Update(avatar.AvatarBigName, avatar.AvatarSmallName, UserID);
         return((rezult != 0) ? avatar : null);
     }
 }
示例#12
0
        public async Task <sr <UserAvatar> > SetActive(UserAvatar userAvatar)
        {
            await Mediator.Send(new ActiveUserAvatarState.ChangeActiveUserAvatarAction {
                UserAvatar = userAvatar
            });

            return(await _base.Put <int, UserAvatar>($"api/userAvatar/setactive/{userAvatar.Id}", userAvatar.Id));
        }
示例#13
0
        public ActionResult AddComment(CommentAddViewModel commentAddViewModel)
        {
            if (!commentAddViewModel.Validate().IsValid)
            {
                return(this.Issue404());
            }

            // Normalize the Line Breaks
            commentAddViewModel.CommentText = commentAddViewModel.CommentText.Replace("\n", Environment.NewLine);

            switch (commentAddViewModel.CommentType)
            {
            case CommentType.Recipe:
                RecipeComment recipeComment;

                using (var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork())
                {
                    recipeComment             = new RecipeComment();
                    recipeComment.CommentText = commentAddViewModel.CommentText;
                    recipeComment.RecipeId    = commentAddViewModel.GenericId;
                    this.RecipeService.AddRecipeComment(recipeComment);
                    unitOfWork.Commit();
                }

                // Queue Comment Notification
                this.NotificationService.QueueNotification(NotificationType.RecipeComment, recipeComment);
                break;

            case CommentType.Session:
                BrewSessionComment brewSessionComment;

                using (var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork())
                {
                    brewSessionComment               = new BrewSessionComment();
                    brewSessionComment.CommentText   = commentAddViewModel.CommentText;
                    brewSessionComment.BrewSessionId = commentAddViewModel.GenericId;
                    this.RecipeService.AddBrewSessionComment(brewSessionComment);
                    unitOfWork.Commit();
                }

                // Queue Comment Notification
                this.NotificationService.QueueNotification(NotificationType.BrewSessionComment, brewSessionComment);
                break;

            default:
                return(this.Issue404());
            }

            var commentViewModel = new CommentViewModel();

            commentViewModel.CommentText   = commentAddViewModel.CommentText;
            commentViewModel.UserId        = this.ActiveUser.UserId;
            commentViewModel.UserName      = this.ActiveUser.Username;
            commentViewModel.UserAvatarUrl = UserAvatar.GetAvatar(59, this.ActiveUser.EmailAddress);
            commentViewModel.DateCreated   = DateTime.Now;

            return(View("_Comment", commentViewModel));
        }
示例#14
0
        public static async Task <Dictionary <int, UserAvatarOutput> > GetAvatars(BitcornGameContext dbContext, int[] users, string platform)
        {
            var avatarConfig = await dbContext.AvatarConfig.FirstOrDefaultAsync(c => c.Platform == platform);

            var userAvatars = await dbContext.UserAvatar.Where(u => users.Contains(u.UserId)).ToDictionaryAsync(x => x.UserId, x => x);

            int adds = 0;

            for (int i = 0; i < users.Length; i++)
            {
                if (!userAvatars.ContainsKey(users[i]))
                {
                    var userAvatar = new UserAvatar()
                    {
                        AvatarAddress = avatarConfig.DefaultAvatar,
                        UserId        = users[i]
                    };
                    dbContext.Add(userAvatar);
                    userAvatars.Add(users[i], userAvatar);
                    adds++;
                }
            }

            if (adds > 0)
            {
                await dbContext.SaveAsync();
            }

            return(userAvatars.Values.Select(x => new UserAvatarOutput()
            {
                UserId = x.UserId,
                Catalog = avatarConfig.Catalog,
                Avatar = x.AvatarAddress,
                AvailableAvatars = new string[] { }
            }).ToDictionary(x => x.UserId, x => x));
            //var output = new Dictionary<int, UserAvatarOutput>();

            /*
             * if (userAvatar == null)
             * {
             *  userAvatar = new UserAvatar()
             *  {
             *      AvatarAddress = avatarConfig.DefaultAvatar,
             *      UserId = user.UserId
             *  };
             *  dbContext.Add(userAvatar);
             *  await dbContext.SaveAsync();
             * }
             *
             * return new UserAvatarOutput()
             * {
             *  Catalog = avatarConfig.Catalog,
             *  Avatar = userAvatar.AvatarAddress,
             *  AvailableAvatars = new string[] { }
             * };
             */
        }
示例#15
0
        public async Task <ActionResult <UserAvatarOutputTwitchName[]> > GetAvatarsForTwitch([FromBody] GetAvatarsBody body)
        {
            var avatarConfig = await _dbContext.AvatarConfig.FirstOrDefaultAsync(c => c.Platform == "webgl");

            var names      = body.Names;
            var identities = await _dbContext.UserIdentity.Where(x => names.Contains(x.TwitchUsername)).ToArrayAsync();

            var userIds = identities.Select(x => x.UserId).ToArray();

            var foundAvatars = await _dbContext.UserAvatar.Where(x => userIds.Contains(x.UserId)).ToArrayAsync();

            //var foundIds = foundAvatars.Select(x=>x.UserId).ToArray();
            int newAvatars = 0;
            var outputs    = new List <UserAvatarOutputTwitchName>();

            for (int i = 0; i < identities.Length; i++)
            {
                UserAvatar avatar = null;
                bool       found  = false;
                for (int j = 0; j < foundAvatars.Length; j++)
                {
                    var foundAvatar = foundAvatars[j];
                    if (foundAvatar.UserId == userIds[i])
                    {
                        avatar = foundAvatar;
                        found  = true;
                        break;
                    }
                }

                if (!found)
                {
                    avatar               = new UserAvatar();
                    avatar.UserId        = userIds[i];
                    avatar.AvatarAddress = avatarConfig.DefaultAvatar;

                    _dbContext.UserAvatar.Add(avatar);
                    newAvatars++;
                }

                outputs.Add(new UserAvatarOutputTwitchName()
                {
                    AvailableAvatars = new string[0],
                    Avatar           = avatar.AvatarAddress,
                    Catalog          = avatarConfig.Catalog,
                    Name             = identities[i].TwitchUsername
                });
            }

            if (newAvatars > 0)
            {
                await _dbContext.SaveAsync();
            }


            return(outputs.ToArray());
        }
        public JsonResult ThumbnailAvatarUploadImage(string userToken)
        {
            UserInfo userInfo = GetUserInfoFromUserToken(userToken);

            try
            {
                if (userInfo != null && Request.Form.Files != null && Request.Form.Files.Count > 0)
                {
                    for (int i = 0; i < Request.Form.Files.Count; i++)
                    {
                        IFormFile file = Request.Form.Files[i];

                        if (file.Length > 0)
                        {
                            byte[] byteArray = null;
                            using (MemoryStream ms = new MemoryStream())
                            {
                                file.CopyTo(ms);
                                byteArray = ms.ToArray();
                            }

                            if (byteArray != null && byteArray.Length > 0)
                            {
                                byte[] resizeArr = ImageTool.ResizeImage(byteArray, new System.Drawing.Size(200, 200));
                                using (VistosDbContext ctx = new VistosDbContext())
                                {
                                    UserAvatar userAvatar = new UserAvatar()
                                    {
                                        Deleted      = false,
                                        Created      = DateTime.Now,
                                        Modified     = DateTime.Now,
                                        CreatedBy_FK = userInfo.UserId,
                                        Avatar       = resizeArr
                                    };
                                    ctx.UserAvatar.Add(userAvatar);
                                    ctx.SaveChanges();

                                    var staleItem = Url.Action("GetThumbnailAvatar", "VistosApi", new
                                    {
                                        id = userInfo.UserId
                                    });
                                    //**Response.RemoveOutputCacheItem(staleItem);

                                    return(Json(new { id = userAvatar.Id }));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.SaveLogError(LogLevel.Error, "ThumbnailAvatarUploadImage", ex, null, userInfo);
            }
            return(null);
        }
示例#17
0
文件: Data.cs 项目: kolya5544/GQChat
 public ClientConnectOffline(long id, string nick, string passworld, UserAvatar userAvatar,
                             string email, bool offical)
 {
     ID         = id;
     Nick       = nick;
     Passworld  = passworld;
     UserAvatar = userAvatar;
     Email      = email;
     Offical    = offical;
 }
 public static UserAvatar Generate(Stream stream, long UserID)
 {
     using (Bitmap bmp = new Bitmap(stream))
     {
         string avatarNameBig = "", avatarNameSmall = "";
         try
         {
             avatarNameBig   = DrawAndSave(bmp, GetResize(bmp.Width, bmp.Height, PicSizeBig), AvatarType.Big);
             avatarNameSmall = DrawAndSave(bmp, GetResize(bmp.Width, bmp.Height, PicSizeSmall), AvatarType.Small);
             UserAvatar updateAvatar = new UserAvatar(avatarNameBig, avatarNameSmall);
             // Async Delete From File
             Task.Factory.StartNew((object input) =>
             {
                 UserAvatar oldAvatar = (UserAvatar)input;
                 //
                 if (!oldAvatar.IsDefault)
                 {
                     if (File.Exists(oldAvatar.AvatarBigFull))
                     {
                         File.Delete(oldAvatar.AvatarBigFull);
                     }
                     if (File.Exists(oldAvatar.AvatarSmallFull))
                     {
                         File.Delete(oldAvatar.AvatarSmallFull);
                     }
                 }
                 // Update Cache
             }, Global.Cache.GetAvatar(UserID));
             //
             bmp.Dispose();
             return(Global.Cache.UpdateUserAvatar(UserID, _DL.User.Update.Avatar(UserID, updateAvatar), true));
         }
         catch (Exception ex)
         {
             // Async Delete
             Task.Factory.StartNew((object avatar) =>
             {
                 UserAvatar uploadedAvatar = (UserAvatar)avatar;
                 if (File.Exists(uploadedAvatar.AvatarBigFull))
                 {
                     File.Delete(uploadedAvatar.AvatarBigFull);
                 }
                 if (File.Exists(uploadedAvatar.AvatarSmallFull))
                 {
                     File.Delete(uploadedAvatar.AvatarSmallFull);
                 }
             }, new UserAvatar(avatarNameBig, avatarNameSmall));
             //
             bmp.Dispose();
             Log4Net.Logger.Write_Error(ex);
             // return Cache
             return(Global.Cache.GetAvatar(UserID));
         }
     }
 }
        public Dictionary <string, AnimationId> CollectAnimationIds(UserAvatar avatar)
        {
            var animIds   = new Dictionary <string, AnimationId>();
            var userAnims = avatar.Animations;

            foreach (string animName in R15_ANIMATION_IDS.Keys)
            {
                AnimationId animId = new AnimationId();

                if (userAnims.ContainsKey(animName))
                {
                    animId.AnimationType = AnimationType.R15AnimFolder;
                    animId.AssetId       = userAnims[animName];
                }
                else
                {
                    animId.AnimationType = AnimationType.KeyframeSequence;
                    animId.AssetId       = R15_ANIMATION_IDS[animName];
                }

                animIds.Add(animName, animId);
            }

            if (userAnims.ContainsKey("Idle"))
            {
                // Remove default lookaround
                if (animIds.ContainsKey("Idle2"))
                {
                    animIds.Remove("Idle2");
                }

                // If this isn't rthro idle...
                long animId = userAnims["Idle"];

                if (animId != 2510235063)
                {
                    // Remove default pose
                    if (animIds.ContainsKey("Pose"))
                    {
                        animIds.Remove("Pose");
                    }

                    // Append the pose animation
                    AnimationId pose = new AnimationId()
                    {
                        AnimationType = AnimationType.R15AnimFolder,
                        AssetId       = animId
                    };

                    animIds.Add("Pose", pose);
                }
            }

            return(animIds);
        }
示例#20
0
        public async Task <IActionResult> UploadAvatar([FromForm] UserAvatar data)
        {
            if (ModelState.IsValid)
            {
                var updatedBy = User.Claims.FirstOrDefault(s => s.Type == "userName").Value;
                var result    = await _accountRepository.UploadAvatar(data, updatedBy);

                return(Ok(result));
            }
            return(BadRequest(ModelState));
        }
示例#21
0
        public async Task <sr <UserAvatar> > Save(UserAvatar userAvatar)
        {
            var response = await _base.Post <UserAvatar, int>("api/userAvatar", userAvatar);

            if (response.Success)
            {
                userAvatar.Id = response.Data;
                return(sr <UserAvatar> .GetSuccess(userAvatar));
            }
            return(sr <UserAvatar> .Get(response.Message));
        }
示例#22
0
文件: Data.cs 项目: kolya5544/GQChat
 public ClientConnectOnly(TcpClient tcpClient, string nick, string email,
                          string passworld, long id, UserAvatar userAvatar, bool offical)
 {
     ClientSocket = tcpClient;
     Nick         = nick;
     Email        = email;
     Passworld    = passworld;
     ID           = id;
     UserAvatar   = userAvatar;
     Offical      = offical;
 }
示例#23
0
 public static void AddAvatar(long userID, UserAvatar avatar)
 {
     if (dicUserAvatars.ContainsKey(userID))
     {
         dicUserAvatars[userID] = avatar;
     }
     else
     {
         dicUserAvatars.Add(userID, avatar);
     }
 }
示例#24
0
 public static UserAvatar UpdateUserAvatar(long userID, UserAvatar avatar, bool updateCurrent = false)
 {
     AddAvatar(userID, avatar);
     //
     if (updateCurrent && Global.CurrentUser != null)
     {
         Global.CurrentUser.Avatar = avatar;
     }
     //
     return(avatar);
 }
 // Use this for initialization
 void Start()
 {
     radiusSquared      = radius * radius;
     userAvatar         = FindObjectOfType <UserAvatar>();
     nextWaypoint       = userAvatar.path[0];
     transform.position = nextWaypoint.transform.position;
     //start coroutines to send notifications at intervals
     StartCoroutine("Check_Notification", notification_vibrate);
     StartCoroutine("Check_Notification", notification_ping);
     StartCoroutine("Check_Notification", notification_voice);
 }
示例#26
0
    private UserAvatar CreateAvatarData()
    {
        UserAvatar newAvatarData = new UserAvatar
        {
            sexo   = Gender,
            cabelo = hairCode[HairColor],
            pele   = skinCode[SkinColor]
        };

        return(newAvatarData);
        //{ "sexo": 1, "cabelo": "fdebf0fa-119e-11e8-89d2-74d4359f41f2", "pele": "74f0a924-11aa-11e8-89d2-74d4359f41f2" }
    }
示例#27
0
 private void Awake()
 {
     if (instance == null || gameObject == null)
     {
         instance = this;
         DontDestroyOnLoad(instance);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#28
0
        public DashboardForm2(int userId)
        {
            InitializeComponent();
            this.userId = userId;

            UserService userService = new UserService();

            user = userService.GetElementById(userId);

            Image avatar = UserAvatar.GetAvatar(user.Avatar);

            this.avatarPicture.BackgroundImage = avatar;
        }
示例#29
0
 /// <summary>
 /// Updates the profile information in the data base.
 /// </summary>
 /// <param name="username"></param>
 /// <param name="email"></param>
 /// <param name="password"></param>
 /// <param name="image"></param>
 public void UpdateProfile(string username, string email, string password, byte[] image)
 {
     using (DataBaseContainer context = new DataBaseContainer())
     {
         User user = context.Users.ToList().Find(x => x.Username == username);
         user.Email    = email;
         user.Password = password;
         UserAvatar avatar = new UserAvatar();
         avatar.Image    = image;
         user.UserAvatar = avatar;
         context.SaveChanges();
     }
 }
示例#30
0
        public Rbx2Source()
        {
            UserAvatar defaultAvatar = UserAvatar.FromUserId(2032622);

            currentUser = defaultAvatar.UserInfo;

            InitializeComponent();

            if (!Debugger.IsAttached)
            {
                MainTab.Controls.Remove(Debug);
            }
        }