Gameplay UI progress

This commit is contained in:
maverickdgg 2023-03-02 09:55:41 +08:00
parent 9dd01f5fa1
commit e0ee2a8079
19 changed files with 165 additions and 55 deletions

View File

@ -1,4 +1,4 @@
Start Maximized: true Start Maximized: true
Working Scene ID: 97158628 Working Scene ID: 86098106
Window Size: {x: 1920, y: 1013} Window Size: {x: 1920, y: 1013}
Style: 0 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 - EID: 199
Name: Gameplay UI Canvas Name: Gameplay UI Canvas
IsActive: true IsActive: true
NumberOfChildren: 4 NumberOfChildren: 3
Components: Components:
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
@ -9621,26 +9621,6 @@
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ 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 - EID: 139
Name: Multiplier Text Name: Multiplier Text
IsActive: true IsActive: true
@ -9653,27 +9633,32 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: TEST Text: TEST
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 199 Canvas ID: 199
Hovered: false Hovered: false
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts:
- Type: SHADE_Scripting.UI.MultiplierTextFx
Enabled: true
maxSize: 1
minSize: 0.300000012
minAlpha: 0.300000012
- EID: 463 - EID: 463
Name: Multiplier BG Name: Multiplier BG
IsActive: true IsActive: true
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: 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} 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 IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 133784677
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 199 Canvas ID: 199
@ -9693,7 +9678,7 @@
IsActive: true IsActive: true
Text Renderer Component: Text Renderer Component:
Text: My name is Brandon. Text: My name is Brandon.
Font: 176667660 Font: 174412429
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 199 Canvas ID: 199
@ -9707,13 +9692,13 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: 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} 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 IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 127527215
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 199 Canvas ID: 199
@ -10714,7 +10699,7 @@
- EID: 10 - EID: 10
Name: Canvas Name: Canvas
IsActive: true IsActive: true
NumberOfChildren: 3 NumberOfChildren: 4
Components: Components:
Canvas Component: Canvas Component:
Canvas Width: 1920 Canvas Width: 1920
@ -10730,23 +10715,31 @@
Transform Component: Transform Component:
Translate: {x: 0, y: 100, z: 0} Translate: {x: 0, y: 100, z: 0}
Rotate: {x: 0, y: 0, 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 IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 52901020 Default Texture: 63979907
Hovered Texture: 62235279 Hovered Texture: 51379325
Clicked Texture: 64722619 Clicked Texture: 66788278
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 10 Canvas ID: 10
Hovered: false Hovered: false
Clicked: false Clicked: false
IsActive: true 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 - EID: 0
Name: QuitButton Name: QuitButton
IsActive: true IsActive: true
@ -10755,23 +10748,31 @@
Transform Component: Transform Component:
Translate: {x: 0, y: -300, z: 0} Translate: {x: 0, y: -300, z: 0}
Rotate: {x: 0, y: 0, 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 IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 66477839 Default Texture: 61602036
Hovered Texture: 65045286 Hovered Texture: 58910810
Clicked Texture: 58607560 Clicked Texture: 57786063
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 10 Canvas ID: 10
Hovered: false Hovered: false
Clicked: false Clicked: false
IsActive: true 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 - EID: 461
Name: RetryButton Name: RetryButton
IsActive: true IsActive: true
@ -10780,20 +10781,56 @@
Transform Component: Transform Component:
Translate: {x: 0, y: -100, z: 0} Translate: {x: 0, y: -100, z: 0}
Rotate: {x: 0, y: 0, 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 IsActive: true
Renderable Component: Renderable Component:
Mesh: 141771688 Mesh: 141771688
Material: 129340704 Material: 129340704
IsActive: true IsActive: true
Button Component: Button Component:
Default Texture: 55782622 Default Texture: 64806384
Hovered Texture: 58972174 Hovered Texture: 58347825
Clicked Texture: 55224464 Clicked Texture: 63234380
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 10 Canvas ID: 10
Hovered: false Hovered: false
Clicked: false Clicked: false
IsActive: true IsActive: true
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: ~ 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;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -93,13 +94,13 @@ public class GameManager : Script
{ {
timer -= Time.DeltaTimeF; timer -= Time.DeltaTimeF;
if(scoreText) if(scoreText)
scoreText.GetComponent<TextRenderable>().Text = $"Score: {Score}"; scoreText.GetComponent<TextRenderable>().Text = $"{Score}";
if(timeText) if(timeText)
timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}"; timeText.GetComponent<TextRenderable>().Text = $"Time Left: {timer.ToString("0.00")}";
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;
@ -150,9 +151,17 @@ public class GameManager : Script
totalItemCount -= 1; totalItemCount -= 1;
itemScored = true; itemScored = true;
currMultiplierDuration = 0; currMultiplierDuration = 0;
multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont); //multiplierText.GetComponent<Transform>().LocalScale = new Vector3(multiplierFont, multiplierFont, multiplierFont);
if (currMultiplierCombo < maxMultiplierCombo) if (currMultiplierCombo < maxMultiplierCombo)
currMultiplierCombo += 1; 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) 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 minSize = 0.3f;
public float minAlpha = 0.3f; public float minAlpha = 0.3f;
private bool showMultiplier = false;
[NonSerialized] [NonSerialized]
private Vector3 defaultScale; private Vector3 defaultScale;
protected override void start() protected override void start()
{ {
sizeThread = TweenManager.CreateTweenThread(GameManager.Instance.maxMultiplierDuration, maxSize, minSize, EASING_METHOD.EASE_IN_SINE); sizeThread = TweenManager.CreateTweenThread(0.0f, maxSize, minSize, EASING_METHOD.EASE_IN_SINE);
alphaThread = TweenManager.CreateTweenThread(GameManager.Instance.maxMultiplierDuration, 1.0f, minAlpha, EASING_METHOD.EASE_OUT_SINE); alphaThread = TweenManager.CreateTweenThread(0.0f, 1.0f, minAlpha, EASING_METHOD.EASE_OUT_SINE);
Transform transform = GetComponent<Transform>(); Transform transform = GetComponent<Transform>();
if (transform != null) if (transform != null)
{
defaultScale = transform.LocalScale; defaultScale = transform.LocalScale;
transform.LocalScale = Vector3.Zero;
}
showMultiplier = false;
} }
protected override void update() protected override void update()
{ {
Transform transform = GetComponent<Transform>(); Transform transform = GetComponent<Transform>();
if(transform != null) if (transform != null && showMultiplier == true)
{ {
if(sizeThread.IsCompleted()) if(sizeThread.IsCompleted())
{ {
transform.LocalScale = Vector3.Zero; transform.LocalScale = Vector3.Zero;
showMultiplier = false;
} }
else else
{ {
transform.LocalScale = defaultScale * sizeThread.GetValue(); 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