private void TransitionToMenu(object sender) { if (game.CurrentGameState == Game1.GameState.NotStarted) return; game.ResetGame(); float distance = -700; float time = 1.0f; mainStoryboard.Stop(); mainStoryboard.Clear(); mainStoryboard.OnCompleted = null; mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.GameTitle, time, new Vector2(game.GameTitle.Left, game.GameTitle.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.Panel, time, new Vector2(game.Panel.Left, game.Panel.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextPlayerName, time, new Vector2(game.TextPlayerName.Left, game.TextPlayerName.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextRoomID, time, new Vector2(game.TextRoomID.Left, game.TextRoomID.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextBoxRoom, time, new Vector2(game.TextBoxRoom.Left, game.TextBoxRoom.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextBoxName, time, new Vector2(game.TextBoxName.Left, game.TextBoxName.Top - distance), false)); Animation anim = new TranslationAnimation(mainStoryboard, game.btnPlaySingle, time, new Vector2(game.btnPlaySingle.Left, game.btnPlaySingle.Top + distance), false); anim.SetGraphFunction(new LinearGraphFunction()); mainStoryboard.AddAnimation(anim); mainStoryboard.Start(); }
private void TransitionToMenu(object sender) { if (game.CurrentGameState == Game1.GameState.NotStarted) return; game.ResetGame(); mainStoryboard.Stop(); mainStoryboard.Clear(); mainStoryboard.OnCompleted = null; float distance = -700; Vector2 scale = new Vector2(0.9f, 0.9f); Vector2 logoDistance = new Vector2(200, 10); Vector2 fromLogo = new Vector2(game.GameTitle.Left, game.GameTitle.Top); Vector2 toLogo = Vector2.Add(fromLogo, logoDistance); float time = 1.0f; Animation anim; anim = new TranslationAnimation(mainStoryboard, game.GameTitle, time, toLogo, false); anim.SetGraphFunction(new LinearGraphFunction()); mainStoryboard.AddAnimation(anim); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.Panel, time, new Vector2(game.Panel.Left, game.Panel.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextPlayerName, time, new Vector2(game.TextPlayerName.Left, game.TextPlayerName.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextRoomID, time, new Vector2(game.TextRoomID.Left, game.TextRoomID.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextBoxRoom, time, new Vector2(game.TextBoxRoom.Left, game.TextBoxRoom.Top - distance), false)); mainStoryboard.AddAnimation(new TranslationAnimation(mainStoryboard, game.TextBoxName, time, new Vector2(game.TextBoxName.Left, game.TextBoxName.Top - distance), false)); anim = new TranslationAnimation(mainStoryboard, game.btnPlaySingle, time, new Vector2(game.btnPlaySingle.Left, game.btnPlaySingle.Top + distance), false); anim.SetGraphFunction(new LinearGraphFunction()); mainStoryboard.AddAnimation(anim); anim = new TranslationAnimation(mainStoryboard, game.btnPlayMulti, time, new Vector2(game.btnPlayMulti.Left, game.btnPlayMulti.Top + distance), false); anim.SetGraphFunction(new LinearGraphFunction()); mainStoryboard.AddAnimation(anim); anim = new TranslationAnimation(mainStoryboard, game.btnSetting, time, new Vector2(game.btnSetting.Left, game.btnSetting.Top + distance), false); anim.SetGraphFunction(new LinearGraphFunction()); mainStoryboard.AddAnimation(anim); anim = new TranslationAnimation(mainStoryboard, game.btnExit, time, new Vector2(game.btnExit.Left, game.btnExit.Top + 230), false); anim.SetGraphFunction(new LinearGraphFunction()); mainStoryboard.AddAnimation(anim); mainStoryboard.Start(); }