UGUI使用,NGUI需要稍微修改一点
1.按钮音效脚本
//=====================================================
// - FileName: SoundButtonTool.cs
// - Author: Autumn
// - CreateTime: 2019/05/28 10:51:42
// - Email: 543761701@qq.com
// - Description:
// - (C) Copyright 2019, webeye,Inc.
// - All Rights Reserved.
//======================================================
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Qarth;
namespace GameWish.Game
{
public enum ButtonClickSound
{
Normal,
Close,
}
[RequireComponent(typeof(Button))]
public class SoundButtonTool : MonoBehaviour
{
public ButtonClickSound clickSound = ButtonClickSound.Normal;
void ClickSound()
{
switch (clickSound)
{
case ButtonClickSound.Normal:
AudioMgr.S.PlaySound(GameSo