Skip to content

Commit 9961dbb

Browse files
committed
Added Localized background
- Removed StackView's transition element
1 parent f283103 commit 9961dbb

23 files changed

+1424
-39
lines changed

Assets/Localization/Asset Tables/Game Assets Shared Data.asset

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ MonoBehaviour:
1919
m_Key: words
2020
m_Metadata:
2121
m_Items: []
22+
- m_Id: 1290280815812608
23+
m_Key: BACKGROUND-IMAGE
24+
m_Metadata:
25+
m_Items: []
2226
m_Metadata:
2327
m_Items:
2428
- rid: 2216566521478512918
29+
- rid: 4577796410279985478
2530
m_KeyGenerator:
2631
rid: 2216566521478512917
2732
references:
@@ -43,3 +48,15 @@ MonoBehaviour:
4348
- ar
4449
m_TypeString: Unity.Samples.LetterSpell.WordDatabase, Assembly-CSharp, Version=0.0.0.0,
4550
Culture=neutral, PublicKeyToken=null
51+
- rid: 4577796410279985478
52+
type: {class: AssetTypeMetadata, ns: UnityEngine.Localization.Metadata, asm: Unity.Localization}
53+
data:
54+
m_Entries:
55+
- m_KeyId: 1290280815812608
56+
m_TableCodes:
57+
- ar
58+
- en
59+
- ja
60+
- es
61+
m_TypeString: UnityEngine.Texture2D, UnityEngine.CoreModule, Version=0.0.0.0,
62+
Culture=neutral, PublicKeyToken=null

Assets/Localization/Asset Tables/Game Assets_ar.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ MonoBehaviour:
2222
m_Localized: b84efdec20ddfe043aa893e7bee2c0c3
2323
m_Metadata:
2424
m_Items: []
25+
- m_Id: 1290280815812608
26+
m_Localized: 3697ae0c4beca4d7381ec20cca6e3557
27+
m_Metadata:
28+
m_Items: []
2529
references:
2630
version: 2
2731
RefIds: []

Assets/Localization/Asset Tables/Game Assets_en.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ MonoBehaviour:
2222
m_Localized: 622030c59d5b7447c9676d0e8669dfb8
2323
m_Metadata:
2424
m_Items: []
25+
- m_Id: 1290280815812608
26+
m_Localized: 27ec5b3bcd56e46fa8f0c071844e577e
27+
m_Metadata:
28+
m_Items: []
2529
references:
2630
version: 2
2731
RefIds: []

Assets/Localization/Asset Tables/Game Assets_es.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ MonoBehaviour:
2222
m_Localized: 0003b268dede3c84cb4e93ac53e28b97
2323
m_Metadata:
2424
m_Items: []
25+
- m_Id: 1290280815812608
26+
m_Localized: 72dcdfe6ffd374b9e8fbe9eae2e99d88
27+
m_Metadata:
28+
m_Items: []
2529
references:
2630
version: 2
2731
RefIds: []

Assets/Localization/Asset Tables/Game Assets_ja.asset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ MonoBehaviour:
2222
m_Localized: 354d19838a5569a4991a4d5ec7017e7f
2323
m_Metadata:
2424
m_Items: []
25+
- m_Id: 1290280815812608
26+
m_Localized: afea9e2cbe6a34e92bb592436d89a029
27+
m_Metadata:
28+
m_Items: []
2529
references:
2630
version: 2
2731
RefIds: []

Assets/Resources/UITk/MainView.uxml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<ui:VisualElement name="root" style="flex-grow: 1;">
44
<ui:VisualElement name="background" style="flex-grow: 1; position: absolute; top: 0; left: 0; bottom: 0; right: 0; background-color: rgb(11, 163, 109);"/>
55
<ui:VisualElement name="viewContainer" style="flex-grow: 1;">
6-
<Unity.Samples.LetterSpell.StackView name="stackView" index="0" style="flex-grow: 1;">
6+
<Unity.Samples.LetterSpell.StackView name="stackView" index="1" style="flex-grow: 1;">
77
<ui:VisualElement name="splashView" style="flex-grow: 1; background-image: url(&quot;project://database/Assets/UI/Images/Splash-Screen.png?fileID=4602334432413793429&amp;guid=364b68ded9ed04f07848b6c7de25fdad&amp;type=3#Intro Screen_0&quot;);">
88
<ui:Label text="A fun spelling game" name="splashSubTitle"/>
99
</ui:VisualElement>
10-
<ui:VisualElement name="loginView" style="flex-grow: 1; background-image: url(&quot;project://database/Assets/UI/Images/Background-Intro.png?fileID=2800000&amp;guid=718087ba784b64abd9675b1452fc0095&amp;type=3#Background-Intro&quot;); align-items: center; justify-content: center;">
10+
<ui:VisualElement name="loginView" style="flex-grow: 1; align-items: center; justify-content: center;">
1111
<ui:VisualElement name="logo" class="lsp-logo"/>
1212
<ui:Label class="title-text">
1313
<Bindings>
@@ -26,7 +26,7 @@
2626
</Bindings>
2727
</ui:Button>
2828
</ui:VisualElement>
29-
<ui:VisualElement name="levelChoiceView" style="flex-grow: 1; background-image: url(&quot;project://database/Assets/UI/Images/Background-Intro.png?fileID=2800000&amp;guid=718087ba784b64abd9675b1452fc0095&amp;type=3#Background-Intro&quot;);">
29+
<ui:VisualElement name="levelChoiceView" style="flex-grow: 1;">
3030
<ui:VisualElement name="logo" class="lsp-logo"/>
3131
<ui:VisualElement style="flex-grow: 1; justify-content: center; align-items: center;">
3232
<ui:VisualElement name="choiceButtonContainer" class="choice-button-container">
@@ -45,13 +45,13 @@
4545
</ui:VisualElement>
4646
</ui:VisualElement>
4747
<ui:Button name="settingsButton" style="position: absolute; right: 22px; top: 5px;">
48-
<Bindings>
49-
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(19656456957952)"/>
50-
</Bindings>
48+
<Bindings>
49+
<UnityEngine.Localization.LocalizedString property="text" table="GUID:cc1d194facb1d9d4380a9ea2032c10ca" entry="Id(19656456957952)"/>
50+
</Bindings>
5151
</ui:Button>
5252
</ui:VisualElement>
5353
</ui:VisualElement>
54-
<ui:VisualElement name="gameView" style="flex-grow: 1; background-image: url(&quot;project://database/Assets/UI/Images/Background-Intro.png?fileID=2800000&amp;guid=718087ba784b64abd9675b1452fc0095&amp;type=3#Background-Intro&quot;);">
54+
<ui:VisualElement name="gameView" style="flex-grow: 1;">
5555
<ui:VisualElement name="logo" class="lsp-logo"/>
5656
<ui:VisualElement name="clueContainer">
5757
<ui:Label text="#clue" name="clueLabel" class="title-text" style="-unity-text-align: middle-center;"/>
@@ -204,6 +204,9 @@
204204
</ui:ScrollView>
205205
</ui:VisualElement>
206206
</Unity.Samples.LetterSpell.StackView>
207+
<Bindings>
208+
<UnityEngine.Localization.LocalizedTexture property="style.backgroundImage" table="GUID:7a3c0612d6a067448bdc5058f2111932" entry="Id(1290280815812608)"/>
209+
</Bindings>
207210
</ui:VisualElement>
208211
<lsp:Popup name="exitGamePopup">
209212
<ui:Label text="Game Paused">
@@ -239,7 +242,6 @@
239242
</UnityEngine.Localization.LocalizedString>
240243
</Bindings>
241244
</ui:Label>
242-
243245
<ui:VisualElement name="resultButtonContainer" style="flex-grow: 1; flex-direction: row; margin-top: 10px; align-items: center;">
244246
<ui:Button name="resultMainMenuButton">
245247
<Bindings>

Assets/Scripts/UITk/Controls/StackView.cs

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public partial class StackView : VisualElement
1212
{
1313
private VisualElement m_ContentContainer;
1414
private VisualElement m_ActiveView;
15-
private VisualElement m_TransitionElement;
1615

1716
public override VisualElement contentContainer => m_ContentContainer;
1817

@@ -93,43 +92,42 @@ public StackView()
9392

9493
void StartTransition(VisualElement from, VisualElement to)
9594
{
96-
if (m_TransitionElement == null)
95+
if (from != null)
9796
{
98-
m_TransitionElement ??= new VisualElement();
99-
m_TransitionElement.AddToClassList("lsp-stack-view-Transition");
100-
}
101-
m_TransitionElement.style.opacity = 0;
102-
hierarchy.Add(m_TransitionElement);
97+
var fadeIn = from.experimental.animation.Start(
98+
(element) => element.style.opacity.value,
99+
0, 400, (element, value) =>
100+
{
101+
element.style.opacity = value;
102+
});
103103

104-
var fadeIn = m_TransitionElement.experimental.animation.Start(
105-
(element) => element.style.opacity.value,
106-
1f, 400, (element, value) =>
104+
fadeIn.onAnimationCompleted += () =>
107105
{
108-
element.style.opacity = value;
109-
Debug.Log("op = " + value);
110-
});
111-
fadeIn.onAnimationCompleted += () =>
112-
{
113-
// Hide the old view
114-
if (from != null)
106+
// Hide the old view
115107
from.style.display = DisplayStyle.None;
116108

117-
// Show the new view
118-
if (to != null)
119-
{
120-
to.style.display = DisplayStyle.Flex;
121-
}
122-
123-
var fadeOut = m_TransitionElement.experimental.animation.Start(
124-
(element) => element.style.opacity.value,
125-
0, 400, (element, value) => element.style.opacity = value);
126-
fadeOut.onAnimationCompleted += () =>
127-
{
128-
m_TransitionElement.RemoveFromHierarchy();
109+
// Show the new view
110+
if (to != null)
111+
{
112+
to.style.display = DisplayStyle.Flex;
113+
to.style.opacity = 0.0f;
114+
var fadeOut = to.experimental.animation.Start(
115+
(element) => element.style.opacity.value,
116+
1, 400, (element, value) => element.style.opacity = value);
117+
fadeOut.onAnimationCompleted += () =>
118+
{
119+
};
120+
}
129121
};
130-
};
122+
}
123+
else if (to != null)
124+
{
125+
// If there is no from, just show the
126+
to.style.display = DisplayStyle.Flex;
127+
to.style.opacity = 1;
128+
}
131129
}
132-
130+
133131
bool firstGeometryChange = true;
134132

135133
void OnGeometryChanged(GeometryChangedEvent evt)
48.9 KB
Loading

Assets/UI/Images/Background-Intro-Ar.png.meta

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

0 commit comments

Comments
 (0)