Exemple #1
0
        //public GameplayHelper helper, temp;
        public attackGame()
        {
            hel = hel as GameplayHelper;
            _To = "ovo jebeno izgleda da radi";
            graphics = new GraphicsDeviceManager(this);
            PhoneApplicationService phoneAppService = PhoneApplicationService.Current;
            phoneAppService.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            graphics.IsFullScreen = true;
            //Set the Windows Phone screen resolution
            graphics.PreferredBackBufferWidth = 480;
            graphics.PreferredBackBufferHeight = 800;
            //
            Content.RootDirectory = "Content";
            backScreen = new SplashScreen();
            loadingScreen = new LoadingScreen(1,2);
            //helper = helper as GameplayHelper;
            //temp = temp as GameplayHelper;
            // Hook up lifecycle events

            PhoneApplicationService.Current.Launching += new EventHandler<LaunchingEventArgs>(Current_Launching);
            PhoneApplicationService.Current.Activated += new EventHandler<ActivatedEventArgs>(Current_Activated);
            //PhoneApplicationService.Current.Closing += new EventHandler<ClosingEventArgs>(Current_Closing);
            PhoneApplicationService.Current.Deactivated += new EventHandler<DeactivatedEventArgs>(Current_Deactivated);

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromSeconds(1 / 30.0);

            //Create a new instance of the Screen Manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);
            //Debug.WriteLine("konstruktor");
        }
        public override void LoadContent()
        {
            temp = isoHelper.LoadHighScores("scoress.xml");
            //GameplayHelper.spawnTime = 1f;

            if (newGame)
            {
                Debug.WriteLine("u load content je");
                gameplayHelper = new GameplayHelper(LoadingScreen.cont, LoadingScreen.sprite, LoadingScreen.grapDevice);
                gameplayHelper.InitializeAssets(ScreenManager.Game.Content, ScreenManager.SpriteBatch, ScreenManager.Game.GraphicsDevice);
                gameplayHelper.LoadContent();
            }
            else gameplayHelper = (GameplayHelper)PhoneApplicationService.Current.State["gameplayHelper"];

            PhoneApplicationService.Current.State[attackGame.InGameKey] = true;

            base.LoadContent();
        }
        void BackgroundLoadContent()
        {
            // If we have never created a gameplay helper yet, now is the time. Otherwise, we simply need to reload its content, possibly.
            if (PhoneApplicationService.Current.State.ContainsKey("gameplayHelper"))
            {
                gameplayHelper = attackGame.hel;
                cont = ScreenManager.Game.Content;
                sprite = ScreenManager.SpriteBatch;
                grapDevice = ScreenManager.Game.GraphicsDevice;

            }
            else
            {
                gameplayHelper = new GameplayHelper(ScreenManager.Game.Content, ScreenManager.SpriteBatch,
                    ScreenManager.Game.GraphicsDevice);
                cleanHelper = new GameplayHelper(ScreenManager.Game.Content, ScreenManager.SpriteBatch,
                    ScreenManager.Game.GraphicsDevice);

                if (PhoneApplicationService.Current.State.ContainsKey("newGame"))
                {
                    PhoneApplicationService.Current.State.Remove("newGame");
                }
                PhoneApplicationService.Current.State.Add("newGame", cleanHelper as GameplayHelper);
                //}
                PhoneApplicationService.Current.State.Add("gameplayHelper", gameplayHelper as GameplayHelper);

                cont = ScreenManager.Game.Content;
                sprite = ScreenManager.SpriteBatch;
                grapDevice = ScreenManager.Game.GraphicsDevice;

            }

            if ((ScreenManager.Game as attackGame).ReloadRequired)
            {
                gameplayHelper.InitializeAssets(ScreenManager.Game.Content, ScreenManager.SpriteBatch, ScreenManager.Game.GraphicsDevice);
                cleanHelper.InitializeAssets(ScreenManager.Game.Content, ScreenManager.SpriteBatch, ScreenManager.Game.GraphicsDevice);
                gameplayHelper.LoadContent();
                cleanHelper.LoadContent();
            }
        }
 public LoadingScreen()
 {
     gameplayHelper = gameplayHelper as GameplayHelper;
 }
Exemple #5
0
        void Current_Deactivated(object sender, DeactivatedEventArgs e)
        {
            Debug.WriteLine("deactivating event...");

            if (true == PhoneApplicationService.Current.State.ContainsKey("background"))
            {
                //clear prev value
                PhoneApplicationService.Current.State.Remove("background");
            }

            PhoneApplicationService.Current.State.Add("background", backScreen as SplashScreen);

            if (true == PhoneApplicationService.Current.State.ContainsKey("loading"))
            {
                //clear prev value
                PhoneApplicationService.Current.State.Remove("loading");
            }
            PhoneApplicationService.Current.State.Add("loading", loadingScreen as LoadingScreen);

            hel = (GameplayHelper)PhoneApplicationService.Current.State["gameplayHelper"] as GameplayHelper;
            attackGame.GameplayHelper = hel;

            string SendTo = _To;
            tem = hel;
            PhoneApplicationService.Current.State.Add("Unsaved_To", tem as GameplayHelper);
        }