*
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class AuthorsMenu : MenuLayer {
|
||||
|
||||
public override string Name { get {return "AuthorsMenu"; } }
|
||||
|
||||
|
||||
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;
|
||||
|
||||
GUI.Label (new Rect (boxRect.center.x - buttonWidth * 0.5f,
|
||||
(boxRect.yMax - (buttonHeight + buttonMargin) * 2), buttonWidth, buttonHeight), "L-proger");
|
||||
|
||||
if (GUI.Button (new Rect (boxRect.center.x - buttonWidth * 0.5f,
|
||||
(boxRect.yMax - buttonHeight - buttonMargin), buttonWidth, buttonHeight), "Назад")) {
|
||||
manager.ActivatePreviousMenu();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Enter(){
|
||||
|
||||
}
|
||||
public override void Leave(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72c7f2fb5a5a0774b88e12ab79e2f713
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,62 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class MainMenu : MenuLayer {
|
||||
private GUIStyle style;
|
||||
public AudioClip clickSound;
|
||||
|
||||
public override string Name { get {return "MainMenu"; } }
|
||||
|
||||
|
||||
public override void Draw(){
|
||||
float w = (float)Screen.width;
|
||||
float h = (float)Screen.height;
|
||||
|
||||
float buttonHeight = 60;
|
||||
float buttonWidth = 250;
|
||||
float buttonSpacing = 10;
|
||||
float buttonOffset = buttonHeight + buttonSpacing;
|
||||
|
||||
float buttonBlockHeight = buttonOffset * 5;
|
||||
float buttonBlockOffset = (h - buttonBlockHeight) * 0.5f;
|
||||
style = GUI.skin.GetStyle ("button");
|
||||
style.fontSize = 22;
|
||||
|
||||
|
||||
|
||||
GUI.enabled = (gameManager != null) && (gameManager.State.currentLevel != 0);
|
||||
if(GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 0, buttonWidth, buttonHeight), "Продолжить", style)){
|
||||
if(manager != null){
|
||||
//manager.
|
||||
}
|
||||
}
|
||||
GUI.enabled = true;
|
||||
if (GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 1, buttonWidth, buttonHeight), "Новая игра", style)) {
|
||||
if(clickSound != null) gameManager.audio.PlayOneShot(clickSound);
|
||||
gameManager.NewGame();
|
||||
}
|
||||
|
||||
if(GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 2, buttonWidth, buttonHeight), "Настройки", style)){
|
||||
if(clickSound != null) gameManager.audio.PlayOneShot(clickSound);
|
||||
manager.ActivateMenu("SettingsMenu");
|
||||
}
|
||||
|
||||
if (GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 3, buttonWidth, buttonHeight), "Авторы", style)) {
|
||||
if(clickSound != null) gameManager.audio.PlayOneShot(clickSound);
|
||||
manager.ActivateMenu("AuthorsMenu");
|
||||
}
|
||||
|
||||
|
||||
if (GUI.Button (new Rect (0, buttonBlockOffset + buttonOffset * 4, buttonWidth, buttonHeight), "Выход", style)) {
|
||||
if(clickSound != null) gameManager.audio.PlayOneShot(clickSound);
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Enter(){
|
||||
|
||||
}
|
||||
public override void Leave(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0abe46495ed365468451a51a7ec2221
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public abstract class MenuLayer : MonoBehaviour {
|
||||
|
||||
public MenuManager manager;
|
||||
protected GameManager gameManager;
|
||||
|
||||
public abstract string Name { get; }
|
||||
|
||||
void Start(){
|
||||
gameManager = GameObject.FindObjectOfType<GameManager> ();
|
||||
}
|
||||
|
||||
public virtual void Draw(){
|
||||
|
||||
}
|
||||
public virtual void Enter(){
|
||||
|
||||
}
|
||||
public virtual void Leave(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d969a2e5701374478473140c4936408
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,34 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class MenuShow : MonoBehaviour {
|
||||
public Button Predicate;
|
||||
private MenuManager Manager;
|
||||
public string MenuName;
|
||||
public bool ShowOnStart = false;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
if (Predicate != null) {
|
||||
Predicate.EventClick += HandleEventClick;
|
||||
}
|
||||
Manager = GameObject.FindObjectOfType<MenuManager> ();
|
||||
|
||||
if (ShowOnStart) {
|
||||
if (Manager != null) {
|
||||
Manager.ActivateMenu(MenuName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEventClick (Button sender)
|
||||
{
|
||||
if (Manager != null) {
|
||||
Manager.ActivateMenu(MenuName);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1ced3061a6b0e7498f4e350655df028
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,41 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class PauseMenu : MenuLayer {
|
||||
public override string Name { get {return "PauseMenu"; } }
|
||||
|
||||
public override void Draw(){
|
||||
float w = (float)Screen.width;
|
||||
float h = (float)Screen.height;
|
||||
|
||||
float buttonHeight = 40;
|
||||
float buttonWidth = 200;
|
||||
float buttonSpacing = 10;
|
||||
float buttonOffset = buttonHeight + buttonSpacing;
|
||||
|
||||
float buttonBlockHeight = buttonOffset * 4;
|
||||
float buttonBlockVOffset = (h - buttonBlockHeight) * 0.5f;
|
||||
float buttonBlockHOffset = (w - buttonWidth) * 0.5f;
|
||||
|
||||
if (GUI.Button (new Rect (buttonBlockHOffset, buttonBlockVOffset + buttonOffset * 0, buttonWidth, buttonHeight), "Продолжить")) {
|
||||
manager.ActivateMenu("");
|
||||
}
|
||||
GUI.Button (new Rect (buttonBlockHOffset, buttonBlockVOffset + buttonOffset * 1, buttonWidth, buttonHeight), "Настройки");
|
||||
if (GUI.Button (new Rect (buttonBlockHOffset, buttonBlockVOffset + buttonOffset * 2, buttonWidth, buttonHeight), "Главное меню")) {
|
||||
gameManager.MainMenu();
|
||||
}
|
||||
|
||||
|
||||
if (GUI.Button (new Rect (buttonBlockHOffset, buttonBlockVOffset + buttonOffset * 3, buttonWidth, buttonHeight), "Выход")) {
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Enter(){
|
||||
Debug.Log ("Set time scale to 0");
|
||||
Time.timeScale = 0.0f;
|
||||
}
|
||||
public override void Leave(){
|
||||
Time.timeScale = 1.0f;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98f0ab250b1825c4ea6665a6e75fe3e9
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,51 @@
|
||||
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(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a6d21b57d78ce5945b3d46ba5b1fde4d
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System;
|
||||
|
||||
[Serializable]
|
||||
public class UIPoint{
|
||||
public bool Relative;
|
||||
public Vector2 Position;
|
||||
public Vector2 PixelPosition{
|
||||
get{
|
||||
if(Relative){
|
||||
return new Vector2(Position.x * Screen.width, Position.y * Screen.height);
|
||||
}else{
|
||||
return Position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UIItem : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa8eacbb58aa5854a81e4cd830687021
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class UIPlane : MonoBehaviour {
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cad42e97e167c14eab86cda9f6b9807
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Reference in New Issue
Block a user