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
5 changed files with 268 additions and 77 deletions
Showing only changes of commit 381fe476be - Show all commits

View File

@ -2228,24 +2228,54 @@
gamePauseText: 11
canvas: 10
- EID: 199
Name: =====Text====
Name: Gameplay Canvas
IsActive: true
NumberOfChildren: 3
Components:
Canvas Component:
Canvas Width: 1920
Canvas Height: 1080
Scale by canvas width: false
IsActive: true
NumberOfChildren: 4
Components: ~
Scripts: ~
- EID: 237
Name: Score
Name: Score Text
IsActive: true
NumberOfChildren: 1
Components:
Transform Component:
Translate: {x: -800, y: 365, z: 0.600000024}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 60}
IsActive: true
Text Renderer Component:
Text: My name is Brandon.
Font: 174412429
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 522
Name: Score BG
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 400, z: 0}
Translate: {x: 0.300000012, y: 0.600000024, z: 0.98999995}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 60, y: 60, z: 60}
Scale: {x: 3.45600009, y: 2, z: 1}
IsActive: true
Text Renderer Component:
Text: My name is Brandon.
Font: 176667660
Renderable Component:
Mesh: 141771688
Material: 127527215
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 206
@ -2262,36 +2292,56 @@
Text: My name is Brandon.
Font: 176667660
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 139
Name: Multiplier
Name: Multiplier Text
IsActive: true
NumberOfChildren: 1
Components:
Transform Component:
Translate: {x: -800, y: 250, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 50, y: 50, z: 60}
IsActive: true
Text Renderer Component:
Text: X2
Font: 174412429
IsActive: true
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
IsActive: true
Scripts:
- Type: SHADE_Scripting.UI.MultiplierTextFx
Enabled: true
maxSize: 1
minSize: 0.300000012
minAlpha: 0.300000012
- EID: 523
Name: Multiplier BG
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -800, y: 300, z: 0}
Translate: {x: 0.400000006, y: 0.400000006, z: 0.98999995}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 60, y: 60, z: 60}
Scale: {x: 4.26499987, y: 2, z: 1}
IsActive: true
Text Renderer Component:
Text: TEST
Font: 176667660
Renderable Component:
Mesh: 141771688
Material: 133784677
IsActive: true
Scripts: ~
- EID: 11
Name: GamePause
UI Component:
Canvas ID: 199
Hovered: false
Clicked: false
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
Scripts: ~
- EID: 198
Name: ====Raccoon====
@ -2414,7 +2464,7 @@
armLength: 3
turnSpeedPitch: 0.200000003
turnSpeedYaw: 0.400000006
inverseXControls: false
inverseXControls: true
inverseYControls: false
pitchUpperClamp: 45
pitchLowerClamp: 5
@ -4782,9 +4832,9 @@
- Type: JumpPad
Enabled: true
- EID: 10
Name: Canvas
Name: Pause Canvas
IsActive: true
NumberOfChildren: 3
NumberOfChildren: 4
Components:
Canvas Component:
Canvas Width: 1920
@ -4800,23 +4850,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
@ -4825,23 +4883,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
@ -4850,22 +4916,50 @@
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:
- 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: 176667660
IsActive: false
UI Component:
Canvas ID: 10
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
- EID: 19
Name: ====EnvironmentMaster====
@ -13334,3 +13428,11 @@
alphaValue: 1
fadeInTime: 0.5
fadeOutTime: 0.5
- EID: 172
Name: TweenManager
IsActive: true
NumberOfChildren: 0
Components: ~
Scripts:
- Type: SHADE_Scripting.UI.TweenManager
Enabled: true

View File

@ -352,23 +352,23 @@
Scripts: ~
- EID: 14
Name: BackGround
IsActive: true
IsActive: false
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0.5}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1920, y: 1080, z: 1}
IsActive: true
IsActive: false
Renderable Component:
Mesh: 141771688
Material: 121834459
IsActive: true
IsActive: false
UI Component:
Canvas ID: 13
Hovered: false
Clicked: false
IsActive: true
IsActive: false
Scripts: ~
- EID: 15
Name: Instruction Image
@ -580,7 +580,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -150, y: 400, z: -0.5}
Translate: {x: -150, y: 400, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
@ -600,7 +600,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -900, y: 300, z: -0.5}
Translate: {x: -900, y: 300, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
@ -636,7 +636,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.5}
Translate: {x: 0, y: 0, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -656,7 +656,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: -0.5}
Translate: {x: 0, y: -100, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -676,7 +676,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: -0.5}
Translate: {x: 0, y: -200, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -781,7 +781,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -900, y: -120, z: -0.5}
Translate: {x: -900, y: -120, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
@ -817,7 +817,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: -0.5}
Translate: {x: 0, y: 0, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -837,7 +837,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: -0.5}
Translate: {x: 0, y: -100, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -935,7 +935,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Translate: {x: 0, y: 0, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -960,7 +960,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: 0.5}
Translate: {x: 0, y: -100, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -985,7 +985,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -200, z: 0.5}
Translate: {x: 0, y: -200, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -1026,7 +1026,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0, z: 0}
Translate: {x: 0, y: 0, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -1051,7 +1051,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: -100, z: 0.5}
Translate: {x: 0, y: -100, z: 1}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 75, y: 75, z: 1}
IsActive: true
@ -1135,7 +1135,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -150, y: 400, z: -0.5}
Translate: {x: -150, y: 400, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true
@ -1214,7 +1214,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -150, y: 400, z: -0.5}
Translate: {x: -150, y: 400, z: 0.100000001}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 100, y: 100, z: 1}
IsActive: true

View File

@ -84,6 +84,8 @@ public class GameManager : Script
AudioHandler.audioClipHandlers["SFXHumming"] = Audio.CreateAudioClip("event:/Homeowner/homeowner_humming");
AudioHandler.audioClipHandlers["SFXHumming"].SetVolume(0.15f);
AudioHandler.audioClipHandlers["SFXHumming"].Play();
SceneFadeInOut.Instance.CallFadeOut();
}
protected override void update()

View File

@ -37,12 +37,13 @@ namespace SHADE_Scripting.UI
fadeR = GameObject.GetComponent<Renderable>();
fadeR.Material.SetProperty<float>("data.alpha", alphaValue);
GameObject.Parent.SetActive(false);
//alphaValue = fadeR.Material.GetProperty<float>("data.alpha");
}
protected override void start()
{
CallFadeOut();
}
protected override void update()
@ -55,12 +56,17 @@ namespace SHADE_Scripting.UI
if (fadeInTime == 0.0f)
{
alphaValue = 1.0f;
}
else
{
alphaValue += (1.0f / fadeInTime) * Time.DeltaTimeF;
}
if (alphaValue >= 1.0f) alphaValue = 1.0f;
if (alphaValue >= 1.0f)
{
alphaValue = 1.0f;
GameObject.Parent.SetActive(false);
}
}
if (fadeOut) //fading out
@ -69,12 +75,17 @@ namespace SHADE_Scripting.UI
if (fadeOutTime == 0.0f)
{
alphaValue = 0.0f;
}
else
{
alphaValue -= (1.0f / fadeOutTime) * Time.DeltaTimeF;
}
if (alphaValue <= 0.0f) alphaValue = 0.0f;
if (alphaValue <= 0.0f)
{
alphaValue = 0.0f;
GameObject.Parent.SetActive(false);
}
}
fadeR.Material.SetProperty<float>("data.alpha", alphaValue);
@ -91,18 +102,21 @@ namespace SHADE_Scripting.UI
{
fadeIn = true;
fadeOut = false;
GameObject.Parent.SetActive(true);
}
public void CallFadeOut()
{
fadeOut = true;
fadeIn = false;
GameObject.Parent.SetActive(true);
}
public void CallFadeStop()
{
fadeOut = false;
fadeIn = false;
GameObject.Parent.SetActive(false);
}
public bool FadeOutFinished()

View File

@ -16,8 +16,6 @@ namespace SHADE_Scripting.UI
private float value = 0.0f;
public float startValue = 0.0f;
public float endValue = 1.0f;
public TweenThread(float duration, float startValue, float endValue, EASING_METHOD method)
{
this.duration = duration;
@ -25,7 +23,6 @@ namespace SHADE_Scripting.UI
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer >= duration)
@ -37,12 +34,10 @@ namespace SHADE_Scripting.UI
value = EasingHelper.EaseHelp(timer/duration, method) * (endValue - startValue) + startValue ;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
@ -61,15 +56,69 @@ namespace SHADE_Scripting.UI
startValue = endValue;
endValue = temp;
}
public float GetValue()
{
return value;
}
}
public class TweenThreadVec3
{
private float timer = 0.0f;
public float duration = 1.0f;
public EASING_METHOD method;
private Vector3 value = Vector3.Zero;
public Vector3 startValue = Vector3.Zero;
public Vector3 endValue = Vector3.Zero;
public TweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
{
this.duration = duration;
this.method = method;
this.startValue = startValue;
this.endValue = endValue;
}
public void Update(float deltaTime)
{
if (timer >= duration)
return;
timer += deltaTime;
if (timer >= duration)
timer = duration;
value = (endValue - startValue) * EasingHelper.EaseHelp(timer / duration, method) + startValue;
}
public bool IsCompleted()
{
return timer >= duration;
}
public void Reset()
{
timer = 0.0f;
value = startValue;
}
public void Reset(Vector3 startValue, Vector3 endValue)
{
Reset();
this.startValue = startValue;
this.endValue = endValue;
}
public void ResetInvert()
{
Reset();
Vector3 temp = startValue;
startValue = endValue;
endValue = temp;
}
public Vector3 GetValue()
{
return value;
}
}
public class TweenManager : Script
{
public static TweenManager Instance { get; private set; }
@ -77,6 +126,9 @@ namespace SHADE_Scripting.UI
[NonSerialized]
private List<TweenThread> threadList;
[NonSerialized]
private List<TweenThreadVec3> threadVec3List;
protected override void awake()
{
if (Instance != null && Instance != this)
@ -85,6 +137,7 @@ namespace SHADE_Scripting.UI
Instance = this;
threadList = new List<TweenThread>();
threadVec3List = new List<TweenThreadVec3>();
}
@ -101,6 +154,11 @@ namespace SHADE_Scripting.UI
{
thread.Update(Time.DeltaTimeF);
}
foreach (TweenThreadVec3 thread in threadVec3List)
{
thread.Update(Time.DeltaTimeF);
}
}
@ -116,5 +174,20 @@ namespace SHADE_Scripting.UI
return thread;
}
public static TweenThreadVec3 CreateTweenThreadVec3(float duration, Vector3 startValue, Vector3 endValue, EASING_METHOD method)
{
if (Instance == null)
return null;
TweenThreadVec3 thread = new TweenThreadVec3(duration, startValue, endValue, method);
Instance.threadVec3List.Add(thread);
thread.Reset();
return thread;
}
}
}