Exemple #1
0
		/// <summary>
		/// helper to translate zIndex to layerDepth. zIndexMax should be at least equal to the highest zIndex
		/// </summary>
		/// <returns>The depth.</returns>
		/// <param name="zIndexMax">Z index max.</param>
		public float calculateLayerDepth( float zIndexMin, float zIndexMax, CompositeItemVO compositeItem )
		{
			if( compositeItem != null )
				return compositeItem.calculateLayerDepthForChild( zIndexMin, zIndexMax, this );

			return Mathf.map01( (float)zIndex, zIndexMin, zIndexMax );
		}
Exemple #2
0
        /// <summary>
        /// helper to translate zIndex to layerDepth. zIndexMax should be at least equal to the highest zIndex
        /// </summary>
        /// <returns>The depth.</returns>
        /// <param name="zIndexMax">Z index max.</param>
        public float calculateLayerDepth(float zIndexMax, CompositeItemVO compositeItem)
        {
            if (compositeItem != null)
            {
                return(compositeItem.calculateLayerDepthForChild(zIndexMax, this));
            }

            return((zIndexMax - (float)zIndex) / zIndexMax);
        }
Exemple #3
0
        /// <summary>
        /// helper to translate zIndex to layerDepth. zIndexMax should be at least equal to the highest zIndex
        /// </summary>
        /// <returns>The depth.</returns>
        /// <param name="zIndexMax">Z index max.</param>
        public float calculateLayerDepth(float zIndexMin, float zIndexMax, CompositeItemVO compositeItem)
        {
            if (compositeItem != null)
            {
                return(compositeItem.calculateLayerDepthForChild(zIndexMin, zIndexMax, this));
            }

            return(Mathf.map01((float)zIndex, zIndexMin, zIndexMax));
        }
Exemple #4
0
        public void setLayerDepthRecursively(float zIndexMax, CompositeItemVO parentCompositeVO)
        {
            for (var i = 0; i < sImages.Count; i++)
            {
                sImages[i].layerDepth = sImages[i].calculateLayerDepth(zIndexMax, parentCompositeVO);
                //Overlap2DImporter.logger.LogMessage( "[image] zIndex: {0} -> {1}, parent: {2}", sImages[i].zIndex, sImages[i].layerDepth, parentCompositeVO );
            }

            for (var i = 0; i < sComposites.Count; i++)
            {
                // compositeItems are considered global so they have their own zIndex that isnt affected by parents up the chain
                sComposites[i].layerDepth = sComposites[i].calculateLayerDepth(zIndexMax, null);

                if (sComposites[i].composite != null)
                {
                    sComposites[i].composite.setLayerDepthRecursively(zIndexMax, sComposites[i]);
                }
            }
        }
Exemple #5
0
        public CompositeItemVO clone()
        {
            CompositeItemVO tmp = new CompositeItemVO();

            tmp.composite = composite;
            tmp.itemName  = itemName;
            tmp.layerName = layerName;
            tmp.rotation  = rotation;
            tmp.tint      = tint;
            tmp.x         = x;
            tmp.y         = y;
            tmp.zIndex    = zIndex;

            tmp.scissorX      = scissorX;
            tmp.scissorY      = scissorY;
            tmp.scissorWidth  = scissorWidth;
            tmp.scissorHeight = scissorHeight;

            tmp.width  = width;
            tmp.height = height;

            return(tmp);
        }
Exemple #6
0
		public void setLayerDepthRecursively( float zIndexMin, float zIndexMax, CompositeItemVO parentCompositeVO )
		{
			for( var i = 0; i < sImages.Count; i++ )
			{
				sImages[i].layerDepth = sImages[i].calculateLayerDepth( zIndexMin, zIndexMax, parentCompositeVO );
				Overlap2DImporter.logger.LogMessage( "[image] zIndex: {0} -> {1}, parent: {2}, renderLayer: {3}", sImages[i].zIndex, sImages[i].layerDepth, parentCompositeVO, sImages[i].renderLayer );
			}

			for( var i = 0; i < sComposites.Count; i++ )
			{
				// compositeItems are considered global so they have their own zIndex that isnt affected by parents up the chain
				sComposites[i].layerDepth = sComposites[i].calculateLayerDepth( zIndexMin, zIndexMax, null );

				if( sComposites[i].composite != null )
					sComposites[i].composite.setLayerDepthRecursively( zIndexMin, zIndexMax, sComposites[i] );
			}
		}
Exemple #7
0
		public void setLayerDepthRecursively( Dictionary<int,int> minIndicies, Dictionary<int,int> maxIndicies, CompositeItemVO parentCompositeVO )
		{
			for( var i = 0; i < sImages.Count; i++ )
			{
				var renderLayer = sImages[i].renderLayer;
				var minIndex = minIndicies[renderLayer];
				var maxIndex = maxIndicies[renderLayer];

				sImages[i].layerDepth = sImages[i].calculateLayerDepth( minIndex, maxIndex, parentCompositeVO );
				Overlap2DImporter.logger.LogMessage( "[image] zIndex: {0} -> {1}, parent: {2}, renderLayer: {3}", sImages[i].zIndex, sImages[i].layerDepth, parentCompositeVO, sImages[i].renderLayer );
			}

			for( var i = 0; i < sComposites.Count; i++ )
			{
				var renderLayer = sComposites[i].renderLayer;
				var minIndex = minIndicies[renderLayer];
				var maxIndex = maxIndicies[renderLayer];

				// compositeItems are considered global so they have their own zIndex that isnt affected by parents up the chain
				sComposites[i].layerDepth = sComposites[i].calculateLayerDepth( minIndex, maxIndex, null );

				if( sComposites[i].composite != null )
					sComposites[i].composite.setLayerDepthRecursively( minIndex, maxIndex, sComposites[i] );
			}
		}
Exemple #8
0
 public void update(CompositeItemVO vo)
 {
     composite = new CompositeVO(vo.composite);
 }
Exemple #9
0
 public CompositeItemVO(CompositeItemVO vo) : base(vo)
 {
     composite = new CompositeVO(vo.composite);
 }
Exemple #10
0
        public void setLayerDepthRecursively(Dictionary <int, int> minIndicies, Dictionary <int, int> maxIndicies, CompositeItemVO parentCompositeVO)
        {
            for (var i = 0; i < sImages.Count; i++)
            {
                var renderLayer = sImages[i].renderLayer;
                var minIndex    = minIndicies[renderLayer];
                var maxIndex    = maxIndicies[renderLayer];

                sImages[i].layerDepth = sImages[i].calculateLayerDepth(minIndex, maxIndex, parentCompositeVO);
                Overlap2DImporter.logger.LogMessage("[image] zIndex: {0} -> {1}, parent: {2}, renderLayer: {3}", sImages[i].zIndex, sImages[i].layerDepth, parentCompositeVO, sImages[i].renderLayer);
            }

            for (var i = 0; i < sComposites.Count; i++)
            {
                var renderLayer = sComposites[i].renderLayer;
                var minIndex    = minIndicies[renderLayer];
                var maxIndex    = maxIndicies[renderLayer];

                // compositeItems are considered global so they have their own zIndex that isnt affected by parents up the chain
                sComposites[i].layerDepth = sComposites[i].calculateLayerDepth(minIndex, maxIndex, null);

                if (sComposites[i].composite != null)
                {
                    sComposites[i].composite.setLayerDepthRecursively(minIndex, maxIndex, sComposites[i]);
                }
            }
        }