コード例 #1
0
ファイル: ExitGameEvent.cs プロジェクト: pampersrocker/STAR
 protected override DrawPosition InitializeEvent(IServiceProvider serviceProvider,GraphicsDevice device,LevelVariables levelVariables,Options options)
 {
     exit = levelVariables.ExitRectangle;
     blank = Content.Load<Texture2D>("Stuff/Blank");
     rect = new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight);
     return DrawPosition.InFrontOfLevel;
 }
コード例 #2
0
ファイル: StyleChangeForm.cs プロジェクト: pampersrocker/STAR
 public StyleChangeForm(LevelVariables lv)
 {
     InitializeComponent();
     variables = lv;
     LoadBackgroundLists();
     SelectCurrentSettings();
     //GraphXPackBox.SelectedItem = variables.Dictionary[LV.GraphXPack];
     RefreshGraphXPackBox();
 }
コード例 #3
0
ファイル: GameLogic.cs プロジェクト: pampersrocker/STAR
 public void Initialize(IServiceProvider serviceProvider,GraphicsDevice device, LevelVariables levelvariables, Options options)
 {
     GameEvent gameevent;
     gameevent = new ExitGameEvent();
     gameevent.Initialize(serviceProvider,device, levelvariables, options);
     gameevent.Enabled = false;
     events.Add(gameevent);
     gameevent = new KillEvent();
     gameevent.Initialize(serviceProvider,device, levelvariables, options);
     gameevent.Enabled = false;
     events.Add(gameevent);
     gameevent = new StartLevelCountdown();
     gameevent.Initialize(serviceProvider, device, levelvariables, options);
     events.Add(gameevent);
 }
コード例 #4
0
ファイル: CloudLayer.cs プロジェクト: pampersrocker/STAR
 protected override void InitializeGraphX(Star.GameManagement.Options options,LevelVariables levelvariables)
 {
     string[] clouds = levelvariables.Dictionary[LV.CloudLayerImgs].Split(',');
     LayerObjects = new LayerObject[clouds.Length];
     for (int i = 0; i < LayerObjects.Length; i++)
     {
         LayerObjects[i] = new LayerObject(Content.Load<Texture2D>(GameManagement.GameConstants.GraphXPacksPath + levelvariables.Dictionary[LV.GraphXPack] + GraphXPath + clouds[i]),
             new Rectangle(getRandom(0, options.ScreenWidth),
                 getRandom(0, (int)(options.ScreenHeight * PercentageOfScreen)),
                 (int)(100*options.ScaleFactor),
                 (int)(80*options.ScaleFactor)));
         LayerObjects[i].SpecialRect = new Rectangle(LayerObjects[i].Rectangle.X,LayerObjects[i].Rectangle.Y,LayerObjects[i].Rectangle.Width,LayerObjects[i].Rectangle.Height);
         LayerObjects[i].SpecialValue = getRandom(20,80);
         LayerObjects[i].SpecialValue2 = (float)getRandom(0, 6000) / 3000f;
         LayerObjects[i].SpecialValue3 = (float)getRandom(500, 3000) / 1000f;
     }
 }
コード例 #5
0
ファイル: DecoLayer.cs プロジェクト: pampersrocker/STAR
        protected override void InitializeGraphX(Star.GameManagement.Options options, LevelVariables levelvariables)
        {
            layerObjects = new List<LayerObject>();
            if(!string.IsNullOrEmpty(LayerName.Trim()))
            {
                try
                {
                    DecorationsLayer decorationLayerType = (DecorationsLayer)Enum.Parse(typeof(DecorationsLayer), LayerName);
                    if (decorationLayerType == DecorationsLayer.Rear && !string.IsNullOrEmpty(levelvariables.Dictionary[LV.RearDecorationsLayerData]))
                        ParseData(levelvariables.Dictionary[LV.RearDecorationsLayerData], levelvariables);
                    else if (decorationLayerType == DecorationsLayer.Front && !string.IsNullOrEmpty(levelvariables.Dictionary[LV.FrontDecorationsLayerData]))
                        ParseData(levelvariables.Dictionary[LV.FrontDecorationsLayerData], levelvariables);
                }
                catch (Exception)
                {
                    LayerObjects = new LayerObject[1];
                    LayerObjects[0] = new LayerObject(Content.Load<Texture2D>("Stuff/Blank"), new Rectangle());
                    Debug.DebugManager.AddItem("Failed to Parse Decorations Layer " + LayerName, this.ToString(), new System.Diagnostics.StackTrace(),System.Drawing.Color.Red);
                    throw;
                }

            }
        }
コード例 #6
0
ファイル: Level.cs プロジェクト: pampersrocker/STAR
        /// <summary>
        /// Initializes a Level
        /// </summary>
        /// <param name="daten">The Content of the LevelFile</param>
        /// <returns>if it was successfull</returns>
        private bool LoadLevel(string daten)
        {
            bool level_loaded = false;
            //try
            {

                Dictionary<string, string> config = new Dictionary<string, string>();
                //Split Lines
                string[] zeilen = daten.Split(new char[] { ';' });
                foreach (string zeile in zeilen)
                {
                    //Splite Key and Value
                    string[] temp = zeile.Split(new char[] { '=' });
                    if (temp.Length > 1)
                    {
                        string config_name = temp[0];
                        string value = temp[1];

                        config_name = config_name.Trim();
                        value = value.Trim();

                        config[config_name] = value;
                    }
                }

                try
                {
                    //Load the LevelTiles
                    load_level_tiles(config["Level"]);
                }
                catch (Exception ex)
                {
                    error_messages.Add(ex.Message);
                }

                //Load LevelVariables
                levelvariables = new LevelVariables(daten,tiles);

                //Old Method für Loading Level (ByChar)
                #region CharLevel
               /*
                string[] temp_level_lines = config["Level"].Split(new char[] { ':' });
                level_lines = new string[temp_level_lines.Count()];
                for (int i = 0; i < temp_level_lines.Count(); i++)
                {
                    level_lines[i] = temp_level_lines[i].Trim();
                }

                int max_width = level_lines[0].Length;
                foreach (string lines in level_lines)
                {
                    if (lines.Length > max_width)
                    {
                        max_width = lines.Length;
                    }
                }
                tiles = new Tile[level_lines.Count(), max_width];

                for (int x = 0; x < level_lines.Count(); x++)
                {
                    for (int y = 0; y < max_width; y++)
                    {
                        tiles[x, y] = new Tile(y, x);
                        if (y >= level_lines[x].Length)
                        {
                            tiles[x, y].load_tile('E');
                        }
                        else
                        {
                            tiles[x, y].load_tile(level_lines[x][y]);
                            if (tiles[x, y].get_TileType == TileType.Start)
                            {
                                startpos.X = tiles[x, y].get_rect.Location.X + Tile.TILE_SIZE / 2;
                                startpos.Y = tiles[x, y].get_rect.Location.Y + Tile.TILE_SIZE / 2;
                            }
                        }
                    }
                }
                */
               #endregion

                quadtree = new Quadtree(tiles, int.Parse(levelvariables.Dictionary[LV.QuadtreeLayerDepth]));
                level_loaded = true;
            }
            //catch (Exception e)
            {
              //  error_messages.Add(e.Message);
            }

            return level_loaded;
        }
コード例 #7
0
ファイル: LevelMDIChild.cs プロジェクト: pampersrocker/STAR
 private void SetLVStyleChange(LevelVariables pLV)
 {
     levelControl1.Level.LevelVariables = pLV;
     levelControl1.ReloadTextures();
 }
コード例 #8
0
ファイル: ParallaxLayer.cs プロジェクト: pampersrocker/STAR
 protected override void InitializeGraphX(Star.GameManagement.Options options,LevelVariables levelvariables)
 {
     //LayerObjects[0] = new LayerObject(Content.Load<Texture2D>(GameConstants.GraphXPacksPath + levelvariables.Dictionary[LV.GraphXPack] + graphXPath + graphXName),
     //        new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight));
     //LayerObjects[1] = new LayerObject(LayerObjects[0].Texture,
     //    new Rectangle(options.ScreenWidth, 0, options.ScreenWidth, options.ScreenHeight));
     Texture2D tex = Content.Load<Texture2D>(GameConstants.GraphXPacksPath + levelvariables.Dictionary[LV.GraphXPack] + graphXPath + graphXName);
     LayerObjects[0] = new LayerObject(tex,
             new Rectangle(0, 0, options.ScreenWidth, (int)(tex.Height / ((float)tex.Width/(float)options.ScreenWidth))));
     LayerObjects[1] = new LayerObject(LayerObjects[0].Texture,
         new Rectangle(options.ScreenWidth, 0, options.ScreenWidth, (int)(tex.Height / ((float)tex.Width / (float)options.ScreenWidth))));
 }
コード例 #9
0
ファイル: Layer.cs プロジェクト: pampersrocker/STAR
 /// <summary>
 /// Initializes the LayerObjects
 /// Is called by Initialize
 /// </summary>
 /// <param name="options">Optionen for the Resolution</param>
 protected abstract void InitializeGraphX(Star.GameManagement.Options options,LevelVariables levelvariables);
コード例 #10
0
ファイル: DecoLayer.cs プロジェクト: pampersrocker/STAR
        private void ParseData(string data,LevelVariables levelvariables)
        {
            string[] dataLines = SplitData(data);
            for (int i = 0; i < dataLines.Length; i++)
            {
                if (!string.IsNullOrEmpty(dataLines[i]))
                {
                    Vector2 texSize = new Vector2(1);
                    ExtendedRectangle extRect;
                    Texture2D tex;
                    string texName = "";
                    try
                    {
                        texName = dataLines[i].Split(',')[9].Trim();
                        tex = Content.Load<Texture2D>(
                            GameConstants.GraphXPacksPath +
                            levelvariables.Dictionary[LV.GraphXPack] +
                            GameConstants.DECORATIONS_PATH +
                            texName);
                        texSize = new Vector2(tex.Width, tex.Height);
                        tex.Name = texName;
                    }
                    catch (Exception)
                    {
                        Debug.DebugManager.AddItem(
                            "Failed to Load DecorationTexture: " + texName,
                            this.ToString(),
                            new System.Diagnostics.StackTrace(), System.Drawing.Color.Yellow);
                        tex = Content.Load<Texture2D>("Stuff/Blank");
                        texSize = new Vector2(tex.Width, tex.Height);
                    }
                    extRect = ExtendedRectangle.CreateFromString(dataLines[i], texSize);
                    layerObjects.Add(new LayerObject(tex, extRect));
                }

            }
        }
コード例 #11
0
ファイル: Layer.cs プロジェクト: pampersrocker/STAR
 public void Initialize(Options options, LevelVariables levelVariables)
 {
     Initialize(
         options.InitObjectHolder.serviceProvider,
         options.InitObjectHolder.dataHolder.GetData<int>(Data_Layer.NumLayerObjects.GetKey()),
         options,
         levelVariables,
         options.InitObjectHolder.graphics);
 }
コード例 #12
0
ファイル: Layer.cs プロジェクト: pampersrocker/STAR
        protected void Initialize(IServiceProvider ServiceProvider,int numberOfLayerObjects,Star.GameManagement.Options options,LevelVariables levelvariables,GraphicsDevice graphicsDevice)
        {
            content = new ContentManager(ServiceProvider);
            content.RootDirectory = "Data";
            //colorizeEffect = new Colorize();
            //colorizeEffect.Initialize(ServiceProvider, graphicsDevice, options);
            colorizeLUT = new ColorizeLUT();
            colorizeLUT.Initialize(ServiceProvider, graphicsDevice, options);
            colorizeLUT.Enabled = true;
            //fxData = LayerFXData.Default;
            //fxData.SaturationEnabled = true;
            //fxData.HueEnabled = true;
            //fxData.Saturation = 0f;
            GraphicsManager.AddItem(this);
            //colorizeEffect.Enabled = true;

            //setColorizeEffectParameters();
            layerobjects = new LayerObject[numberOfLayerObjects];
            InitializeGraphX(options,levelvariables);
            FinalizeInitialize();
        }
コード例 #13
0
ファイル: KillEvent.cs プロジェクト: pampersrocker/STAR
 protected override DrawPosition InitializeEvent(IServiceProvider serviceProvider,GraphicsDevice device,LevelVariables levelVariables, Options options)
 {
     this.options = options;
     blank = Content.Load<Texture2D>("Stuff/Blank");
     killeffect = new KillEffect();
     killeffect.Initialize(serviceProvider, device, options);
     traceEffect = new Trace();
     traceEffect.Initialize(serviceProvider, device, options);
     rect = new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight);
     screenwidth = options.ScreenWidth;
     coord = new Vector2(options.ScreenWidth / 2, options.ScreenHeight / 2 + options.ScreenHeight * 0.35f);
     frontrect = new Rectangle(0, 0, options.ScreenWidth, options.ScreenHeight);
     shakeDivider = 10;
     manager = new ParticleSystem();
     gameOverText.font = Content.Load<SpriteFont>("Stuff\\Font");
     gameOverText.Text = gameOver;
     gameOverText.color = new Color(1f,1f,1f, 0);
     blackScreenColor = new Color(0f,0f,0f, 0);
     toonShader = new ToonShader();
     toonShader.Initialize(serviceProvider, device, options);
     toonShader.CurrentTechnique = ToonShaderEffects.BrightEdgesColored;
     return DrawPosition.Post;
 }
コード例 #14
0
ファイル: Level.cs プロジェクト: pampersrocker/STAR
        /// <summary>
        /// Generates an new default Level with px rows an py coloumns
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <param name="px"></param>
        /// <param name="py"></param>
        public void LoadLevel(IServiceProvider serviceProvider, GraphicsDevice graphicsDevice, Options options, int px, int py)
        {
            content = new ContentManager(serviceProvider);
            content.RootDirectory = "Data";
            textures = new Texture2D[AMOUNT_TILE_TYPES];
            startpos = Vector2.Zero;
            levelvariables = new LevelVariables();
            error_messages = new List<string>();
            tiles = new Tile[py, px];

            for (int x = 0; x < px; x++)
            {
                for (int y = 0; y < py; y++)
                {
                    tiles[y, x] = new Tile(x, y);
                    if (y - 1 >= 0)
                        tiles[y, x].load_tile(((int)TileType.Empty), tiles[y - 1, x]);
                    else
                        tiles[y, x].load_tile(((int)TileType.Empty), null);
                }
            }
            InitializeEffects(serviceProvider, graphicsDevice, options);
            reLoadTextures();
        }
コード例 #15
0
ファイル: Level.cs プロジェクト: pampersrocker/STAR
 /// <summary>
 /// Generates an Empty Level with default Values
 /// </summary>
 /// <param name="serviceProvider">For The Content</param>
 public void LoadLevel(IServiceProvider serviceProvider, GraphicsDevice graphicsDevice, Options options)
 {
     content = new ContentManager(serviceProvider);
     content.RootDirectory = "Data";
     textures = new Texture2D[AMOUNT_TILE_TYPES];
     startpos = Vector2.Zero;
     levelvariables = new LevelVariables();
     error_messages = new List<string>();
     tiles = new Tile[1, 1];
     tiles[0, 0] = new Tile(0, 0);
     tiles[0, 0].load_tile((int)TileType.Empty,null);
     InitializeEffects(serviceProvider, graphicsDevice, options);
     reLoadTextures();
 }
コード例 #16
0
ファイル: GameEvent.cs プロジェクト: pampersrocker/STAR
 protected abstract DrawPosition InitializeEvent(IServiceProvider serviceProvider,GraphicsDevice device,LevelVariables levelVariables,Options options);
コード例 #17
0
ファイル: GameEvent.cs プロジェクト: pampersrocker/STAR
 public void Initialize(IServiceProvider serviceProvider,GraphicsDevice device,LevelVariables levelVariables,Options options)
 {
     content = new ContentManager(serviceProvider, "Data");
     drawposition = InitializeEvent(serviceProvider,device, levelVariables,options);
     FinishInitialization();
 }