mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2024-12-25 19:28:53 +00:00
18 lines
613 B
TypeScript
18 lines
613 B
TypeScript
|
import { Component, _decorator } from "cc";
|
||
|
import { AppRoot } from "../AppRoot/AppRoot";
|
||
|
import { UIButton } from "../Services/UI/Button/UIButton";
|
||
|
const { ccclass, property } = _decorator;
|
||
|
|
||
|
@ccclass("UIButtonAudioPlayer")
|
||
|
export class UIButtonAudioPlayer extends Component {
|
||
|
@property(UIButton) private button: UIButton;
|
||
|
public start(): void {
|
||
|
this.button.InteractedEvent.on(this.playButtonClick, this);
|
||
|
}
|
||
|
|
||
|
private playButtonClick(): void {
|
||
|
const audioClip = AppRoot.Instance.GameAssets.AudioAssets.buttonClick;
|
||
|
AppRoot.Instance.AudioPlayer.playSound(audioClip);
|
||
|
}
|
||
|
}
|