Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions S1API/Products/ProductDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

using S1API.Internal.Utils;
using S1API.Items;
using UnityEngine;

namespace S1API.Products
{
Expand Down Expand Up @@ -41,5 +42,14 @@ internal ProductDefinition(S1Product.ProductDefinition productDefinition) : base
/// <returns>An instance of the product.</returns>
public override ItemInstance CreateInstance(int quantity = 1) =>
new ProductInstance(CrossType.As<S1Product.ProductItemInstance>(S1ProductDefinition.GetDefaultInstance(quantity)));

/// <summary>
/// Gets the in-game icon associated with the product.
/// </summary>
public Sprite Icon
{
get { return S1ProductDefinition.Icon; }
}

}
}
6 changes: 3 additions & 3 deletions S1API/UI/UIFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
/// <param name="go">The GameObject to which a VerticalLayoutGroup will be added or configured.</param>
/// <param name="spacing">The spacing between child objects within the VerticalLayoutGroup. Default is 10.</param>
/// <param name="padding">The padding around the edges of the VerticalLayoutGroup. If null, a default RectOffset of (10, 10, 10, 10) will be used.</param>
public static void VerticalLayoutOnGO(GameObject go, int spacing = 10, RectOffset padding = null)

Check warning on line 250 in S1API/UI/UIFactory.cs

View workflow job for this annotation

GitHub Actions / Verify Successful Build

Cannot convert null literal to non-nullable reference type.

Check warning on line 250 in S1API/UI/UIFactory.cs

View workflow job for this annotation

GitHub Actions / Verify Successful Build

Cannot convert null literal to non-nullable reference type.
{
var layout = go.AddComponent<VerticalLayoutGroup>();
layout.spacing = spacing;
Expand Down Expand Up @@ -321,15 +321,15 @@
/// <param name="onRightButtonClick">An optional action to be invoked when the button is clicked. If null, the button will not be created.</param>
/// <param name="rightButtonText">The text to display on the optional button. Defaults to "Action" if not specified.</param>
/// <returns>The created GameObject representing the top bar.</returns>
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,

Check warning on line 325 in S1API/UI/UIFactory.cs

View workflow job for this annotation

GitHub Actions / Verify Successful Build

Cannot convert null literal to non-nullable reference type.

Check warning on line 325 in S1API/UI/UIFactory.cs

View workflow job for this annotation

GitHub Actions / Verify Successful Build

Cannot convert null literal to non-nullable reference type.
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<HorizontalLayoutGroup>();
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;
Expand Down
Loading