internal static void CustomSelectListCtrl_OnPointerClick_Postfix(CustomSelectListCtrl __instance, GameObject obj) { if (__instance.onChangeItemFunc == null || obj == null) { return; } OnCustomSelectListClick?.Invoke(__instance, new CustomSelectListCtrlEventArgs(obj)); }
internal static void Init() { OnMakerStartLoading += (_sender, _args) => { Core.DebugLog($"[OnMakerStartLoading]"); CurrentAccssoryIndex = -1; Inside = true; KKAPI.Hooks.OnMakerStartLoadingPatch(); _hookInstance = Harmony.CreateAndPatchAll(typeof(Hooks)); if (MoreAccessories.Installed) { _hookInstance.Patch(MoreAccessories.Instance.GetType().GetMethod("UpdateMakerUI", AccessTools.all), postfix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.MoreAccessories_UpdateMakerUI_Postfix))); } }; OnMakerBaseLoaded += (_sender, _args) => { Core.DebugLog($"[OnMakerBaseLoaded]"); if (MoreAccessories.Installed) { MoreAccessories.OnMakerBaseLoaded(); } }; OnMakerFinishedLoading += (_sender, _args) => { Core.DebugLog($"[OnMakerFinishedLoading]"); Loaded = true; _hookInstance.Patch(typeof(CvsAccessory).GetMethod("UpdateCustomUI", AccessTools.all), prefix: new HarmonyMethod(typeof(Hooks), nameof(Hooks.CvsAccessory_UpdateCustomUI_Prefix))); CvsScrollable = GameObject.Find("tglSlot01/Slot01Top/tglSlot01ScrollView") != null; int _onCustomSelectListClickCount = OnCustomSelectListClick?.GetInvocationList()?.Length ?? 0; if (_onCustomSelectListClickCount > 0) { Core.DebugLog($"[MakerFinishedLoading][(OnCustomSelectListClick: {_onCustomSelectListClickCount}]"); _hookInstance.PatchAll(typeof(HooksCustomSelectListCtrl)); } int _onPointerEnterCount = OnPointerEnter?.GetInvocationList()?.Length ?? 0; int _onPointerExitCount = OnPointerExit?.GetInvocationList()?.Length ?? 0; if (_onPointerEnterCount + _onPointerExitCount > 0) { Core.DebugLog($"[MakerFinishedLoading][(OnPointerEnter + OnPointerExit: {_onPointerEnterCount + _onPointerExitCount}]"); _hookInstance.PatchAll(typeof(HooksSelectable)); } CvsNavMenuInit(Singleton <CustomChangeMainMenu> .Instance); if (MoreAccessories.Installed) { MoreAccessories.OnMakerFinishedLoading(); } }; OnMakerExiting += (_sender, _args) => { Core.DebugLog($"[OnMakerExiting]"); CurrentAccssoryIndex = -1; Inside = false; Loaded = false; _hookInstance.UnpatchAll(_hookInstance.Id); _hookInstance = null; }; OnSelectedMakerSlotChanged += (_sender, _args) => { Core.DebugLog($"[OnSelectedMakerSlotChanged][{_args.OldSlotIndex}][{_args.NewSlotIndex}]"); }; OnSlotAdded += (_sender, _args) => { Core.DebugLog($"[OnSlotAdded][{_args.SlotIndex}][{_args.SlotTemplate.name}]"); _args.SlotTemplate.GetComponent <CvsNavSideMenuEventHandler>().SlotIndex = _args.SlotIndex; }; OnCvsNavMenuClick += (_sender, _args) => { Core.DebugLog($"[OnCvsNavMenuClick][{_args.TopIndex}][{_args.SideToggle.name}][{_args.Changed}]"); }; OnClothesCopy += (_sender, _args) => { Core.DebugLog($"[OnClothesCopy][{_args.SourceCoordinateIndex}][{_args.DestinationCoordinateIndex}][{_args.DestinationSlotIndex}]"); }; if (MoreAccessories.Installed) { EventInfo _event = MoreAccessories.Instance.GetType().GetEvent("onCharaMakerSlotAdded"); _event.AddEventHandler(MoreAccessories.Instance, new Action <int, Transform>((_slotIndex, _transform) => OnSlotAdded(null, new SlotAddedEventArgs(_slotIndex, _transform)))); //(MoreAccessories.Instance as MoreAccessoriesKOI.MoreAccessories).onCharaMakerSlotAdded += new Action<int, Transform>((_slotIndex, _transform) => OnSlotAdded(null, new SlotAddedEventArgs(_slotIndex, _transform))); } }