Button FX now uses the easing functions. Viewport can now be fixed at an AR. #371
|
@ -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
|
|
@ -4,5 +4,5 @@
|
||||||
Properties:
|
Properties:
|
||||||
data.color: {x: 1, y: 1, z: 1, w: 1}
|
data.color: {x: 1, y: 1, z: 1, w: 1}
|
||||||
data.textureIndex: 57302694
|
data.textureIndex: 57302694
|
||||||
data.alpha: 0
|
data.alpha: 1
|
||||||
data.beta: {x: 1, y: 1, z: 1}
|
data.beta: {x: 1, y: 1, z: 1}
|
|
@ -9591,27 +9591,14 @@
|
||||||
gamePauseText: 11
|
gamePauseText: 11
|
||||||
canvas: 10
|
canvas: 10
|
||||||
- EID: 199
|
- EID: 199
|
||||||
Name: =====Text====
|
Name: Gameplay UI Canvas
|
||||||
IsActive: true
|
IsActive: true
|
||||||
NumberOfChildren: 4
|
NumberOfChildren: 4
|
||||||
Components: ~
|
|
||||||
Scripts: ~
|
|
||||||
- EID: 237
|
|
||||||
Name: Score
|
|
||||||
IsActive: true
|
|
||||||
NumberOfChildren: 0
|
|
||||||
Components:
|
Components:
|
||||||
Transform Component:
|
Canvas Component:
|
||||||
Translate: {x: -800, y: 400, z: 0}
|
Canvas Width: 1920
|
||||||
Rotate: {x: 0, y: 0, z: 0}
|
Canvas Height: 1080
|
||||||
Scale: {x: 60, y: 60, z: 60}
|
Scale by canvas width: false
|
||||||
IsActive: true
|
|
||||||
Text Renderer Component:
|
|
||||||
Text: My name is Brandon.
|
|
||||||
Font: 176667660
|
|
||||||
IsActive: true
|
|
||||||
UI Component:
|
|
||||||
Canvas ID: 199
|
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 206
|
- EID: 206
|
||||||
|
@ -9630,6 +9617,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 199
|
Canvas ID: 199
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 139
|
- EID: 139
|
||||||
|
@ -9648,6 +9637,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 199
|
Canvas ID: 199
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 11
|
- EID: 11
|
||||||
|
@ -9664,6 +9655,51 @@
|
||||||
Text: Game Pause
|
Text: Game Pause
|
||||||
Font: 176667660
|
Font: 176667660
|
||||||
IsActive: false
|
IsActive: false
|
||||||
|
UI Component:
|
||||||
|
Canvas ID: 199
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 462
|
||||||
|
Name: Score BG
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 1
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: -900, y: 450, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 400, y: 100, z: 1}
|
||||||
|
IsActive: true
|
||||||
|
Renderable Component:
|
||||||
|
Mesh: 141771688
|
||||||
|
Material: 129340704
|
||||||
|
IsActive: true
|
||||||
|
UI Component:
|
||||||
|
Canvas ID: 199
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
|
IsActive: true
|
||||||
|
Scripts: ~
|
||||||
|
- EID: 237
|
||||||
|
Name: Score Text
|
||||||
|
IsActive: true
|
||||||
|
NumberOfChildren: 0
|
||||||
|
Components:
|
||||||
|
Transform Component:
|
||||||
|
Translate: {x: -0.050249815, y: -0.300000191, z: 0}
|
||||||
|
Rotate: {x: 0, y: 0, z: 0}
|
||||||
|
Scale: {x: 0.150000006, y: 0.600000024, z: 60}
|
||||||
|
IsActive: true
|
||||||
|
Text Renderer Component:
|
||||||
|
Text: My name is Brandon.
|
||||||
|
Font: 176667660
|
||||||
|
IsActive: true
|
||||||
|
UI Component:
|
||||||
|
Canvas ID: 199
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 198
|
- EID: 198
|
||||||
Name: ====Raccoon====
|
Name: ====Raccoon====
|
||||||
|
@ -9765,7 +9801,6 @@
|
||||||
Yaw: 360
|
Yaw: 360
|
||||||
Roll: 1.28065994e-06
|
Roll: 1.28065994e-06
|
||||||
Width: 1055
|
Width: 1055
|
||||||
Height: 604
|
|
||||||
Near: 0.00999999978
|
Near: 0.00999999978
|
||||||
Far: 10000
|
Far: 10000
|
||||||
Perspective: true
|
Perspective: true
|
||||||
|
@ -10664,6 +10699,7 @@
|
||||||
Canvas Component:
|
Canvas Component:
|
||||||
Canvas Width: 1920
|
Canvas Width: 1920
|
||||||
Canvas Height: 1080
|
Canvas Height: 1080
|
||||||
|
Scale by canvas width: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 8
|
- EID: 8
|
||||||
|
@ -10687,6 +10723,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 10
|
Canvas ID: 10
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 0
|
- EID: 0
|
||||||
|
@ -10710,6 +10748,8 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 10
|
Canvas ID: 10
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 461
|
- EID: 461
|
||||||
|
@ -10733,5 +10773,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 10
|
Canvas ID: 10
|
||||||
|
Hovered: false
|
||||||
|
Clicked: false
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Scripts: ~
|
Scripts: ~
|
|
@ -21,7 +21,7 @@
|
||||||
IsActive: true
|
IsActive: true
|
||||||
Renderable Component:
|
Renderable Component:
|
||||||
Mesh: 141771688
|
Mesh: 141771688
|
||||||
Material: 121834459
|
Material: 129138332
|
||||||
IsActive: true
|
IsActive: true
|
||||||
UI Component:
|
UI Component:
|
||||||
Canvas ID: 0
|
Canvas ID: 0
|
||||||
|
@ -1024,14 +1024,14 @@
|
||||||
maxValue: 100
|
maxValue: 100
|
||||||
- EID: 46
|
- EID: 46
|
||||||
Name: Credits Canvas
|
Name: Credits Canvas
|
||||||
IsActive: true
|
IsActive: false
|
||||||
NumberOfChildren: 3
|
NumberOfChildren: 3
|
||||||
Components:
|
Components:
|
||||||
Canvas Component:
|
Canvas Component:
|
||||||
Canvas Width: 1920
|
Canvas Width: 1920
|
||||||
Canvas Height: 1080
|
Canvas Height: 1080
|
||||||
Scale by canvas width: false
|
Scale by canvas width: false
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 47
|
- EID: 47
|
||||||
Name: BackGround
|
Name: BackGround
|
||||||
|
@ -1103,14 +1103,14 @@
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 50
|
- EID: 50
|
||||||
Name: Level Select Canvas
|
Name: Level Select Canvas
|
||||||
IsActive: true
|
IsActive: false
|
||||||
NumberOfChildren: 3
|
NumberOfChildren: 3
|
||||||
Components:
|
Components:
|
||||||
Canvas Component:
|
Canvas Component:
|
||||||
Canvas Width: 1920
|
Canvas Width: 1920
|
||||||
Canvas Height: 1080
|
Canvas Height: 1080
|
||||||
Scale by canvas width: false
|
Scale by canvas width: false
|
||||||
IsActive: true
|
IsActive: false
|
||||||
Scripts: ~
|
Scripts: ~
|
||||||
- EID: 51
|
- EID: 51
|
||||||
Name: BackGround
|
Name: BackGround
|
||||||
|
|
|
@ -11,6 +11,9 @@ namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
EASE_IN_SINE,
|
EASE_IN_SINE,
|
||||||
EASE_OUT_SINE,
|
EASE_OUT_SINE,
|
||||||
|
EASE_OUT_BOUNCE,
|
||||||
|
EASE_IN_BOUNCE,
|
||||||
|
EASE_INOUT_BOUNCE
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class EasingHelper
|
public static class EasingHelper
|
||||||
|
@ -28,7 +31,20 @@ namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
return EaseOutSine(value);
|
return EaseOutSine(value);
|
||||||
}break;
|
}break;
|
||||||
|
case EASING_METHOD.EASE_OUT_BOUNCE:
|
||||||
|
{
|
||||||
|
return EaseOutBounce(value);
|
||||||
|
}break;
|
||||||
|
case EASING_METHOD.EASE_IN_BOUNCE:
|
||||||
|
{
|
||||||
|
return EaseInBounce(value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case EASING_METHOD.EASE_INOUT_BOUNCE:
|
||||||
|
{
|
||||||
|
return EaseInOutBounce(value);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -44,5 +60,37 @@ namespace SHADE_Scripting.UI
|
||||||
return (float)(1.0f - Math.Sin(value * Math.PI) / 2.0f);
|
return (float)(1.0f - Math.Sin(value * Math.PI) / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static float EaseOutBounce(float value)
|
||||||
|
{
|
||||||
|
const float n1 = 7.5625f;
|
||||||
|
const float d1 = 2.75f;
|
||||||
|
if (value < 1.0f / d1)
|
||||||
|
{
|
||||||
|
return n1 * value * value;
|
||||||
|
} else if (value < 2.0f / d1)
|
||||||
|
{
|
||||||
|
return n1 * (value -= 2.25f / d1) * value + 0.9375f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return n1 * (value -= 2.625f / d1) * value + 0.984375f;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static float EaseInBounce(float value)
|
||||||
|
{
|
||||||
|
return 1 - EaseOutBounce(1 - value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static float EaseInOutBounce(float value)
|
||||||
|
{
|
||||||
|
return (value < 0.5f)
|
||||||
|
?(1.0f - EaseOutBounce(1.0f - 2.0f * value)) / 2.0f
|
||||||
|
: (1.0f + EaseOutBounce(2.0f * value - 1.0f)) / 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,16 +30,30 @@ namespace SHADE_Scripting.UI
|
||||||
public float clickScale = 0.9f;
|
public float clickScale = 0.9f;
|
||||||
|
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private TweenThread thread;
|
||||||
|
|
||||||
|
[NonSerialized]
|
||||||
|
private bool tweening = false;
|
||||||
|
[NonSerialized]
|
||||||
|
private float currentScale = 1.0f;
|
||||||
|
|
||||||
protected override void awake()
|
protected override void awake()
|
||||||
{
|
{
|
||||||
onHoverEnterACHandler = SHADE.Audio.CreateAudioClip(onHoverEnterSound);
|
onHoverEnterACHandler = SHADE.Audio.CreateAudioClip(onHoverEnterSound);
|
||||||
onHoverExitACHandler = SHADE.Audio.CreateAudioClip(onHoverExitSound);
|
onHoverExitACHandler = SHADE.Audio.CreateAudioClip(onHoverExitSound);
|
||||||
onClickACHandler = SHADE.Audio.CreateAudioClip(onClickSound);
|
onClickACHandler = SHADE.Audio.CreateAudioClip(onClickSound);
|
||||||
onReleaseACHandler = SHADE.Audio.CreateAudioClip(onReleaseSound);
|
onReleaseACHandler = SHADE.Audio.CreateAudioClip(onReleaseSound);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void start()
|
protected override void start()
|
||||||
{
|
{
|
||||||
|
thread = TweenManager.CreateTweenThread(0.1f, 0.9f, 1.0f, EASING_METHOD.EASE_IN_SINE);
|
||||||
|
|
||||||
|
|
||||||
Transform transform = GetComponent<Transform>();
|
Transform transform = GetComponent<Transform>();
|
||||||
if (transform == null)
|
if (transform == null)
|
||||||
return;
|
return;
|
||||||
|
@ -55,35 +69,53 @@ namespace SHADE_Scripting.UI
|
||||||
{
|
{
|
||||||
if (onClickSound != "")
|
if (onClickSound != "")
|
||||||
onClickACHandler.Play();
|
onClickACHandler.Play();
|
||||||
transform.LocalScale = defaultScale * clickScale;
|
tweening = true;
|
||||||
|
if(thread != null)
|
||||||
|
thread.Reset(currentScale,clickScale);
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.OnRelease.RegisterAction(() =>
|
ui.OnRelease.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
if (onReleaseSound != "")
|
if (onReleaseSound != "")
|
||||||
onReleaseACHandler.Play();
|
onReleaseACHandler.Play();
|
||||||
transform.LocalScale = defaultScale;
|
tweening = true;
|
||||||
|
if (thread != null)
|
||||||
|
thread.Reset(currentScale, 1.0f);
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.OnHoverEnter.RegisterAction(() =>
|
ui.OnHoverEnter.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
if(onHoverEnterSound != "")
|
if (onHoverEnterSound != "")
|
||||||
onHoverEnterACHandler.Play();
|
onHoverEnterACHandler.Play();
|
||||||
transform.LocalScale = defaultScale * hoverScale;
|
tweening = true;
|
||||||
|
if (thread != null)
|
||||||
|
thread.Reset(currentScale, hoverScale);
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.OnHoverExit.RegisterAction(() =>
|
ui.OnHoverExit.RegisterAction(() =>
|
||||||
{
|
{
|
||||||
if (onHoverExitSound != "")
|
if (onHoverExitSound != "")
|
||||||
onHoverExitACHandler.Play();
|
onHoverExitACHandler.Play();
|
||||||
transform.LocalScale = defaultScale;
|
tweening = true;
|
||||||
|
if (thread != null)
|
||||||
|
thread.Reset(currentScale, 1.0f);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void update()
|
protected override void update()
|
||||||
{
|
{
|
||||||
|
Transform transform = GetComponent<Transform>();
|
||||||
|
if (transform == null)
|
||||||
|
return;
|
||||||
|
if (tweening == true && thread != null)
|
||||||
|
{
|
||||||
|
Debug.Log("Tweening value " + thread.GetValue());
|
||||||
|
transform.LocalScale = defaultScale * thread.GetValue();
|
||||||
|
currentScale = thread.GetValue();
|
||||||
|
if (thread.IsCompleted())
|
||||||
|
tweening = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue