private void Update() { Vector3 worldPosition = UtilsClass.GetMouseWorldPosition(); music(); if (Input.GetMouseButtonDown(0)) { if (isGameActive) { MapGridObject.Type gridType = map.RevealGridPosition(worldPosition); if (gridType == MapGridObject.Type.Mine) { // Revealed a Mine, Game Over! isGameActive = false; song = 1; map.RevealEntireMap(); UI_Blocker.Show_Static(); UI_GameOver.Instance.Show(); } } } if (Input.GetMouseButtonDown(1)) { if (isGameActive) { map.FlagGridPosition(worldPosition); } } if (Input.GetKeyDown(KeyCode.T)) { gridPrefabVisual.SetRevealEntireMap(true); } if (Input.GetKeyUp(KeyCode.T)) { gridPrefabVisual.SetRevealEntireMap(false); } HandleTimer(); if (Input.GetKeyDown(KeyCode.Escape)) { pause = !pause; } if (pause) { SoundManager.Instance.Pause(); isGameActive = false; UI_Blocker.Show_Static(); } }
private void Start() { transform.Find("submitScoreBtn").GetComponent <Button_UI>().ClickFunc = () => { UI_Blocker.Show_Static(); UI_InputWindow.Show_Static("Score", 0, () => { UI_Blocker.Hide_Static(); }, (int score) => { UI_InputWindow.Show_Static("Player Name", "", "ABCDEFGIJKLMNOPQRSTUVXYWZ", 3, () => { UI_Blocker.Hide_Static(); }, (string nameText) => { UI_Blocker.Hide_Static(); highscoreTable.AddHighscoreEntry(score, nameText); }); }); }; }
private void Show(string popupTextString, string validateCharacters, Action <int> accept, Action cancel) { UI_Blocker.GetInstance().Show(this); gameObject.SetActive(true); transform.SetAsLastSibling(); popupText.text = popupTextString; inputField.characterLimit = 2; inputField.onValidateInput = (string text, int charIndex, char addedChar) => { return(ValidateChar(validateCharacters, addedChar)); }; int amount = int.Parse(inputField.text); acceptButton.Click = () => { accept(amount); }; cancelButton.Click = () => { cancel(); }; }
private void Awake() { instnace = this; }