Esempio n. 1
0
 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;
     }
 }
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
 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))));
 }
Esempio n. 4
0
        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;
                }

            }
        }
Esempio n. 5
0
 public void RemoveItem(LayerObject layerObject)
 {
     layerObjects.Remove(layerObject);
 }
Esempio n. 6
0
 public void AddItem(LayerObject item)
 {
     layerObjects.Add(item);
 }
Esempio n. 7
0
 void levelControl1_DecoAdded(LayerObject layerObject, DecorationsLayer layer)
 {
     ListViewItem item;
     switch (toolManager.CurrentLayer)
     {
         case DecorationsLayer.Front:
             frontCollection.Add(layerObject);
             item = new ListViewItem(layerObject.Texture.Name);
             item.SubItems.Add(layerObject.ExtendedRectangle.Translation.ToString());
             listViewPlacedDecos.Items.Add(item);
             break;
         case DecorationsLayer.Rear:
             rearCollection.Add(layerObject);
             item = new ListViewItem(layerObject.Texture.Name);
             item.SubItems.Add(layerObject.ExtendedRectangle.Translation.ToString());
             listViewPlacedDecos.Items.Add(item);
             break;
     }
 }
Esempio n. 8
0
        private void buttonRemoveSelectedDeco_Click(object sender, EventArgs e)
        {
            int[] indices = new int[listViewPlacedDecos.SelectedIndices.Count];
            LayerObject[] items = new LayerObject[listViewPlacedDecos.SelectedIndices.Count];
            for (int i = 0; i < items.Length; i++)
            {
                indices[i] = listViewPlacedDecos.SelectedIndices[i];
                if (toolManager.CurrentLayer == DecorationsLayer.Front)
                {
                    items[i] = frontCollection[listViewPlacedDecos.SelectedIndices[i]];
                }
                else
                {
                    items[i] = rearCollection[listViewPlacedDecos.SelectedIndices[i]];
                }
            }
            for (int i = items.Length-1; i >= 0; i--)
            {
                if(toolManager.CurrentLayer == DecorationsLayer.Front)
                {
                        frontCollection.Remove(items[i]);
                }
                else
                {
                        rearCollection.Remove(items[i]);
                }
                levelControl1.RemoveItem(items[i], toolManager.CurrentLayer);
                listViewPlacedDecos.Items.RemoveAt(indices[i]);

            }
        }
Esempio n. 9
0
        private void PlaceDeco()
        {
            LayerObject newDeco = new LayerObject(mouseDeco.Texture, ExtendedRectangle.Transform(
                        mouseDeco.ExtendedRectangle.OrgRectangle,
                        new Vector2(mouseDeco.Texture.Width,mouseDeco.Texture.Height),
                        mouseDeco.ExtendedRectangle.Origin,
                        DetermineLevelMousePos(),
                        mouseDeco.ExtendedRectangle.Rotation));
            switch (currentDecoLayer)
            {
                case DecorationsLayer.Front:

                    frontDecoLayer.AddItem(newDeco);
                    break;
                case DecorationsLayer.Rear:
                    reardecoLayer.AddItem(newDeco);
                    break;
            }
            DecoAdded(newDeco,currentDecoLayer);
        }
Esempio n. 10
0
 void LevelControl_DecoAdded(LayerObject layerObject, DecorationsLayer layer)
 {
     //throw new NotImplementedException();
 }
Esempio n. 11
0
 public void SetDecorationType(string texture)
 {
     Texture2D tex;
     try
     {
         tex = gamecontent.Load<Texture2D>(
         GameConstants.GraphXPacksPath +
         level.LevelVariables.Dictionary[LV.GraphXPack] +
         GameConstants.DECORATIONS_PATH + "\\" + texture);
         tex.Name = texture;
     }
     catch (Exception e)
     {
         FileManager.WriteInErrorLog(this, e.Message, e.GetType());
         tex = gamecontent.Load<Texture2D>(
         "Stuff\\Blank");
     }
     ExtendedRectangle extRect = ExtendedRectangle.Transform(
         new Rectangle(0, 0, tex.Width, tex.Height),
         new Vector2(tex.Width, tex.Height),
         null,
         DetermineLevelMousePos(),
         0);
     mouseDeco = new LayerObject(tex, extRect);
     DecoTextureChanged(tex);
 }
Esempio n. 12
0
 public void RemoveItem(LayerObject layerObject, DecorationsLayer layer)
 {
     switch (layer)
     {
         case DecorationsLayer.Front:
             frontDecoLayer.RemoveItem(layerObject);
             break;
         case DecorationsLayer.Rear:
             reardecoLayer.RemoveItem(layerObject);
             break;
     }
 }