public void UpdateDisplayFarmers() { for (int i = 0; i < availableTextures.Count; i++) { var textureIndex = i + _startingRow * _texturesPerRow; if (textureIndex < filteredTextureOptions.Count) { var targetPack = filteredTextureOptions[textureIndex]; string modDataKey = null; AppearanceModel appearanceModel = null; switch (_appearanceFilter) { case HandMirrorMenu.HAIR_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_HAIR_ID; appearanceModel = (targetPack as HairContentPack).GetHairFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.ACCESSORY_FILTER_BUTTON: modDataKey = _callbackMenu.GetCurrentAccessorySlotKey(); appearanceModel = (targetPack as AccessoryContentPack).GetAccessoryFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.HAT_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_HAT_ID; appearanceModel = (targetPack as HatContentPack).GetHatFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.SHIRT_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_SHIRT_ID; appearanceModel = (targetPack as ShirtContentPack).GetShirtFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.PANTS_FILTER_BUTTON: modDataKey = ModDataKeys.CUSTOM_PANTS_ID; appearanceModel = (targetPack as PantsContentPack).GetPantsFromFacingDirection(fakeFarmers[i].facingDirection); break; case HandMirrorMenu.SLEEVES_FILTER_BUTTON: if (_callbackMenu.GetCurrentFeatureSlotKey() == ModDataKeys.CUSTOM_SHOES_ID) { modDataKey = ModDataKeys.CUSTOM_SHOES_ID; appearanceModel = (targetPack as ShoesContentPack).GetShoesFromFacingDirection(fakeFarmers[i].facingDirection); } else { modDataKey = ModDataKeys.CUSTOM_SLEEVES_ID; appearanceModel = (targetPack as SleevesContentPack).GetSleevesFromFacingDirection(fakeFarmers[i].facingDirection); } break; } fakeFarmers[i].modData[modDataKey] = targetPack.Id; FashionSense.ResetAnimationModDataFields(fakeFarmers[i], 0, AnimationModel.Type.Idle, fakeFarmers[i].facingDirection); FashionSense.SetSpriteDirty(); } } }
internal AppearanceInfo(AppearanceModel model) { Hair = new(model.Hair); EyeColor = model.EyeColor; SkinColor = model.SkinColor; EquippedHair = new(model.EquippedHair); EquippedEyeColor = model.EquippedEyeColor; EquippedSkinColor = model.EquippedSkinColor; }
public ActionResult Appearance() { var setting = _settingService.Queryable().FirstOrDefault(); var model = new AppearanceModel() { ID = setting.ID, CoverPhotoUrl = ImageHelper.GetCommunityImagePath("cover"), FaviconUrl = ImageHelper.GetCommunityImagePath("favicon"), LogoUrl = ImageHelper.GetCommunityImagePath("logo", "png") }; return(View(model)); }
public async Task <ActionResult> AppearanceUpdate(AppearanceModel model) { var settingExisting = _settingService.Query(x => x.ID == model.ID).Select().FirstOrDefault(); settingExisting.ObjectState = Repository.Pattern.Infrastructure.ObjectState.Modified; _settingService.Update(settingExisting); await _unitOfWorkAsync.SaveChangesAsync(); _dataCacheService.UpdateCache(CacheKeys.Settings, settingExisting); SavePicture(model.Favicon, "favicon", new Size(32, 32)); SavePicture(model.CoverPhoto, "cover", new Size(1048, 0)); SavePicture(model.Logo, "logo", new Size(200, 30), "png"); return(RedirectToAction("Appearance")); }
public void ClientEvent_SubmitNewCharacter(Client client, string dataAsJson) { if (!client.IsLoggedIn()) { return; } var newCharData = JsonConvert.DeserializeObject <AppearanceJson>(dataAsJson); if (!ValidateString(ValidationStrings.CharFirstName, newCharData.firstname)) { client.TriggerEvent(Events.ServerToClient.Character.ResetCharCreation, "There is something wrong with that first name."); return; } if (!ValidateString(ValidationStrings.CharFirstName, newCharData.lastname)) { client.TriggerEvent(Events.ServerToClient.Character.ResetCharCreation, "There is something wrong with that first name."); return; } TaskManager.Run(client, async() => { var charName = $"{newCharData.firstname}_{newCharData.lastname}"; var ch = await CharacterModel.ReadByKeyAsync(() => new CharacterModel().CharacterName, charName); if (ch.Any()) { client.TriggerEvent(Events.ServerToClient.Character.ResetCharCreation, "That character name already exists."); return; } await CharacterModel.CreateNewAsync(client.GetAccount(), charName); var newChIEnumerable = await CharacterModel.ReadByKeyAsync(() => new CharacterModel().CharacterName, charName); var newCh = newChIEnumerable.First(); var pedhash = newCharData.isMale ? PedHash.FreemodeMale01 : PedHash.FreemodeFemale01; var newChApp = new AppearanceModel(pedhash, newCh); newChApp.Populate(newCharData); await AppearanceModel.CreateAsync(newChApp); client.TriggerEvent(Events.ServerToClient.Character.SuccessCharCreation); }); }
public void ClientEvent_SubmitCharacterSelection(Client client, int selectedCharId) { if (!client.IsLoggedIn()) { return; } if (selectedCharId < 0) { return; } TaskManager.Run(client, async() => { var fetchedChar = await CharacterModel.ReadAsync(selectedCharId); if (fetchedChar == null) { client.SendChatMessage("Error retriving char. Bad char id?"); return; } var accData = client.GetAccount(); if (accData == null) { return; } if (accData.ID != fetchedChar.CharOwnerID) { client.SendChatMessage("That is not your character. Ban/Kick?"); return; } var app = (await AppearanceModel.ReadByKeyAsync(() => new AppearanceModel().CharacterID, fetchedChar.ID)).FirstOrDefault(); if (app != null) { app.Apply(client); } client.Transparency = 255; }); }
public MainWindowViewModel() { this.IpfFile = new IpfFileModel(); this.Appearance = new AppearanceModel(); }