diff --git a/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs b/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs index 321f64c..7ad78ae 100644 --- a/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs +++ b/src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs @@ -272,20 +272,15 @@ private static void CreateCustomAccessoryWindowControls() var tglSlot01GameObject = customAcsChangeSlot.transform.FindLoop("tglSlot01"); if (tglSlot01GameObject == null) throw new ArgumentNullException(nameof(tglSlot01GameObject)); var container = tglSlot01GameObject.transform.parent; -#if KK || KKS +#if KK //Set source early rather than search every time var original_scroll = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/03_ClothesTop/tglTop/TopTop/Scroll View").transform.GetComponent(); -#if KKS - var content_image = original_scroll.content.GetComponent(); -#endif var scroll_bar_area_sprite = original_scroll.verticalScrollbar.GetComponent().sprite; var scroll_bar_handle_sprite = original_scroll.verticalScrollbar.image.sprite; -#if KK var root = container.parent.parent.parent; root.Find("tglCopy").GetComponent().minWidth = 200f; root.Find("tglChange").GetComponent().minWidth = 200f; -#endif foreach (var slotTransform in container.Cast()) { var layout = slotTransform.GetComponent(); @@ -307,11 +302,8 @@ private static void CreateCustomAccessoryWindowControls() } } CreateCustomControlsInSubCategory(slotTransform, _accessoryWindowEntries, true); -#if KK || KKS +#if KK var listParent = slotTransform.Cast().Where(x => x.name.EndsWith("Top")).First(); -#if KKS - GameObject.DestroyImmediate(listParent.GetComponent());//Destroy image that contains scrollbar -#endif var elements = new List(); foreach (Transform t in listParent) elements.Add(t); @@ -333,24 +325,13 @@ private static void CreateCustomAccessoryWindowControls() scroll.verticalScrollbar.image.sprite = scroll_bar_handle_sprite; scroll.verticalScrollbar.GetComponent().sprite = scroll_bar_area_sprite; -#if KKS - //Add image that doesn't contain scroll bar - var image = scroll.content.gameObject.AddComponent(); - image.sprite = content_image.sprite; - image.type = content_image.type; -#endif Object.DestroyImmediate(scroll.horizontalScrollbar.gameObject); var content = scroll.content.transform; Object.Destroy(scroll.GetComponent()); var s_LE = scroll.gameObject.AddComponent(); -#if KK var height = (GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/04_AccessoryTop/Slots").transform as RectTransform).rect.height; var width = 400f; -#else - var height = 875f; //Slots from KK doesn't exist - var width = 400f; -#endif s_LE.preferredHeight = height; s_LE.preferredWidth = width; @@ -373,12 +354,14 @@ private static void CreateCustomAccessoryWindowControls() internal static void OnMakerAccSlotAdded(Transform newSlotTransform) { // Necessary because MoreAccessories copies existing slot, so controls get copied but with no events hooked up -#if KK || KKS +#if KK || KKS // not sure if necessary? is this useful in EC as well? //KeelsChildNeglect(newSlotTransform, 0); //used to print children paths in case it's needed in the future, like horizontal support or something if (!MakerAPI.InsideAndLoaded) { return;//Maker slots are added before CreateCustomAccessoryWindowControls is called. don't create controls yet } +#endif +#if KK //find Content where controls are placed, additional Slots are copies of first slot as such they are currently named downstream Slot01 newSlotTransform = newSlotTransform.Find("Slot01Top/tglSlot01ScrollView/Viewport/Content"); #endif