Exemplo n.º 1
0
        /// <summary>
        /// Re-builds an alpha-blending preview.
        /// </summary>
        protected void updateAlphaSprites()
        {
            if (alphaSprites != null)
            {
                alphaSprites.Dispose();
            }

            // builds a new alpha blended preview
            alphaSprites = createAlphaSprites();
        }
Exemplo n.º 2
0
 public FixedSizeStructurePlacementController(FixedSizeStructureContribution _contrib, IControllerSite _site)
     : base(_contrib.size, _site)
 {
     this.contrib      = _contrib;
     this.alphaSprites = new AlphaBlendSpriteSet(contrib.sprites);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Re-builds an alpha-blending preview.
        /// </summary>
        private void updateAlphaSprites()
        {
            if (direction == null)
            {
                return;                         // during the initialization, this method can be called in a wrong timing.
            }
            if (alphaSprites != null)
            {
                alphaSprites.Dispose();
            }


            ISprite[, ,] alphas = null;

            switch (this.currentMode)
            {
            case Mode.Station:
                // builds a new alpha blended preview
                alphas = selectedStation.Sprites;
                break;

            case Mode.ThinPlatform:
                ISprite spr = ThinPlatform.getSprite(direction, false);

                // build sprite set
                // TODO: use the correct sprite
                if (direction == Direction.NORTH || direction == Direction.SOUTH)
                {
                    alphas = new ISprite[1, length, 1];
                    for (int i = 0; i < length; i++)
                    {
                        alphas[0, i, 0] = spr;
                    }
                }
                else
                {
                    alphas = new ISprite[length, 1, 1];
                    for (int i = 0; i < length; i++)
                    {
                        alphas[i, 0, 0] = spr;
                    }
                }

                alphaSprites = new AlphaBlendSpriteSet(alphas);
                break;

            case Mode.FatPlatform:
                RailPattern rp = this.railPattern;


                // build sprite set
                if (direction == Direction.NORTH || direction == Direction.SOUTH)
                {
                    alphas = new ISprite[2, length, 1];
                    int j = direction == Direction.SOUTH ? 1 : 0;
                    for (int i = 0; i < length; i++)
                    {
                        alphas[j, i, 0]     = FatPlatform.getSprite(direction);
                        alphas[j ^ 1, i, 0] = railPattern;
                    }
                }
                else
                {
                    alphas = new ISprite[length, 2, 1];
                    int j = direction == Direction.WEST ? 1 : 0;
                    for (int i = 0; i < length; i++)
                    {
                        alphas[i, j, 0]     = FatPlatform.getSprite(direction);
                        alphas[i, j ^ 1, 0] = railPattern;
                    }
                }
                break;
            }

            alphaSprites = new AlphaBlendSpriteSet(alphas);
            WorldDefinition.World.OnAllVoxelUpdated();  // completely redraw the window
        }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="contrib"></param>
 /// <param name="site"></param>
 public FixedSizeStructurePlacementController(FixedSizeStructureContribution contrib, IControllerSite site)
     : base(contrib.Size, site)
 {
     this.contrib      = contrib;
     this.alphaSprites = new AlphaBlendSpriteSet(this.contrib.Sprites);
 }