Ejemplo n.º 1
0
        public void LayerTest()
        {
            TestManager.Helpers.CreateTestScene("LayerTest.scene");
              IScene scene = EditorManager.Scene;

              Assert.IsTrue(scene.Save());
              Assert.AreEqual(1,scene.Layers.Count);

              // default layer should be active
              Assert.IsNotNull(scene.ActiveLayer);
              Assert.AreEqual(1,scene.Layers.Count);

              Layer layer1 = new Layer("added1");
              scene.AddLayer(layer1,false);
              Assert.AreEqual(2,scene.Layers.Count);

              Layer layer2 = new Layer("added2");
              scene.AddLayer(layer2,true);
              Assert.AreEqual(3,scene.Layers.Count);
              Assert.AreEqual(layer2,scene.ActiveLayer);

              Assert.IsTrue(scene.RemoveLayer(layer2));
              Assert.IsNotNull(scene.ActiveLayer);
              Assert.IsFalse(layer2==scene.ActiveLayer);

              TestManager.Helpers.CloseTestProject();
        }
Ejemplo n.º 2
0
 private void AddLayerClicked(object sender, EventArgs e)
 {
     // For now all layers are assumed to be some type of image file.
     if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         // Load the image in as a new layer.
         Layer layer = new Layer("Layer " + _layerListView.Items.Count);
         if (_textureManager.Exists(openFileDialog1.FileName) == false)
         {
             _textureManager.LoadTexture(openFileDialog1.FileName, openFileDialog1.FileName);
         }
         layer.SetImage(_textureManager.Get(openFileDialog1.FileName));
         _scene.AddLayer(layer);
         ListViewItem listViewItem = new ListViewItem();
         listViewItem.Text = "Layer " + _layerListView.Items.Count;
         listViewItem.Name = "someuniqueid";
         _layerListView.Items.Add(listViewItem);
     }
 }
Ejemplo n.º 3
0
        public override bool AddLayer(Layer layer, bool bSetAsActive, bool bCreateEngineInstances, bool bLock)
        {
            if (!base.AddLayer(layer, bSetAsActive, bCreateEngineInstances, bLock))
            return false;

              if (layer.IsReference)
            this.WriteReferenceFile();

              return true;
        }
Ejemplo n.º 4
0
        public override bool RemoveLayer(Layer layer, bool triggerChangeEvents = true)
        {
            if (!base.RemoveLayer(layer, triggerChangeEvents))
            return false;

              if (layer.IsReference)
            this.WriteReferenceFile();

              return true;
        }
Ejemplo n.º 5
0
        public override bool RemoveLayer(Layer layer)
        {
            if (!base.RemoveLayer(layer))
            return false;

              if (layer.IsReference)
            this.WriteReferenceFile();

              return true;
        }
Ejemplo n.º 6
0
 public void AddLayer(Layer layer)
 {
     _layerList.Add(layer);
 }