Fixed Slider Text. Changed Fonts #372

Merged
maverickdgg merged 2 commits from SP3-20-UI-System into main 2023-02-27 16:41:37 +08:00
9 changed files with 98 additions and 56 deletions
Showing only changes of commit cbb334d48e - Show all commits

View File

@ -1,4 +1,4 @@
Start Maximized: true Start Maximized: true
Working Scene ID: 86098106 Working Scene ID: 97158628
Window Size: {x: 1920, y: 1013} Window Size: {x: 1920, y: 1013}
Style: 0 Style: 0

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: Dangrek-Regular
ID: 174412429
Type: 10

Binary file not shown.

View File

@ -9621,26 +9621,6 @@
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 139
Name: Multiplier
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 300, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 60, y: 60, z: 60}
IsActive: true
Text Renderer Component:
Text: TEST
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 11 - EID: 11
Name: GamePause Name: GamePause
IsActive: true IsActive: true
@ -9661,15 +9641,35 @@
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 462 - EID: 139
Name: Score BG Name: Multiplier Text
IsActive: true IsActive: true
NumberOfChildren: 1 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: -850, y: 450, z: 0} Translate: {x: -800, y: 300, z: 0}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 60, y: 60.0000038, z: 60}
IsActive: true
Text Renderer Component:
Text: TEST
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 463
Name: Multiplier BG
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.833334029, y: 0.416666061, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 5, y: 1.66666651, z: 0.0166666675}
IsActive: true IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
@ -9684,12 +9684,12 @@
- EID: 237 - EID: 237
Name: Score Text Name: Score Text
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 1
Components: Components:
Transform Component: Transform Component:
Translate: {x: -0.050249815, y: -0.300000191, z: 0} Translate: {x: -770.099915, y: 419.999969, z: 0}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 0.150000006, y: 0.600000024, z: 60} Scale: {x: 60.0000038, y: 60.0000038, z: 60}
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: My name is Brandon. Text: My name is Brandon.
@ -9701,6 +9701,26 @@
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 462
Name: Score BG
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.334998131, y: 0.500000477, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 6.66666603, y: 1.66666651, z: 0.0166666675}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 198 - EID: 198
Name: ====Raccoon==== Name: ====Raccoon====
IsActive: true IsActive: true

View File

@ -538,7 +538,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Options Text: Options
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -558,7 +558,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Audio Text: Audio
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -594,7 +594,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Master Text: Master
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -614,7 +614,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: SFX Text: SFX
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -634,7 +634,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: BGM Text: BGM
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -673,7 +673,7 @@
Material: 128676209 Material: 128676209
IsActive: true IsActive: true
Slider Component: Slider Component:
Slider Value: 0 Slider Value: 1
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -696,7 +696,7 @@
Material: 128676209 Material: 128676209
IsActive: true IsActive: true
Slider Component: Slider Component:
Slider Value: 0 Slider Value: 1
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -719,7 +719,7 @@
Material: 128676209 Material: 128676209
IsActive: true IsActive: true
Slider Component: Slider Component:
Slider Value: 0 Slider Value: 1
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -739,7 +739,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Camera Text: Camera
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -775,7 +775,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: FOV Text: FOV
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -795,7 +795,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Sensitivity Text: Sensitivity
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -834,7 +834,7 @@
Material: 128676209 Material: 128676209
IsActive: true IsActive: true
Slider Component: Slider Component:
Slider Value: 0 Slider Value: 1
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -857,7 +857,7 @@
Material: 128676209 Material: 128676209
IsActive: true IsActive: true
Slider Component: Slider Component:
Slider Value: 0 Slider Value: 1
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -893,7 +893,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -918,7 +918,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -943,7 +943,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -984,7 +984,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -1009,7 +1009,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -1093,7 +1093,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Credits Text: Credits
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 46 Canvas ID: 46
@ -1172,7 +1172,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: Level Select Text: Level Select
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 50 Canvas ID: 50

View File

@ -100,7 +100,7 @@ public class GameManager : Script
if (itemScored) if (itemScored)
{ {
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}"; multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF; //multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
currMultiplierDuration += Time.DeltaTimeF; currMultiplierDuration += Time.DeltaTimeF;
if (currMultiplierDuration >= maxMultiplierDuration) if (currMultiplierDuration >= maxMultiplierDuration)
@ -113,7 +113,7 @@ public class GameManager : Script
} }
else else
{ {
multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero; //multiplierText.GetComponent<Transform>().LocalScale = Vector3.Zero;
} }
if ((timer > 0 && totalItemCount <= 0) || Input.GetKeyDown(Input.KeyCode.F1)) if ((timer > 0 && totalItemCount <= 0) || Input.GetKeyDown(Input.KeyCode.F1))

View File

@ -14,7 +14,17 @@ namespace SHADE_Scripting.UI
public int minValue = 0; public int minValue = 0;
public int maxValue = 0; public int maxValue = 0;
protected override void start()
{
Slider slider = sliderObj.GetComponent<Slider>();
TextRenderable text = GetComponent<TextRenderable>();
if (slider != null && text != null)
{
text.Text = ((int)(slider.GetValue() * (maxValue - minValue) + minValue)).ToString();
}
}
protected override void update() protected override void update()
{ {
Slider slider = sliderObj.GetComponent<Slider>(); Slider slider = sliderObj.GetComponent<Slider>();

View File

@ -432,18 +432,27 @@ namespace SHADE
if (comp.GetValue() < 0.0f) if (comp.GetValue() < 0.0f)
comp.value = 0.0f; comp.value = 0.0f;
} }
try
if (comp.GetValue() != tempValue)
{ {
//Set shader value.
auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID()); auto renderable = SHComponentManager::GetComponent_s<SHRenderable>(comp.GetEID());
//auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture()); //auto texture = SHResourceManager::Get<SHTexture>(comp.GetDefaultTexture());
auto material = renderable->GetModifiableMaterial(); auto material = renderable->GetModifiableMaterial();
if (renderable)
{
if (comp.GetValue() != material->GetProperty<float>("data.sliderThreshold"))
{
//Set shader value.
material->SetProperty("data.sliderThreshold", comp.GetValue()); material->SetProperty("data.sliderThreshold", comp.GetValue());
} }
}
}
catch (...)
{
}
} }