1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class PanelSet : MonoBehaviour {
- private Button backBtn;
- private Slider musicsli;
- private Slider audiosli;
- // Use this for initialization
- void Start () {
- backBtn = transform.Find("BackBtn").GetComponent<Button>();
- backBtn.onClick.RemoveAllListeners();
- backBtn.onClick.AddListener(backBtnEvent);
- musicsli = transform.Find("MusicSli").GetComponent<Slider>();
- musicsli.value = ScoreManager.instance.BGM;
- audiosli = transform.Find("AudioSli").GetComponent<Slider>();
- audiosli.value = ScoreManager.instance.AM;
- }
- private void backBtnEvent()
- {
- UIManager.instance.CreatePanel("PanelStart");
- UIManager.instance.DestroyPanel("PanelSet");
- PlayerPrefs.SetFloat("BGM",musicsli.value);
- PlayerPrefs.SetFloat("AM",audiosli.value);
- }
- // Update is called once per frame
- void Update () {
- ScoreManager.instance.BGM = musicsli.value;
- ScoreManager.instance.AM = audiosli.value;
- }
- }
|