Scene Fade In and Out Fixes

This commit is contained in:
mushgunAX 2023-03-02 15:47:00 +08:00
parent 1e734b6006
commit 802924141a
9 changed files with 151 additions and 24 deletions

View File

@ -1,6 +1,6 @@
- VertexShader: 46580970 - VertexShader: 46580970
FragmentShader: 50110174 FragmentShader: 50110174
SubPass: UI SubPass: UI Translucent
Properties: Properties:
data.color: {x: 0, y: 0, z: 0, w: 1} data.color: {x: 0, y: 0, z: 0, w: 1}
data.textureIndex: 0 data.textureIndex: 0

View File

@ -4300,6 +4300,7 @@
Text Renderer Component: Text Renderer Component:
Text: My name is Brandon. Text: My name is Brandon.
Font: 176667660 Font: 176667660
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 206 - EID: 206
@ -4315,6 +4316,7 @@
Text Renderer Component: Text Renderer Component:
Text: My name is Brandon. Text: My name is Brandon.
Font: 176667660 Font: 176667660
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 238 - EID: 238
@ -4330,6 +4332,7 @@
Text Renderer Component: Text Renderer Component:
Text: TEST Text: TEST
Font: 176667660 Font: 176667660
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 236 - EID: 236
@ -5307,7 +5310,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0} Translate: {x: 0, y: 0, z: 0.0500000007}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1} Scale: {x: 1920, y: 1080, z: 1}
IsActive: true IsActive: true

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001} Translate: {x: 0, y: 0, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1} Scale: {x: 1920, y: 1080, z: 1}
IsActive: true IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 75, z: 0} Translate: {x: 0, y: 75, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -200, z: 0} Translate: {x: 0, y: -200, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
@ -153,4 +153,40 @@
Components: ~ Components: ~
Scripts: Scripts:
- Type: SHADE_Scripting.UI.TweenManager - Type: SHADE_Scripting.UI.TweenManager
Enabled: true Enabled: true
- EID: 8
Name: TransitionCanvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 9
Name: Transition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 120016136
IsActive: true
UI Component:
Canvas ID: 8
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.SceneFadeInOut
Enabled: true
alphaValue: 1
fadeInTime: 0.5
fadeOutTime: 0.5

View File

@ -587,6 +587,7 @@
Text Renderer Component: Text Renderer Component:
Text: Options Text: Options
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -607,6 +608,7 @@
Text Renderer Component: Text Renderer Component:
Text: Audio Text: Audio
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -643,6 +645,7 @@
Text Renderer Component: Text Renderer Component:
Text: Master Text: Master
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -663,6 +666,7 @@
Text Renderer Component: Text Renderer Component:
Text: SFX Text: SFX
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -683,6 +687,7 @@
Text Renderer Component: Text Renderer Component:
Text: BGM Text: BGM
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -788,6 +793,7 @@
Text Renderer Component: Text Renderer Component:
Text: Camera Text: Camera
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -824,6 +830,7 @@
Text Renderer Component: Text Renderer Component:
Text: FOV Text: FOV
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -844,6 +851,7 @@
Text Renderer Component: Text Renderer Component:
Text: Sensitivity Text: Sensitivity
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -942,6 +950,7 @@
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -967,6 +976,7 @@
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -992,6 +1002,7 @@
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -1033,6 +1044,7 @@
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -1058,6 +1070,7 @@
Text Renderer Component: Text Renderer Component:
Text: 100 Text: 100
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 19 Canvas ID: 19
@ -1142,6 +1155,7 @@
Text Renderer Component: Text Renderer Component:
Text: Credits Text: Credits
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 46 Canvas ID: 46
@ -1221,10 +1235,47 @@
Text Renderer Component: Text Renderer Component:
Text: Level Select Text: Level Select
Font: 174412429 Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true IsActive: true
UI Component: UI Component:
Canvas ID: 50 Canvas ID: 50
Hovered: false Hovered: false
Clicked: false Clicked: false
IsActive: true IsActive: true
Scripts: ~ Scripts: ~
- EID: 55
Name: Transition Canvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 56
Name: Transition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 120016136
IsActive: true
UI Component:
Canvas ID: 55
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.SceneFadeInOut
Enabled: true
alphaValue: 1
fadeInTime: 0.5
fadeOutTime: 0.5

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 0, z: 0.100000001} Translate: {x: 0, y: 0, z: 0.200000003}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1} Scale: {x: 1920, y: 1080, z: 1}
IsActive: true IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: 75, z: 0} Translate: {x: 0, y: 75, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0 NumberOfChildren: 0
Components: Components:
Transform Component: Transform Component:
Translate: {x: 0, y: -200, z: 0} Translate: {x: 0, y: -200, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0} Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1} Scale: {x: 400, y: 100, z: 1}
IsActive: true IsActive: true
@ -153,4 +153,40 @@
Components: ~ Components: ~
Scripts: Scripts:
- Type: SHADE_Scripting.UI.TweenManager - Type: SHADE_Scripting.UI.TweenManager
Enabled: true Enabled: true
- EID: 8
Name: TransitionCanvas
IsActive: true
NumberOfChildren: 1
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
Scripts: ~
- EID: 9
Name: Transition
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
Renderable Component:
Mesh: 141771688
Material: 120016136
IsActive: true
UI Component:
Canvas ID: 8
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.SceneFadeInOut
Enabled: true
alphaValue: 1
fadeInTime: 0.5
fadeOutTime: 0.5

View File

@ -22,22 +22,19 @@ public class ChangeSceneButton : Script
{ {
ui.OnRelease.RegisterAction(() => ui.OnRelease.RegisterAction(() =>
{ {
if (sceneID != 0) if (sceneID != 0)
{ {
Audio.PlaySFXOnce2D("event:/UI/success"); Audio.PlaySFXOnce2D("event:/UI/success");
Audio.StopAllSounds();
Audio.StopAllSounds(); if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn(); SceneFadeInOut.Instance.CallFadeIn();
clickedFlag = true; clickedFlag = true;
} }
}); });
} }
else else
{ {
Debug.LogError("Failed to register button action for ChangeSceneButton."); Debug.LogError("Failed to register button action for ChangeSceneButton.");
} }
} }
protected override void update() protected override void update()

View File

@ -1,6 +1,7 @@
using System; using System;
using SHADE; using SHADE;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
public class EndScene : Script public class EndScene : Script
{ {
@ -18,6 +19,7 @@ public class EndScene : Script
Input.SetMouseCentering(false); Input.SetMouseCentering(false);
Debug.Log("EndScene::Start():"); Debug.Log("EndScene::Start():");
Application.IsCursorVisible = true; Application.IsCursorVisible = true;
SceneFadeInOut.Instance.CallFadeOut();
} }
protected override void update() protected override void update()

View File

@ -1,6 +1,7 @@
using System; using System;
using SHADE; using SHADE;
using SHADE_Scripting.Audio; using SHADE_Scripting.Audio;
using SHADE_Scripting.UI;
public class MainMenu : Script public class MainMenu : Script
{ {
@ -25,6 +26,7 @@ public class MainMenu : Script
{ {
Input.SetMouseCentering(false); Input.SetMouseCentering(false);
Application.IsCursorVisible = true; Application.IsCursorVisible = true;
SceneFadeInOut.Instance.CallFadeOut();
} }
protected override void update() protected override void update()
{ {

View File

@ -43,7 +43,6 @@ namespace SHADE_Scripting.UI
protected override void start() protected override void start()
{ {
} }
protected override void update() protected override void update()
@ -56,7 +55,6 @@ namespace SHADE_Scripting.UI
if (fadeInTime == 0.0f) if (fadeInTime == 0.0f)
{ {
alphaValue = 1.0f; alphaValue = 1.0f;
} }
else else
{ {
@ -64,8 +62,8 @@ namespace SHADE_Scripting.UI
} }
if (alphaValue >= 1.0f) if (alphaValue >= 1.0f)
{ {
alphaValue = 1.0f; alphaValue = 1.0f;
GameObject.Parent.SetActive(false); //GameObject.Parent.SetActive(false);
} }
} }
@ -83,8 +81,10 @@ namespace SHADE_Scripting.UI
} }
if (alphaValue <= 0.0f) if (alphaValue <= 0.0f)
{ {
alphaValue = 0.0f; alphaValue = 0.0f;
GameObject.Parent.SetActive(false); //This line is to be added so that (because the fade in and out item is usually the front-most UI element)
//the fade in and out UI element does not block functionality of other UI elements
GameObject.Parent.SetActive(false);
} }
} }