Implemented mouse centering and hiding in game #384

Merged
mushgunAX merged 9 commits from SP3-10-input-management into main 2023-03-03 18:29:54 +08:00
9 changed files with 151 additions and 24 deletions
Showing only changes of commit 802924141a - Show all commits

View File

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

View File

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

View File

@ -29,7 +29,7 @@
NumberOfChildren: 0
Components:
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}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Translate: {x: 0, y: 75, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Translate: {x: 0, y: -200, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true
@ -154,3 +154,39 @@
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
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: Options
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -607,6 +608,7 @@
Text Renderer Component:
Text: Audio
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -643,6 +645,7 @@
Text Renderer Component:
Text: Master
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -663,6 +666,7 @@
Text Renderer Component:
Text: SFX
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -683,6 +687,7 @@
Text Renderer Component:
Text: BGM
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -788,6 +793,7 @@
Text Renderer Component:
Text: Camera
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -824,6 +830,7 @@
Text Renderer Component:
Text: FOV
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -844,6 +851,7 @@
Text Renderer Component:
Text: Sensitivity
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -942,6 +950,7 @@
Text Renderer Component:
Text: 100
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -967,6 +976,7 @@
Text Renderer Component:
Text: 100
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -992,6 +1002,7 @@
Text Renderer Component:
Text: 100
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -1033,6 +1044,7 @@
Text Renderer Component:
Text: 100
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -1058,6 +1070,7 @@
Text Renderer Component:
Text: 100
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 19
@ -1142,6 +1155,7 @@
Text Renderer Component:
Text: Credits
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 46
@ -1221,6 +1235,7 @@
Text Renderer Component:
Text: Level Select
Font: 174412429
Color: {x: 1, y: 1, z: 1, w: 1}
IsActive: true
UI Component:
Canvas ID: 50
@ -1228,3 +1243,39 @@
Clicked: false
IsActive: true
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
Components:
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}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
@ -49,7 +49,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 75, z: 0}
Translate: {x: 0, y: 75, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true
@ -85,7 +85,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0}
Translate: {x: 0, y: -200, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 400, y: 100, z: 1}
IsActive: true
@ -154,3 +154,39 @@
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
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,13 +22,11 @@ public class ChangeSceneButton : Script
{
ui.OnRelease.RegisterAction(() =>
{
if (sceneID != 0)
{
Audio.PlaySFXOnce2D("event:/UI/success");
Audio.StopAllSounds();
if (SceneFadeInOut.Instance != null)
SceneFadeInOut.Instance.CallFadeIn();
clickedFlag = true;
}
@ -37,7 +35,6 @@ public class ChangeSceneButton : Script
else
{
Debug.LogError("Failed to register button action for ChangeSceneButton.");
}
}
protected override void update()

View File

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

View File

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

View File

@ -43,7 +43,6 @@ namespace SHADE_Scripting.UI
protected override void start()
{
}
protected override void update()
@ -56,7 +55,6 @@ namespace SHADE_Scripting.UI
if (fadeInTime == 0.0f)
{
alphaValue = 1.0f;
}
else
{
@ -65,7 +63,7 @@ namespace SHADE_Scripting.UI
if (alphaValue >= 1.0f)
{
alphaValue = 1.0f;
GameObject.Parent.SetActive(false);
//GameObject.Parent.SetActive(false);
}
}
@ -84,6 +82,8 @@ namespace SHADE_Scripting.UI
if (alphaValue <= 0.0f)
{
alphaValue = 0.0f;
//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);
}
}