Exemplo n.º 1
0
 public void RemoveScreenLayer(IScreenLayer screenLayer)
 {
     // If you delete a screen layer during the HandleInput method or
     // outside of the main loop entirely, another update may take place
     // before the screen is actually deleted.
     _screenLayersToRemove.Add(screenLayer);
 }
Exemplo n.º 2
0
 public void AddScreenLayerBehind(IScreenLayer reference, IScreenLayer toAdd)
 {
     if (isEnumerating && queueIfEnumerating(() => AddScreenLayerBehind(reference, toAdd)))
     {
         return;
     }
     // Equivalent to adding screen layer _before_ reference.
     addScreenLayerAtIndex(screenLayers.IndexOf(reference), toAdd);
 }
Exemplo n.º 3
0
 public void AddScreenLayerOnTop(IScreenLayer screenLayer)
 {
     if (isEnumerating && queueIfEnumerating(() => AddScreenLayerOnTop(screenLayer)))
     {
         return;
     }
     screenLayers.Add(screenLayer);
     initializeScreenLayer(screenLayer);
 }
Exemplo n.º 4
0
        public void AddScreenLayerOnTopOf(IScreenLayer reference, IScreenLayer toAdd)
        {
            // Equivalent to adding screen layer _after_ reference.
            var indexOfRef = _screenLayers.IndexOf(reference);

            if (indexOfRef == _screenLayers.Count)
            {
                AddScreenLayerOnTop(toAdd);
            }
            else
            {
                addScreenLayerAtIndex(indexOfRef + 1, toAdd);
            }
        }
Exemplo n.º 5
0
        public MapSquare(IScreenLayer layer, Tile tile, int x, int y, int tilesize)
        {
            this.layer = layer;
            Tile       = tile;
            X          = x;
            Y          = y;
            screenX    = x * tilesize;
            screenY    = y * tilesize;

            var commonBox = Tile.Sprite.BoundBox;

            blockBox = new Rectangle(commonBox.X, commonBox.Y, commonBox.Width, commonBox.Height);
            blockBox.Offset(-Tile.Sprite.HotSpot.X, -Tile.Sprite.HotSpot.Y);
        }
Exemplo n.º 6
0
        public MapSquare(IScreenLayer layer, Tile tile, int x, int y, int tilesize)
        {
            this.layer = layer;
            Tile = tile;
            X = x;
            Y = y;
            screenX = x * tilesize;
            screenY = y * tilesize;

            var commonBox = Tile.Sprite.BoundBox;

            blockBox = new RectangleF(commonBox.X, commonBox.Y, commonBox.Width, commonBox.Height);
            blockBox.Offset(-Tile.Sprite.HotSpot.X, -Tile.Sprite.HotSpot.Y);
        }
Exemplo n.º 7
0
        public void AddScreenLayerOnTopOf(IScreenLayer reference, IScreenLayer toAdd)
        {
            if (isEnumerating && queueIfEnumerating(() => AddScreenLayerOnTopOf(reference, toAdd)))
            {
                return;
            }
            // Equivalent to adding screen layer _after_ reference.
            var indexOfRef = screenLayers.IndexOf(reference);

            if (indexOfRef == screenLayers.Count)
            {
                AddScreenLayerOnTop(toAdd);
            }
            else
            {
                addScreenLayerAtIndex(indexOfRef + 1, toAdd);
            }
        }
Exemplo n.º 8
0
 private void initializeScreenLayer(IScreenLayer screenLayer)
 {
     screenLayer.OnResize(_viewportSize);
 }
Exemplo n.º 9
0
 public void AddScreenLayerBehind(IScreenLayer reference, IScreenLayer toAdd)
 {
     // Equivalent to adding screen layer _before_ reference.
     addScreenLayerAtIndex(_screenLayers.IndexOf(reference), toAdd);
 }
Exemplo n.º 10
0
 private void addScreenLayerAtIndex(int index, IScreenLayer screenLayer)
 {
     _screenLayers.Insert(index, screenLayer);
     initializeScreenLayer(screenLayer);
 }
Exemplo n.º 11
0
 public void AddScreenLayerOnTop(IScreenLayer screenLayer)
 {
     _screenLayers.Add(screenLayer);
     initializeScreenLayer(screenLayer);
 }