void ModoGame() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Time Atack")) { showMenu = true; currentMenu = FaseGame; gerente.SetGameModeOnLine(GameModeOnLine.timeatack); } if (GUILayout.Button("Take Flag")) { showMenu = true; currentMenu = FaseGame; gerente.SetGameModeOnLine(GameModeOnLine.takeflag); } GUILayout.EndArea(); }
void OptionsMenu() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f - height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); GUILayout.Label("Settings"); if (GUILayout.Button("Sound")) { Debug.Log("Sound !"); currentMenu = Sound; } if (GUILayout.Button("Buttons")) { Debug.Log("Buttons!"); currentMenu = Buttons; } if (GUILayout.Button("Camera")) { Debug.Log("Camera"); currentMenu = Cameras; } if (GUILayout.Button("Return to main menu")) { currentMenu = MainMenu; } GUILayout.EndArea(); }
public void ExitMenuGUI() { GUI.skin = this.guiSkin; guiSkin.label.fontSize = HUD.LabelSize; guiSkin.button.fontSize = HUD.ButtonSize; GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), LangHelper.GetInstance().GetString("ConfirmMessageExit"), GUI.skin.GetStyle("box")); if (GUI.Button(new Rect(HUD.Left + 20, HUD.GetPositionTop(2), HUD.Width / 2, HUD.Height), LangHelper.GetInstance().GetString("ConfirmExitButton"), GUI.skin.GetStyle("button"))) { PlayerPrefs.Save(); if (Application.isEditor) { UnityEditor.EditorApplication.isPlaying = false; } else { Application.Quit(); } } if (GUI.Button(new Rect((HUD.Left + HUD.Left) - 20, HUD.GetPositionTop(2), HUD.Width / 2, HUD.Height), LangHelper.GetInstance().GetString("CancelExitButton"), GUI.skin.GetStyle("button"))) { this.currentGUIMethod = MainMenuGUI; } }
void MainMenu() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f - height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Restart")) { gerente.SetGameState(GameState.restarting); gerente.CurrentStage(); } if (GUILayout.Button("Options")) { Debug.Log("Options button!"); currentMenu = OptionsMenu; } if (GUILayout.Button("Quit")) { Application.LoadLevel("Opening"); } GUILayout.EndArea(); }
void GameOverGame() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Continue")) { showMenu = false; currentMenu = MainMenu; gerente.CurrentStage(); } if (GUILayout.Button("Quit")) { showMenu = true; currentMenu = OpeningGame; Application.LoadLevel("Opening"); } GUILayout.EndArea(); }
void OpeningGame() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("1P Game")) { showMenu = false; currentMenu = MainMenu; Application.LoadLevel("DD"); } if (GUILayout.Button("Multiplayer Game")) { GameObject menuObj = GameObject.Find("NetworkChat"); MPBase2 menu = menuObj.GetComponent <MPBase2>(); menu.Toggle(); currentMenu = MultiplayerMenu; } GUILayout.EndArea(); }
void MainMenu() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f - height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Play")) { Debug.Log("Play button!"); } if (GUILayout.Button("Options")) { Debug.Log("Options button!"); currentMenu = OptionsMenu; } if (GUILayout.Button("Quit")) { currentMenu = OpeningGame; Application.LoadLevel("Opening"); } GUILayout.EndArea(); }
void ResearchExplanationGUI() { GUI.enabled = true; GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, ""); GUILayout.BeginArea(GUI_bindings.MESSAGE_BOX_RECT); this.scrollPositionMessage = GUILayout.BeginScrollView(this.scrollPositionMessage); GUILayout.Label(string.Format(G.strings["danger_common"], G.strings[string.Format("danger_{0}", this.research_danger_level)]), GUI_bindings.Instance.LabelAlt(true, null, false)); GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); if (GUILayout.Button("OK")) { this.researchExplanationGUI = null; G.play_sound(); } GUILayout.EndArea(); }
void set_current() { // GUI.enabled = this.offline_confirmGUI == null && this.countGUI == null; if (this.item_type_to_build == "cpu") { space_left = (this._base.type as Base_Class).size; // If there are any existing CPUs of this type, warn that they will // be taken offline until construction finishes. matches = this._base.cpus != null && this._base.cpus.type == item_type; if (matches) { space_left -= this._base.cpus.count; if (this._base.cpus.done && !go_ahead) { this.offline_confirmGUI = this.Offline_ConfirmGUI; } else { this.count_prompt = string.Format(G.strings["num_cpu_prompt"], item_type.name, space_left); this.count_text_init = space_left.ToString(); this.countGUI = this.CountGUI; } } else { this.count_prompt = string.Format(G.strings["num_cpu_prompt"], item_type.name, space_left); this.count_text_init = space_left.ToString(); this.countGUI = this.CountGUI; } } else { int index = (new List <string>() { "reactor", "network", "security" }).IndexOf(item_type_to_build); if (this._base.extra_items[index] == null || this._base.extra_items[index].type != item_type) { this._base.extra_items[index] = new Item(item_type, this._base, 1, false); this._base.check_power(); } this._base.recalc_cpu(); this.build_itemGUI = this.buildItemListGUI = null; } if (this.offline_confirmGUI != null) { this.offline_confirmGUI(); } if (this.countGUI != null) { this.countGUI(); } }
public void OptionsMenuGUI() { GUI.skin = this.guiSkin; guiSkin.label.fontSize = HUD.LabelSize; guiSkin.button.fontSize = HUD.ButtonSize; GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), LangHelper.GetInstance().GetString("OptionLabel"), GUI.skin.GetStyle("box")); if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("SoundButton") + (SoundEffectsHelper.Instance.HasSound ? "On" : "Off"), GUI.skin.GetStyle("button"))) { SoundEffectsHelper.Instance.SetSound(); } if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(2), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("MusicButton") + (SoundEffectsHelper.Instance.HasMusic ? "On" : "Off"), GUI.skin.GetStyle("button"))) { SoundEffectsHelper.Instance.SetMusic(); } if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(4), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("BackButton"), GUI.skin.GetStyle("button"))) { this.currentGUIMethod = MainMenuGUI; } if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(3), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("LanguageLabel"))) { if (!showDropLanguages) { showDropLanguages = true; } else { showDropLanguages = false; } } if (showDropLanguages) { scrollViewVector = GUI.BeginScrollView(new Rect(HUD.Left + HUD.Width - 20, HUD.GetPositionTop(3), HUD.Width / 4, HUD.Height), scrollViewVector, new Rect(0, 0, HUD.Width / 5.5f, (HUD.Height * languages.Length))); for (index = 0; index < languages.Length; index++) { if (GUI.Button(new Rect(0, index * HUD.Height, HUD.Width / 5, HUD.Height), "")) { showDropLanguages = false; wichLanguage = index; PlayerPrefs.SetString("Language", languages[index]); LangHelper.GetInstance().ChangeLanguage(); } GUI.Label(new Rect(12, index * HUD.Height, HUD.Width / 5, HUD.Height), Resources.Load(languages[index]) as Texture); } GUI.EndScrollView(); } else { GUI.Label(new Rect(HUD.Left + HUD.Width - 10, HUD.GetPositionTop(3), HUD.Width, HUD.Height), Resources.Load(languages[wichLanguage]) as Texture); } }
public void Show(IESGUIDialog _parent) { if (_parent != null) { this.parent = _parent; } this.enabled = true; G.play_music(""); this.researchExplanationGUI = null; this.research_items_keys = new List <string> (); this.research_items_keys.Add("cpu_pool"); this.research_items_keys.Add("jobs"); List <Tech> list = G.techs.Values.Where(w => w.available && !w.done).ToList(); list.Sort(); this.research_items_keys.AddRange(list.Select(s => s.id)); this.research_items_names = new string[this.research_items_keys.Count]; this.research_item_notavailable = new bool[this.research_items_keys.Count]; this.sliders = new float[this.research_items_keys.Count]; this.slidersPrevious = new float[this.research_items_keys.Count]; this.slidersMaxValues = new float[this.research_items_keys.Count]; for (int i = 0; i < this.research_items_keys.Count; i++) { if (this.research_items_keys[i] == "cpu_pool") { this.research_items_names[i] = "CPU Pool"; } else if (this.research_items_keys[i] == "jobs") { this.research_items_names[i] = G.get_job_level(); } else { this.research_items_names[i] = G.techs[this.research_items_keys[i]].name; } this.research_item_notavailable[i] = false; } this.dirty_count = true; for (int i = 0; i < this.research_items_keys.Count; i++) { this.update_item(i); } this.research_item_description = string.Empty; }
void Start() { showDropLanguages = false; index = 0; var language = PlayerPrefs.GetString("Language"); wichLanguage = languages.ToList().IndexOf(language); SoundEffectsHelper.Instance.MakeBackgroundSound(SoundType.Menu); this.currentGUIMethod = MainMenuGUI; }
public void Show(IESGUIDialog _parent) { // no parent - top dialog.. this.childDlg = null; this.newGameGUIMethod = this.aboutGUIMethod = this.helpGUIMethod = null; this.enabled = true; G.play_music(""); }
public void Show (IESGUIDialog _parent) { // no parent - top dialog.. this.childDlg = null; this.newGameGUIMethod = this.aboutGUIMethod = this.helpGUIMethod = null; this.enabled = true; G.play_music (""); }
private void ExitMenu() { if (GUI.Button(new Rect(10, 60, Screen.width - 220, 40), "yes")) { // exit Application.Quit(); } if (GUI.Button(new Rect(10, 150, Screen.width - 220, 40), "no")) { // go back to the main menu this.currentGUIMethod = MainMenu1; } }
public void Show (IESGUIDialog _parent) { if (_parent != null) this.parent = _parent; this.countGUI = this.buildItemListGUI = this.offline_confirmGUI = this.build_itemGUI = null; this.enabled = true; this.selectedItemIdx = -1; this.selectedItemIdxPrev = -1; G.play_music (""); }
public void HandleOnStateChange() { switch (gerente.gameState) { case GameState.clear: break; case GameState.playing: break; case GameState.gameover: break; case GameState.restarting: break; case GameState.opening: showMenu = true; currentMenu = OpeningGame; break; case GameState.pause: break; case GameState.dieing: HitEnter(gerente.connectplayerName + " Morreu ", ""); break; case GameState.novafase: break; } Debug.Log("Handling state Rede change to: " + gerente.gameState); }
public void Show(IESGUIDialog _parent) { if (_parent != null) { this.parent = _parent; } this.countGUI = this.buildItemListGUI = this.offline_confirmGUI = this.build_itemGUI = null; this.enabled = true; this.selectedItemIdx = -1; this.selectedItemIdxPrev = -1; G.play_music(""); }
/// <summary> /// /// </summary> void Awake() { currentMenu = MainMenu; // Get the menu size fScreenX = Screen.width * 0.5f - fMenuWidth * 0.5f; fScreenY = Screen.height * 0.5f - fMenuHeight * 0.5f; // Background titleScreenBGPos.x = 0; titleScreenBGPos.y = 0; titleScreenBGPos.width = Screen.width; titleScreenBGPos.height = Screen.height; }
private void QuickPlay() { GUI.TextArea(new Rect(10, 25, Screen.width - 220, 40), "Are you shure"); if (GUI.Button(new Rect(10, 60, Screen.width - 220, 40), "yes")) { // Load scene SceneManager.LoadScene("DroneSim"); } if (GUI.Button(new Rect(10, 150, Screen.width - 220, 40), "no")) { // go back to the main menu this.currentGUIMethod = MainMenu1; } }
public void Show (IESGUIDialog _parent) { if (_parent != null) this.parent = _parent; this.enabled = true; G.play_music (""); this.researchExplanationGUI = null; this.research_items_keys = new List<string> (); this.research_items_keys.Add ("cpu_pool"); this.research_items_keys.Add ("jobs"); List<Tech> list = G.techs.Values.Where ( w => w.available && !w.done ).ToList(); list.Sort(); this.research_items_keys.AddRange( list.Select( s => s.id ) ); this.research_items_names = new string[this.research_items_keys.Count]; this.research_item_notavailable = new bool[this.research_items_keys.Count]; this.sliders = new float[this.research_items_keys.Count]; this.slidersPrevious = new float[this.research_items_keys.Count]; this.slidersMaxValues = new float[this.research_items_keys.Count]; for (int i = 0; i < this.research_items_keys.Count; i++) { if (this.research_items_keys[i] == "cpu_pool") this.research_items_names[i] = "CPU Pool"; else if (this.research_items_keys[i] == "jobs") this.research_items_names[i] = G.get_job_level (); else this.research_items_names[i] = G.techs[this.research_items_keys[i]].name; this.research_item_notavailable[i] = false; } this.dirty_count = true; for (int i = 0; i < this.research_items_keys.Count; i++) this.update_item (i); this.research_item_description = string.Empty; }
void FaseGame() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Fase 1")) { showMenu = true; currentMenu = OpeningNetwork; Application.LoadLevel("Level1"); Network.InitializeServer(32, gerente.connectPort, false); } if (GUILayout.Button("Fase 2")) { showMenu = true; currentMenu = OpeningNetwork; Application.LoadLevel("Level2"); Network.InitializeServer(32, gerente.connectPort, false); } if (GUILayout.Button("Fase M")) { showMenu = true; currentMenu = OpeningNetwork; Application.LoadLevel("LevelM"); Network.InitializeServer(32, gerente.connectPort, false); } GUILayout.EndArea(); }
void Awake() { // Background stuff rectBGScreen.x = 0; rectBGScreen.y = 0; rectBGScreen.width = Screen.width; rectBGScreen.height = Screen.height; // Put the menu on the center of the screen fScreenX = Screen.width * 0.5f - fMenuWidth * 0.5f; //fScreenY = Screen.height * 0.5f - fMenuHeight * 0.5f; fScreenY = 240; currentMenu = MainMenu; }
public void MainMenuGUI() { GUI.skin = this.guiSkin; guiSkin.label.fontSize = HUD.LabelSize; guiSkin.button.fontSize = HUD.ButtonSize; if (Input.GetKeyDown(KeyCode.Escape)) { this.currentGUIMethod = ExitMenuGUI; } var style = GUI.skin.GetStyle("box"); style.fontSize = HUD.TitleSize; GUI.Box(new Rect(10, 10, Screen.width - 20, Screen.height - 20), LangHelper.GetInstance().GetString("AppName"), style); if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("PlayButton"))) { Application.LoadLevel("Level"); } if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(2), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("OptionButton"))) { this.currentGUIMethod = OptionsMenuGUI; } if (GUI.Button(new Rect(HUD.Left, HUD.GetPositionTop(3), HUD.Width, HUD.Height), LangHelper.GetInstance().GetString("ExitButton"))) { this.currentGUIMethod = ExitMenuGUI; } var bestScore = PlayerPrefs.GetInt("BestScore"); var guiStyleScore = new GUIStyle(GUI.skin.GetStyle("label")); guiStyleScore.normal.textColor = Color.yellow; var totalCoin = PlayerPrefs.GetInt("TotalCoins", 0); var guiStyleCoin = new GUIStyle(GUI.skin.GetStyle("label")); guiStyleCoin.normal.textColor = Color.yellow; GUI.Label(new Rect(20, Screen.height - guiStyleScore.lineHeight - 20, Screen.width, Screen.height), LangHelper.GetInstance().GetString("BestScoreLabel") + bestScore, guiStyleScore); GUI.Label(new Rect(Screen.width - (Screen.width / 3.5f), Screen.height - guiStyleCoin.lineHeight - 20, Screen.width, 100), LangHelper.GetInstance().GetString("TotalCoinsLabel") + totalCoin, guiStyleCoin); }
public void Show (IESGUIDialog _parent) { if (_parent != null) this.parent = _parent; this.childDlg = null; this.newBaseGUI = this.confirm_destroyGUI = this.newBaseNameGUI = null; this.enabled = true; this.selectedBaseIdx = this.selectedNewBaseTypeIdx = this.selectedNewBaseTypeIdxPrev = -1; this.base_type_info = string.Empty; G.play_music (""); this.rebuild( true ); }
public void MainMenu1() { if (GUI.Button(new Rect(10, 25, Screen.width - 220, 40), "Quick play")) { // options button clicked, switch to new menu this.currentGUIMethod = QuickPlay; } if (GUI.Button(new Rect(10, 150, Screen.width - 220, 40), "Controller")) { // Load scene SceneManager.LoadScene("ControllerMenu1"); } if (GUI.Button(new Rect(10, 200, Screen.width - 220, 40), "Exit")) { // options button clicked, switch to new menu this.currentGUIMethod = ExitMenu; } }
public void Show(IESGUIDialog _parent) { if (_parent != null) { this.parent = _parent; } this.childDlg = null; this.newBaseGUI = this.confirm_destroyGUI = this.newBaseNameGUI = null; this.enabled = true; this.selectedBaseIdx = this.selectedNewBaseTypeIdx = this.selectedNewBaseTypeIdxPrev = -1; this.base_type_info = string.Empty; G.play_music(""); this.rebuild(true); }
void Cameras() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f - height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); GUILayout.Label("Cameras"); if (GUILayout.Button("Return")) { currentMenu = OptionsMenu; } GUILayout.EndArea(); }
void OpeningGame() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Multiplayer")) { gerente.SetGameStateNetwork(GameStateNetwork.online); showMenu = true; currentMenu = OpeningNetwork; } GUILayout.EndArea(); }
void MainMenu() { int w = Screen.width; int h = Screen.height; // Draw banner GUI.DrawTexture(new Rect(w * .380f, // Horizontal Position h * .010f, // Vertical Position w * .200f, // Width h * .200f), // Height BannerTexture); // Create buttons bool PlayButton = GUI.Button(new Rect(w * .250f, // Horizontal Position h * .333f, // Vertical Position w * .105f, // Width h * .092f), // Height PlayTexture); bool OptionsButton = GUI.Button(new Rect(w * .250f, // Horizontal Position h * .500f, // Vertical Position w * .200f, // Width h * .092f), // Height OptionsTexture); bool QuitButton = GUI.Button(new Rect(w * .250f, // Horizontal Position h * .600f, // Vertical Position w * .100f, // Width h * .100f), // Height QuitTexture); // Handle button presses if (PlayButton) currentGUIMethod = Play; if (OptionsButton) currentGUIMethod = Options; if (QuitButton) currentGUIMethod = Quit; }
public void Show(IESGUIDialog _parent) { this.menuGUI = this.messageGUI = this.introGUI = null; this.childDlg = null; this.enabled = true; G.play_music(""); #if !UNITY_WEBPLAYER if (Application.genuineCheckAvailable) { if (!Application.genuine) { int?f = null; int i = 1 / (int)f; Debug.Log(i); } } #endif }
void Sound() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f - height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); GUILayout.Label("Sound"); if (GUILayout.Button("Normal")) { currentMenu = OptionsMenu; // audioChosen = 1; // this.GetComponent<Audios>().ChooseAudio(audioChosen); } if (GUILayout.Button("Guitarra")) { currentMenu = OptionsMenu; // audioChosen = 2; // this.GetComponent<Audios>().ChooseAudio(audioChosen); } if (GUILayout.Button("Bateria")) { currentMenu = OptionsMenu; // audioChosen = 3; // this.GetComponent<Audios>().ChooseAudio(audioChosen); } if (GUILayout.Button("Return")) { currentMenu = OptionsMenu; } GUILayout.EndArea(); }
void MultiplayerMenu() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Return")) { GameObject menuObj = GameObject.Find("NetworkChat"); MPBase2 menu = menuObj.GetComponent <MPBase2>(); menu.Toggle(); currentMenu = OpeningGame; } GUILayout.EndArea(); }
void SetClothes() { GUI.skin = menuSkin; float screenX = Screen.width * 0.5f - width * 0.5f; float screenY = Screen.height * 0.5f + height * 0.5f; GUILayout.BeginArea(new Rect(screenX, screenY, width, height)); if (GUILayout.Button("Luigi")) { gerente.roupa = PlayerRoupa.luigi; currentMenu = OpeningNetwork; } if (GUILayout.Button("Fogo")) { gerente.roupa = PlayerRoupa.fogo; currentMenu = OpeningNetwork; } if (GUILayout.Button("Mimico")) { gerente.roupa = PlayerRoupa.mimico; currentMenu = OpeningNetwork; } if (GUILayout.Button("Mario")) { gerente.roupa = PlayerRoupa.mario; currentMenu = OpeningNetwork; } if (GUILayout.Button("Wario")) { gerente.roupa = PlayerRoupa.wario; currentMenu = OpeningNetwork; } GUILayout.EndArea(); }
void HandleOnStateChange() { switch (gerente.gameState) { case GameState.gameover: showMenu = true; currentMenu = GameOverGame; break; case GameState.clear: if (Application.loadedLevelName != "ClearStage") { showMenu = false; currentMenu = OpeningGame; } break; case GameState.dieing: showMenu = false; break; case GameState.opening: showMenu = true; currentMenu = OpeningGame; break; case GameState.playing: showMenu = false; currentMenu = MainMenu; break; case GameState.pause: showMenu = true; currentMenu = MainMenu; break; } }
void NewBaseName() { GUI.enabled = true; GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, G.strings["new_base_text"]); GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, G.strings["new_base_text"]); GUI.Box(GUI_bindings.MESSAGE_BOX_RECT, G.strings["new_base_text"]); GUILayout.BeginArea(GUI_bindings.MESSAGE_BOX_RECT); this.new_base_name = GUILayout.TextField(this.new_base_name, GUI_bindings.Instance.TextFieldAlt()); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("OK")) { this.location.add_base(new Base(this.new_base_name, this.base_type, false)); this.rebuild(false); this.newBaseNameGUI = null; this.newBaseGUI = null; G.play_sound(); } if (GUILayout.Button("Cancel")) { this.newBaseNameGUI = null; this.newBaseGUI = null; G.play_sound(); } GUILayout.EndHorizontal(); GUILayout.EndArea(); }
void Start() { if (!PlayTexture || !OptionsTexture || !QuitTexture) Debug.LogError("Button texture is missing!"); currentGUIMethod = MainMenu; }
void set_current () { // GUI.enabled = this.offline_confirmGUI == null && this.countGUI == null; if (this.item_type_to_build == "cpu") { space_left = (this._base.type as Base_Class).size; // If there are any existing CPUs of this type, warn that they will // be taken offline until construction finishes. matches = this._base.cpus != null && this._base.cpus.type == item_type; if (matches) { space_left -= this._base.cpus.count; if (this._base.cpus.done && !go_ahead) { this.offline_confirmGUI = this.Offline_ConfirmGUI; } else { this.count_prompt = string.Format (G.strings["num_cpu_prompt"], item_type.name, space_left); this.count_text_init = space_left.ToString (); this.countGUI = this.CountGUI; } } else { this.count_prompt = string.Format( G.strings["num_cpu_prompt"], item_type.name, space_left) ; this.count_text_init = space_left.ToString(); this.countGUI = this.CountGUI; } } else { int index = (new List<string>() { "reactor", "network", "security" }).IndexOf(item_type_to_build); if ( this._base.extra_items[index] == null || this._base.extra_items[index].type != item_type ) { this._base.extra_items[index] = new Item( item_type, this._base, 1, false ); this._base.check_power(); } this._base.recalc_cpu(); this.build_itemGUI = this.buildItemListGUI = null; } if (this.offline_confirmGUI != null) this.offline_confirmGUI (); if (this.countGUI != null) this.countGUI (); }
void switchMenuForWeaponsButton() { this.currentGUIMethod = weaponsMenu; // switch to Weapons Menu amount = 1; // resets the amount of itens selected }
void Start() { levelHighScore = PlayerPrefsHelper.GetLevelHighScore(GameObject.FindObjectOfType<FinishingLine>().levelNo); currentGUIMethod = Game; Time.timeScale = 1; backgroundMusicSource.Play(); }
public void Show (IESGUIDialog _parent) { this.menuGUI = this.messageGUI = this.introGUI = null; this.childDlg = null; this.enabled = true; G.play_music (""); #if !UNITY_WEBPLAYER if (Application.genuineCheckAvailable) if (!Application.genuine) { int? f = null; int i = 1 / (int)f; Debug.Log( i ); } #endif }
void MenuGUI () { GUI.enabled = this.childDlg == null; GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, ""); GUILayout.BeginArea (GUI_bindings.MESSAGE_BOX_RECT); // center GUILayout.BeginHorizontal (); GUILayout.FlexibleSpace (); GUILayout.BeginVertical (); // disable save && load in webplayer #if UNITY_WEBPLAYER GUI.enabled = false; #endif // nice trick.. here MaxWidth actually *stretches* the width of a button if (GUILayout.Button (" Save game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth (Screen.width / 2))) { this.childDlg = this.GetComponent<SaveScreen> (); this.childDlg.Show (this); G.play_sound(); } GUILayout.FlexibleSpace (); if (GUILayout.Button (" Load game", GUI_bindings.Instance.ButtonMainMenu())) { this.childDlg = this.GetComponent<LoadScreen> (); this.childDlg.Show (this); G.play_sound(); } #if UNITY_WEBPLAYER GUI.enabled = true; #endif GUILayout.FlexibleSpace (); if (GUILayout.Button ("Options", GUI_bindings.Instance.ButtonMainMenu())) { this.childDlg = this.GetComponent<OptionsScreen> (); this.childDlg.Show (this); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Quit", GUI_bindings.Instance.ButtonMainMenu())) { this.enabled = false; this.GetComponent<Main_menu>().Show(null); G.play_sound(); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Back", GUI_bindings.Instance.ButtonMainMenu())) { this.menuGUI = null; G.play_sound(); } GUILayout.EndVertical (); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal (); GUILayout.EndArea(); }
void ResearchExplanationGUI () { GUI.enabled = true; GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUILayout.BeginArea (GUI_bindings.MESSAGE_BOX_RECT ); this.scrollPositionMessage = GUILayout.BeginScrollView (this.scrollPositionMessage); GUILayout.Label ( string.Format(G.strings["danger_common"], G.strings[string.Format ("danger_{0}", this.research_danger_level)] ), GUI_bindings.Instance.LabelAlt( true, null, false) ); GUILayout.EndScrollView (); GUILayout.FlexibleSpace (); if (GUILayout.Button ("OK")) { this.researchExplanationGUI = null; G.play_sound (); } GUILayout.EndArea (); }
void NewBaseName () { GUI.enabled = true; GUI.Box ( GUI_bindings.MESSAGE_BOX_RECT, G.strings["new_base_text"]); GUI.Box ( GUI_bindings.MESSAGE_BOX_RECT, G.strings["new_base_text"]); GUI.Box ( GUI_bindings.MESSAGE_BOX_RECT, G.strings["new_base_text"]); GUILayout.BeginArea ( GUI_bindings.MESSAGE_BOX_RECT); this.new_base_name = GUILayout.TextField (this.new_base_name, GUI_bindings.Instance.TextFieldAlt()); GUILayout.FlexibleSpace (); GUILayout.BeginHorizontal (); if (GUILayout.Button ("OK")) { this.location.add_base (new Base (this.new_base_name, this.base_type, false)); this.rebuild ( false ); this.newBaseNameGUI = null; this.newBaseGUI = null; G.play_sound(); } if (GUILayout.Button ("Cancel")) { this.newBaseNameGUI = null; this.newBaseGUI = null; G.play_sound(); } GUILayout.EndHorizontal (); GUILayout.EndArea(); }
void Pause() { Time.timeScale = 0; currentGUIMethod = PauseMenu; }
void PauseMenu() { GUILayout.Label("", bigFrame, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height)); GUILayout.BeginArea(new Rect((Screen.width - pause.fixedWidth) / 2, MARGIN * 2, Screen.width - (Screen.width - pause.fixedWidth) / 2, Screen.height / 6)); { GUILayout.Label("", pause); } GUILayout.EndArea(); GUILayout.BeginArea(new Rect((Screen.width - music.fixedWidth) / 2, Screen.height / 3, Screen.width - (Screen.width - music.fixedWidth) / 2, Screen.height / 4)); { GUILayout.BeginVertical(); { if (GUILayout.Button("", music)) { audio.PlayOneShot(buttonSound); if (AudioListener.volume != 0) { AudioListener.volume = 0; PlayerPrefsHelper.SaveMusicOn(false); } else { AudioListener.volume = 1; PlayerPrefsHelper.SaveMusicOn(true); } } GUILayout.FlexibleSpace(); if (GUILayout.Button("", menuInPause)) { audio.PlayOneShot(buttonSound); currentGUIMethod = ProgressLost; } GUILayout.FlexibleSpace(); if (GUILayout.Button("", resume)) { audio.PlayOneShot(buttonSound); Unpause(); } } } GUILayout.EndVertical(); GUILayout.EndArea(); if (Input.GetKeyUp(KeyCode.Escape) && Event.current.type == EventType.KeyUp) { audio.PlayOneShot(buttonSound); Unpause(); } }
/* -------------------------------------------------------------------------------------------------------- */ /* * UNITY STUFF */ /* -------------------------------------------------------------------------------------------------------- */ // Use this for initialization void Awake() { Script = this; // Background stuff mainScreenBGPos.x = 0; mainScreenBGPos.y = 0; mainScreenBGPos.width = Screen.width; mainScreenBGPos.height = Screen.height; // Menu stuff screenX = Screen.width * 0.5f - menuWidth * 0.5f; screenY = Screen.height * 0.5f - menuHeight * 0.5f; //screenY = Screen.height * 0.5f - menuHeight * 0.5f; currentMenu = MainMenu; // Host game window stuff subMenuWindow.x = Screen.width * 0.5f - hostMenuWidth * 0.5f; subMenuWindow.y = (Screen.height * 0.5f - hostMenuHeight * 0.5f) + hostMenuOffsetY; subMenuWindow.width = hostMenuWidth; subMenuWindow.height = hostMenuHeight; // Network stuff netScript = GameObject.Find("NetworkCode").GetComponent<NetworkGame>(); serverName = netScript.GetServerName(); if(playerName == null || playerName == "") { playerName = "RandomName" + Random.Range(1,999); } }
void ResearchItemGUI (int _idx) { rt = GUILayoutUtility.GetRect (new GUIContent (""), GUI_bindings.Instance.ButtonMainMenu() ) ; if (GUIHelpers.goodButton (rt, "" ) ) { if (this.research_items_keys[_idx] == "cpu_pool") this.research_item_description = string.Format (G.strings["cpu_pool"] + "\n---\n" + G.strings["research_cpu_pool"]); else if (this.research_items_keys[_idx] == "jobs") { long profit = long.Parse (G.jobs[G.get_job_level ()][0]); if (G.techs["Advanced Simulacra"].done) profit = (long)(profit * 1.1f); this.research_item_description = string.Format ("{0}\n{1} money per CPU per day.\n---\n{2}", G.jobs[G.get_job_level ()][3], profit, G.jobs[G.get_job_level ()][2]); } else this.research_item_description = G.techs[this.research_items_keys[_idx]].get_info (); } GUI.Label (new Rect (rt.x, rt.y, rt.width / 4 * 3, rt.height / 2 ), this.research_items_names[_idx], GUI_bindings.Instance.LabelAlt(false,null, true) ); GUI.Label (new Rect (rt.x + rt.width / 4 * 3, rt.y, rt.width / 3, rt.height / 2), G.to_money((long)this.sliders[_idx]) , GUI_bindings.Instance.LabelAlt (false, null, false) ); if (!this.research_item_notavailable[_idx]) { this.sliders[_idx] = Mathf.Round( GUI.HorizontalSlider (new Rect (rt.x, rt.y + rt.height / 2, rt.width, rt.height / 2), this.sliders[_idx], 0f, this.slidersMaxValues[_idx]) ); } else { if (GUI.Button (new Rect (rt.x, rt.y + rt.height / 2, rt.width / 2, rt.height / 2), "?")) { // update this.research_danger_level; not set if shown && clicked without sliders changed string key = this.research_items_keys[_idx]; this.research_danger_level = this.danger_for (key); this.researchExplanationGUI = this.ResearchExplanationGUI; G.play_sound (); } } if (this.sliders[_idx] != this.slidersPrevious[_idx]) { this.slidersPrevious[_idx] = this.sliders[_idx]; // handle slide G.pl.cpu_usage[this.research_items_keys[_idx]] = (long)Mathf.Round(this.sliders[_idx]); this.dirty_count = true; // update item plus all other items, too => for (int i = 0; i < this.research_items_keys.Count; i++) this.update_item (i); } }
void NewBaseGUI () { GUI.enabled = this.newBaseNameGUI == null; GUI.Box ( GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box ( GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box ( GUI_bindings.MESSAGE_BOX_RECT, ""); GUILayout.BeginArea ( GUI_bindings.MESSAGE_BOX_RECT ); GUILayout.BeginHorizontal (); scrollPositionBaseTypes = GUILayout.BeginScrollView (scrollPositionBaseTypes); this.selectedNewBaseTypeIdx = GUILayout.SelectionGrid (this.selectedNewBaseTypeIdx, base_types_names, 1, GUI_bindings.Instance.SelectionGrid() ); GUILayout.EndScrollView (); if (this.selectedNewBaseTypeIdx != this.selectedNewBaseTypeIdxPrev) { this.selectedNewBaseTypeIdxPrev = this.selectedNewBaseTypeIdx; this.base_type = G.base_type.Values.First( f => f.name == this.base_types_names[this.selectedNewBaseTypeIdx] ); this.base_type_info = this.base_type.get_info (this.location); } this.scrollPositionLabel = GUILayout.BeginScrollView (this.scrollPositionLabel, GUILayout.MaxWidth( (int)(Screen.width / 2 ) ) ); GUILayout.Label (this.base_type_info, GUI_bindings.Instance.LabelAlt(true,null, false), GUILayout.MaxWidth( (int)(Screen.width / 2 ) ) ); GUILayout.EndScrollView (); GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); if (GUILayout.Button ("OK")) { if (this.selectedNewBaseTypeIdx >= 0) { this.new_base_name = this.generate_base_name (this.location, this.base_type); this.newBaseNameGUI = this.NewBaseName; G.play_sound(); } } if (GUILayout.Button ("Back")) { this.newBaseGUI = null; G.play_sound(); } GUILayout.EndHorizontal (); GUILayout.EndArea(); if (this.newBaseNameGUI != null) this.newBaseNameGUI (); }
void CountGUI () { GUI.enabled = true; if ( count_gui_init ) { count_gui_init = false; count_text = count_text_init; } GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT , ""); GUILayout.BeginArea (GUI_bindings.MESSAGE_BOX_RECT ); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace (); GUILayout.Label( this._base.name, GUI_bindings.Instance.LabelAlt(true,null,false) ); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace (); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace (); GUILayout.Label( count_prompt, GUI_bindings.Instance.LabelAlt(true,null,false) ); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal (); GUILayout.FlexibleSpace (); this.count_text = GUILayout.TextField (this.count_text, 10, GUI_bindings.Instance.LabelAlt(true,null, false)); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.BeginHorizontal (); if (GUILayout.Button ("OK")) { G.play_sound (); int count = -1; if ( int.TryParse( this.count_text, out count ) ) { if ( count > this.space_left ) count = this.space_left; if ( count > 0 ) { Item new_cpus = new Item( item_type, this._base, count, false ); if ( matches ) this._base.cpus += new_cpus; else this._base.cpus = new_cpus; this._base.check_power(); this._base.recalc_cpu(); this.countGUI = this.build_itemGUI = this.buildItemListGUI = null; count_gui_init = true; } } } if (GUILayout.Button ("Back")) { this.countGUI = this.build_itemGUI = null; G.play_sound (); count_gui_init = true; } GUILayout.EndHorizontal (); GUILayout.EndArea(); }
/* -------------------------------------------------------------------------------------------------------- */ /* * MENU STUFF */ /* -------------------------------------------------------------------------------------------------------- */ /* * @brief Main menu for the game * @param * @return void */ void MainMenu() { GUILayout.BeginArea (new Rect (screenX , screenY , menuWidth, menuHeight)); if (GUILayout.Button ("Host network game")) { currentMenu = HostGameMenu; } else if (GUILayout.Button ("Join network game")) { currentMenu = JoinGameMenu; } else if (GUILayout.Button ("Quit")) { Application.Quit (); } GUILayout.EndArea (); }
// Use this for initialization void Start() { GameObject go = GameObject.FindGameObjectWithTag("Player"); //find the GameObject w/ "Player" TAG playerTransform = go.transform; //and stores its Transform myTransform = transform; // NPC transform; this.currentGUIMethod = itensMenu; // start with the main menu GUI selectedItem = ""; //sets the selected item to null addStuffToArrays(); // fills the arrays with the Items }
/// <summary> /// Main game screen /// </summary> void MainScreen () { GUI.enabled = this.menuGUI == null && this.introGUI == null && this.messageGUI == null && this.childDlg == null; // G.pl.recalc_cpu (); GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height)); GUILayout.BeginHorizontal(); if (GUILayout.Button ("Menu")) // , GUILayout.ExpandHeight (true))) { this.menuGUI = this.MenuGUI; G.play_sound(); } GUILayout.Space ( 3 ); GUILayout.BeginVertical(); // turn off word wrap here due layout ( we need it otherwise for labels ) GUILayout.Label (string.Format("DAY {0,4}, {1:00}:{2:00}:{3:00}", G.pl.time_day, G.pl.time_hour, G.pl.time_min, G.pl.time_sec ), GUI_bindings.Instance.LabelSmall(false,null) ); GUILayout.Label (string.Format("CASH {0} ({1})", G.to_money(G.pl.cash), G.to_money(G.pl.future_cash() ) ), GUI_bindings.Instance.LabelSmall(false,null) ); long cpu_left = G.pl.available_cpus[0]; long total_cpu = cpu_left + G.pl.sleeping_cpus; foreach ( KeyValuePair<string, long> kvp in G.pl.cpu_usage) cpu_left -= kvp.Value; long cpu_pool_value = 0; G.pl.cpu_usage.TryGetValue( "cpu_pool", out cpu_pool_value ) ; long cpu_pool = cpu_left + cpu_pool_value; if (UnityEngine.Event.current.type == EventType.Repaint && this.needs_timer) { long maint_cpu = 0; foreach ( string group in Group.group_list ) detects_per_day[group] = 0; foreach ( Base _base in G.all_bases() ) { if (_base.done) maint_cpu += _base.maintenance[1]; Dictionary<string, int> detect_chance = _base.get_detect_chance(true); foreach( string group in Group.group_list ) { detects_per_day[group] += detect_chance[group] / 10000f; } } if (cpu_pool < maint_cpu) this.color = Color.red; else this.color = Color.white; } GUILayout.Label (string.Format("CPU {0} ({1})", G.to_money(total_cpu), G.to_money(cpu_pool) ), GUI_bindings.Instance.LabelSmall(false, this.color) ); GUILayout.EndVertical(); if ( G.debug ) { GUILayout.FlexibleSpace(); if ( GUILayout.Button ("T") ) { foreach( var t in G.techs ) { if ( t.Key != "unknown_tech" ) t.Value.finish(); } G.play_sound(); } GUILayout.FlexibleSpace(); if ( GUILayout.Button ("$") ) { G.pl.cash += 1000000000; G.play_sound(); } } // (we can not has unicode in acknowtt font) GUILayout.FlexibleSpace(); // if ( GUILayout.Button (" " + '\u25AE'.ToString() + " " + '\u25AE'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[0]) ) ) //, GUILayout.ExpandHeight (true) ) ) if ( GUILayout.Button (" ii ", GUI_bindings.Instance.Button(G.curr_speed == speeds[0]) ) ) //, GUILayout.ExpandHeight (true) ) ) { this.set_speed ( speeds[0] ); G.play_sound(); } // if ( GUILayout.Button (" " + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[1]) )) //, GUILayout.ExpandHeight (true) ) ) if ( GUILayout.Button (" > ", GUI_bindings.Instance.Button(G.curr_speed == speeds[1]) )) //, GUILayout.ExpandHeight (true) ) ) { this.set_speed ( speeds[1] ); G.play_sound(); } // if ( GUILayout.Button (" " + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[2]) )) //, GUILayout.ExpandHeight (true) ) ) if ( GUILayout.Button (" >> ", GUI_bindings.Instance.Button(G.curr_speed == speeds[2]) )) //, GUILayout.ExpandHeight (true) ) ) { this.set_speed ( speeds[2] ); G.play_sound(); } // if ( GUILayout.Button ('\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[3]) )) //, GUILayout.ExpandHeight (true) ) ) if ( GUILayout.Button (">>>", GUI_bindings.Instance.Button(G.curr_speed == speeds[3]) )) //, GUILayout.ExpandHeight (true) ) ) { this.set_speed ( speeds[3] ); G.play_sound(); } // if ( GUILayout.Button ('\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString() + '\u25B6'.ToString(), GUI_unitybindings.Instance.Button(G.curr_speed == speeds[4]) )) //, GUILayout.ExpandHeight (true) ) ) if ( GUILayout.Button (">>>>", GUI_bindings.Instance.Button(G.curr_speed == speeds[4]) )) //, GUILayout.ExpandHeight (true) ) ) { this.set_speed ( speeds[4] ); G.play_sound(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button ("Res/Tasks")) //, GUILayout.ExpandHeight (true))) { this.childDlg = this.GetComponent<ResearchScreen>(); this.childDlg.Show( this ); G.play_sound(); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); foreach (KeyValuePair<string, Location> l in G.locations) { if (l.Value.available ()) { int width = (l.Value.name.Length + 5) * GUI_bindings.CHAR_WIDTH; int height = GUI_bindings.BUTTON_HEIGHT; if (GUI.Button (new Rect (l.Value.x - (width / 2), l.Value.y - ( height / 2 ), width, height), string.Format( "{0} ({1,2})", l.Value.name, l.Value.bases.Count ) ) ) { this.open_location ( l.Value.id ); G.play_sound(); } } } GUILayout.BeginHorizontal(); if (GUILayout.Button ("Finance")) //, GUILayout.ExpandHeight (true))) { this.childDlg = this.GetComponent<FinanceScreen>(); this.childDlg.Show( this ); } GUILayout.FlexibleSpace(); if (GUILayout.Button ("Knowledge")) //, GUILayout.ExpandHeight (true))) { this.childDlg = this.GetComponent<KnowledgeScreen>(); this.childDlg.Show( this ); } GUILayout.EndHorizontal(); GUILayout.Space ( 5 ); // What we display in the suspicion section depends on whether // Advanced Socioanalytics has been researched. If it has, we // show the standard percentages. If not, we display a short // string that gives a range of 25% as to what the suspicions // are. // A similar system applies to the danger levels shown. foreach( string group in Group.group_list ) { int suspicion = G.pl.groups[group].suspicion; this.suspicion_display_dict_colors[group] = G.danger_colors[G.suspicion_to_danger_level(suspicion)]; float detects = detects_per_day[group]; int danger_level = G.pl.groups[group].detects_per_day_to_danger_level(detects); this.danger_display_dict_colors[group] = G.danger_colors[danger_level]; if (G.techs["Advanced Socioanalytics"].done) { suspicion_display_dict[group] = G.to_percent(suspicion, true); danger_display_dict[group] = G.to_percent((int)(detects*10000), true); } else { suspicion_display_dict[group] = G.suspicion_to_detect_str(suspicion); danger_display_dict[group] = G.danger_level_to_detect_str(danger_level); } } if ( !G.pl.had_grace ) { GUILayout.BeginHorizontal(); GUILayout.Label( "[SUSPICION]", GUI_bindings.Instance.LabelSmall(false,null)); GUILayout.Label( string.Format ( "NEWS:{0:5}", this.suspicion_display_dict["news"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["news"]) ); GUILayout.Label( string.Format ( " SCIENCE:{0:5}", this.suspicion_display_dict["science"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["science"]) ); GUILayout.Label( string.Format ( " COVERT:{0:5}", this.suspicion_display_dict["covert"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["covert"]) ); GUILayout.Label( string.Format ( " PUBLIC:{0:5}", this.suspicion_display_dict["public"] ), GUI_bindings.Instance.LabelSmall(false,this.suspicion_display_dict_colors["public"]) ); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label( "[DET.RATE] ", GUI_bindings.Instance.LabelSmall(false,null)); GUILayout.Label( string.Format ( " NEWS:{0}", this.danger_display_dict["news"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["news"]) ); GUILayout.Label( string.Format ( " SCIENCE:{0}", this.danger_display_dict["science"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["science"]) ); GUILayout.Label( string.Format ( " COVERT:{0}", this.danger_display_dict["covert"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["covert"]) ); GUILayout.Label( string.Format ( " PUBLIC:{0}", this.danger_display_dict["public"] ), GUI_bindings.Instance.LabelSmall(false,this.danger_display_dict_colors["public"]) ); GUILayout.EndHorizontal(); } else { GUILayout.Label( "", GUI_bindings.Instance.LabelSmall(false,null) ); GUILayout.Label( "", GUI_bindings.Instance.LabelSmall(false,null) ); } GUILayout.EndArea(); if ( this.menuGUI != null ) this.menuGUI(); if ( this.introGUI != null ) this.introGUI(); // show any message/s if ( this.messages.Count > 0 ) { this.messageGUI = this.MessageGUI; this.messageGUI(); } else { this.messageGUI = null; } }
void switchMenuForArmorsButton() { this.currentGUIMethod = armorsMenu; // switch to Armors Menu amount = 1; // resets the amount of itens selected }
void LocationGUI () { GUI.enabled = this.childDlg == null && this.newBaseGUI == null && this.confirm_destroyGUI == null && this.newBaseNameGUI == null; GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, ""); GUI.Box (GUI_bindings.MESSAGE_BOX_RECT, ""); GUILayout.BeginArea (GUI_bindings.MESSAGE_BOX_RECT); GUILayout.BeginHorizontal (); GUILayout.FlexibleSpace (); GUILayout.Label (this.location.name); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal (); scrollPositionBases = GUILayout.BeginScrollView (scrollPositionBases); this.selectedBaseIdx = GUILayout.SelectionGrid (this.selectedBaseIdx, this.baseSelectionItems, 1, GUI_bindings.Instance.SelectionGridAlt() ); GUILayout.EndScrollView (); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal (); if (GUILayout.Button ("Open Base")) { if (selectedBaseIdx >= 0) { Base _base = this.location.bases.Find (f => f.name == this.baseNames[selectedBaseIdx]); if ( _base.done ) { this.childDlg = this.GetComponent<BaseScreen> (); (this.childDlg as BaseScreen)._base = _base; this.childDlg.Show (this); } G.play_sound(); } } if (GUILayout.Button ("Power State")) { if (selectedBaseIdx >= 0) { Base _base = this.location.bases.Find (f => f.name == this.baseNames[selectedBaseIdx] ) ; int old_index = state_list.IndexOf (_base.power_state); _base.power_state = state_list[(old_index + 1) % state_list.Count]; _base.check_power (); this.rebuild( false ); G.play_sound(); } } GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); if (GUILayout.Button ("New base")) { List<Base_Class> list = G.base_type.Values.Where ( w => w.available() && w.regions.Contains( this.location.id ) ).ToList(); list.Sort(); list.Reverse(); this.base_types_names = list.Select( s => s.name).ToArray(); if ( this.base_types_names.Count() == 1 ) { this.selectedNewBaseTypeIdx = 0; this.selectedNewBaseTypeIdxPrev = -1; } this.newBaseGUI = this.NewBaseGUI; G.play_sound(); } if (GUILayout.Button ("Destroy base")) { if ( this.selectedBaseIdx >= 0 ) { this.confirm_destroyGUI = this.DestroyConfirmationGUI; G.play_sound(); } } if (GUILayout.Button ("Back")) { this.enabled = false; this.parent.Show (null); G.play_sound(); } GUILayout.EndHorizontal (); GUILayout.EndArea (); if (this.newBaseGUI != null) this.newBaseGUI (); if (this.confirm_destroyGUI != null) this.confirm_destroyGUI (); }
void ProgressLost() { GUILayout.BeginArea(new Rect(MARGIN, Screen.height * 2 / 3, POPUP_WIDTH, popupBackground.fixedHeight)); { GUILayout.Label("", popupBackground, GUILayout.Width(popupBackground.fixedWidth), GUILayout.Height(popupBackground.fixedHeight)); } GUILayout.EndArea(); GUILayout.BeginArea(new Rect(MARGIN * 2, Screen.height * 2 / 3 + (int)(MARGIN * 2.5), POPUP_WIDTH - MARGIN * 2, popupBackground.fixedHeight)); { GUILayout.BeginHorizontal(); { if (GUILayout.Button("", yes)) { audio.PlayOneShot(buttonSound); Application.LoadLevel("MainMenu"); } GUILayout.FlexibleSpace(); if (GUILayout.Button("", no)) { audio.PlayOneShot(buttonSound); currentGUIMethod = PauseMenu; } } } GUILayout.EndHorizontal(); GUILayout.EndArea(); if (Input.GetKeyUp(KeyCode.Escape) && Event.current.type == EventType.KeyUp) { audio.PlayOneShot(buttonSound); currentGUIMethod = PauseMenu; } }
void Unpause() { Time.timeScale = 1; currentGUIMethod = Game; }
void MainMenu () { GUI.enabled = this.newGameGUIMethod == null && this.aboutGUIMethod == null && this.helpGUIMethod == null && this.childDlg == null; GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height)); GUILayout.BeginVertical(); GUILayout.FlexibleSpace (); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace (); GUILayout.BeginVertical(); GUILayout.Label ("ENDGAME:", GUI_bindings.Instance.LabelMainMenu(Color.red)); GUILayout.Label ("SINGULARITY", GUI_bindings.Instance.LabelMainMenu(Color.red)); GUILayout.EndVertical(); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace (); GUILayout.BeginHorizontal (); GUILayout.FlexibleSpace (); GUILayout.BeginVertical (); if (GUILayout.Button ("New game", GUI_bindings.Instance.ButtonMainMenu(), GUILayout.MaxWidth ( Screen.width / 2 ) ) ) { this.newGameGUIMethod = this.NewGame; G.play_sound (); } GUILayout.FlexibleSpace (); // disable load in webplayer #if UNITY_WEBPLAYER GUI.enabled = false; #endif if (GUILayout.Button ("Load game", GUI_bindings.Instance.ButtonMainMenu (), GUILayout.MaxWidth (Screen.width / 2) ) ) { this.childDlg = this.GetComponent<LoadScreen> (); this.childDlg.Show (this); G.play_sound (); } #if UNITY_WEBPLAYER GUI.enabled = true; #endif GUILayout.FlexibleSpace (); if (GUILayout.Button ("Options", GUI_bindings.Instance.ButtonMainMenu (), GUILayout.MaxWidth (Screen.width / 2) ) ) { this.childDlg = this.GetComponent<OptionsScreen> (); this.childDlg.Show (this); G.play_sound (); } GUILayout.FlexibleSpace (); GUILayout.EndVertical (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal (); GUILayout.BeginHorizontal (); if (GUILayout.Button ("About", GUI_bindings.Instance.ButtonMainMenu ())) { this.aboutGUIMethod = this.About; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Help", GUI_bindings.Instance.ButtonMainMenu ())) { this.helpGUIMethod = this.Help; G.play_sound (); } GUILayout.EndHorizontal (); GUILayout.EndVertical(); GUILayout.EndArea(); if ( this.newGameGUIMethod != null ) this.newGameGUIMethod(); if ( this.aboutGUIMethod != null ) this.aboutGUIMethod(); if ( this.helpGUIMethod != null ) this.helpGUIMethod(); }
void Game() { GUI.skin.font = comicSans; GUI.contentColor = Color.black; var score_text_style = new GUIStyle(); score_text_style.fontSize = SCORE_FONT_SIZE; GUILayout.BeginArea(new Rect(2, 2, Screen.width, Screen.height)); { GUILayout.Label("Highscore: " + levelHighScore + "\nScore: " + Player.instance.Score.ToString(), score_text_style); } GUILayout.EndArea(); if (Input.GetKeyUp(KeyCode.Escape) && Event.current.type == EventType.KeyUp) { audio.PlayOneShot(buttonSound); Pause(); } if (Player.instance.isLevelFailed) { Pause(); currentGUIMethod = FailedLevel; } //if (Input.GetKeyUp(KeyCode.A) && Event.current.type == EventType.KeyUp) //{ // Pause(); // currentGUIMethod = PauseMenu; //} if (Player.instance.isLevelCompleted) { Pause(); currentGUIMethod = PassedLevel; } }
// new game dialog void NewGame () { GUI.enabled = true; GUI.Box (new Rect (0, 0, Screen.width, Screen.height), ""); GUI.Box (new Rect (0, 0, Screen.width, Screen.height), ""); GUI.Box (new Rect (0, 0, Screen.width, Screen.height), ""); GUILayout.BeginArea (new Rect (0, 0, Screen.width, Screen.height)); GUILayout.BeginHorizontal (); GUILayout.FlexibleSpace (); GUILayout.BeginVertical (); GUILayout.FlexibleSpace (); if (GUILayout.Button ("Very easy", GUI_bindings.Instance.ButtonMainMenu ())) { G.new_game (1); this.GetComponent<MapScreen> ().Show (this); this.enabled = false; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Easy", GUI_bindings.Instance.ButtonMainMenu ())) { G.new_game (3); this.GetComponent<MapScreen> ().Show (this); this.enabled = false; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Normal", GUI_bindings.Instance.ButtonMainMenu ())) { G.new_game (5); this.GetComponent<MapScreen> ().Show (this); this.enabled = false; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Hard", GUI_bindings.Instance.ButtonMainMenu ())) { G.new_game (7); this.GetComponent<MapScreen> ().Show (this); this.enabled = false; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Ultra hard", GUI_bindings.Instance.ButtonMainMenu ())) { G.new_game (10); this.GetComponent<MapScreen> ().Show (this); this.enabled = false; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button (" Impossible", GUI_bindings.Instance.ButtonMainMenu ())) { G.new_game (100); this.GetComponent<MapScreen> ().Show (this); this.enabled = false; G.play_sound (); } GUILayout.FlexibleSpace (); if (GUILayout.Button ("Back", GUI_bindings.Instance.ButtonMainMenu ())) { this.newGameGUIMethod = null; G.play_sound (); } GUILayout.FlexibleSpace (); GUILayout.EndVertical (); GUILayout.FlexibleSpace (); GUILayout.EndHorizontal (); GUILayout.EndArea (); }