Beispiel #1
0
 //This is used when an inspected recipe asset is saved
 public override void Save(UMAData.UMARecipe umaRecipe, UMAContext context)
 {
     if (recipeType == "Wardrobe")        //Wardrobe Recipes can save the standard UMA way- they dont have WardrobeSets- although the recipe string wont have a packedRecipeType field
     {
         base.Save(umaRecipe, context);
     }
     else if (recipeType != "Standard")        //this will just be for type DynamicCharacterAvatar- and WardrobeCollection if we add that
     {
         var packedRecipe = PackRecipeV2(umaRecipe);
         //DCSPackRecipe doesn't do any more work, it just gets the values from PackRecipeV2 that we need and discards the rest
         var packedRecipeToSave = new DCSPackRecipe(packedRecipe, this.name, recipeType, activeWardrobeSet);
         recipeString = JsonUtility.ToJson(packedRecipeToSave);
     }
     else         //This will be Standard- this is 'backwards Compatible' and is also how the Recipe Editor saves 'backwardsCompatible' 'Standard' recipes when they are inspected
     {
         umaRecipe.MergeMatchingOverlays();
         var packedRecipe       = PackRecipeV2(umaRecipe);
         var packedRecipeToSave = new DCSUniversalPackRecipe(packedRecipe);            //this gets us a recipe with all the standard stuff plus our extra fields
         //so now we can save the wardrobeSet into it if it existed
         if (activeWardrobeSet != null)
         {
             if (activeWardrobeSet.Count > 0)
             {
                 packedRecipeToSave.wardrobeSet = activeWardrobeSet;
             }
         }
         recipeString = JsonUtility.ToJson(packedRecipeToSave);
     }
 }