void Start()
 {
     customCharaFile = FindObjectOfType <CustomCharaFile>();
     listCtrl        = Traverse.Create(customCharaFile).Field("listCtrl").GetValue <CustomFileListCtrl>();
     BepInEx.Config.ReloadConfig();
     folderName = BepInEx.Config.GetEntry("FolderName", "", CardOrganizer.configName);
     StartCoroutine(SetListFolderDelayed());
 }
Beispiel #2
0
        public static void InitializePatch(CustomCharaFile __instance)
        {
            if (_customCharaFile == null)
            {
                _customCharaFile = __instance;

                _folderTreeView.DefaultPath   = Overlord.GetDefaultPath(__instance.chaCtrl.sex);
                _folderTreeView.CurrentFolder = _folderTreeView.DefaultPath;

                _targetScene = Scene.AddSceneName;
            }
        }
Beispiel #3
0
        private static void RefreshThumbs(CustomCharaFile listCtrl)
        {
            var traverse = Traverse.Create(listCtrl);
            // KKP - private bool Initialize(bool isDefaultDataAdd, bool reCreate)
            var target = traverse.Method("Initialize", true, false);

            if (target.MethodExists())
            {
                target.GetValue();
            }
            else
            {
                // KK/EC - private bool Initialize()
                traverse.Method("Initialize").GetValue();
            }
        }
        public static void CustomCharaFileInitializePrefix(CustomCharaFile __instance)
        {
            if (CharacterCardWatcher == null)
            {
                CustomCharaFileInstance = __instance;

                CharacterCardWatcher                       = new FileSystemWatcher();
                CharacterCardWatcher.Path                  = Singleton <CustomBase> .Instance.modeSex == 0 ? CC.Paths.MaleCardPath : CC.Paths.FemaleCardPath;
                CharacterCardWatcher.NotifyFilter          = NotifyFilters.FileName;
                CharacterCardWatcher.Filter                = "*.png";
                CharacterCardWatcher.EnableRaisingEvents   = true;
                CharacterCardWatcher.Created              += (o, ee) => CardEvent(CardEventType.CharaMakerCharacter);
                CharacterCardWatcher.Deleted              += (o, ee) => CardEvent(CardEventType.CharaMakerCharacter);
                CharacterCardWatcher.IncludeSubdirectories = true;
            }

            InCharaMaker = true;
        }
Beispiel #5
0
        public static void InitHook(CustomCharaFile __instance)
        {
            var gt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/06_SystemTop");

            _loadCharaToggle = gt.transform.Find("tglLoadChara").GetComponent <Toggle>();
            _saveCharaToggle = gt.transform.Find("tglSaveChara").GetComponent <Toggle>();

            var mt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMainMenu/BaseTop/tglSystem");

            _catToggle = mt.GetComponent <Toggle>();

            _saveFront = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CvsCaptureFront");

            _targetScene = Scene.AddSceneName;

            // Exit maker / save character dialog boxes
            _ccwGo = GameObject.FindObjectOfType <CustomCheckWindow>()?.gameObject;
        }
        public static void InitHook(CustomCharaFile __instance)
        {
            _folderTreeView.DefaultPath   = Overlord.GetDefaultPath(CustomBase.Instance.modeSex);
            _folderTreeView.CurrentFolder = _folderTreeView.DefaultPath;

            _customCharaFile = __instance;

            var gt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/06_SystemTop");

            _loadCharaToggle = gt.transform.Find("tglLoadChara").GetComponent <Toggle>();
            _saveCharaToggle = gt.transform.Find("tglSaveChara").GetComponent <Toggle>();

            var mt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMainMenu/BaseTop/tglSystem");

            _catToggle = mt.GetComponent <Toggle>();

            _saveFront = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CvsCaptureFront");

            _targetScene = Scene.Instance.AddSceneName;
        }
        internal static void InitHook(CustomCharaFile __instance)
        {
            var instance = CustomBase.Instance;

            _folderTreeView.DefaultPath   = Path.Combine(Utils.NormalizePath(UserData.Path), instance.modeSex != 0 ? @"chara/female" : "chara/male");
            _folderTreeView.CurrentFolder = _folderTreeView.DefaultPath;

            _customCharaFile = __instance;

            var gt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/06_SystemTop");

            _loadCharaToggle = gt.transform.Find("tglLoadChara").GetComponent <Toggle>();
            _saveCharaToggle = gt.transform.Find("tglSaveChara").GetComponent <Toggle>();

            var mt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMainMenu/BaseTop/tglSystem");

            _catToggle = mt.GetComponent <Toggle>();

            _saveFront = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CvsCaptureFront");

            _targetScene = Scene.Instance.AddSceneName;
        }
Beispiel #8
0
        internal static void InitHook(CustomCharaFile __instance)
        {
            Traverse.Create("ConvertChaFileScene").Method("Start").GetValue(); //todo is this necessary? doesn't seem to find the Start method even
            var instance = CustomBase.Instance;

            _folderTreeView.DefaultPath   = Path.Combine(Utils.NormalizePath(UserData.Path), instance.modeSex != 0 ? @"chara/female/" : "chara/male");
            _folderTreeView.CurrentFolder = _folderTreeView.DefaultPath;

            _customCharaFile = __instance;

            var gt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/06_SystemTop");

            _loadCharaToggle = gt.transform.Find("tglLoadChara").GetComponent <Toggle>();
            _saveCharaToggle = gt.transform.Find("tglSaveChara").GetComponent <Toggle>();

            var mt = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMainMenu/BaseTop/tglSystem");

            _catToggle = mt.GetComponent <Toggle>();

            _saveFront = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CvsCaptureFront");

            _targetScene = Scene.Instance.AddSceneName;
        }
Beispiel #9
0
        public static bool InitializePrehook(CustomCharaFile __instance)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();


            int          modeSex      = Singleton <CustomBase> .Instance.modeSex;
            FolderAssist folderAssist = new FolderAssist();

            string[] searchPattern = new string[]
            {
                "*.png"
            };
            string folder = UserData.Path + ((modeSex != 0) ? "chara/female/" : "chara/male/");

            folderAssist.CreateFolderInfoEx(folder, searchPattern, true);

            CustomFileListCtrl listCtrl = (CustomFileListCtrl)listCtrl_info.GetValue(__instance);

            listCtrl.ClearList();
            int fileCount = folderAssist.GetFileCount();
            int num       = 0;

            for (int i = 0; i < fileCount; i++)
            {
                ChaFileControl chaFileControl = new ChaFileControl();
                if (!chaFileControl.LoadCharaFile(folderAssist.lstFile[i].FullPath, 255, false, true))
                {
                    int lastErrorCode = chaFileControl.GetLastErrorCode();
                }
                else
                {
                    string club        = string.Empty;
                    string personality = string.Empty;
                    if (modeSex != 0)
                    {
                        VoiceInfo.Param param;
                        if (!Singleton <Voice> .Instance.voiceInfoDic.TryGetValue(chaFileControl.parameter.personality, out param))
                        {
                            personality = "不明";
                        }
                        else
                        {
                            personality = param.Personality;
                        }
                        ClubInfo.Param param2;
                        if (!Game.ClubInfos.TryGetValue((int)chaFileControl.parameter.clubActivities, out param2))
                        {
                            club = "不明";
                        }
                        else
                        {
                            club = param2.Name;
                        }
                    }
                    else
                    {
                        listCtrl.DisableAddInfo();
                    }
                    listCtrl.AddList(num, chaFileControl.parameter.fullname, club, personality, folderAssist.lstFile[i].FullPath, folderAssist.lstFile[i].FileName, folderAssist.lstFile[i].time, false);
                    num++;
                }
            }
            stopwatch.Stop();
            Logger.Log(LogLevel.Error, $"Cards load stage 1: [{fileCount}] {stopwatch.Elapsed}");

            stopwatch.Reset();
            stopwatch.Start();
            listCtrl.Create(__instance.OnChangeSelect);
            Logger.Log(LogLevel.Error, $"Cards load stage 2: {stopwatch.Elapsed}");
            stopwatch.Stop();

            return(false);
        }