-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
143 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Elements.Core; | ||
using FrooxEngine; | ||
using FrooxEngine.UIX; | ||
using ResoniteMetricsCounter.Utils; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace ResoniteMetricsCounter.UIX; | ||
internal struct MetricColumnDefinition | ||
{ | ||
public string Label; | ||
public float FlexWidth; | ||
public float MinWidth; | ||
public Alignment Alignment; | ||
|
||
public MetricColumnDefinition(string label, Alignment alignment = Alignment.MiddleLeft, float flexWidth = -1, float minWidth = -1) | ||
{ | ||
Label = label; | ||
FlexWidth = flexWidth; | ||
MinWidth = minWidth; | ||
Alignment = alignment; | ||
} | ||
|
||
public static IEnumerable<Text> Build(UIBuilder uiBuilder, IEnumerable<MetricColumnDefinition> columns, Action<HorizontalLayout>? containerModifier = null) | ||
{ | ||
uiBuilder.PushStyle(); | ||
|
||
uiBuilder.Style.MinHeight = Constants.ROWHEIGHT; | ||
uiBuilder.Style.TextColor = RadiantUI_Constants.TEXT_COLOR; | ||
uiBuilder.Style.TextAlignment = Alignment.MiddleCenter; | ||
uiBuilder.Style.ForceExpandWidth = false; | ||
|
||
var horizontalLayout = uiBuilder.HorizontalLayout(Constants.SPACING, Constants.PADDING); | ||
if (containerModifier != null) | ||
{ | ||
containerModifier(horizontalLayout); | ||
} | ||
|
||
foreach (var column in columns) | ||
{ | ||
uiBuilder.Style.FlexibleWidth = column.FlexWidth; | ||
uiBuilder.Style.MinWidth = column.MinWidth; | ||
uiBuilder.Panel(); | ||
yield return uiBuilder.Text(column.Label); | ||
uiBuilder.NestOut(); | ||
} | ||
uiBuilder.NestOut(); | ||
|
||
uiBuilder.PopStyle(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.