Esempio n. 1
0
        public MainItemVO(MainItemVO vo)
        {
            uniqueId       = vo.uniqueId;
            itemIdentifier = vo.itemIdentifier;
            itemName       = vo.itemName;
            if (tags != null)
            {
                tags = (string[])vo.tags.Clone();
            }
            customVars = vo.customVars;
            x          = vo.x;
            y          = vo.y;
            rotation   = vo.rotation;
            zIndex     = vo.zIndex;
            layerName  = vo.layerName;
            if (vo.tint != null)
            {
                tint = (float[])vo.tint.Clone();
            }
            scaleX  = vo.scaleX;
            scaleY  = vo.scaleY;
            originX = vo.originX;
            originY = vo.originY;

            if (vo.shape != null)
            {
                shape = vo.shape.clone();
            }

            if (vo.physics != null)
            {
                physics = new PhysicsBodyDataVO(vo.physics);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// gets the layerDepth for a child composite. It calculates it by first getting the composite (parent) layerDepth the standard way
        /// (via zIndexMaxComp) and then subtracting the inverse of the child (O2DMainItem) layerDepth which uses zIndexMaxChild. For this to
        /// work intelligently zIndexMaxComp should be the standard scene.zIndexMax value and zIndexMaxChild should be a much higher number. The
        /// reason for this is so that the parent component has a small offset to use for each child and so they dont overflow to the next zIndex.
        ///
        /// Example: parent is 14. Any children must end up being between 14 and 15 so they dont overflow on top of another composite.
        /// </summary>
        /// <returns>The depth for child.</returns>
        /// <param name="zIndexMaxComp">Z index max comp.</param>
        /// <param name="child">Child.</param>
        /// <param name="zIndexMaxChild">Z index max child.</param>
        public float calculateLayerDepthForChild(float zIndexMax, MainItemVO child, float zIndexMaxChild = 100)
        {
            if (zIndexMaxChild < zIndexMax)
            {
                zIndexMaxChild = zIndexMax * 10;
            }

            return(calculateLayerDepth(zIndexMax, null) - (1 - child.calculateLayerDepth(zIndexMaxChild, null)));
        }
Esempio n. 3
0
        public void removeItem(MainItemVO vo)
        {
            Type classType = vo.GetType();

            if (classType.Name == "SimpleImageVO")
            {
                sImages.Remove((SimpleImageVO)vo);
            }
            if (classType.Name == "Image9patchVO")
            {
                sImage9patchs.Remove((Image9patchVO)vo);
            }
            if (classType.Name == "TextBoxVO")
            {
                sTextBox.Remove((TextBoxVO)vo);
            }
            if (classType.Name == "LabelVO")
            {
                sLabels.Remove((LabelVO)vo);
            }
            if (classType.Name == "CompositeItemVO")
            {
                sComposites.Remove((CompositeItemVO)vo);
            }
            if (classType.Name == "SelectBoxVO")
            {
                sSelectBoxes.Remove((SelectBoxVO)vo);
            }
            if (classType.Name == "ParticleEffectVO")
            {
                sParticleEffects.Remove((ParticleEffectVO)vo);
            }
            if (classType.Name == "LightVO")
            {
                sLights.Remove((LightVO)vo);
            }
            if (classType.Name == "SpineVO")
            {
                sSpineAnimations.Remove((SpineVO)vo);
            }
            if (classType.Name == "SpriteAnimationVO")
            {
                sSpriteAnimations.Remove((SpriteAnimationVO)vo);
            }
            if (classType.Name == "SpriterVO")
            {
                sSpriterAnimations.Remove((SpriterVO)vo);
            }
            if (classType.Name == "ColorPrimitiveVO")
            {
                sColorPrimitives.Remove((ColorPrimitiveVO)vo);
            }
        }
Esempio n. 4
0
		/// <summary>
		/// gets the layerDepth for a child composite. It calculates it by first getting the composite (parent) layerDepth the standard way
		/// (via zIndexMin/Max) and then subtracting the inverse of the child (O2DMainItem) layerDepth which uses zIndexMaxChild. For this to
		/// work intelligently zIndexMaxComp should be the standard scene.zIndexMax value and zIndexMaxChild should be a much higher number. The
		/// reason for this is so that the parent component has a small offset to use for each child and so they dont overflow to the next zIndex.
		/// 
		/// Example: parent is 14. Any children must end up being between 14 and 15 so they dont overflow on top of another composite.
		/// </summary>
		/// <returns>The depth for child.</returns>
		/// <param name="zIndexMaxComp">Z index max comp.</param>
		/// <param name="child">Child.</param>
		/// <param name="zIndexMaxChild">Z index max child.</param>
		public float calculateLayerDepthForChild( float zIndexMin, float zIndexMax, MainItemVO child, float zIndexMaxChild = 100 )
		{
			if( zIndexMaxChild < zIndexMax )
				zIndexMaxChild = zIndexMax * 10;
			if( child.zIndex < zIndex )
				child.zIndex = zIndex + 1;

			var ourLayerDepth = calculateLayerDepth( zIndexMin, zIndexMax, null );
			var childLayerDepth = child.calculateLayerDepth( zIndexMin, zIndexMax, null );

			return Mathf.clamp01( ourLayerDepth + childLayerDepth );
			//return calculateLayerDepth( zIndexMin, zIndexMax, null ) - ( 1 - child.calculateLayerDepth( zIndexMin, zIndexMax, null ) );
		}
Esempio n. 5
0
        /// <summary>
        /// gets the layerDepth for a child composite. It calculates it by first getting the composite (parent) layerDepth the standard way
        /// (via zIndexMin/Max) and then subtracting the inverse of the child (O2DMainItem) layerDepth which uses zIndexMaxChild. For this to
        /// work intelligently zIndexMaxComp should be the standard scene.zIndexMax value and zIndexMaxChild should be a much higher number. The
        /// reason for this is so that the parent component has a small offset to use for each child and so they dont overflow to the next zIndex.
        ///
        /// Example: parent is 14. Any children must end up being between 14 and 15 so they dont overflow on top of another composite.
        /// </summary>
        /// <returns>The depth for child.</returns>
        /// <param name="zIndexMaxComp">Z index max comp.</param>
        /// <param name="child">Child.</param>
        /// <param name="zIndexMaxChild">Z index max child.</param>
        public float calculateLayerDepthForChild(float zIndexMin, float zIndexMax, MainItemVO child, float zIndexMaxChild = 100)
        {
            if (zIndexMaxChild < zIndexMax)
            {
                zIndexMaxChild = zIndexMax * 10;
            }
            if (child.zIndex < zIndex)
            {
                child.zIndex = zIndex + 1;
            }

            var ourLayerDepth   = calculateLayerDepth(zIndexMin, zIndexMax, null);
            var childLayerDepth = child.calculateLayerDepth(zIndexMin, zIndexMax, null);

            return(Mathf.clamp01(ourLayerDepth + childLayerDepth));
            //return calculateLayerDepth( zIndexMin, zIndexMax, null ) - ( 1 - child.calculateLayerDepth( zIndexMin, zIndexMax, null ) );
        }