Added TweenThreadVec3. Updated UI elements to use new textures and fonts. Gameplay UI WIP #380

Merged
maverickdgg merged 6 commits from SP3-20-UI-System into main 2023-03-02 12:46:12 +08:00
19 changed files with 165 additions and 55 deletions
Showing only changes of commit e0ee2a8079 - Show all commits

View File

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

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 52018575
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Multiplier
ID: 133784677
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 54238246
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Score
ID: 127527215
Type: 7

View File

@ -0,0 +1,8 @@
- VertexShader: 46580970
FragmentShader: 35983630
SubPass: UI
Properties:
data.color: {x: 1, y: 1, z: 1, w: 1}
data.textureIndex: 60494030
data.alpha: 1
data.beta: {x: 1, y: 1, z: 1}

View File

@ -0,0 +1,3 @@
Name: UIMat_Timer
ID: 126220632
Type: 7

View File

@ -9593,7 +9593,7 @@
- EID: 199
Name: Gameplay UI Canvas
IsActive: true
NumberOfChildren: 4
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
@ -9621,26 +9621,6 @@
Clicked: false
IsActive: true
Scripts: ~
- EID: 11
Name: GamePause
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -250, y: 300, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 100}
IsActive: true
Text Renderer Component:
Text: Game Pause
Font: 176667660
IsActive: false
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 139
Name: Multiplier Text
IsActive: true
@ -9653,27 +9633,32 @@
IsActive: true
Text Renderer Component:
Text: TEST
Font: 176667660
Font: 174412429
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.MultiplierTextFx
Enabled: true
maxSize: 1
minSize: 0.300000012
minAlpha: 0.300000012
- EID: 463
Name: Multiplier BG
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.833334029, y: 0.416666061, z: 0}
Translate: {x: 0.833334029, y: 0.416666061, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 5, y: 1.66666651, z: 0.0166666675}
Scale: {x: 3.45600009, y: 2, z: 0.0166666675}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
Material: 133784677
IsActive: true
UI Component:
Canvas ID: 199
@ -9693,7 +9678,7 @@
IsActive: true
Text Renderer Component:
Text: My name is Brandon.
Font: 176667660
Font: 174412429
IsActive: true
UI Component:
Canvas ID: 199
@ -9707,13 +9692,13 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.334998131, y: 0.500000477, z: 0}
Translate: {x: 0.334998131, y: 0.500000477, z: 1.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 6.66666603, y: 1.66666651, z: 0.0166666675}
Scale: {x: 3.20000005, y: 1.60000002, z: 0.0166666675}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
Material: 127527215
IsActive: true
UI Component:
Canvas ID: 199
@ -10714,7 +10699,7 @@
- EID: 10
Name: Canvas
IsActive: true
NumberOfChildren: 3
NumberOfChildren: 4
Components:
Canvas Component:
Canvas Width: 1920
@ -10730,23 +10715,31 @@
Transform Component:
Translate: {x: 0, y: 100, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 300, y: 200, z: 500}
Scale: {x: 400, y: 100, z: 500}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 52901020
Hovered Texture: 62235279
Clicked Texture: 64722619
Default Texture: 63979907
Hovered Texture: 51379325
Clicked Texture: 66788278
IsActive: true
UI Component:
Canvas ID: 10
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: event:/Music/player_undetected
onHoverExitSound: event:/Music/player_undetected
onClickSound: event:/Music/player_undetected
onReleaseSound: event:/Music/player_undetected
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 0
Name: QuitButton
IsActive: true
@ -10755,23 +10748,31 @@
Transform Component:
Translate: {x: 0, y: -300, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 300, y: 200, z: 500}
Scale: {x: 400, y: 100, z: 500}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 66477839
Hovered Texture: 65045286
Clicked Texture: 58607560
Default Texture: 61602036
Hovered Texture: 58910810
Clicked Texture: 57786063
IsActive: true
UI Component:
Canvas ID: 10
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: event:/Music/player_undetected
onHoverExitSound: event:/Music/player_undetected
onClickSound: event:/Music/player_undetected
onReleaseSound: event:/Music/player_undetected
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 461
Name: RetryButton
IsActive: true
@ -10780,20 +10781,56 @@
Transform Component:
Translate: {x: 0, y: -100, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 300, y: 200, z: 500}
Scale: {x: 400, y: 100, z: 500}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 129340704
IsActive: true
Button Component:
Default Texture: 55782622
Hovered Texture: 58972174
Clicked Texture: 55224464
Default Texture: 64806384
Hovered Texture: 58347825
Clicked Texture: 63234380
IsActive: true
UI Component:
Canvas ID: 10
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.ButtonFX
Enabled: true
onHoverEnterSound: event:/Music/player_undetected
onHoverExitSound: event:/Music/player_undetected
onClickSound: event:/Music/player_undetected
onReleaseSound: event:/Music/player_undetected
hoverScale: 1.10000002
clickScale: 0.899999976
- EID: 11
Name: GamePause
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -250, y: 300, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 100}
IsActive: true
Text Renderer Component:
Text: Game Pause
Font: 174412429
IsActive: false
UI Component:
Canvas ID: 10
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 464
Name: RweenManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
Enabled: true

View File

@ -1,5 +1,6 @@
using SHADE;
using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
using System;
using System.Collections.Generic;
@ -93,13 +94,13 @@ public class GameManager : Script
{
timer -= Time.DeltaTimeF;
if(scoreText)
scoreText.GetComponent<TextRenderable>().Text = $"Score: {Score}";
scoreText.GetComponent<TextRenderable>().Text = $"{Score}";
if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
if (itemScored)
{
multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
//multiplierText.GetComponent<TextRenderable>().Text = $"X {currMultiplierCombo}";
//multiplierText.GetComponent<Transform>().LocalScale -= fontScalar * Time.DeltaTimeF;
currMultiplierDuration += Time.DeltaTimeF;
@ -150,9 +151,17 @@ public class GameManager : Script
totalItemCount -= 1;
itemScored = true;
currMultiplierDuration = 0;
multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
//multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1;
}
MultiplierTextFx fx = multiplierText.GetScript<MultiplierTextFx>();
if (fx)
{
fx.ShowMultiplier(currMultiplierCombo, maxMultiplierDuration);
}
}
}

View File

@ -57,7 +57,7 @@ namespace SHADE_Scripting.UI
private static float EaseOutSine(float value)
{
return (float)(1.0f - Math.Sin(value * Math.PI) / 2.0f);
return (float)(Math.Sin(value * Math.PI) / 2.0f);
}

View File

@ -18,37 +18,59 @@ namespace SHADE_Scripting.UI
public float minSize = 0.3f;
public float minAlpha = 0.3f;
private bool showMultiplier = false;
[NonSerialized]
private Vector3 defaultScale;
protected override void start()
{
sizeThread = TweenManager.CreateTweenThread(GameManager.Instance.maxMultiplierDuration, maxSize, minSize, EASING_METHOD.EASE_IN_SINE);
alphaThread = TweenManager.CreateTweenThread(GameManager.Instance.maxMultiplierDuration, 1.0f, minAlpha, EASING_METHOD.EASE_OUT_SINE);
sizeThread = TweenManager.CreateTweenThread(0.0f, maxSize, minSize, EASING_METHOD.EASE_IN_SINE);
alphaThread = TweenManager.CreateTweenThread(0.0f, 1.0f, minAlpha, EASING_METHOD.EASE_OUT_SINE);
Transform transform = GetComponent<Transform>();
if (transform != null)
{
defaultScale = transform.LocalScale;
transform.LocalScale = Vector3.Zero;
}
showMultiplier = false;
}
protected override void update()
{
Transform transform = GetComponent<Transform>();
if(transform != null)
if (transform != null && showMultiplier == true)
{
if(sizeThread.IsCompleted())
{
transform.LocalScale = Vector3.Zero;
showMultiplier = false;
}
else
{
transform.LocalScale = defaultScale * sizeThread.GetValue();
GetComponentInChildren<Renderable>().Material.SetProperty<float>("data.alpha",alphaThread.GetValue());
}
}
}
public void ShowMultiplier(int multiplier, float duration)
{
GetComponent<TextRenderable>().Text = $"X {multiplier}";
sizeThread.duration = duration;
alphaThread.duration = duration;
sizeThread.Reset();
alphaThread.Reset();
showMultiplier = true;
}
}
}

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: GameplayUI_Multiplier
ID: 52018575
Type: 3

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
Name: GameplayUI_Score
ID: 54238246
Type: 3

View File

@ -0,0 +1,3 @@
Name: GameplayUI_Timer
ID: 60494030
Type: 3