Ejemplo n.º 1
0
        public DocLayer Generate()
        {
            DocLayer layer = Create();

            FillWithData(layer);

            return(layer);
        }
Ejemplo n.º 2
0
        protected override void Update(float time)
        {
            if (Document.Instance.SelectedLayer != _layer || _layer.PropertiesDirty)
            {
                _layer = Document.Instance.SelectedLayer;
                UpdateProperties();
            }

            Select.Value = Tools.Tool.Current is Tools.Select;
            Eraser.Value = Tools.Tool.Current is Tools.EraseTile;
        }
Ejemplo n.º 3
0
        public void MoveLayerDown(DocLayer layer)
        {
            SelectLayer(layer);
            int index = Document.Current.Layers.IndexOf(layer);

            if (index < Document.Current.Layers.Count - 1)
            {
                Document.Current.Layers.MoveElementToIndex(layer, index + 1);
                SetDocumentModified();
            }
        }
Ejemplo n.º 4
0
        public void MoveLayerUp(DocLayer layer)
        {
            SelectLayer(layer);
            int index = Document.Current.Layers.IndexOf(layer);

            if (index > 0)
            {
                Document.Current.Layers.MoveElementToIndex(layer, index - 1);
                SetDocumentModified();
            }
        }
Ejemplo n.º 5
0
        protected override void FillWithData(DocLayer layer)
        {
            base.FillWithData(layer);

            TiledLayer tl = layer.Layer as TiledLayer;

            tl.Resize(Width, Height);

            tl.TiledWidth  = TiledWidth;
            tl.TiledHeight = TiledHeight;

            tl.Tileset = Tileset;
        }
Ejemplo n.º 6
0
        public void Select(DocLayer layer)
        {
            for (int idx = 0; idx < Layers.Count; ++idx)
            {
                Layers[idx].Selected.Value = false;
            }

            layer.Selected.Value = true;

            if (LayerSelectionChanged != null)
            {
                LayerSelectionChanged();
            }
        }
Ejemplo n.º 7
0
        void ReadVersion1(BinaryReader reader)
        {
            int layersNo = reader.ReadInt32();

            for (int idx = 0; idx < layersNo; ++idx)
            {
                bool tiled = reader.ReadBoolean();

                DocLayer layer = tiled ? (DocLayer) new DocTiledLayer("") : (DocLayer) new DocVectorLayer("");
                layer.Deserialize(reader);

                Layers.Add(layer);
            }
        }
Ejemplo n.º 8
0
        public void New()
        {
            new Tools.Select();

            _nextIndex++;
            FileName = string.Format("New {0}", _nextIndex);
            FilePath = null;

            Layers.Clear();

            foreach (var layer in CurrentTemplate.Instance.Layers)
            {
                DocLayer generated = layer.Generate();
                Layers.Add(generated);
                if (layer.Selected)
                {
                    Select(generated);
                }
            }

            _layerIndex = Layers.Count + 1;
            IsModified  = false;
        }
Ejemplo n.º 9
0
 protected virtual void FillWithData(DocLayer layer)
 {
     layer.Layer.ScrollSpeed = new Vector2((float)HorizontalSpeed / 100f, (float)VerticalSpeed / 100f);
 }
Ejemplo n.º 10
0
 public void SelectLayer(DocLayer layer)
 {
     Document.Current.Select(layer);
 }