Example #1
0
        internal static void InitHook(ClassRoomCharaFile __instance)
        {
            _folderTreeView.CurrentFolder = _folderTreeView.DefaultPath;

            _customCharaFile = __instance;
            _canvas          = __instance.transform.GetComponentInParent <Canvas>();

            _targetScene = Scene.Instance.AddSceneName;
        }
            public static void ClassRoomCharaFileStartPostfix(ClassRoomCharaFile __instance)
            {
                ReactiveProperty <ChaFileControl> info        = Traverse.Create(__instance).Field("info").GetValue <ReactiveProperty <ChaFileControl> >();
                ClassRoomFileListCtrl             listCtrl    = Traverse.Create(__instance).Field("listCtrl").GetValue <ClassRoomFileListCtrl>();
                List <CustomFileInfo>             lstFileInfo = Traverse.Create(listCtrl).Field("lstFileInfo").GetValue <List <CustomFileInfo> >();
                Button enterButton = Traverse.Create(__instance).Field("enterButton").GetValue <Button>();

                enterButton.onClick.RemoveAllListeners();
                enterButton.onClick.AddListener(() =>
                {
                    var onEnter     = (Action <ChaFileControl>)AccessTools.Field(typeof(ClassRoomCharaFile), "onEnter").GetValue(__instance);
                    string fullPath = lstFileInfo.First(x => x.FileName == info.Value.charaFileName.Remove(info.Value.charaFileName.Length - 4)).FullPath;

                    ChaFileControl chaFileControl = new ChaFileControl();
                    chaFileControl.LoadCharaFile(fullPath, info.Value.parameter.sex, false, true);

                    onEnter(chaFileControl);
                    Utils.Sound.Play(SystemSE.sel);
                });
            }