68 lines
2.1 KiB
C#
68 lines
2.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using Ichni.Menu.UI;
|
|
using Ichni.RhythmGame;
|
|
using Ichni.UI;
|
|
using Sirenix.OdinInspector;
|
|
using SLSUtilities.WwiseAssistance;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.Menu
|
|
{
|
|
public partial class SongSelectionManager : SerializedMonoBehaviour
|
|
{
|
|
public static SongSelectionManager instance;
|
|
|
|
public SongSelectionUIPage songSelectionUIPage;
|
|
|
|
public float currentFilterValue;
|
|
public Tweener filterTweener;
|
|
|
|
private uint _playPreviewPlayingID;
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
currentFilterValue = 100f;
|
|
_playPreviewPlayingID = AkUnitySoundEngine.AK_INVALID_PLAYING_ID;
|
|
}
|
|
|
|
}
|
|
|
|
public partial class SongSelectionManager
|
|
{
|
|
public void SetPreview(SongItemData connectedSong, bool isLocked)
|
|
{
|
|
if(_playPreviewPlayingID != AkUnitySoundEngine.AK_INVALID_PLAYING_ID)
|
|
{
|
|
AudioManager.Stop(_playPreviewPlayingID);
|
|
}
|
|
AudioManager.SetSwitch(connectedSong.songSwitch);
|
|
_playPreviewPlayingID = AudioManager.Post(AK.EVENTS.PLAYPREVIEW);
|
|
|
|
float targetFilterValue = isLocked ? 50 : 100;
|
|
if (!Mathf.Approximately(currentFilterValue, targetFilterValue))
|
|
{
|
|
filterTweener.Kill(true);
|
|
filterTweener =
|
|
DOTween.To(() => currentFilterValue, x => currentFilterValue = x, targetFilterValue, 1f)
|
|
.SetEase(Ease.OutQuad)
|
|
.OnUpdate(() =>
|
|
{
|
|
AudioManager.SetRTPC("PreviewLowPassFilter", currentFilterValue);
|
|
}).Play();
|
|
}
|
|
}
|
|
|
|
public void StopPreviewSong()
|
|
{
|
|
if(_playPreviewPlayingID != AkUnitySoundEngine.AK_INVALID_PLAYING_ID)
|
|
{
|
|
AudioManager.Stop(_playPreviewPlayingID);
|
|
_playPreviewPlayingID = AkUnitySoundEngine.AK_INVALID_PLAYING_ID;
|
|
}
|
|
}
|
|
}
|
|
} |