赞
踩
实现功能主要4个脚本:音乐源管理,资源加载,进度条SliderUI,音乐信息显示UI(prefab)
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.EventSystems;
- using UnityEngine.Events;
- using System;
-
- public class Sound_demo : MonoBehaviour
- {
- AudioSource source;
- RectTransform content;
- SliderUI slider;//进度控制
- Slider volume;//音量控制
-
- int currentIndex = 0;//当前音频索引
- // Use this for initialization
- void Start()
- {
- source = this.GetComponent<AudioSource>();//获该脚本下的音频源组件
- content = GameObject.Find("Content").GetComponent<RectTransform>();//找到Scroll View 下的Content 用来存放预设体
- slider = GameObject.Find("Slider").GetComponent<SliderUI>();//获取进度条下的自定义SliderUI:Slider组件
- volume = GameObject.Find("Volume").GetComponent<Slider>();//获取音量进度条
- InitSoundList();//初始化播放列表
- }
-
- // Update is called once per frame
- void Update()
- {
- //if (slider!=null&am
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。