This commit is contained in:
ntr committed 2023-09-01 22:27:50 +10:00
1 parent 0450f32a9e
commit ec99a4579d
9 files changed
+90 -17

No files matched your search

+12 -4
View File
@@ -1,14 +1,18 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
<Style src="project://database/Assets/Src/UI/TimingUi.uss?fileID=7433441132597879392&amp;guid=cf92f075876ddf7ffb4cd5c59633ad7b&amp;type=3#TimingUi" />
<ui:VisualElement name="shipUi" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); color: rgb(255, 255, 255); font-size: 28px; -unity-font: url(&apos;project://database/Assets/UI%20Toolkit/Fonts/Jura-Medium.otf?fileID=12800000&amp;guid=65648a14640996362a6b0929c723b6e4&amp;type=3#Jura-Medium&apos;); -unity-font-definition: initial;">
<ui:VisualElement name="Top" style="flex-grow: 1;" />
<ui:VisualElement name="Top" style="flex-grow: 1; font-size: 12px;" />
<ui:VisualElement name="Middle" style="flex-grow: 1; align-items: center;" />
<ui:VisualElement name="Bottom" style="flex-grow: 0; background-color: rgba(0, 0, 0, 0.26); flex-direction: column; align-items: stretch; justify-content: flex-end; color: rgb(255, 255, 255); width: 33%; align-self: center;">
<ui:VisualElement name="Bottom" class="bottom">
<ui:VisualElement name="notice" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0);">
<ui:VisualElement name="timerDesc" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); flex-direction: row; justify-content: space-between; align-items: auto; width: auto; align-self: stretch; flex-shrink: 0; font-size: 14px; color: rgb(245, 245, 245);">
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="msg" style="align-self: flex-end; align-items: auto;" />
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="noticePosition" text="5 / 128" />
</ui:VisualElement>
<ui:VisualElement name="noticeLap" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); flex-direction: row; justify-content: space-between; align-items: auto; width: auto; align-self: stretch; flex-shrink: 0;">
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="noticeTime" style="align-self: flex-end; align-items: auto;" />
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="noticeTime" text="1:12.888" style="align-self: flex-end; align-items: auto;" />
<ui:VisualElement name="noticeDiff" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); -unity-text-align: upper-right;">
<ui:Label tabindex="-1" display-tooltip-when-elided="true" />
<ui:Label tabindex="-1" display-tooltip-when-elided="true" text="+0.128" />
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="noticeSectors" class="sectors" style="flex-grow: 0; background-color: rgba(0, 0, 0, 0); flex-direction: row; -unity-text-align: upper-left;">
@@ -18,6 +22,10 @@
</ui:VisualElement>
</ui:VisualElement>
<ui:VisualElement name="timer" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0);">
<ui:VisualElement name="timerDesc" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); flex-direction: row; justify-content: space-between; align-items: auto; width: auto; align-self: stretch; flex-shrink: 0; font-size: 14px; color: rgb(245, 245, 245);">
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="msg" style="align-self: flex-end; align-items: auto;" />
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="timerPosition" text="5 / 128" />
</ui:VisualElement>
<ui:VisualElement name="timerLap" style="flex-grow: 1; background-color: rgba(0, 0, 0, 0); flex-direction: row; justify-content: space-between; align-items: auto; width: auto; align-self: stretch; flex-shrink: 0;">
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="timerTime" style="align-self: flex-end; align-items: auto;" />
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="timerPb" />
+12
View File
@@ -16,11 +16,13 @@ public class TimingUI : MonoBehaviour {
VisualElement timerSectors;
Label timerTime;
Label timerPb;
Label timerPosition;
VisualElement notice;
VisualElement noticeSectors;
VisualElement noticeDiff;
Label noticeTime;
Label noticePosition;
void OnEnable() {
Init();
@@ -42,7 +44,12 @@ public class TimingUI : MonoBehaviour {
timerTime = uiDocument.rootVisualElement.Q<Label>("timerTime");
timerPb = uiDocument.rootVisualElement.Q<Label>("timerPb");
noticePosition = uiDocument.rootVisualElement.Q<Label>("noticePosition");
timerPosition = uiDocument.rootVisualElement.Q<Label>("timerPosition");
timerPb.text = "-";
noticePosition.text = "- / -";
timerPosition.text = "- / -";
notice.AddToClassList("hidden");
}
@@ -79,9 +86,13 @@ public class TimingUI : MonoBehaviour {
timerSectors.Add(l);
}
noticePosition.text = timing.Position;
timerPosition.text = timing.Position;
}
public void ShowRecentLap(Lap lap) {
Init();
timer.AddToClassList("hidden");
notice.RemoveFromClassList("hidden");
@@ -97,6 +108,7 @@ public class TimingUI : MonoBehaviour {
}
public void HideRecentLap() {
Init();
timer.RemoveFromClassList("hidden");
notice.AddToClassList("hidden");
}
+22
View File
@@ -72,3 +72,25 @@ BoostIndicator {
margin-top: 12px;
margin-bottom: 12px;
}
.bottom {
flex-grow: 0;
background-color: rgba(0, 0, 0, 0.26);
flex-direction: column;
align-items: stretch;
justify-content: flex-end;
color: rgb(255, 255, 255);
width: 33%;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
align-self: center;
padding-left: 8px;
padding-right: 8px;
padding-top: 8px;
}
.bottom Label {
padding: 0;
margin-left: 0;
margin-right: 0;
}