From 5e4cfb26333eae289117a54c45a7f9eb07d7b8a3 Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Wed, 23 Apr 2025 23:10:17 +0200 Subject: [PATCH 1/2] feat: get product icon --- S1API/Products/ProductDefinition.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/S1API/Products/ProductDefinition.cs b/S1API/Products/ProductDefinition.cs index 7f606424..bcb467a7 100644 --- a/S1API/Products/ProductDefinition.cs +++ b/S1API/Products/ProductDefinition.cs @@ -8,6 +8,7 @@ using S1API.Internal.Utils; using S1API.Items; +using UnityEngine; namespace S1API.Products { @@ -41,5 +42,14 @@ internal ProductDefinition(S1Product.ProductDefinition productDefinition) : base /// An instance of the product. public override ItemInstance CreateInstance(int quantity = 1) => new ProductInstance(CrossType.As(S1ProductDefinition.GetDefaultInstance(quantity))); + + /// + /// Gets the in-game icon associated with the product. + /// + public Sprite Icon + { + get { return S1ProductDefinition.Icon; } + } + } } \ No newline at end of file From 35aace0abc48c5d4b24dd1f7b04f9f9402d7bfdd Mon Sep 17 00:00:00 2001 From: Omar Akermi Date: Wed, 23 Apr 2025 23:33:15 +0200 Subject: [PATCH 2/2] fix: more customization --- S1API/UI/UIFactory.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/S1API/UI/UIFactory.cs b/S1API/UI/UIFactory.cs index 894b5652..831f68ab 100644 --- a/S1API/UI/UIFactory.cs +++ b/S1API/UI/UIFactory.cs @@ -321,15 +321,15 @@ public static GameObject CreateQuestRow(string name, Transform parent, out GameO /// An optional action to be invoked when the button is clicked. If null, the button will not be created. /// The text to display on the optional button. Defaults to "Action" if not specified. /// The created GameObject representing the top bar. - public static GameObject TopBar(string name, Transform parent, string title,float buttonWidth,float buttonHeight, + public static GameObject TopBar(string name, Transform parent, string title,float buttonWidth,float buttonHeight,float topbarSize,int rectleft,int rectright,int recttop,int rectbottom, Action onRightButtonClick = null, string rightButtonText = "Action") { var topBar = Panel(name, parent, new Color(0.15f, 0.15f, 0.15f), - new Vector2(0f, 0.85f), new Vector2(1f, 1f)); + new Vector2(0f, topbarSize), new Vector2(1f, 1f)); var layout = topBar.AddComponent(); - layout.padding = new RectOffset(75, 75, 30, 30); + layout.padding = new RectOffset(rectleft,rectright,recttop,rectbottom);; layout.spacing = 20; layout.childAlignment = TextAnchor.MiddleCenter; layout.childForceExpandWidth = false;