Exemplo n.º 1
0
        public static FrameData Get_Mouth_Frame_Data(OfficialSetData set_data, BustupData bustup_data, MakerCommandData command_data)
        {
            // Create variables for the folder and JSON that contains the data for the set.
            string data_folder = $@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Data//Template_Data//{set_data.Origin}//Bustup//{set_data.ID}";
            string data_sheet  = "mouth_frame_data.json";

            // If the file folder doesn't exist, create it.
            if (!Directory.Exists(data_folder))
            {
                Directory.CreateDirectory(data_folder);
            }

            // If the file exists at the specified directory, load its contents.
            if (File.Exists(data_folder + "/" + data_sheet))
            {
                // Load the data sheet for the selected sprite set.
                frame_data_list = Load_Frame_Data_List(data_folder + "/" + data_sheet).ToList();

                // To create the filename for the frame, delete the file extention at the end of the base bustup's filename first.
                string bustup_filename = bustup_data.Filename.Substring(0, bustup_data.Filename.Length - 4);

                // Combine the base bustup filename substring with the needed frame suffix to create the frame filename.
                string frame_filename = $"{bustup_filename}_m{command_data.Mouth_Frame}.png";

                // Return the frame data info by using its filename to search for its entry.
                return(Frame_Data_From_Filename(frame_filename));
            }
            // If the file doesn't exist, create it.
            else
            {
                Create_Mouth_Frame_Data_List(set_data);
                return(Get_Mouth_Frame_Data(set_data, bustup_data, command_data));
            }
        }
Exemplo n.º 2
0
        public static List <BustupData> Create_Bustup_Data_List(OfficialSetData set_data) // For dev purposes only
        {
            var new_list = new List <BustupData>();

            string bustup_path = $@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Templates//{set_data.Origin}//Bustup//{set_data.ID}";
            string data_path   = $@"{AssetDirectoryConfig.assetDirectory.assetFolderPath}//SceneMaker//Data//Template_Data//{set_data.Origin}//Bustup//{set_data.ID}//bustup_data.json";

            // Get a count of how many files are in the sprite set's directory.
            int filecount = OfficialSetMethods.AttachmentCountItemDirectory(bustup_path);

            // Create a loop starting at 1 meant to iterate though every file in the directory.
            // Expression numbers always start at 1, so we'll begin there.
            for (int expression = 1; expression <= filecount; expression++)
            {
                // Inside, create a secondary loop also meant to iterate though every file in the directory.
                // This loop is searching for outfits, which start at 1.
                for (int outfit = 1; outfit <= filecount; outfit++)
                {
                    // Here, we're going to create a file path that could potentially exist given the combination of expression and outfit numbers.
                    // Check if the created file path string exists.
                    if (File.Exists($"{bustup_path}//{set_data.ID.ToLower()}_{expression}_{outfit}.png"))
                    {
                        var new_bustup_data = new BustupData()
                        {
                            Filename             = $"{set_data.ID.ToLower()}_{expression}_{outfit}.png",
                            Default_Name_EN      = "Rise",
                            Default_Name_JPN     = "久慈川 りせ",
                            P4D_Scale_Width      = 1024,
                            P4D_Scale_Height     = 1024,
                            P4D_Left_Coord_X     = -64,
                            P4D_Left_Coord_Y     = 64,
                            P4D_Center_Coord_X   = 448,
                            P4D_Center_Coord_Y   = 64,
                            P4D_Right_Coord_X    = 960,
                            P4D_Right_Coord_Y    = 64,
                            P4D_Nav_Scale_Width  = 0,
                            P4D_Nav_Scale_Height = 0,
                            P4D_Nav_Coord_X      = 0,
                            P4D_Nav_Coord_Y      = 0,
                            P4D_Dual_Flip        = false
                        };
                        new_list.Add(new_bustup_data);
                    }
                }
            }

            try
            {
                string json = JsonConvert.SerializeObject(new_list, Formatting.Indented);
                File.WriteAllText(data_path, json);
            }
            catch (Exception e)
            {
                Console.WriteLine($"'{e}'");
            }

            return(new_list);
        }