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 @@ -321,15 +321,15 @@ public static GameObject CreateQuestRow(string name, Transform parent, out GameO
/// <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,
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