public static void Reload(Type type) { Scene newScene = Activator.CreateInstance(type) as Scene; ScreenContext screenContext = new ScreenContext(newScene); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public EventsController(ScreenContext context, IMapper mapper, IEventRepo eventRepo, IOptions <EventConfig> option) { _context = context; _mapper = mapper; _eventRepo = eventRepo; _option = option; }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; ScreenContext screenContext = new ScreenContext(new MainMenuScene()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); // Register the SoundManager service WaveServices.RegisterService<SoundManager>(new SoundManager()); WaveServices.ViewportManager.Activate(768, 1280, ViewportManager.StretchMode.Uniform); var gameContext = new ScreenContext("GamePlayContext", new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground }; var introContext = new ScreenContext(new IntroScene()); WaveServices.ScreenContextManager.Push(gameContext); WaveServices.ScreenContextManager.Push(introContext); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo("Content/music.mp3")); WaveServices.MusicPlayer.Volume = 0.3f; WaveServices.MusicPlayer.IsRepeat = true; }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem <GameStorage>(gameStorage); // Register the SoundManager service WaveServices.RegisterService <SoundManager>(new SoundManager()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Audio.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; // GameBackContext is visible always at the background. // For this reason the behavior is set to Draw and Update when the scene is in background. var backContext = new ScreenContext("GameBackContext", new GameScene()); backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground; //On init show the Main menu WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene())); }
private IGameAction CreateContextAnimation(bool appear, ScreenContext screenContext) { if (screenContext == null || screenContext.Count <= 0) { return(GameActionFactory.CreateEmptyGameAction(null)); } List <IGameAction> sceneAnimations = new List <IGameAction>(); for (int i = 0; i < screenContext.Count; i++) { var animatedNavigationScene = screenContext[i] as IAnimatedNavigationScene; if (animatedNavigationScene != null) { if (appear) { sceneAnimations.Add(animatedNavigationScene.CreateAppearGameAction()); } else { sceneAnimations.Add(animatedNavigationScene.CreateDiappearGameAction()); } } } return(GameActionFactory.CreateParallelGameActions(null as Scene, sceneAnimations) .WaitAll()); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem<GameStorage>(gameStorage); // Register the SoundManager service WaveServices.RegisterService<SoundManager>(new SoundManager()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Audio.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; // GameBackContext is visible always at the background. // For this reason the behavior is set to Draw and Update when the scene is in background. var backContext = new ScreenContext("GameBackContext", new GameScene()); backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground; //On init show the Main menu WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene())); }
private void PreloadAndNavigateFoward(Scene nextScene, bool isModal = false, bool doTransition = true) { var transitionDuration = TimeSpan.FromSeconds(0.2f); ScreenTransition transition = null; ScreenContext nextConxtext; if (isModal) { nextConxtext = new ScreenContext(nextScene); } else { nextConxtext = new ScreenContext(this.backgroundMenu, nextScene); } var transitionAction = GameActionFactory.CreateGameActionFromAction(null, () => { var screenContextManager = WaveServices.ScreenContextManager; if (isModal) { screenContextManager.CurrentContext.Behavior = ScreenContextBehaviors.DrawInBackground; } transition = doTransition ? new CrossFadeTransition(transitionDuration) : null; screenContextManager.Push(nextConxtext, transition); }) .AndWaitCondition(() => !doTransition || transition.CurrentTime >= transitionDuration); this.PreloadAndNavigateFoward(nextConxtext, transitionAction); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; ScreenContext screenContext = new ScreenContext(new MainMenuScene()); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3)); WaveServices.MusicPlayer.IsRepeat = true; WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); #if DEBUG if (WaveServices.Storage.Exists <GameStorage>()) { WaveServices.Storage.Delete <GameStorage>(); } #endif // Load storage game data if (WaveServices.Storage.Exists <GameStorage>()) { _gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { _gameStorage = new GameStorage { IsMusicEnabled = true, AreSoundsEnabled = true, Record = 0 }; } Catalog.RegisterItem(_gameStorage); WaveServices.RegisterService(new SimpleSoundService()); StartMusic(); var screenContext = new ScreenContext(new MainMenuScene(), new PlayersPopupScene(), new RulesScene()); var transition = new ColorFadeTransition(Color.White, TimeSpan.FromSeconds(1)); WaveServices.ScreenContextManager.To(screenContext, transition); }
protected override void CreateScene() { RenderManager.BackgroundColor = Color.FloralWhite; Button startGameButton = new Button() { HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center, VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Center, Text = string.Empty, IsBorder = false, BackgroundImage = Textures.PLAY_BUTTON, PressedBackgroundImage = Textures.PLAY_BUTTON_PRESSED }; startGameButton.Click += (o, e) => { TimeSpan timeSpan = new TimeSpan(0, 0, 0, 1, 500); CurtainsTransition transition = new CurtainsTransition(timeSpan); ScreenContext gameContext = new ScreenContext("GameScene", new GameScene()) { Behavior = ScreenContextBehaviors.DrawInBackground //Hacemos que se renderize cuando esté apilado en background (Paused) }; WaveServices.ScreenContextManager.Push(gameContext, transition); }; EntityManager.Add(startGameButton); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; //ViewportManager vm = WaveServices.ViewportManager; //vm.Activate(768, 1024, ViewportManager.StretchMode.Fill); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists <GameStorage>()) { gameStorage = WaveServices.Storage.Read <GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1024, 768, ViewportManager.StretchMode.UniformToFill); ScreenContext screenContext = new ScreenContext(new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); ScreenContext screenContext = new ScreenContext(new StockScene(WaveContent.Scenes.EmitterScene)); WaveServices.ScreenContextManager.To(screenContext); }
public override void Render() { if (!IsInitialized || !Visible) { return; } RenderContext.SetRenderScreen(ScreenContext); ScreenContext.MoveCameraByCameraMotionProvider(); RenderContext.Timer.TickUpdater(); FpsCounter.CountFrame(); ClearViews(); ScreenContext.WorldSpace.DrawAllResources(ScreenContext.HitChekcer); #if VSG_DEBUG #else SpriteBatch.Begin(); if (DrawSpriteHandler != null) { DrawSpriteHandler(SpriteBatch); } SpriteBatch.End(); #endif ScreenContext.SwapChain.Present(0, PresentFlags.None); }
private async void AsyncImagesLoad(object sender, GestureEventArgs e) { await this.AnimateClick(this.asyncImagesLoadButton).AsTask().ConfigureWaveAwait(WaveTaskContinueOn.Foreground); ScreenContext screenContext = new ScreenContext(new LoadImagesScene()); WaveServices.ScreenContextManager.To(screenContext); }
/// <summary> /// Handles the ClientSizeChanged event of the RenderForm control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param> private void RenderForm_ClientSizeChanged(object sender, EventArgs e) { if (ScreenContext != null && RenderContext.DeviceManager != null) { ScreenContext.Resize(); ScreenContext.MatrixManager.ProjectionMatrixManager.AspectRatio = (float)Width / Height; } }
public void Dispose() { if (_db != null) { _db.Dispose(); _db = null; } }
private void MatchmakingClientService_StateChanged(object sender, ClientStates state) { if (state != ClientStates.Joined) { ScreenContext screenContext = new ScreenContext(new MainScene()); WaveServices.ScreenContextManager.To(screenContext); } }
public override void Initialize(IApplication application) { base.Initialize(application); ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1280, 720, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new MainMenuScene()); WaveServices.ScreenContextManager.To(screenContext); }
/// <summary> /// Goes to the next scene. /// </summary> public static void NextScene() { sceneIndex = (sceneIndex + 1) % 16; var context = new ScreenContext(new MyScene(sceneIndex)); WaveServices.ScreenContextManager.To(context, (context[0] as MyScene).transition); }
/// <summary> /// Play again the same scene. /// </summary> /// <param name="sender">The object that sends the event</param> /// <param name="e">The parameters of the event.</param> private void OnPlayAgainButtonClicked(object sender, EventArgs e) { _soundManager.PlaySound(SimpleSoundService.SoundType.Button); var screenContext = new ScreenContext(new PlayScene(_numberOfPlayers), new PlayGameOverPopupScene(_numberOfPlayers)); var transition = new ColorFadeTransition(Color.White, TimeSpan.FromSeconds(1)); WaveServices.ScreenContextManager.To(screenContext, transition); }
private void Multiplayer_TouchPressed(object sender, GestureEventArgs e) { ScreenContext screenContext = new ScreenContext(new VietF.GameScene.GameScene()) { Name = "FromMultiplayer", }; WaveServices.ScreenContextManager.To(screenContext); }
private void TwoPlayers_TouchPressed(object sender, GestureEventArgs e) { ScreenContext screenContext = new ScreenContext(new GameScene()) { Name = "TwoPlayers", }; WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); WaveServices.ViewportManager.Activate(800, 600, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
protected override void OnClientSizeChanged(EventArgs e) { base.OnClientSizeChanged(e); if (!DesignMode && ScreenContext != null) { ScreenContext.Resize(); ScreenContext.MatrixManager.ProjectionMatrixManager.AspectRatio = (float)Width / Height; } }
/// <summary> /// Goes Back to the Main Menu Scene. /// </summary> /// <param name="sender">The object that sends the event</param> /// <param name="e">The parameters of the event.</param> private void OnGoBackButtonClicked(object sender, EventArgs e) { _soundManager.PlaySound(SimpleSoundService.SoundType.Back); var screenContext = new ScreenContext(new MainMenuScene(), new PlayersPopupScene(), new RulesScene()); var transition = new ColorFadeTransition(Color.White, TimeSpan.FromSeconds(1)); WaveServices.ScreenContextManager.To(screenContext, transition); }
protected override void OnHandleDestroyed(EventArgs e) { base.OnHandleDestroyed(e); RenderContext.ScreenContexts.Remove(this); ScreenContext.Dispose(); if (RenderContext.ScreenContexts.Count == 0) { RenderContext.Dispose(); } }
public override void Initialize(IApplication application) { base.Initialize(application); this.Load(WaveContent.GameInfo); ScreenContext screenContext = new ScreenContext(new MyScene(0)); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Use ViewportManager to ensure scaling in all devices WaveServices.ViewportManager.Activate(1024, 576, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new BackgroundScene(), new MainScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); string liscenseKey = "Afv3YtH/////AAAAAd6O5swHskO5iA9kEPTrLhUfL0+AXF0Kmbc37H865djR8OyOWZxNgHLluSS1NML85StoInIgPw/UPEmcMfjV6KNwSn/enTSseboJxd8zrYfPY8v4iuhuZlyJ7K918/xnwDUS17Qx3o/6Fx2eVqU4puzoZNsLoMhpFTZbBgrpbZ5aCsLhz0jxsVZO729c6EXPZvMgLDaseU3DRgbSbk4cnn8LiQNhpeYVo5sxl3eqZKnu4HyDLhdCuGdtKEOChFKQShd7QcXnlxijV7+q6j1yI8GP8H75YFg5kYXf5nDquvbOGX7tXU17E/x62mRW+U0rJJ9ZYCQ857eo+PPKL4ZsEpAvGURGYpeSxtFgH0L8uyQ0"; WaveServices.RegisterService(new VuforiaService(WaveContent.Assets.AR.TestVuforia_xml, liscenseKey)); }
public override void Initialize(IApplication application) { base.Initialize(application); ViewportManager vm = WaveServices.GetService<ViewportManager>(); vm.Activate(800, 480, ViewportManager.StretchMode.Fill); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
private void Back_TouchPressed(object sender, GestureEventArgs e) { WaveServices.TimerFactory.RemoveTimer("Init"); ScreenContext screenContext = new ScreenContext(new MenuScene()) { Name = "FromGame", }; WaveServices.ScreenContextManager.To(screenContext); }
private void onNewGameButtonClick(object sender, EventArgs e) { GameScene gc = new GameScene(MapLoader.getInstance().load(WaveContent.Assets.desert_tmx)); Player player = new Player(gc); gc.player = player; ScreenContext screenContext = new ScreenContext(gc); WaveServices.ScreenContextManager.To(screenContext, new CurtainsTransition(new TimeSpan(0,0,5))); }
public override void Initialize(IApplication application) { base.Initialize(application); WaveServices.RegisterService(new ScoreService()); WaveServices.RegisterService(new AnimationService()); WaveServices.RegisterService(new AudioService()); ScreenContext screenContext = new ScreenContext(new InitialScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Creates a ScreenContext with two scenes. // + The first one will be rendered in a RenderTarget. // + The second one is the primary scene. // The RenderTargetScene must be the added before the primary scene. ScreenContext screenContext = new ScreenContext(new RenderTargetScene(), new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); LeapMotionService leapMotionService = new LeapMotionService(); WaveServices.RegisterService(leapMotionService); leapMotionService.StartSensor(LeapFeatures.Hands | LeapFeatures.CameraImages); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // ViewportManager is used to automatically adapt resolution to fit screen size ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1280, 720, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new Arena()); WaveServices.ScreenContextManager.To(screenContext); }
public ControlForm(RenderContext context, ScreenContext scContext, ITargetContext sccContext) { this.Context = context; this._scContext = scContext; this._sccContext = sccContext; InitializeComponent(); this.frameSelector.ValueChanged += frameSelector_ValueChanged; this.play.Click += play_Click; this.stop.Click += stop_Click; UpdatePositionData(); }
/** * <summary> * Moves to the key change scene * </summary> */ private void ChangeKeys(object sender, EventArgs e) { if (!isConnected) { WaveServices.SoundPlayer.StopAllSounds(); //We create a new scene of the same class (myscene, playablescene, test, etc.) of the current scene WaveServices.UnregisterService <NetworkService>(); ScreenContext screenContext = new ScreenContext(new KeysScene(this.GetType())); WaveServices.ScreenContextManager.To(screenContext); } }
private void Play_Click(object sender, EventArgs e) { #endif var gameContext = new ScreenContext("GamePlay", new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.Pop(); WaveServices.ScreenContextManager.Push(gameContext, new CrossFadeTransition(TimeSpan.FromSeconds(1.5f))); }
public override void Initialize(IApplication application) { base.Initialize(application); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; WaveServices.ViewportManager.Activate(768, 1024, ViewportManager.StretchMode.Uniform); ScreenContext screenContext = new ScreenContext(new MenuScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Register KinectServices var kinectService = new KinectService(); WaveServices.RegisterService(kinectService); kinectService.StartSensor(KinectSources.Color | KinectSources.Body);//| KinectSources.Face); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); #if WINDOWS //Register oculus rift service WaveServices.RegisterService<WaveEngine.OculusRift.OVRService>(new WaveEngine.OculusRift.OVRService(application)); #endif WaveServices.RegisterService<HeadTrackSensor>(new HeadTrackSensor()); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; #if ANDROID InitializeAndRegisterSocialService(); #endif // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); // Register the SoundManager service WaveServices.RegisterService<SoundManager>(new SoundManager()); // Use ViewportManager to ensure scaling in all devices ViewportManager vm = WaveServices.ViewportManager; vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform); var backContext = new ScreenContext("BackContext", new BackgroundScene()) { Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground }; var mainContext = new ScreenContext(new MainMenuScene()); WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(mainContext); // Play music WaveServices.MusicPlayer.Play(new MusicInfo(WaveContent.Assets.Sounds.bg_music_mp3)); WaveServices.MusicPlayer.Volume = 1.0f; WaveServices.MusicPlayer.IsRepeat = true; }
public override void Initialize(IApplication application) { base.Initialize(application); ViewportManager vm = WaveServices.GetService<ViewportManager>(); vm.Activate(800, 480, ViewportManager.StretchMode.Uniform); this.analyticsManager = new AnalyticsManager(application.Adapter); WaveServices.RegisterService<AnalyticsManager>(analyticsManager); this.analyticsManager.SetAnalyticsSystem(new LocalyticsInfo(/*Insert your Localytics API KEY code here*/)); this.analyticsManager.Open(); this.analyticsManager.Upload(); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); ViewportManager vm = WaveServices.GetService<ViewportManager>(); vm.Activate(800, 480, ViewportManager.StretchMode.Uniform); this.analyticsManager = new AnalyticsManager(application.Adapter); WaveServices.RegisterService<AnalyticsManager>(analyticsManager); this.analyticsManager.SetAnalyticsSystem(new LocalyticsInfo("492098e861d94597fd5f0cf-e9b821a6-7d17-11e3-9836-009c5fda0a25")); this.analyticsManager.Open(); this.analyticsManager.Upload(); ScreenContext screenContext = new ScreenContext(new MyScene()); WaveServices.ScreenContextManager.To(screenContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); // Register the SoundManager service WaveServices.RegisterService<SoundManager>(new SoundManager()); // Set portrait orientation in WP if (WaveServices.Platform.PlatformType == PlatformType.WindowsPhone) { application.Adapter.DefaultOrientation = DisplayOrientation.Portrait; application.Adapter.SupportedOrientations = DisplayOrientation.Portrait; } // Use ViewportManager to ensure scaling in all devices ViewportManager vm = WaveServices.ViewportManager; vm.Activate(768, 1024, ViewportManager.StretchMode.Uniform); // Load heavy assets to avoid breaks during gameplay this.LoadHeavyAssets(); var backContext = new ScreenContext("BackContext", new BackgroundScene()) { Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground }; var mainContext = new ScreenContext(new MainMenuScene()); WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(mainContext); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); ScreenContext screenContext = new ScreenContext(new GamePlayScene()); WaveServices.ScreenContextManager.To(screenContext); }
/// <summary> /// Initializes the game according to the passed application (thus adapter). /// The adapter implementation depends on the while-running platform. /// Such method acts as the bridge between the game and the final hardware. /// </summary> /// <param name="application">The application (adapter).</param> public override void Initialize(IApplication application) { base.Initialize(application); // ViewportManager is used to automatically adapt resolution to fit screen size ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1920, 1080, ViewportManager.StretchMode.Uniform); // Register Kinect Service Wave Engine Extension WaveServices.RegisterService(new KinectService()); ScreenContext screenContext = new ScreenContext(new KinectScene()) { Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground }; WaveServices.ScreenContextManager.Push(screenContext); WaveServices.ScreenContextManager.Push(new ScreenContext(new StartScene()), new CrossFadeTransition(TimeSpan.FromSeconds(3.0f))); }
public override void Initialize(IApplication application) { base.Initialize(application); // Load storage game data GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem<GameStorage>(gameStorage); // Register the SoundManager service WaveServices.RegisterService<SoundManager>(new SoundManager()); // Use ViewportManager to ensure scaling in all devices WaveServices.ViewportManager.Activate( 1024, 768, ViewportManager.StretchMode.Uniform); // Play background music WaveServices.MusicPlayer.Play(new MusicInfo(Sounds.BG_MUSIC)); WaveServices.MusicPlayer.IsRepeat = true; // GameBackContext is visible always at the background. // For this reason the behavior is set to Draw and Update when the scene is in background. var backContext = new ScreenContext("GameBackContext", new GameScene()); backContext.Behavior = ScreenContextBehaviors.DrawInBackground | ScreenContextBehaviors.UpdateInBackground; //On init show the Main menu WaveServices.ScreenContextManager.Push(backContext); WaveServices.ScreenContextManager.Push(new ScreenContext("MenuContext", new MenuScene())); }
public override void Initialize(IApplication application) { base.Initialize(application); GameStorage gameStorage; if (WaveServices.Storage.Exists<GameStorage>()) { gameStorage = WaveServices.Storage.Read<GameStorage>(); } else { gameStorage = new GameStorage(); } Catalog.RegisterItem(gameStorage); ViewportManager vm = WaveServices.ViewportManager; vm.Activate(1024, 768, ViewportManager.StretchMode.UniformToFill); ScreenContext screenContext = new ScreenContext(new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.To(screenContext); }
private void CreateUI() { // Play Button Button play = new Button("Play") { Text = string.Empty, IsBorder = false, BackgroundImage = WaveContent.Assets.Textures.play_png, PressedBackgroundImage = WaveContent.Assets.Textures.playPressed_png, Margin = new Thickness(244, 580, 0, 0), }; play.Click += #if ANDROID async #endif (s, o) => { #if ANDROID var logIn = await WaveServices.GetService<SocialService>().Login(); if(logIn) { #endif var gameContext = new ScreenContext("GamePlay", new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.Pop(); WaveServices.ScreenContextManager.Push(gameContext, new CrossFadeTransition(TimeSpan.FromSeconds(1.5f))); #if ANDROID } #endif }; play.Entity.FindChild("ImageEntity").FindComponent<Transform2D>().Origin = Vector2.Center; play.Entity.AddComponent(new AnimationUI()); EntityManager.Add(play); // Best Scores TextBlock bestScores = new TextBlock("BestScores") { FontPath = WaveContent.Assets.Fonts.Bulky_Pixels_16_TTF, Text = "your best score:", Foreground = new Color(223 / 255f, 244 / 255f, 255 / 255f), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(161, 0, 0, 30), }; EntityManager.Add(bestScores); // Scores TextBlock scores = new TextBlock() { FontPath = WaveContent.Assets.Fonts.Bulky_Pixels_26_TTF, Text = this.gameStorage.BestScore.ToString(), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(440, 0, 0, 40), }; EntityManager.Add(scores); }
private async void Play_Click(object sender, EventArgs e) { var logIn = await WaveServices.GetService<SocialService>().Login(); if (!logIn) { return; } #else private void Play_Click(object sender, EventArgs e) { #endif var gameContext = new ScreenContext("GamePlay", new GamePlayScene()) { Behavior = ScreenContextBehaviors.DrawInBackground }; WaveServices.ScreenContextManager.Pop(); WaveServices.ScreenContextManager.Push(gameContext, new CrossFadeTransition(TimeSpan.FromSeconds(1.5f))); }
private void Singleplayer_TouchPressed(object sender, GestureEventArgs e) { ScreenContext screenContext = new ScreenContext(new GameScene()) { Name = "FromSingleplayer", }; WaveServices.ScreenContextManager.To(screenContext); }