Esempio n. 1
0
        public static void ClassRoomFileListCtrlCreatePostfix(ClassRoomFileListCtrl __instance)
        {
            void OnEnter(CustomFileInfo info)
            {
                var wrapper = CharaFileInfoWrapper.CreateWrapper(info);

                Translation.Hooks.OnPointerEnterPostfix(__instance, wrapper);
            }

            void OnExit(CustomFileInfo info)
            {
                Translation.Hooks.OnPointerExitPrefix();
            }

            __instance.OnPointerEnter += OnEnter;
            __instance.OnPointerExit  += OnExit;
        }
            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);
                });
            }