コード例 #1
0
 public Material Get(ModelVariantIdentifier variantId)
 {
     if (variantId.StainKey.HasValue && StainsAvailable)
     {
         return(Get(variantId.ImcVariant, variantId.StainKey.Value));
     }
     return(Get(variantId.ImcVariant));
 }
コード例 #2
0
 public Material Get(ModelVariantIdentifier variantId)
 {
     if (variantId.StainKey.HasValue && StainsAvailable)
         return Get(variantId.ImcVariant, variantId.StainKey.Value);
     return Get(variantId.ImcVariant);
 }
コード例 #3
0
        private bool TryGetModel(out ModelDefinition model, out ModelVariantIdentifier variant)
        {
            model = null;
            variant = default(ModelVariantIdentifier);
            if (SelectedEquipment == null)
                return false;

            var charType = RaceCharacterTypes[SelectedEquipment.RacesEquippableBy.First().Key];
            if (!SelectedEquipment.EquippableByMale)
                charType += 100;
            try {
                model = SelectedEquipment.GetModel(charType, out variant.ImcVariant);
                if (SelectedEquipment.IsDyeable && SelectedStain != null)
                    variant.StainKey = SelectedStain.Key;

                var result = (model != null);
                if (!result)
                    System.Windows.MessageBox.Show(string.Format("Unable to find model for {0} (c{1:D4}).", SelectedEquipment.Name, charType), "Model not found", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                return result;
            } catch (Exception e) {
                System.Windows.MessageBox.Show(string.Format("Failed to load model for {0} (c{1:D4}):{2}{3}", SelectedEquipment.Name, charType, Environment.NewLine, e), "Read failure", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                return false;
            }
        }