Gameplay and Main Menu UI Update #448

Merged
maverickdgg merged 7 commits from SP3-20-UI-System into main 2023-03-31 15:07:19 +08:00
3 changed files with 93 additions and 4 deletions
Showing only changes of commit 6ee619d26e - Show all commits

View File

@ -770,7 +770,11 @@
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.SliderFX
Enabled: true
onClickSound: event:/UI/button_success
onReleaseSound: event:/UI/button_fail
- EID: 437
Name: Slider BG
IsActive: true
@ -815,7 +819,11 @@
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.SliderFX
Enabled: true
onClickSound: event:/UI/button_success
onReleaseSound: event:/UI/button_fail
- EID: 436
Name: Slider BG
IsActive: true
@ -860,7 +868,11 @@
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.SliderFX
Enabled: true
onClickSound: event:/UI/button_success
onReleaseSound: event:/UI/button_fail
- EID: 435
Name: Slider BG
IsActive: true
@ -1025,7 +1037,11 @@
Hovered: false
Clicked: false
IsActive: true
Scripts: ~
Scripts:
- Type: SHADE_Scripting.UI.SliderFX
Enabled: true
onClickSound: event:/UI/button_success
onReleaseSound: event:/UI/button_fail
- EID: 434
Name: Slider BG
IsActive: true

View File

@ -0,0 +1,70 @@
using SHADE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SHADE_Scripting.UI
{
public class SliderFX : Script
{
public string onClickSound = "event:/UI/button_success";
public string onReleaseSound = "event:/UI/button_fail";
[NonSerialized]
private AudioClipHandler onClickACHandler;
[NonSerialized]
private AudioClipHandler onReleaseACHandler;
protected override void awake()
{
if (onClickSound != "Empty")
onClickACHandler = SHADE.Audio.CreateAudioClip(onClickSound);
if (onReleaseSound != "Empty")
onReleaseACHandler = SHADE.Audio.CreateAudioClip(onReleaseSound);
}
protected override void start()
{
Transform transform = GetComponent<Transform>();
if (transform == null)
return;
UIElement ui = GetComponent<UIElement>();
if (ui == null)
return;
ui.OnClick.RegisterAction(() =>
{
if (onClickSound != "Empty")
onClickACHandler.Play();
});
ui.OnRelease.RegisterAction(() =>
{
if (onReleaseSound != "Empty")
onReleaseACHandler.Play();
});
}
protected override void update()
{
}
}
}

View File

@ -0,0 +1,3 @@
Name: SC_SliderFX
ID: 157251414
Type: 9