Skip to content

Commit

Permalink
Size adjust slots and window size
Browse files Browse the repository at this point in the history
  • Loading branch information
jalil49 authored and ManlyMarco committed Jun 3, 2021
1 parent ee56a2f commit 84255b4
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/Shared.KKalike/Maker/MakerInterfaceCreator.KK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,18 @@ private static void CreateCustomAccessoryWindowControls()
#endif
var scroll_bar_area_sprite = original_scroll.verticalScrollbar.GetComponent<Image>().sprite;
var scroll_bar_handle_sprite = original_scroll.verticalScrollbar.image.sprite;

#if KK
var root = container.parent.parent.parent;
root.Find("tglCopy").GetComponent<LayoutElement>().minWidth = 200f;
root.Find("tglChange").GetComponent<LayoutElement>().minWidth = 200f;
#endif
foreach (var slotTransform in container.Cast<Transform>())
{
var layout = slotTransform.GetComponent<LayoutElement>();
layout.minWidth = 200f;
layout.preferredWidth = 200f;
}
#endif
foreach (var slotTransform in container.Cast<Transform>().Where(x => x.name.StartsWith("tglSlot")).OrderBy(x => x.name))
{
Expand Down Expand Up @@ -295,14 +307,16 @@ private static void CreateCustomAccessoryWindowControls()
var scrollTransform = DefaultControls.CreateScrollView(new DefaultControls.Resources());
scrollTransform.name = $"{slotTransform.name}ScrollView";
scrollTransform.transform.SetParent(listParent.transform, false);

listParent.transform.position -= new Vector3(30, 0, 0);
var scroll = scrollTransform.GetComponent<ScrollRect>();
scroll.horizontal = false;
scroll.scrollSensitivity = 40f;

scroll.movementType = ScrollRect.MovementType.Clamped;
scroll.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
scroll.verticalScrollbar.image.sprite = scroll_bar_handle_sprite;
scroll.verticalScrollbar.GetComponent<Image>().sprite = scroll_bar_area_sprite;

#if KKS
//Add image that doesn't contain scroll bar
var image = scroll.content.gameObject.AddComponent<Image>();
Expand All @@ -316,10 +330,10 @@ private static void CreateCustomAccessoryWindowControls()
var s_LE = scroll.gameObject.AddComponent<LayoutElement>();
#if KK
var height = (GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree/04_AccessoryTop/Slots").transform as RectTransform).rect.height;
var width = 360f;
var width = 400f;
#else
var height = 875f; //Slots from KK doesn't exist
var width = 380f;
var width = 400f;
#endif
s_LE.preferredHeight = height;
s_LE.preferredWidth = width;
Expand Down

0 comments on commit 84255b4

Please sign in to comment.