Dude, after playing your game, I want to make one myself.
But I have a problem. How do you create the file for every girl in [Girlpacks]?
What should the corresponding code be?
I want to make a game similar to fm2022
Tobe made the code for this a long time ago and I've not changed it--but I can tell you the broad strokes on how it works.
First, there's the GirlClass class that contains the data structure for the girl. This just uses unity's library to read the initial values from the JSON directly for each property. For example, the property GirlClass.moneyCost is in the JSON as "moneyCost": 300, or whatever--it's just as easy as making sure the name matches the property. For internal-only properties, you just don't put those in JSONs, and you don't tell anyone they exist.
Handling the videos is easy as well. Because the name of the girl and the name of the folder must be identical, you just have the code look into the directory like StaticStrings.
PATHTOGIRLPACKS + girl.name + StaticStrings.VIDEOFOLDER + StaticStrings.SEXFOLDER + StaticStrings.BACKVAGFOLDER where the properties of StaticStrings are defined in their own static class. It then pulls a random video from the file list there (checking if that was the last video played but that's neither here nor there.)
That leaves the portraits. In initialization, it runs co-routines that load the images into unity's sprite objects for each of the 6 portrait types, and then stores them. If a portrait is missing, I then added code that has it set the references for missing portraits to the level below, ensuring that all 6 portraits have a representative in the code (and therefore doesn't have to check every type it calls a portrait). This doesn't work with Nicole, however, because she operates under completely different rules, accessing Unity's resource system.
Once you have that structure in place, it goes into the Girlpacks directory---and it checks every subdirectory for the JSON, and if it's missing, it gives an error and won't create that girl. If it is and the JSON has the wrong name, it gives an error and won't create that girl. Otherwise, it goes in and creates it.
To keep track of it, it just using a List<Girlclass> as a master list of the girls in the game. Girl gets created, added to the list, rinse repeat.
There is a snag though. You do not want to use this master list as your in-game data. In order to get around this, you have a clone method that creates a copy of the girl as a new object, and you use this as your recruited girl data. Creating a clone is important--if you just go recruitedGirlsList.Add(masterList[index]) you'll toss a reference to the master data on your recruited list and that means any changes you make to the girl (including gaining stats in the booth or other changes over time) will copy over to your master list, and on a restart this means that your girls will not 'start from scratch.'
A similar thing is necessary for Scramble Mode, though my exact implementation is different from Tobe's and I had a lot of 'learning as I go' trying to get it to work, and save properly. The recruited girls in Scramble Mode save as normal, but the list of girls to be recruited needed to be saved seperately as well.
----
Now, if you want to make a game along these lines, if I may?
There is no need to reinvent the wheel! Just go into this thread, look up Tobe's posts, and you should be able to find his link to the 8.1 source code. Study it (the GirlClass.cs in particular, as well as RegisterGirl.cs and StaticFunctions.cs and StaticStrings.cs is where the meat of what you're looking for is) and use it as a basis of your own. Port the code over that does the loading and initialization, and leave out the part that loads data from the Girlpack's JSON.
Then you can have a second JSON it'd pull your game's specific data from, and have that in the same place the description.JSON is. Have code that can generate a new one from scratch and save it as a JSON (unity has this in its library) and badabing badaboom, you're now able to use VC girlpacks in your game.
You'll want to add an interface for selecting the location for the girlpack folder (do NOT copy VC's for this, for your own sanity TRUST ME) but other than that, bob's your uncle.
I fully support and endorse other games using VC Girlpacks as expandable user-made content for their own--I love TUSC's take on it and I do not see more games using this as a bad thing.