Синтаксис:
Используется javascript
// Main Menu Script
var window = 0;
var myFont : Font;
var style : GUIStyle;
var toggle = false; //тумблер
var _menuWindow = false;
var toggle1 = false;
static var soundFloat : float = 1.0;
//
function Start (){
}
function Update ()
{
if(Input.GetKeyDown(KeyCode.Escape))
{
Time.timeScale = 0f;
_menuWindow = true;
}
}
function OnGUI()
{
if(_menuWindow)
MenuWindow();
} //(!)
function MenuWindow()
{
AudioListener.volume = soundFloat; //применяем громкость
if (Input.GetKey("f1"))
window = 2;
{
GUI.skin.fon == myFont;
if (window == 0) // теперь главное меню активировано при window = 0
}
GUI.Box (Rect (Screen.width/2 - 100,Screen.height/2 - 140,200,220), "ГЛАВНОЕ МЕНЮ");
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 80,180,30), "Новая игра"))
{
Application.LoadLevel (1);
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 40,180,30), "Настройки"))
{
window = 1; // активируем окно "настройки"
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 0,180,30), "Помощь"))
{
window = 2; // активируем окно "помощь"
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 + 40,180,30), "Выход"))
{
Application.Quit();
}
}
if (window == 1) // наши настройки
{
GUI.Box (Rect (Screen.width/2 - 100,Screen.height/2 - 100,200,180), "Настройки");
GUI.Label (Rect (Screen.width/2 - 90,Screen.height/2 - 70, 180, 20), "Громкость музыки:");
soundFloat = GUI.HorizontalSlider (Rect (Screen.width/2 - 90,Screen.height/2 - 50, 180, 20), soundFloat, 0.0, 1.0); //ползунок, регулирующий громкость
toggle = GUI.Toggle (Rect (Screen.width/2 - 90,Screen.height/2 - 20, 180, 20), toggle, "На весь экран");
if(GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 - 0,180,30), "Применить"))
}
if (toggle) Screen.SetResolution(Screen.currentResolution.width, Screen.currentResolution.height, true);
else Screen.SetResolution(800, 600, false);
}
{
Time.timeScale = 1f;
_menuWindow = false;
}
}
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 + 40,180,30), "Назад") || Input.GetKey ("escape"))
{
window = 0;
}
}
if (window == 2) // наша помощь
{
GUI.Box (Rect (Screen.width/2 - 100,Screen.height/2 - 140,200,220), "Помощь");
GUI.Label (Rect (Screen.width/2 - 100,Screen.height/2 - 80,200,300), " текст ", style); // текст
GUI.Label (Rect (Screen.width/2 - 100,Screen.height/2 - 50,500,250), " текст ", style); // текст
if (GUI.Button (Rect (Screen.width/2 - 90,Screen.height/2 + 40,180,30), "Назад") || Input.GetKey ("escape"))
{
window = 0;
}
}
}
Ошибка
Assets/Standard Assets/Scripts/New Folder/menu.js(34,25): BCE0044: expecting :, found ';'.