52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
using UnityEngine;
|
|||
|
|
using System.Collections;
|
||
|
|
|
||
|
|
public class SettingsMenu : MenuLayer {
|
||
|
|
|
||
|
|
public override string Name { get {return "SettingsMenu"; } }
|
||
|
|
|
||
|
|
|
||
|
|
public override void Draw(){
|
||
|
|
float w = (float)Screen.width;
|
||
|
|
float h = (float)Screen.height;
|
||
|
|
|
||
|
|
float boxWidth = 300;
|
||
|
|
float boxHeight = 200;
|
||
|
|
|
||
|
|
float boxOffsetX = (w - boxWidth) * 0.5f;
|
||
|
|
float boxOffsetY = (h - boxHeight) * 0.5f;
|
||
|
|
Rect boxRect = new Rect (boxOffsetX, boxOffsetY, boxWidth, boxHeight);
|
||
|
|
GUI.Box (boxRect, "");
|
||
|
|
|
||
|
|
|
||
|
|
float buttonHeight = 50;
|
||
|
|
float buttonWidth = 150;
|
||
|
|
float buttonMargin = 10;
|
||
|
|
|
||
|
|
float sliderSize = boxWidth * 0.9f;
|
||
|
|
float sliderHeight = 20.0f;
|
||
|
|
|
||
|
|
float value = gameManager == null ? 50 : gameManager.State.Volume;
|
||
|
|
value = GUI.HorizontalSlider (new Rect (boxRect.center.x - sliderSize * 0.5f, boxRect.center.y - sliderHeight * 0.5f, sliderSize, sliderHeight), value, 0, 100);
|
||
|
|
if (gameManager != null) {
|
||
|
|
gameManager.State.Volume = value;
|
||
|
|
}
|
||
|
|
|
||
|
|
GUI.Label(new Rect (boxRect.center.x - sliderSize * 0.5f, boxRect.center.y - sliderHeight * 0.5f - 30, sliderSize, sliderHeight), "Громкость");
|
||
|
|
|
||
|
|
|
||
|
|
if (GUI.Button (new Rect (boxRect.center.x - buttonWidth * 0.5f,
|
||
|
|
(boxRect.yMax - buttonHeight - buttonMargin), buttonWidth, buttonHeight), "Назад")) {
|
||
|
|
gameManager.SaveState();
|
||
|
|
manager.ActivatePreviousMenu();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Enter(){
|
||
|
|
|
||
|
|
}
|
||
|
|
public override void Leave(){
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|