예제 #1
0
        // add data from *phot_motion_list*.nei files to PhotoMotionData.motion_data_
        public static void PhotMotExt()
        {
            string[] PhotoMotNei = null;

            PhotoMotNei = GameUty.FileSystemMod.GetList("PhotMot_NEI", AFileSystemBase.ListType.AllFile);


            //   if (PhotoMotNei == null || PhotoMotNei.Length == 0)
            //   { return; }

            foreach (string str in PhotoMotNei)
            {
                string nei_filename = Path.GetFileName(str);

                if (Path.GetExtension(nei_filename) == ".nei" && nei_filename != "phot_motion_list.nei")
                {
                    using (AFileBase aFileBase = GameUty.FileSystem.FileOpen(nei_filename))
                    {
                        using (CsvParser csvParser = new CsvParser())
                        {
                            if (csvParser.Open(aFileBase))
                            {
                                for (int i = 1; i < csvParser.max_cell_y; i++)
                                {
                                    int             num             = 0;
                                    PhotoMotionData photoMotionData = new PhotoMotionData(); // this requires prepatched assembly to compile
                                    photoMotionData.id                = (long)csvParser.GetCellAsInteger(num++, i);
                                    photoMotionData.category          = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.name              = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.direct_file       = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.is_loop           = (csvParser.GetCellAsString(num++, i) == "○");
                                    photoMotionData.call_script_fil   = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.call_script_label = csvParser.GetCellAsString(num++, i);
                                    photoMotionData.is_mod            = false;
                                    string cellAsString = csvParser.GetCellAsString(num++, i);
                                    bool   flag         = csvParser.GetCellAsString(num++, i) == "○";
                                    photoMotionData.use_animekey_mune_l = (photoMotionData.use_animekey_mune_r = flag);
                                    photoMotionData.is_man_pose         = (csvParser.GetCellAsString(num++, i) == "○");
                                    PhotoMotionData.motion_data_.Add(photoMotionData);
                                }
                            }
                            else
                            {
                                Debug.Log($"Skipping invalid file: Mod/{str}");
                            }
                        }
                    }
                }
            }
        }
        private static void SetEverydaySub(FreeModeItemEveryday.ScnearioType type, string fileName, AbstractFreeModeItem.GameMode gameMode, string fixingFlagText)
        {
            AFileBase afileBase;

            if (gameMode == AbstractFreeModeItem.GameMode.CM3D2)
            {
                afileBase = GameUty.FileSystemOld.FileOpen(fileName);
            }
            else
            {
                if (gameMode != AbstractFreeModeItem.GameMode.COM3D)
                {
                    return;
                }
                afileBase = GameUty.FileSystem.FileOpen(fileName);
            }
            using (afileBase)
            {
                using (CsvParser csvParser = new CsvParser())
                {
                    bool condition = csvParser.Open(afileBase);
                    NDebug.Assert(condition, fileName + "\nopen failed.");
                    for (int i = 1; i < csvParser.max_cell_y; i++)
                    {
                        if (csvParser.IsCellToExistData(0, i))
                        {
                            int cellAsInteger = csvParser.GetCellAsInteger(0, i);

                            int num = 1;
                            if (gameMode != AbstractFreeModeItem.GameMode.CM3D2 || type != FreeModeItemEveryday.ScnearioType.Nitijyou)
                            {
                                string name            = csvParser.GetCellAsString(num++, i);
                                string call_file_name  = csvParser.GetCellAsString(num++, i);
                                string check_flag_name = csvParser.GetCellAsString(num++, i);
                                if (gameMode == AbstractFreeModeItem.GameMode.COM3D)
                                {
                                    bool netorare = (csvParser.GetCellAsString(num++, i) == "○");
                                }
                                string        info_text = csvParser.GetCellAsString(num++, i);
                                List <string> list      = new List <string>();
                                for (int j = 0; j < 9; j++)
                                {
                                    if (csvParser.IsCellToExistData(num, i))
                                    {
                                        list.Add(csvParser.GetCellAsString(num, i));
                                    }
                                    num++;
                                }
                                int subHerionID = csvParser.GetCellAsInteger(num++, i);
                                while (csvParser.IsCellToExistData(num, 0))
                                {
                                    if (csvParser.GetCellAsString(num, i) == "○")
                                    {
                                        string cellAsString = csvParser.GetCellAsString(num, 0);
                                        //Personal.Data data = Personal.GetData(cellAsString);
                                    }
                                    num++;
                                }

                                if (GameMain.Instance.CharacterMgr.status.GetFlag(fixingFlagText + check_flag_name) == 0)
                                {
                                    MyLog.LogMessage("SetEverydaySub.Flag"
                                                     , check_flag_name
                                                     , call_file_name
                                                     , cellAsInteger
                                                     , name
                                                     , info_text
                                                     );
                                    GameMain.Instance.CharacterMgr.status.SetFlag(fixingFlagText + check_flag_name, 1);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        // add data to desk_item_detail.nei and desk_item_category.nei
        public static void DeskData_Ext()
        {
#if DEBUG
            Console.WriteLine("Console.Writeline says hi");
            Debug.Log("Debug.Log says hi");
#endif

            string[] DeskItemList = null;
            DeskItemList = GameUty.FileSystemMod.GetList("DeskItem_NEI", AFileSystemBase.ListType.AllFile);
            if (DeskItemList == null || DeskItemList.Length == 0)
            {
                return;
            }

            foreach (string str in  DeskItemList)
            {
                string neifile   = Path.GetFileName(str);
                string extension = Path.GetExtension(neifile);

                // check if file is indeed a .nei file and it snot mennt to overwrite base files
                // also check if the file is category type or detail type to determine the processing
                // only files that contain category in their name are assumed to be category files all others nei files are assumbed to be detail files

                if (neifile.Contains("category") && extension == ".nei" && neifile != "desk_item_category.nei")
                {
                    using (AFileBase afileBase = GameUty.FileSystem.FileOpen(neifile))
                    {
                        using (CsvParser csvParser = new CsvParser())
                        {
                            bool condition = csvParser.Open(afileBase);
                            for (int k = 1; k < csvParser.max_cell_y; k++)
                            {
                                if (!csvParser.IsCellToExistData(0, k))
                                {
                                    break;
                                }
                                int    cellAsInteger = csvParser.GetCellAsInteger(0, k);
                                string cellAsString  = csvParser.GetCellAsString(1, k);
                                if (!DeskManager.item_category_data_dic_.ContainsKey(cellAsInteger))
                                {
                                    DeskManager.item_category_data_dic_.Add(cellAsInteger, cellAsString);
                                }
                            }
                        }
                    }
                }
                else if (neifile != "desk_item_detail.nei" && extension == ".nei")
                {
                    using (AFileBase afileBase = GameUty.FileSystem.FileOpen(neifile))
                    {
                        using (CsvParser csvParser = new CsvParser())
                        {
                            if (csvParser.Open(afileBase))
                            {
                                for (int j = 1; j < csvParser.max_cell_y; j++)
                                {
                                    if (csvParser.IsCellToExistData(0, j))
                                    {
                                        int cellAsInteger2            = csvParser.GetCellAsInteger(0, j);
                                        DeskManager.ItemData itemData = new DeskManager.ItemData(csvParser, j);


                                        // check if it's a prefab data and add it if it is
                                        // is impossible to check if prefab exists in resources files
                                        // so if referenced prefab doesn't exist i ngame files, the entry isn't going to work properly in game
                                        if (!string.IsNullOrEmpty(itemData.prefab_name))
                                        {
                                            itemData.id = itemData.prefab_name.GetHashCode();// override the id from file with hash of prefab string to minimize id conflicts
                                            DeskManager.item_detail_data_dic_.Add(itemData.id, itemData);
                                        }

                                        // check if entry refers to asset bundle, and if it is, check if it exists before addding the data
                                        else if (!string.IsNullOrEmpty(itemData.asset_name) && GameUty.BgFiles.ContainsKey(itemData.asset_name + ".asset_bg"))
                                        {
                                            itemData.id = itemData.asset_name.GetHashCode();
                                            DeskManager.item_detail_data_dic_.Add(itemData.id, itemData);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                Debug.Log($"Skipping invalid file: Mod/{str}");
                            }
                        }
                    }
                }
            }
        }