public Match3Game() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; curScreen = CurrentScreen.MainMenuScreen; IsMouseVisible = true; requiredTextures = new string[] { "playBtn", "playBtnHov", "playBtnClicked", "okBtn", "okBtnHov", "okBtnClicked", "gameOverDlg", }; textures = new Dictionary<string, Texture2D>(); field = new GameField(FIELD_SIZE); blocksTextures = new Texture2D[(int)GameField.BlockType.BlocksCount * 3]; runningAnimations = new List<Animation>(); }
public void ChangeScreen(string name) { if (TryGetScreen(name, out Screen screen)) { Console.WriteLine($"Switching to screen {name}"); PreviousScreen = CurrentScreen; CurrentScreen = screen; CurrentScreen.SwitchOn(); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); CurrentScreen.Draw(gameTime, spriteBatch, font);//Tell the Current Screen to Draw. spriteBatch.End(); // TODO: Add your drawing code here base.Draw(gameTime); }
public void RefreshScreen() { try { CurrentScreen?.Refresh(); } catch (Exception ex) { Trace.WriteError("", Trace.GetMethodName(), CLASSNAME, ex); throw; } }
public void OpenGameScreen() { currentScreen = CurrentScreen.START; SplashScreen.SetActive(false); GamePlayScreen.SetActive(false); GameOverScreen.SetActive(false); StartScreen.SetActive(true); Time.timeScale = 0; }
public void ShowSplashScreen() { currentScreen = CurrentScreen.SPLASH; SplashScreen.SetActive(true); GamePlayScreen.SetActive(false); GameOverScreen.SetActive(false); StartScreen.SetActive(false); Time.timeScale = 0; }
void PlaySound() { if (Sound == Sound.None) { Debug.LogWarning("no sound specified at " + CurrentScreen.ToString() + " " + gameObject.name); return; } SoundManager.Play(Sound); }
// Use this for initialization void Awake() { _currentScreen = CurrentScreen.None; _creditsPanel = GetComponentInChildren <CreditsPanelScript>(true); _broughtPanel = GetComponentInChildren <BroughtPanelScript>(true); _characterCard = GetComponentInChildren <CharacterCard>(true); _titleScreen = GetComponentInChildren <TitleScreenGraphic>(true); _timeLeft = _titleScreenDuration; _audioSource = GetComponent <AudioSource>(); }
public static void Close() { if (_CurrentPopupScreen != EPopupScreens.NoPopup && _PopupScreens.Count > 0) { _PopupScreens[(int)_CurrentPopupScreen].OnClose(); } if (CurrentScreen != null) { CurrentScreen.OnClose(); } }
private void _goBack() { CurrentScreen.Deactivate(); screenStack.Pop(); CurrentScreen = screenStack.Peek(); if (CurrentScreen.ScreenSize != ScreenSize) { CurrentScreen.SetScreenSize(ScreenSize); } CurrentScreen.Activate(); }
// Checks inventory use. private void CheckInventoryUse() { if (KeyPress.InventorySlotId.HasValue) { ActionnedItem itemDropped = Player.Inventory.UseItem(); if (itemDropped != null) { CurrentScreen.AddDroppedItem(itemDropped); } } }
void ShowTitleScreen() { //Hide the title screen, show the character card. _titleScreen.Show(); _characterCard.Hide(); _broughtPanel.Hide(); _creditsPanel.Hide(); _currentScreen = CurrentScreen.TitleScreen; _timeLeft = _titleScreenDuration; }
public override void PerformImmediately() { if (IsGameplayScreen) { CurrentScreen.Transition(new LoadingScreen <T>(CurrentScreen.ScreenManager)); } else { CurrentScreen.Transition((T)Activator.CreateInstance(typeof(T), CurrentScreen.ScreenManager)); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { CurrentScreen.Update(gameTime); if (CurrentScreen.SwitchState) { SwitchState(); } base.Update(gameTime); }
private void Update() { if (HasScreen) { CurrentScreen.OnActive(); } if (Alert != null) { Alert.UpdateTimer(Time.unscaledDeltaTime); } }
public SpellAlchemyTheFortressEscapeGame() { currentScreen = CurrentScreen.HomeScreen; graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = pixelWidthPerTile * squaresAcross; graphics.PreferredBackBufferHeight = pixelHeightPerTile * squaresDown; screenCenter = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2); graphics.IsFullScreen = false; graphics.ApplyChanges(); Content.RootDirectory = "Content"; }
public static void Update(GameTime gameTime) { GamePadEx.Update(gameTime); KeyboardEx.Update(gameTime); TouchPanelEx.Update(gameTime); if (CurrentScreen != null) { CurrentScreen.Update(gameTime); } }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.White); spriteBatch.Begin(); spriteBatch.Draw(background, mainFrame, Color.White); CurrentScreen.Draw(gameTime); spriteBatch.End(); base.Draw(gameTime); }
public static void Update(GameTime gameTime) { GamePad1 = GamePadEx.GetState(PlayerIndex.One); GamePad2 = GamePadEx.GetState(PlayerIndex.Two); GamePad3 = GamePadEx.GetState(PlayerIndex.Three); GamePad4 = GamePadEx.GetState(PlayerIndex.Four); if (CurrentScreen != null) { CurrentScreen.Update(gameTime); } }
public void OnSelectBackToMainMenu() { if (cameraPanCoroutine != null) { StopCoroutine(cameraPanCoroutine); } cameraPanCoroutine = PanCameraTo(0); StartCoroutine(cameraPanCoroutine); currentScreen = CurrentScreen.MainMenu; }
public void OnSelectPlay() { if (cameraPanCoroutine != null) { StopCoroutine(cameraPanCoroutine); } cameraPanCoroutine = PanCameraTo(levelSelectCamPos); StartCoroutine(cameraPanCoroutine); currentScreen = CurrentScreen.LevelSelect; }
public void Update(GameTime gameTime) { if (!ChangingScreen) { //why restrict to three cameras when you can have a ton of them? //this obviously need a list and a way of interacting with other classes DefaultScreenCamera?.Update(gameTime); LeftScreenCamera?.Update(gameTime); RightScreenCamera?.Update(gameTime); CurrentScreen.Update(gameTime); } }
void ShowBrought() { //Hide the title screen, show the character card. _lastFancyScreen = CurrentScreen.Brought; _titleScreen.Hide(); _characterCard.Hide(); _broughtPanel.Show(); _creditsPanel.Hide(); _currentScreen = CurrentScreen.Brought; _timeLeft = _characterCardDuration; }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here CurrentScreen.Update(gameTime);//Tell the Current Screen to Update. base.Update(gameTime); }
public override void Run(GameTime gameTime) { // Currently have to do this like this, because otherwise it loads EVERYTHING at the start of the first screen and f***s everything up if (IsGameplayScreen) { CurrentScreen.Transition(new LoadingScreen <T>(CurrentScreen.ScreenManager)); } else { CurrentScreen.Transition((T)Activator.CreateInstance(typeof(T), CurrentScreen.ScreenManager)); } }
public void SetCurrentScreen(int index) { switch (index) { case 0: currentScreen = CurrentScreen.lobby; break; case 1: currentScreen = CurrentScreen.inRoom; break; } }
public void SetScreen(Screen screen) { CurrentScreen?.OnPaused(); CurrentScreen?.Dispose(); screen.Width = Width; screen.Height = Height; screen.HipsterEngine = _hipsterEngine; screen.SetUIController(UI); CurrentScreen = screen; CurrentScreen.OnLoad(); CurrentScreen.State = ScreenState.Running; }
private IEnumerator ExitDoor(ViewModel.Grid transition) { SetScreenLoading(true); yield return(BuildScreen(transition)); PreviousScreen.ToggleActive(); Manager.Game.Player.transform.position = OverworldPosition; Manager.Game.Audio.PlayFX(FX.Stairs); yield return(StartCoroutine(Manager.Game.Player.AnimateExit())); CurrentScreen.ToggleDoor(false); SetScreenLoading(false); }
public void Tick(TimeSpan elapsedGameTime) { lastElapsedTime = elapsedGameTime; for (int i = timeouts.Count - 1; i >= 0; i--) { if (timeouts[i].Item2 < elapsedGameTime) { timeouts[i].Item1(); timeouts.RemoveAt(i); } } CurrentScreen.Tick(elapsedGameTime); }
/// <summary> /// Вспомогательная функция, которая отрисовывает все виджеты. /// </summary> private void Tick() { if (Console.KeyAvailable && root is IFocusable focusable) { var key = Console.ReadKey(true); focusable.BubbleDown(key); } var context = display !.CurrentScreen.BeginRender(); root.Render(context); display !.Draw(); }
/// <summary> /// Atualiza o gerenciador de tela. /// </summary> /// <param name="gameTime">Obtém acesso aos tempos de jogo.</param> public void Update(GameTime gameTime) { if (IsEnabled) { if (changed) { CurrentScreen = standbyScreen; changed = false; standbyScreen = null; } CurrentScreen?.Update(gameTime); } }
public void openView(CurrentScreen scr, params object[] objs) { if (scr == current) return; current = scr; int num = (int)current; for (int i= 0; i < Screens.Length; i++) { if (i == num) { Screens[i].gameObject.SetActive(true); Screens[i].Init(objs); } else { Screens[i].gameObject.SetActive(false); } } }
///////////////////// /// CATEGORY BUTTONS ////////////////// void CategoryBack_BtnClick() { if(_currentScreen == CurrentScreen.Categories) { HomeMenu.SetActive(true); CategoryMenu.SetActive(false); _currentScreen = CurrentScreen.MainMenu; } else if(_currentScreen != CurrentScreen.Categories) { if(_currentScreen == CurrentScreen.Category_Drug) SubCategory_DrugsMenu.SetActive(false); if(_currentScreen == CurrentScreen.Category_Sports) SubCategory_SportsMenu.SetActive(false); if(_currentScreen == CurrentScreen.Category_Erotic) SubCategory_EroticMenu.SetActive(false); if(_currentScreen == CurrentScreen.Category_Nature) SubCategory_NatureMenu.SetActive(false); CategoryMenu.SetActive(true); CategoryMenu.GetComponentInChildren<TweenPosition>().ResetToBeginning(); CategoryMenu.GetComponentInChildren<TweenPosition>().PlayForward(); _currentScreen = CurrentScreen.Categories; } }
///////////////////// /// Erotic CATEGORY BUTTONS ////////////////// void CategoryErotic_BtnClick() { CategoryMenu.SetActive(false); SubCategory_EroticMenu.SetActive(true); SubCategory_EroticMenu.GetComponentInChildren<TweenPosition>().ResetToBeginning(); SubCategory_EroticMenu.GetComponentInChildren<TweenPosition>().PlayForward(); _currentScreen = CurrentScreen.Category_Erotic; }
private void updateGameScreen(GameTime gameTime) { animationRunning = runningAnimations.Count > 0; Point mp = getMousePosition(); if (gameEnded()) { Rectangle okBtnRect = getOkBtnRect(); if (okBtnRect.Contains(mp) && leftKeyClick()) { curScreen = CurrentScreen.MainMenuScreen; } } else if (!animationRunning) { updateGame(); } }
private void updateMainMenuScreen(GameTime gameTime) { Texture2D playBtn = textures["playBtn"]; Point mp = getMousePosition(); Rectangle btnRect = getPlayBtnRect(); if (btnRect.Contains(mp) && leftKeyClick()) { curScreen = CurrentScreen.GameScreen; info = new GameInfo(); field.Init(); } }
private void backToMain() { currentScreen = CurrentScreen.PAUSE; loadTextFile(); }
public override void init() { input = new GetInput(PlayerIndex.One); attachEventListeners(); currentScreen = CurrentScreen.PAUSE; pauseScreen = new Sprite(mManager.startScreen, new Rectangle(0, 0, pauseWidth, pauseHeight), new Vector2(pausePosX, pausePosY)); pauseFont = mManager.segueUIMono; pauseOptions = new List<string>(); loadTextFile(); }
public static void ChangeToCustomizeScreen(int sender) { currentScreen = Screens.CurrentScreen.CustomizeScreen; CustomizeScreen.Open(sender); CustomizeScreen.Update(); }
public static void Initialize() { currentScreen = CurrentScreen.StartScreen; //Initialize every screen StartScreen.Initialize(); MainMenu.Initialize(); CreditsMenu.Initialize(); SigninMenu.Initialize(); UpgradeScreen.Initialize(); CustomizeScreen.Initialize(); ArenaSelection.Initialize(); ShopScreen.Initialize(); //Initialize the game engine GameEngine.Initialize(); }
public static void ChangeToSignInMenu() { SigninMenu.Update(); currentScreen = Screens.CurrentScreen.SigninMenu; }
public static void ChangeToShopScreen(int sender) { currentScreen = Screens.CurrentScreen.ShopScreen; ShopScreen.Open(sender); }
public static void ChangeToSettingsScreen() { currentScreen = Screens.CurrentScreen.SettingsMenu; CreditsMenu.Update(); }
public static void ChangeToPlayScreen(Arena arenaToUse) { currentScreen = Screens.CurrentScreen.PlayScreen; GameEngine.Start(arenaToUse); }
public static void ChangeToMainMenu() { MainMenu.Update(); currentScreen = Screens.CurrentScreen.MainMenu; }
void Play_BtnClick() { CategoryMenu.SetActive(true); HomeMenu.SetActive(false); CategoryMenu.GetComponentInChildren<TweenPosition>().ResetToBeginning(); CategoryMenu.GetComponentInChildren<TweenPosition>().PlayForward(); _currentScreen = CurrentScreen.Categories; }
private void changeMenuOptions() { switch (currentlySelected) { case 0: mManager.unPause(); break; case 1: currentScreen = CurrentScreen.CONTROLS; loadTextFile(); break; case 2: mManager.changeStates(GameManager.GameStateType.MENU); break; } }
public static void ChangeToArenaSelection() { ArenaSelection.JustOpened = true; ArenaSelection.Update(); currentScreen = Screens.CurrentScreen.ArenaSelection; }