From 7a50c42b584cc2049a5079bee5a0dd64a55c96e3 Mon Sep 17 00:00:00 2001 From: Jeremy Lorelli Date: Fri, 23 Feb 2024 00:32:30 -0800 Subject: [PATCH] feat: Initial VersionInfo component Co-authored-by: AWildErin --- layout/components/version-info.xml | 16 ++++++++++++++++ scripts/components/version-info.js | 24 ++++++++++++++++++++++++ scripts/util/panel-registration.js | 1 + styles/components/version-info.scss | 9 +++++++++ 4 files changed, 50 insertions(+) create mode 100644 layout/components/version-info.xml create mode 100644 scripts/components/version-info.js create mode 100644 styles/components/version-info.scss diff --git a/layout/components/version-info.xml b/layout/components/version-info.xml new file mode 100644 index 00000000..095c0113 --- /dev/null +++ b/layout/components/version-info.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + diff --git a/scripts/components/version-info.js b/scripts/components/version-info.js new file mode 100644 index 00000000..0877e10c --- /dev/null +++ b/scripts/components/version-info.js @@ -0,0 +1,24 @@ +'use strict'; + +class VersionInfo { + static { + $.GetContextPanel().jsClass = this; + } + + static update() { + const cp = $.GetContextPanel(); + + const graphics = VersionAPI.GetGraphicsAPI(); + const version = VersionAPI.GetVersion(); + const branch = VersionAPI.GetBranch(); + const platform = VersionAPI.GetPlatform(); + const physics = VersionAPI.GetPhysicsEngine(); + + // Set the dialog variables so this can be used in label + cp.SetDialogVariable('graphics', graphics); + cp.SetDialogVariable('version', version); + cp.SetDialogVariable('branch', branch); + cp.SetDialogVariable('platform', platform); + cp.SetDialogVariable('physics', physics); + } +} diff --git a/scripts/util/panel-registration.js b/scripts/util/panel-registration.js index d63afa0f..1e13e6ca 100644 --- a/scripts/util/panel-registration.js +++ b/scripts/util/panel-registration.js @@ -5,3 +5,4 @@ //-------------------------------------------------------------------------------------------------- UiToolkitAPI.RegisterPanel2d('LineGraph', 'file://{resources}/layout/components/graphs/line-graph.xml'); +UiToolkitAPI.RegisterPanel2d('VersionInfo', 'file://{resources}/layout/components/version-info.xml'); diff --git a/styles/components/version-info.scss b/styles/components/version-info.scss new file mode 100644 index 00000000..5e6fe7bf --- /dev/null +++ b/styles/components/version-info.scss @@ -0,0 +1,9 @@ +.VersionInfo { + flow-children: down; + + .VersionInfoText { + font-size: 18px; + } + + color: black; +}