private void ClothesListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count <= 0) { return; } _selectedCloth = (ClothData)e.AddedItems[0]; if (_selectedCloth == null) { return; } clothEditWindow.Visibility = Visibility.Collapsed; pedPropEditWindow.Visibility = Visibility.Collapsed; editGroupBox.Visibility = Visibility.Visible; if (_selectedCloth.IsComponent()) { clothEditWindow.Visibility = Visibility.Visible; drawableName.Text = _selectedCloth.Name; texturesList.ItemsSource = _selectedCloth.Textures; firstPersonModelPath.Text = _selectedCloth.FirstPersonModelPath != "" ? _selectedCloth.FirstPersonModelPath : "Not selected..."; unkFlag1Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag1; unkFlag2Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag2; unkFlag3Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag3; unkFlag4Check.IsChecked = _selectedCloth.PedComponentFlags.unkFlag4; isHighHeelsCheck.IsChecked = _selectedCloth.PedComponentFlags.isHighHeels; PostfixUCheck.IsChecked = _selectedCloth.IsPostfix_U(); PostfixRCheck.IsChecked = !_selectedCloth.IsPostfix_U(); } else { pedPropEditWindow.Visibility = Visibility.Visible; drawableName.Text = _selectedCloth.Name; pedPropName.Text = _selectedCloth.Name; pedPropTexturesList.ItemsSource = _selectedCloth.Textures; pedPropFlag1.IsChecked = _selectedCloth.PedPropFlags.unkFlag1; pedPropFlag2.IsChecked = _selectedCloth.PedPropFlags.unkFlag2; pedPropFlag3.IsChecked = _selectedCloth.PedPropFlags.unkFlag3; pedPropFlag4.IsChecked = _selectedCloth.PedPropFlags.unkFlag4; pedPropFlag5.IsChecked = _selectedCloth.PedPropFlags.unkFlag5; } }
public void AddClothTextures(ClothData cloth) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes texture (*.ytd)|*.ytd", FilterIndex = 1, DefaultExt = "ytd", Multiselect = true }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames.Where(f => f.EndsWith(".ytd"))) { cloth.AddTexture(filename); } }
public void SetClothFirstPersonModel(ClothData cloth) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes drawable (*.ydd)|*.ydd", FilterIndex = 1, DefaultExt = "ydd", Multiselect = false }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames.Where(f => f.EndsWith(".ydd"))) { cloth.SetFirstPersonModel(filename); } }
private void RemoveUnderCursor_Click(object sender, RoutedEventArgs e) { if (_selectedCloth == null) { return; } var removedClothName = _selectedCloth.Name; var clothes = Clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); Clothes.Clear(); foreach (var cloth in clothes.Where(c => c != _selectedCloth)) { Clothes.Add(cloth); } _selectedCloth = null; editGroupBox.Visibility = Visibility.Collapsed; clothEditWindow.Visibility = Visibility.Collapsed; pedPropEditWindow.Visibility = Visibility.Collapsed; StatusController.SetStatus($"Removed '{removedClothName}'. Total clothes: " + Clothes.Count); }
public void AddClothes(ClothData.Sex targetSex) { OpenFileDialog openFileDialog = new OpenFileDialog { CheckFileExists = true, Filter = "Clothes geometry (*.ydd)|*.ydd", FilterIndex = 1, DefaultExt = "ydd", Multiselect = true, Title = "Adding " + (targetSex == ClothData.Sex.Male ? "male" : "female") + " clothes" }; if (openFileDialog.ShowDialog() != true) { return; } foreach (string filename in openFileDialog.FileNames) { string baseFileName = Path.GetFileName(filename); ClothNameResolver cData = new ClothNameResolver(baseFileName); if (cData.IsVariation) { StatusController.SetStatus($"Item {baseFileName} can't be added. Looks like it's variant of another item"); continue; } ClothData nextCloth = new ClothData(filename, cData.ClothType, cData.DrawableType, cData.BindedNumber, cData.Postfix, targetSex); if (cData.ClothType == ClothNameResolver.ClothTypes.Component) { nextCloth.SearchForFirstPersonModel(); nextCloth.SearchForTextures(); var clothes = MainWindow.Clothes.ToList(); clothes.Add(nextCloth); clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); MainWindow.Clothes.Clear(); foreach (var cloth in clothes) { MainWindow.Clothes.Add(cloth); } StatusController.SetStatus(nextCloth + " added (" + (!string.IsNullOrEmpty(nextCloth.FirstPersonModelPath) ? "FP Model found, " : "") + "Found " + nextCloth.Textures.Count + " textures). Total clothes: " + MainWindow.Clothes.Count); } else { nextCloth.SearchForTextures(); var clothes = MainWindow.Clothes.ToList(); clothes.Add(nextCloth); clothes = clothes.OrderBy(x => x.Name, new AlphanumericComparer()).ToList(); MainWindow.Clothes.Clear(); foreach (var cloth in clothes) { MainWindow.Clothes.Add(cloth); } StatusController.SetStatus(nextCloth + " added. (Found " + nextCloth.Textures.Count + " textures). Total clothes: " + MainWindow.Clothes.Count); } } }