Skip to content

Commit f4651bc

Browse files
feat(audience-sample-app): scene, panel settings, theme, UXML, USS
Visual layer for the sample app — these reference each other: * SampleApp.unity scene with a UIDocument component * AudienceSampleAppPanelSettings panel settings asset (referenced by the UIDocument) * AudienceSampleAppTheme.tss theme stylesheet (referenced by the panel settings) * AudienceSample.uxml visual tree — header, status bar, tab bar, controls + log columns, drag handle * Templates/Accordion.uxml — typed-events accordion template (cloned per Catalogue entry at runtime) * AudienceSample.uss stylesheet with shared tokens (--bg, --panel-bg, --text, --accent, --ok, --warn, --err, --debug, --transparent, --text-on-accent, ...) and ~95 selectors covering tabs, accordions, status bar, log rows, drag handle, responsive single-column layout below 1024px width.
1 parent a8377a7 commit f4651bc

14 files changed

Lines changed: 2421 additions & 0 deletions

examples/audience/Assets/SampleApp/Resources/AudienceSample.uss

Lines changed: 1526 additions & 0 deletions
Large diffs are not rendered by default.

examples/audience/Assets/SampleApp/Resources/AudienceSample.uss.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/audience/Assets/SampleApp/Resources/AudienceSample.uxml

Lines changed: 388 additions & 0 deletions
Large diffs are not rendered by default.

examples/audience/Assets/SampleApp/Resources/AudienceSample.uxml.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!114 &11400000
4+
MonoBehaviour:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_GameObject: {fileID: 0}
10+
m_Enabled: 1
11+
m_EditorHideFlags: 0
12+
m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0}
13+
m_Name: AudienceSampleAppPanelSettings
14+
m_EditorClassIdentifier:
15+
themeUss: {fileID: -4733365628477956816, guid: 3a3617a21af3244038254f48eafb92e2, type: 3}
16+
m_TargetTexture: {fileID: 0}
17+
m_ScaleMode: 2
18+
m_Scale: 1
19+
m_ReferenceDpi: 96
20+
m_FallbackDpi: 96
21+
m_ReferenceResolution: {x: 1440, y: 900}
22+
m_ScreenMatchMode: 0
23+
m_Match: 0.5
24+
m_SortingOrder: 100
25+
m_TargetDisplay: 0
26+
m_ClearDepthStencil: 1
27+
m_ClearColor: 0
28+
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
29+
m_DynamicAtlasSettings:
30+
m_MinAtlasSize: 64
31+
m_MaxAtlasSize: 4096
32+
m_MaxSubTextureSize: 64
33+
m_ActiveFilters: 31
34+
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
35+
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
36+
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
37+
textSettings: {fileID: 0}

examples/audience/Assets/SampleApp/Resources/AudienceSampleAppPanelSettings.asset.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
/*
2+
* Theme stylesheet for the Audience sample-app PanelSettings.
3+
*
4+
* GenericDropdownMenu (the popup widget DropdownField opens on click)
5+
* is appended to the panel's top-level root container — ABOVE
6+
* UIDocument.rootVisualElement, where AudienceSample.uss is attached.
7+
* Stylesheet scope means USS rules attached to rootVisualElement never
8+
* reach the popup. The TSS, in contrast, is the panel-wide theme — its
9+
* rules apply to the whole panel tree, popup included.
10+
*
11+
* The dropdown popup rules are inlined here (rather than @imported
12+
* from AudienceSample.uss) with hardcoded colors so the rules take
13+
* effect even though the var(--*) tokens defined in AudienceSample.uss
14+
* are scoped to its attached element and would not resolve in the
15+
* popup.
16+
*/
17+
18+
VisualElement {
19+
color: rgb(19, 19, 19);
20+
font-size: 12px;
21+
-unity-font: resource("RobotoMono-Regular");
22+
}
23+
24+
/* Full-panel click-dismiss layer Unity sizes inline. Transparent so it
25+
does not paint over the page; absolute so it does not displace
26+
siblings. Font set here too so it cascades to every child element
27+
regardless of which class Unity actually attaches the text to. */
28+
.unity-base-dropdown {
29+
position: absolute;
30+
background-color: rgba(0, 0, 0, 0);
31+
-unity-font: resource("RobotoMono-Regular");
32+
font-size: 12px;
33+
color: rgb(19, 19, 19);
34+
}
35+
36+
/* The actual popup box. No padding here — gutters live on the inner
37+
container's margin so the bottom gap is visible regardless of how
38+
Unity's ScrollView positions its content viewport. */
39+
.unity-base-dropdown__container-outer {
40+
position: absolute;
41+
flex-direction: column;
42+
background-color: rgb(255, 255, 255);
43+
border-left-width: 1px;
44+
border-right-width: 1px;
45+
border-top-width: 1px;
46+
border-bottom-width: 1px;
47+
border-left-color: rgb(230, 232, 236);
48+
border-right-color: rgb(230, 232, 236);
49+
border-top-color: rgb(230, 232, 236);
50+
border-bottom-color: rgb(230, 232, 236);
51+
border-top-left-radius: 6px;
52+
border-top-right-radius: 6px;
53+
border-bottom-left-radius: 6px;
54+
border-bottom-right-radius: 6px;
55+
padding-top: 0;
56+
padding-bottom: 0;
57+
min-width: 140px;
58+
min-height: 48px;
59+
max-height: 320px;
60+
/* overflow:hidden clips item backgrounds (including :hover) to the
61+
rounded corners. Required to stop the last item's hover fill
62+
from painting a square corner against the rounded outer edge. */
63+
overflow: hidden;
64+
-unity-font: resource("RobotoMono-Regular");
65+
font-size: 12px;
66+
color: rgb(19, 19, 19);
67+
}
68+
69+
/* Inner ScrollView holds the items. Margin (not padding) provides the
70+
visible top/bottom gutter — padding on the outer would be eaten by
71+
ScrollView's content viewport, which positions its content at its
72+
own bounds regardless of parent padding. */
73+
.unity-base-dropdown__container-inner {
74+
margin-top: 6px;
75+
margin-bottom: 6px;
76+
flex-grow: 1;
77+
flex-shrink: 0;
78+
}
79+
80+
.unity-base-dropdown__container-inner > .unity-scroll-view__content-viewport {
81+
flex-grow: 1;
82+
flex-shrink: 0;
83+
}
84+
85+
.unity-base-dropdown__container-inner > .unity-scroll-view__content-viewport > .unity-scroll-view__content-container {
86+
flex-grow: 0;
87+
flex-shrink: 0;
88+
}
89+
90+
/* Items: fixed height with zero internal padding-top/bottom so :hover
91+
does not change geometry. Borders pre-allocated transparent on both
92+
states so a default hover-border on Unity's side cannot shift the
93+
row by 2px. Font + size pinned here AND on every child class so
94+
Unity's runtime defaults cannot override them via inheritance. */
95+
.unity-base-dropdown__item {
96+
flex-direction: row;
97+
align-items: center;
98+
padding-left: 12px;
99+
padding-right: 12px;
100+
padding-top: 0;
101+
padding-bottom: 0;
102+
height: 28px;
103+
flex-shrink: 0;
104+
border-left-width: 0;
105+
border-right-width: 0;
106+
border-top-width: 0;
107+
border-bottom-width: 0;
108+
-unity-font: resource("RobotoMono-Regular");
109+
color: rgb(19, 19, 19);
110+
font-size: 12px;
111+
background-color: rgba(0, 0, 0, 0);
112+
}
113+
114+
.unity-base-dropdown__item:hover:enabled {
115+
background-color: rgb(238, 240, 243);
116+
border-left-width: 0;
117+
border-right-width: 0;
118+
border-top-width: 0;
119+
border-bottom-width: 0;
120+
height: 28px;
121+
-unity-font: resource("RobotoMono-Regular");
122+
font-size: 12px;
123+
}
124+
125+
.unity-base-dropdown__label {
126+
-unity-font: resource("RobotoMono-Regular");
127+
color: rgb(19, 19, 19);
128+
font-size: 12px;
129+
flex-grow: 1;
130+
}
131+
132+
.unity-base-dropdown__checkmark {
133+
-unity-font: resource("RobotoMono-Regular");
134+
color: rgb(19, 19, 19);
135+
font-size: 12px;
136+
}

examples/audience/Assets/SampleApp/Resources/AudienceSampleAppTheme.tss.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/audience/Assets/SampleApp/Resources/Templates.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ui:UXML xmlns:ui="UnityEngine.UIElements">
2+
<ui:VisualElement name="accordion-item" class="accordion-item">
3+
<ui:VisualElement name="accordion-header" class="accordion-header" focusable="true" tabindex="0">
4+
<ui:Label name="accordion-title" class="accordion-title" text="ACCORDION" />
5+
<ui:Label name="accordion-arrow" class="accordion-arrow" text="▸" />
6+
</ui:VisualElement>
7+
<ui:VisualElement name="accordion-content" class="accordion-content" />
8+
</ui:VisualElement>
9+
</ui:UXML>

0 commit comments

Comments
 (0)