Example #1
0
 private void Awake()
 {
     instance = this;
     transform.Find("ResumeButton").GetComponent <Button>().onClick.AddListener(GameHandler.ResumeGame);
     transform.Find("QuitButton").GetComponent <Button>().onClick.AddListener(Application.Quit);
     Hide();
 }
Example #2
0
 private void ResumeGame()
 {
     Time.timeScale = 1.0f;
     gameOver       = false;
     isPaused       = false;
     PauseWindow.HidePauseWindowStatic();
 }
Example #3
0
        private void PlayerPositionTransform(KeyEventArgs e, double beforeY, double beforeX)
        {
            switch (e.Key)
            {
            case System.Windows.Input.Key.Left:
                TransformPlayerLeft(beforeY, beforeX);

                break;

            case System.Windows.Input.Key.Right:
                TransformPlayerRight(beforeX, beforeY);

                break;

            case System.Windows.Input.Key.Down:
                TransformPlayerDown(beforeY, beforeX);
                break;

            case System.Windows.Input.Key.Up:
                TransformPlayerUp(beforeY, beforeX);
                break;

            case System.Windows.Input.Key.Q:
                MainWindow window = e.OriginalSource as MainWindow;
                window.Content    = new Startowa();
                window.KeyDown   -= CanvasKeyPreview;
                window.ResizeMode = ResizeMode.CanResize;
                break;

            case System.Windows.Input.Key.P:
                PauseWindow pause = new PauseWindow();
                pause.ShowDialog();
                break;
            }
        }
Example #4
0
 private void Awake()
 {
     StartCoroutine(OnGameWasOpened());
     DontDestroyOnLoad(this);
     Background              = new Background();
     MainMenu                = new UI.PanelMain();
     Pause                   = new PausePanel();
     PauseWindow             = new PauseWindow();
     ProfilePanel            = new ProfilePanel();
     SinglePanel             = new SinglePanel();
     ServerList              = new ServerListPanel();
     SettingsPanel           = new SettingsPanel();
     DebugPanel              = new DebugPanel();
     CharacterSelectionPanel = new CharacterSelectionPanel();
     Chat = new Chat();
     Log  = new Log();
     DontDestroyOnLoad(new GameObject("DiscordManager").AddComponent <Network.Discord.DiscordManager>());
     DestroyMainScene();
     GameModes.ResetOnLoad();
     //Antis.Spam.EventsCounter.OnEventsSpamDetected += (sender, args) =>
     //{
     //    if(args.SpammedObject == 200 || args.SpammedObject == 253 && args.Count < 130)
     //    {
     //        return;
     //    }
     //    PhotonPlayer player = PhotonPlayer.Find(args.Sender);
     //    if (player.RCIgnored)
     //    {
     //        return;
     //    }
     //    Log.AddLine("eventSpam", args.SpammedObject.ToString(), args.Sender.ToString(), args.Count.ToString());
     //};
     //Antis.Spam.RPCCounter.OnRPCSpamDetected += (sender, args) =>
     //{
     //    if(args.SpammedObject == "netPauseAnimation" || args.SpammedObject == "netCrossFade" && args.Count < 75)
     //    {
     //        return;
     //    }
     //    PhotonPlayer player = PhotonPlayer.Find(args.Sender);
     //    if (player.RCIgnored)
     //    {
     //        return;
     //    }
     //    Log.AddLine("rpcSpam", args.SpammedObject.ToString(), args.Sender.ToString(), args.Count.ToString());
     //};
     //Antis.Spam.InstantiateCounter.OnInstantiateSpamDetected += (sender, args) =>
     //{
     //    if (args.SpammedObject.Contains("TITAN") && args.Count <= 50)
     //    {
     //        return;
     //    }
     //    PhotonPlayer player = PhotonPlayer.Find(args.Sender);
     //    if (player.RCIgnored)
     //    {
     //        return;
     //    }
     //    Log.AddLine("instantiateSpam", args.SpammedObject.ToString(), args.Sender.ToString(), args.Count.ToString());
     //};
     Network.BanList.Load();
 }
Example #5
0
 private void Start()
 {
     pauseWindow = GetComponent <PauseWindow>();
     deathWindow = GetComponent <DeathWindow>();
     DisablePauseWindow();
     DisableDeathWindow();
 }
Example #6
0
 private void Awake()
 {
     instance       = this;
     resumeButton   = transform.Find("resumeButton").GetComponent <Button>();
     mainMenuButton = transform.Find("goToMainMenu").GetComponent <Button>();
     Hide();
 }
    private void InitializeGameStage()
    {
        uIMgr = UImenu.manager;

        PauseWindow quitButton = uIMgr.GetWindow(Menus.Pause) as PauseWindow;

        quitButton.ChangedButton(SceneType.Game);

        clearScore = board.stageData.clearScore;
        moveValue  = board.stageData.move;

        stageBG.sprite = board.stageData.backgroundSprite;

        moveValue  = board.stageData.move;
        clearScore = board.stageData.clearScore;

        stageClearScoreText.text = $"{StaticVariables.ClearScore} {Mathf.FloorToInt(clearScore).ToString("D6")}";
        scoreSlider.maxValue     = clearScore;

        moveText.text = moveValue.ToString();

        currStageState = StageState.Play;

        GameManager.Instance.BackgroundMusicPlay(board.stageData.backgroundMusic);
    }
Example #8
0
 private void Win_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Space && this.canShoot)
     {
         this.canShoot = false;
         this.gameLogic.PlayerShoot();
     }
     else if (e.Key == Key.Left)
     {
         this.isMovingRight = false;
     }
     else if (e.Key == Key.Right)
     {
         this.isMovingRight = true;
     }
     else if (e.Key == Key.Escape)
     {
         this.gameLogic.GameStateSwitch(GameState.Paused);
         PauseWindow window = new PauseWindow(this.gameLogic);
         window.ShowDialog();
         this.gameDisplay   = new SpaceInvaderDisplay(this.gameLogic.Model);
         this.isMovingRight = null;
         this.gameLogic.GameStateSwitch(GameState.Running);
         InvalidateVisual();
     }
     else if (this.gameLogic.Model.GameState == GameState.Finished &&
              e.Key == Key.Enter)
     {
         Window.GetWindow(this).Close();
     }
 }
    // pauzowanie gry

    public static void ResumeGame() // wznow gre
    {
        PauseWindow.HideStatic();
        // ukrywamy okno pauzy po wznowieniu gry
        Time.timeScale = 1f;
        // modyfikator do naszego czasu
        // jesli wynosi 1 to gra sie z powrotem wznowi
    }
Example #10
0
    private void Awake()
    {
        instance = this;

        transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        transform.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;
        Hide();
    }
Example #11
0
    void onPause()
    {
        GameObject obj = GameObject.Find("UI Root").AddChild(this.Window);

        obj.transform.position  = this.transform.position;
        obj.transform.position += new Vector3(-9.0f, -4.0f, 0.0f);

        PauseWindow Window = obj.GetComponent <PauseWindow>();
    }
    // funkcja do zatrzymania gry
    public static void PauseGame() // pauzuj gre
    {
        PauseWindow.ShowStatic();
        // okno pauzy wyswietla sie statycznie

        Time.timeScale = 0f;
        // modyfikator do naszego czasu
        // jesli wynosi 0 to gra sie wstrzyma
    }
Example #13
0
        public void CloseMenu(Menus menu)
        {
            switch (menu)
            {
            case Menus.MainMenu:
                MainMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.NewGameMenu:
                NewGameMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.GameInfoMenu:
                GameInfoMenu.Close();
                break;

            case Menus.AdvancedSettingsMenu:
                AdvancedSettingsMenu.Close();
                break;

            case Menus.HighscoresMenu:
                HighscoresMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.LoadGameMenu:
                LoadGameMenu.Close();
                CurrentMenu = null;
                break;

            case Menus.ConfirmStepWindow:
                ConfirmStepWindow.Close();
                break;

            case Menus.PlayAgainWindow:
                PlayAgainWindow.Close();
                break;

            case Menus.PauseWindow:
                PauseWindow.Close();
                CurrentMenu = null;
                break;

            case Menus.SaveGameWindow:
                SaveGameWindow.Close();
                CurrentMenu = null;
                break;

            case Menus.LoadGameWindow:
                LoadGameWindow.Close();
                CurrentMenu = null;
                break;
            }
        }
Example #14
0
 public static void ResumeGame()
 {
     PauseWindow.HideStatic();
     foreach (AudioSource audio in FindObjectsOfType <AudioSource>())
     {
         audio.UnPause();
     }
     SoundManager.PlaySound(SoundManager.Sound.Unpause);
     Time.timeScale = 1f;
 }
Example #15
0
 public static void PauseGame()
 {
     PauseWindow.ShowStatic();
     foreach (AudioSource audio in FindObjectsOfType <AudioSource>())
     {
         audio.Pause();
     }
     SoundManager.PlaySound(SoundManager.Sound.Pause);
     Time.timeScale = 0f;
 }
    private void OnPauseWindowClosed(BaseWindow baseWindow)
    {
        Debug.Log("OnPausedClosed");
        if (pauseWindow != null)
        {
            pauseWindow.OnWindowClosed -= OnPauseWindowClosed;
            pauseWindow = null;
        }

        GameplayManager.Instance.IsGamePause = false;
    }
    public void Start()
    {
        uIMgr = UImenu.manager;

        PauseWindow quitButton = uIMgr.GetWindow(Menus.Pause) as PauseWindow;

        quitButton.ChangedButton(SceneType.StageSelect);

        SetStageNode();

        GameManager.Instance.BackgroundMusicPlay(BGMClip.SelectStage);
        GameManager.Instance.googleMgr.RefreshAchievements();
    }
Example #18
0
        private void PauseGame()
        {
            this.tickTimer.Stop();
            this.tickTimerSeconds.Stop();
            this.GameModel.Character.Blocked = true;
            PauseWindow pauseWindow = new PauseWindow(this)
            {
                Left = Window.GetWindow(this).Left + 200,
                Top  = Window.GetWindow(this).Top + 100,
            };

            pauseWindow.Show();
        }
Example #19
0
    private void Awake()
    {
        i = this;

        transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        transform.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;

        transform.Find("ResumeButton").GetComponent <Button_UI>().ClickFunc = () => GameHandler.ResumeGame();

        transform.Find("MainMenuButton").GetComponent <Button_UI>().ClickFunc = () => Loader.Load(Loader.Scene.MainMenu);

        Hide();
    }
    private void Awake()
    {
        instance = this;

        transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        transform.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;

        // references to the buttons
        transform.Find("resumeBtn").GetComponent <Button_UI>().ClickFunc = () => GameHandler.ResumeGame();

        transform.Find("mainMenuBtn").GetComponent <Button_UI>().ClickFunc = () => Loader.Load(Loader.Scene.MainMenu);

        Hide();
    }
Example #21
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (isGamePaused())
         {
             ResumeGame();
             PauseWindow.HidePauseWindowStatic();
         }
         else
         {
             PauseGame();
             PauseWindow.ShowPauseWindowStatic();
         }
     }
 }
Example #22
0
    IEnumerator OpenPause()
    {
        pauseopen = true;

        int   length = 40;
        float a      = 150f / length;
        float b      = 1f / length;

        PauseWindow.SetActive(true);
        for (int i = length; i > 0; i--)
        {
            PauseWindow.transform.localPosition = new Vector3(PauseWindow.transform.localPosition.x, 0f - a * i, PauseWindow.transform.localPosition.z);
            PauseGroup.alpha = b * (length - i - 3);
            yield return(new WaitForEndOfFrame());
        }
    }
Example #23
0
    IEnumerator ClosePause()
    {
        pauseopen = false;

        int   length = 40;
        float a      = 150f / length;
        float b      = 1f / length;

        for (int i = 0; i < length; i++)
        {
            PauseWindow.transform.localPosition = new Vector3(PauseWindow.transform.localPosition.x, 0f - a * i, PauseWindow.transform.localPosition.z);
            PauseGroup.alpha = b * (length - i - 3);
            yield return(new WaitForEndOfFrame());
        }
        PauseWindow.SetActive(false);
    }
Example #24
0
        // I_STATES

        public void Enable()
        {
            _gameManager = Core.Instance.GetService <GameManager>();
            Assert.AreNotEqual(null, _gameManager);

            _statesManager = Core.Instance.GetService <StatesManager>();
            Assert.AreNotEqual(null, _statesManager);

            //
            _uiManager = Core.Instance.GetService <UIManager>();
            Assert.AreNotEqual(null, _uiManager);

            _mainScreenStateManager = _uiManager.Get_MainScreenStateManager();
            Assert.AreNotEqual(null, _mainScreenStateManager);

            _gameWindow = _uiManager.GetWindow(UIWindowEnum.GAMEWINDOW_ASYNC) as GameWindowAsyncMultiplayer;
            Assert.AreNotEqual(null, _gameWindow);

            _pauseWindow = _uiManager.GetWindow(UIWindowEnum.PAUSE_ASYNC) as PauseWindow;
            Assert.AreNotEqual(null, _pauseWindow);

            _audioService = Core.Instance.GetService <AudioService>();
            Assert.AreNotEqual(null, _audioService);
            //

            Debug.Log("Enable GAME_ASYNC");

            EventManager._init.Game.MenuButton.Resume += Resume;
            _pauseWindow.OnMenuClick += Menu;

            _gameManager.CreateGameHandler();

            //

            Assert.AreNotEqual(null, _gameWindow._objBackground);

            _gameWindow._objBackground.SetActive(false);

            // -------------------------------------------
            //

            // -------------------------------------------

            //
            _uiManager.ShowWindow(UIWindowEnum.SPLASH, true);
            _mainScreenStateManager.SwitchState(MainScreenStatesEnum.GAME_ASYNC);
        }
Example #25
0
        public void LoadGameplay() // Loads the gameplay window and its content
        {
            if (Windows.ContainsKey("Gameplay"))
            {
                Windows["Gameplay"] = new GameplayWindow();
                Windows["Pause"]    = new PauseWindow();
                Windows["Death"]    = new DeathWindow();
            }
            else
            {
                Windows.Add("Gameplay", new GameplayWindow());
                Windows.Add("Pause", new PauseWindow());
                Windows.Add("Death", new DeathWindow());
            }

            Windows["Pause"].LoadContent();
        }
Example #26
0
    private void Awake()
    {
        instance = this;

        transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        transform.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;
        // zmieniamy polozenie okna na srodek

        transform.Find("resumeBtn").GetComponent <Button_UI>().ClickFunc = () => GameHandler.ResumeGame();
        transform.Find("resumeBtn").GetComponent <Button_UI>().AddButtonSound(); // dzwieki do przyciskow

        // pauzowanie gry za pomoca funkcji z GameHandler
        transform.Find("mainMenuBtn").GetComponent <Button_UI>().ClickFunc = () => Loader.Load(Loader.Scene.MainMenu);
        // po kliknieciu przycisku main menu wroc do sceny glownego menu
        transform.Find("mainMenuBtn").GetComponent <Button_UI>().AddButtonSound(); // dzwieki do przyciskow



        Hide();
    }
Example #27
0
    private void Awake()
    {
        shareInstance = this;

        transform.GetComponent <RectTransform>().anchoredPosition = Vector2.zero;
        transform.GetComponent <RectTransform>().sizeDelta        = Vector2.zero;

        transform.Find("resumBtn").GetComponent <Button_UI>().ClickFunc = () =>
        {
            GameHandler.ResumeGame();
        };

        transform.Find("mainMenuBtn").GetComponent <Button_UI>().ClickFunc = () =>
        {
            Loader.Load(Loader.Scene.MainMenu);
        };

        SetupButtonsSounds();
        Hide();
    }
Example #28
0
 public static void PauseGame()
 {
     PauseWindow.ShowStatic();
     Time.timeScale = 0f;
 }
Example #29
0
 public static void ResumeGame()
 {
     PauseWindow.HideStatic();
     Time.timeScale = 1f;
 }
Example #30
0
 private void Awake()
 {
     instance = this;
     HidePauseWindow();
 }