added ui clicks
This commit is contained in:
parent
242ccb6fcb
commit
a841238f56
|
@ -384,6 +384,7 @@ GameObject:
|
||||||
- component: {fileID: 5921007623216315234}
|
- component: {fileID: 5921007623216315234}
|
||||||
- component: {fileID: 5921007623216315235}
|
- component: {fileID: 5921007623216315235}
|
||||||
- component: {fileID: 5921007623216315232}
|
- component: {fileID: 5921007623216315232}
|
||||||
|
- component: {fileID: 1352108609827047107}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Slider
|
m_Name: Slider
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -478,3 +479,19 @@ MonoBehaviour:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
_defaultValue: 1
|
_defaultValue: 1
|
||||||
_playerPref: {fileID: 11400000, guid: 45598e626e9c27c428f33cca2dd341e2, type: 2}
|
_playerPref: {fileID: 11400000, guid: 45598e626e9c27c428f33cca2dd341e2, type: 2}
|
||||||
|
--- !u!114 &1352108609827047107
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5921007623216315237}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d209d509b2c03e94fb475ce8e7f86ebf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
ClickSfx: event:/UI/Click
|
||||||
|
BloopSfx: event:/UI/Select
|
||||||
|
_clickHorizontal: 1
|
||||||
|
_clickVertical: 0
|
||||||
|
|
|
@ -346,6 +346,8 @@ GameObject:
|
||||||
- component: {fileID: 5361961963888605359}
|
- component: {fileID: 5361961963888605359}
|
||||||
- component: {fileID: 5361961963888605352}
|
- component: {fileID: 5361961963888605352}
|
||||||
- component: {fileID: 5361961963888605358}
|
- component: {fileID: 5361961963888605358}
|
||||||
|
- component: {fileID: 7404948169497184930}
|
||||||
|
- component: {fileID: 5310873695263106293}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: Button
|
m_Name: Button
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
|
@ -445,3 +447,31 @@ Animator:
|
||||||
m_HasTransformHierarchy: 1
|
m_HasTransformHierarchy: 1
|
||||||
m_AllowConstantClipSamplingOptimization: 1
|
m_AllowConstantClipSamplingOptimization: 1
|
||||||
m_KeepAnimatorControllerStateOnDisable: 0
|
m_KeepAnimatorControllerStateOnDisable: 0
|
||||||
|
--- !u!114 &7404948169497184930
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5361961963888605354}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: d209d509b2c03e94fb475ce8e7f86ebf, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
ClickSfx: event:/UI/Click
|
||||||
|
BloopSfx: event:/UI/Select
|
||||||
|
_clickHorizontal: 0
|
||||||
|
_clickVertical: 0
|
||||||
|
--- !u!114 &5310873695263106293
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 5361961963888605354}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 1c3c1a165a7a070469c9513e8e909641, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 25fc6ce6430287c4b9dc4e7217dac37c
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
|
||||||
|
public class HoverSelect : MonoBehaviour, IPointerEnterHandler
|
||||||
|
{
|
||||||
|
private Selectable _selectable;
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
_selectable = GetComponent<Selectable>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnPointerEnter( PointerEventData eventData )
|
||||||
|
=> _selectable.Select();
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1c3c1a165a7a070469c9513e8e909641
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -0,0 +1,74 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using FMODUnity;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.EventSystems;
|
||||||
|
using UnityEngine.Serialization;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class NoisyUIElement : MonoBehaviour, ISelectHandler, ISubmitHandler, IPointerClickHandler, IMoveHandler
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
[EventRef]
|
||||||
|
private string ClickSfx;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
[EventRef]
|
||||||
|
private string BloopSfx;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private bool _clickHorizontal;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private bool _clickVertical;
|
||||||
|
|
||||||
|
private void PlayClickSfx()
|
||||||
|
{
|
||||||
|
if ( !string.IsNullOrEmpty( ClickSfx ) )
|
||||||
|
{
|
||||||
|
RuntimeManager.PlayOneShot( ClickSfx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void PlayBloopSfx()
|
||||||
|
{
|
||||||
|
if ( !string.IsNullOrEmpty( BloopSfx ) )
|
||||||
|
{
|
||||||
|
RuntimeManager.PlayOneShot( BloopSfx );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnSelect( BaseEventData eventData )
|
||||||
|
=> PlayClickSfx();
|
||||||
|
|
||||||
|
public void OnSubmit( BaseEventData eventData )
|
||||||
|
=> PlayBloopSfx();
|
||||||
|
|
||||||
|
public void OnPointerClick( PointerEventData eventData )
|
||||||
|
=> PlayBloopSfx();
|
||||||
|
|
||||||
|
public void OnDrag( PointerEventData eventData )
|
||||||
|
=> PlayBloopSfx();
|
||||||
|
|
||||||
|
public void OnMove( AxisEventData eventData )
|
||||||
|
{
|
||||||
|
switch ( eventData.moveDir )
|
||||||
|
{
|
||||||
|
case MoveDirection.Left:
|
||||||
|
case MoveDirection.Right:
|
||||||
|
if ( _clickHorizontal )
|
||||||
|
{
|
||||||
|
PlayClickSfx();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MoveDirection.Up:
|
||||||
|
case MoveDirection.Down:
|
||||||
|
if ( _clickVertical )
|
||||||
|
{
|
||||||
|
PlayClickSfx();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d209d509b2c03e94fb475ce8e7f86ebf
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue