Esempio n. 1
0
        public SMenu(IServiceProvider ServiceProvider)
        {
            content = new ContentManager(ServiceProvider);
            content.RootDirectory = "Data";

            current_pos = 0;
            custmapmenu = new CustMapMenu(ServiceProvider);
            menulists = new MenuList[4];
            cloudlayer = new Star.Game.Level.CloudLayer();
            string[] names;
            names = new string[5];
            names[0] = "Story";
            names[1] = "Custom Maps";
            names[2] = "Options";
            names[3] = "Credits";
            names[4] = "Quit";
            menulists[0] = new MenuList("Main Menu",names);
            menulists[0].ChangeButtonState(0, ButtonIndicator.Button_Hover);
            names = new string[3];
            names[0] = "Continue";
            names[1] = "Start New Story";
            names[2] = "Mission Selection";
            menulists[1] = new MenuList("Story", names);
            mainmenu = new MainMenu();
            optionsMenu = new OptionsMenu();
            pBackground = new PlayerBackground(ServiceProvider);
            oldMenuEffect = new TransitionEffect(Vector2.Zero, TransitionType.Translate);

            newMenueEffect = new TransitionEffect(Vector2.Zero, TransitionType.Translate);
        }
Esempio n. 2
0
        private void InitializeLayer(Options pOptions, GraphicsDevice graphicsDevice)
        {
            if (cloudlayer != null)
                cloudlayer.Dispose();
            cloudlayer = new CloudLayer();
            cloudlayer.Initialize(pOptions, level.LevelVariables);
            cloudlayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.CloudsFX]);
            LevelLoadEnhanced(53, "Clouds Loaded...");
            if (frontparallaxLayer != null)
                frontparallaxLayer.Dispose();
            frontparallaxLayer = new ParallaxLayer();
            frontparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.FrontParallaxLayerImage];

            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 2);
            frontparallaxLayer.Initialize(pOptions, level.LevelVariables);
            frontparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.FrontParallaxLayerSpeedDivider]);
            frontparallaxLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.FrontParallaxFX]);
            LevelLoadEnhanced(56, "Front Parallax Layer loaded...");
            if (rearparallaxLayer != null)
                rearparallaxLayer.Dispose();
            rearparallaxLayer = new ParallaxLayer();
            rearparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.RearParallaxLayerImage];
            rearparallaxLayer.Initialize(pOptions, level.LevelVariables);
            rearparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.RearParallaxLayerSpeedDivider]);
            rearparallaxLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.RearParallaxFX]);
            LevelLoadEnhanced(59, "Rear Parallax Layer loaded...");
            if (rearDecoLayer != null)
                rearDecoLayer.Dispose();
            rearDecoLayer = new DecoLayer();
            rearDecoLayer.LayerName = DecorationsLayer.Rear.ToString();

            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 1);
            rearDecoLayer.Initialize(pOptions, level.LevelVariables);
            rearDecoLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.LevelFX]);
            if (frontDecoLayer != null)
                frontDecoLayer.Dispose();
            frontDecoLayer = new DecoLayer();
            frontDecoLayer.LayerName = DecorationsLayer.Front.ToString();
            frontDecoLayer.Initialize(pOptions, level.LevelVariables);
            frontDecoLayer.FXData = LayerFXData.FromString(level.LevelVariables.Dictionary[LV.LevelFX]);
            Texture2D tex = content.Load<Texture2D>("Img\\Game\\Exit");
            Rectangle exitRect = level.LevelVariables.ExitRectangle;
            exitRect.Width *= 2;
            exitRect.Height *= 2;
            exitRect.Y -= exitRect.Height / 2;
            ExtendedRectangle extRect = ExtendedRectangle.Transform(exitRect, new Vector2(tex.Width, tex.Height), null, Vector2.Zero, 0);
            LayerObject layerObject = new LayerObject(tex, extRect);
            rearDecoLayer.AddItem(layerObject);
        }
Esempio n. 3
0
        private void InitializeLayer(Options pOptions)
        {
            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 4);
            cloudlayer = new CloudLayer();
            cloudlayer.Initialize(pOptions, level.LevelVariables);
            frontparallaxLayer = new ParallaxLayer();
            frontparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.FrontParallaxLayerImage];
            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 2);
            frontparallaxLayer.Initialize(pOptions,level.LevelVariables);
            frontparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.FrontParallaxLayerSpeedDivider]);
            rearparallaxLayer = new ParallaxLayer();
            rearparallaxLayer.GraphXName = level.LevelVariables.Dictionary[LV.RearParallaxLayerImage];
            rearparallaxLayer.Initialize(pOptions,level.LevelVariables);
            rearparallaxLayer.SpeedDivider = float.Parse(level.LevelVariables.Dictionary[LV.RearParallaxLayerSpeedDivider]);
            reardecoLayer = new DecoLayer();
            reardecoLayer.LayerName = DecorationsLayer.Rear.ToString();

            pOptions.InitObjectHolder.dataHolder.PutData(Layer.Data_Layer.NumLayerObjects.GetKey(), 1);
            reardecoLayer.Initialize(pOptions,level.LevelVariables);
            frontDecoLayer = new DecoLayer();
            frontDecoLayer.LayerName = DecorationsLayer.Front.ToString();
            frontDecoLayer.Initialize(pOptions,level.LevelVariables);
        }
Esempio n. 4
0
        protected override void Initialize()
        {
            //Initilaize Layer Data
            layerData = new Dictionary<LayerFX, LayerFXData>();

            //Fill Dictionary with Default Values
            foreach (LayerFX layer in Enum.GetValues(typeof(LayerFX)))
            {
                layerData.Add(layer, LayerFXData.Default);
            }

            editorcontent = new ContentManager(Services, "StarEditData");
            gamecontent = new ContentManager(Services, "Data");
            blanktex = gamecontent.Load<Texture2D>("Stuff/Blank");

            recttool = new Rectangle();
            options = new Options();
            options.ScreenHeight = DisplayRectangle.Height;
            options.ScreenWidth = DisplayRectangle.Width;
            options.ScreenWidth = GraphicsDevice.PresentationParameters.BackBufferWidth;
            options.ScreenHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;
            options.InitObjectHolder.graphics = GraphicsDevice;

            options.InitObjectHolder.serviceProvider = Services;
            oldscreensize = new Point(DisplayRectangle.Width, DisplayRectangle.Height);
            try
            {
                arial = editorcontent.Load<SpriteFont>("Arial");
                spritebatch = new SpriteBatch(GraphicsDevice);
            }
            catch (Exception e)
            {
                string error = e.Message;
            }
            level = new Level();
            level.LoadLevel(Services,GraphicsDevice,options);
            //level = new Level(Services);
            iObjectManager = new InteractiveObjectManager();
            iObjectManager.Initialize(Services, level.LevelVariables, GraphicsDevice, options);
            rearparallaxLayer = new ParallaxLayer();
            frontparallaxLayer = new ParallaxLayer();
            cloudlayer = new CloudLayer();
            reardecoLayer = new DecoLayer();
            frontDecoLayer = new DecoLayer();
            SetBGRect();
            camera = new Camera(DisplayRectangle.Width, DisplayRectangle.Height, Vector2.Zero, DisplayRectangle.Height / 600f);
            mousetile = new Tile(0, 0);
            mousetile.load_tile((int)TileType.Wall,null);
            mouseTex = editorcontent.Load<Texture2D>("mousetile");
            if (level.Tiles != null)
            {
                mousetile.LoadGrass();
            }
            SetBorders(1, 1);
            enemymanager = new EnemyManager(Services, new Options());
            try
            {
                placeEnemy = new SingleEnemyManager(Services);
                placeEnemy.LoadEnemy(selectedEnemy);
            }
            catch (Exception e)
            {
                FileManager.WriteInErrorLog(this, e.Message, e.GetType());
            }

            bg_tex = new Texture2D(GraphicsDevice, 1, 1);
            colorizePost = new ColorizeLUT();
            colorizePost.Initialize(Services,GraphicsDevice,new Options());
            colorizePost.Enabled = true;
            colorizePost.StartResetEffect();
            colorizePost.FxData = LayerFXData.Default;
            colorizeBackground = new ColorizeLUT();
            colorizeBackground.Initialize(Services, GraphicsDevice, new Options());
            colorizeBackground.Enabled = true;
            colorizeBackground.StartResetEffect();

            target = new RenderTarget2D(GraphicsDevice,
                GraphicsDevice.PresentationParameters.BackBufferWidth,
                GraphicsDevice.PresentationParameters.BackBufferHeight,
                false,
                SurfaceFormat.Color,
                DepthFormat.None,

                GraphicsDevice.PresentationParameters.MultiSampleCount,
                RenderTargetUsage.PreserveContents);
        }
Esempio n. 5
0
        public void ReloadTextures()
        {
            rearparallaxLayer = new ParallaxLayer();
            frontparallaxLayer = new ParallaxLayer();
            cloudlayer = new CloudLayer();

            Level.reLoadTextures();
            InitializeLayer(options);
        }