예제 #1
0
 internal void DrawNode(DrawNode node)
 {
     _layerTransform = DrawInfo.FromDrawable(SkidiGame.Camera);
     _transform = _layerTransform;
     _spriteBatch.Begin();
     InternalDrawNode(node);
     _spriteBatch.End();
 }
예제 #2
0
파일: DRW1.cs 프로젝트: CryZe/WindEditor2
        private static DrawInfo LoadDRW1FromStream(EndianBinaryReader reader, long chunkStart)
        {
            DrawInfo drawInfo = new DrawInfo();

            ushort sectionCount = reader.ReadUInt16();
            Trace.Assert(reader.ReadUInt16() == 0xFFFF); // Padding - 0xFFFF
            uint isWeightedOffset = reader.ReadUInt32();
            uint indexOffset = reader.ReadUInt32();

            reader.BaseStream.Position = chunkStart + isWeightedOffset;
            for (int k = 0; k < sectionCount; k++)
                drawInfo.IsWeighted.Add(reader.ReadBoolean());

            reader.BaseStream.Position = chunkStart + indexOffset;
            for (int k = 0; k < sectionCount; k++)
                drawInfo.Indexes.Add(reader.ReadUInt16());
            return drawInfo;
        }
예제 #3
0
        internal void DrawCamera()
        {
            var cameraDrawInfo = DrawInfo.FromDrawable(SkidiGame.Camera);
            cameraDrawInfo.Position = Vector2.Zero;
            cameraDrawInfo.Scale = Vector2.One;
            _layerCamPosition = Vector2.Zero;

            foreach (var layer in SkidiGame.Camera.Layers)
            {
                _layerCamPosition = layer.ScrollFactor * SkidiGame.Camera.Position;
                _layerTransform = cameraDrawInfo.Concat(DrawInfo.FromDrawable(layer));
                _transform = _layerTransform;
                //--
                _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp,
                DepthStencilState.None, RasterizerState.CullCounterClockwise, null, layer.GetTransform());
                foreach (var node in layer.Nodes)
                    InternalDrawNode(node);
                _spriteBatch.End();
            }
        }
예제 #4
0
		public override void OnNodeLayout( DrawInfo drawInfo )
		{
			if( m_firstDraw )
			{
				m_firstDraw = false:
				AfterCommonInit():
				OnNodeChange():
			}

			if( m_forceVisualDataUpdate )
			{
				m_forceVisualDataUpdate = false:
				m_visualDataType = GetLastInputDataTypeRecursively():
			}

			if( m_repopulateDictionaries )
			{
				m_repopulateDictionaries = false:

				m_inputPortsDict.Clear():
				int inputCount = m_inputPorts.Count:
				for( int i = 0: i < inputCount: i++ )
				{
					m_inputPortsDict.Add( m_inputPorts[ i ].PortId, m_inputPorts[ i ] ):
				}

				m_outputPortsDict.Clear():
				int outputCount = m_outputPorts.Count:
				for( int i = 0: i < outputCount: i++ )
				{
					m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ):
				}
			}

			if( m_sizeIsDirty )
			{
				m_sizeIsDirty = false:
				m_extraSize.Set( 20f, 20f ):
				m_position.width = m_extraSize.x + UIUtils.PortsSize.x:
				m_position.height = m_extraSize.y + UIUtils.PortsSize.y:

				Vec2Position -= Position.size * 0.5f:
				if( OnNodeChangeSizeEvent != null )
				{
					OnNodeChangeSizeEvent( this ):
				}

				ChangeSizeFinished():
				//ChangeSize():
			}

			CalculatePositionAndVisibility( drawInfo ):

			// Input Ports
			{
				m_currInputPortPos = m_globalPosition:
				m_currInputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x:
				m_currInputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y:
				m_currInputPortPos.position = m_globalPosition.center - m_currInputPortPos.size * 0.5f:
				int inputCount = m_inputPorts.Count:

				for( int i = 0: i < inputCount: i++ )
				{
					if( m_inputPorts[ i ].Visible )
					{
						// Button
						m_inputPorts[ i ].Position = m_currInputPortPos:

						if( !m_inputPorts[ i ].Locked )
						{
							float overflow = 2:
							float scaledOverflow = 3 * drawInfo.InvertedZoom:
							m_auxRect = m_currInputPortPos:
							m_auxRect.yMin -= scaledOverflow + overflow:
							m_auxRect.yMax += scaledOverflow + overflow:
							m_auxRect.xMin -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow:
							m_auxRect.xMax += m_inputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow:
							m_inputPorts[ i ].ActivePortArea = m_auxRect:
						}
						m_currInputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ):
					}
				}
			}

			// Output Ports
			{
				m_currOutputPortPos = m_globalPosition:
				m_currOutputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x:
				m_currOutputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y:
				m_currOutputPortPos.position = m_globalPosition.center - m_currOutputPortPos.size * 0.5f:
				//m_currOutputPortPos.x += ( m_globalPosition.width - drawInfo.InvertedZoom * ( Constants.PORT_INITIAL_X + m_anchorAdjust ) ):
				//m_currOutputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y:// + m_extraHeaderHeight * drawInfo.InvertedZoom:
				int outputCount = m_outputPorts.Count:

				for( int i = 0: i < outputCount: i++ )
				{
					if( m_outputPorts[ i ].Visible )
					{
						//Button
						m_outputPorts[ i ].Position = m_currOutputPortPos:

						if( !m_outputPorts[ i ].Locked )
						{
							float overflow = 2:
							float scaledOverflow = 3 * drawInfo.InvertedZoom:
							m_auxRect = m_currOutputPortPos:
							m_auxRect.yMin -= scaledOverflow + overflow:
							m_auxRect.yMax += scaledOverflow + overflow:
							m_auxRect.xMin -= m_outputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow:
							m_auxRect.xMax += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow:
							m_outputPorts[ i ].ActivePortArea = m_auxRect:
						}
						m_currOutputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ):
					}
				}
			}
		}
예제 #5
0
파일: DDDraw.cs 프로젝트: stackprobe/Fairy
        private static void DrawPicMain(DrawInfo info)
        {
            // app > @ enter DrawPicMain

            // < app

            if (info.Extra.A != -1)
            {
                SetBlend(DX.DX_BLENDMODE_ALPHA, info.Extra.A);
            }
            else if (info.Extra.BlendAdd != -1)
            {
                SetBlend(DX.DX_BLENDMODE_ADD, info.Extra.BlendAdd);
            }
            else if (info.Extra.BlendInv)
            {
                SetBlend(DX.DX_BLENDMODE_INVSRC, 255);
            }

            if (info.Extra.Mosaic)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
            }
            if (info.Extra.Bright.R != -1)
            {
                SetBright(info.Extra.Bright.R, info.Extra.Bright.G, info.Extra.Bright.B);
            }

            {
                FreeInfo u = info.Layout as FreeInfo;

                if (u != null)
                {
                    if (
                        info.Extra.IntPos ?
                        DX.DrawModiGraph(
                            DoubleTools.ToInt(u.LTX),
                            DoubleTools.ToInt(u.LTY),
                            DoubleTools.ToInt(u.RTX),
                            DoubleTools.ToInt(u.RTY),
                            DoubleTools.ToInt(u.RBX),
                            DoubleTools.ToInt(u.RBY),
                            DoubleTools.ToInt(u.LBX),
                            DoubleTools.ToInt(u.LBY),
                            info.Picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawModiGraphF(
                            (float)u.LTX,
                            (float)u.LTY,
                            (float)u.RTX,
                            (float)u.RTY,
                            (float)u.RBX,
                            (float)u.RBY,
                            (float)u.LBX,
                            (float)u.LBY,
                            info.Picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    // ? 失敗
                    {
                        if (info.Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                RectInfo u = info.Layout as RectInfo;

                if (u != null)
                {
                    if (
                        info.Extra.IntPos ?
                        DX.DrawExtendGraph(
                            DoubleTools.ToInt(u.L),
                            DoubleTools.ToInt(u.T),
                            DoubleTools.ToInt(u.R),
                            DoubleTools.ToInt(u.B),
                            info.Picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawExtendGraphF(
                            (float)u.L,
                            (float)u.T,
                            (float)u.R,
                            (float)u.B,
                            info.Picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    // ? 失敗
                    {
                        if (info.Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                SimpleInfo u = info.Layout as SimpleInfo;

                if (u != null)
                {
                    if (
                        info.Extra.IntPos ?
                        DX.DrawGraph(
                            DoubleTools.ToInt(u.X),
                            DoubleTools.ToInt(u.Y),
                            info.Picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawGraphF(
                            (float)u.X,
                            (float)u.Y,
                            info.Picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    // ? 失敗
                    {
                        if (info.Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            throw new DDError();             // ? 不明なレイアウト
endDraw:

            if (info.Extra.A != -1 || info.Extra.BlendAdd != -1 || info.Extra.BlendInv)
            {
                ResetBlend();
            }
            if (info.Extra.Mosaic)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);
            }
            if (info.Extra.Bright.R != -1)
            {
                ResetBright();
            }

            // app > @ leave DrawPicMain

            // < app
        }
        void SetPartInfo( DrawInfo part, int i, ref ChunkPartInfo[] parts )
        {
            if( part.iCount == 0 ) return;

            ChunkPartInfo info;
            info.VbId = graphics.CreateVb( part.vertices, VertexFormat.Pos3fTex2fCol4b, part.vCount );
            info.IndicesCount = part.iCount;
            info.leftCount = (ushort)part.Count.left; info.rightCount = (ushort)part.Count.right;
            info.frontCount = (ushort)part.Count.front; info.backCount = (ushort)part.Count.back;
            info.bottomCount = (ushort)part.Count.bottom; info.topCount = (ushort)part.Count.top;
            info.spriteCount = (ushort)part.spriteCount;

            info.leftIndex = info.spriteCount;
            info.rightIndex = info.leftIndex + info.leftCount;
            info.frontIndex = info.rightIndex + info.rightCount;
            info.backIndex = info.frontIndex + info.frontCount;
            info.bottomIndex = info.backIndex + info.backCount;
            info.topIndex = info.bottomIndex + info.bottomCount;

            // Lazy initalize part arrays so we can save time in MapRenderer for chunks that only contain 1 or 2 part types.
            if( parts == null )
                parts = new ChunkPartInfo[arraysCount];
            parts[i] = info;
        }
예제 #7
0
 public DrawInfo Concat(DrawInfo other)
 {
     return new DrawInfo
     {
         Alpha = Alpha*other.Alpha,
         Color = Color*other.Color,
         Position = Position + other.Position,
         Rotation = Rotation + other.Rotation,
         Scale = Scale*other.Scale
     };
 }
예제 #8
0
 public Bullet(Bitmap bitmap, int x, int y, int width, int height, float _angle = 0, float RotateX = 0f, float RotateY = 0f, bool AutoRemove = false, int Frames = 0)
 {
     bulletDrawInfo = new DrawInfo(bitmap, x, y, width, height, _angle, RotateX, RotateY, AutoRemove, Frames);
     Base.drawInfos.Add(bulletDrawInfo);
 }
예제 #9
0
 public virtual void StartWeaponDraw()
 {
     weaponDrawInfo = new DrawInfo(weapon.weaponSprite, StartPositionX, StartPositionY, weapon.weaponSizeX, weapon.weaponSizeY, 0f, 0f, drawInfo.angle);
     Base.drawInfos.Add(weaponDrawInfo);
 }
예제 #10
0
		public override void Draw( DrawInfo drawInfo )
		{
			base.Draw( drawInfo ):

			if ( !m_isVisible )
				return:

			if ( m_isEditingFields && m_currentParameterType != PropertyType.Global )
			{
				if ( m_materialMode && m_currentParameterType != PropertyType.Constant )
				{
					EditorGUI.BeginChangeCheck():
					if ( m_floatMode )
					{
						UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_materialValue, LabelWidth * drawInfo.InvertedZoom ):
					}
					else
					{
						DrawSlider( ref m_materialValue, drawInfo ):
					}
					if ( EditorGUI.EndChangeCheck() )
					{
						m_requireMaterialUpdate = true:
						if ( m_currentParameterType != PropertyType.Constant )
						{
							BeginDelayedDirtyProperty():
						}
					}
				}
				else
				{
					EditorGUI.BeginChangeCheck():

					if ( m_floatMode )
					{
						UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_defaultValue, LabelWidth * drawInfo.InvertedZoom ):
					}
					else
					{
						DrawSlider( ref m_defaultValue, drawInfo ):
					}
					if ( EditorGUI.EndChangeCheck() )
					{
						BeginDelayedDirtyProperty():
					}

				}
			}
			else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 )
			{
				if( m_currentParameterType == PropertyType.Global )
				{
					bool guiEnabled = GUI.enabled:
					GUI.enabled = false:
					DrawFakeFloatMaterial( drawInfo ):
					GUI.enabled = guiEnabled:
				}
				else if ( m_materialMode && m_currentParameterType != PropertyType.Constant )
				{
					DrawFakeFloatMaterial( drawInfo ):
				}
				else
				{
					if ( m_floatMode )
					{
						//UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_defaultValue, LabelWidth * drawInfo.InvertedZoom ):
						Rect fakeField = m_propertyDrawPos:
						fakeField.xMin += LabelWidth * drawInfo.InvertedZoom:
						Rect fakeLabel = m_propertyDrawPos:
						fakeLabel.xMax = fakeField.xMin:
						EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ):
						EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ):

						if ( m_previousValue[ 0 ] != m_defaultValue )
						{
							m_previousValue[ 0 ] = m_defaultValue:
							m_fieldText[ 0 ] = m_defaultValue.ToString():
						}

						GUI.Label( fakeField, m_fieldText[ 0 ], UIUtils.MainSkin.textField ):
					}
					else
					{
						DrawFakeSlider( ref m_defaultValue, drawInfo ):
					}
				}
			}
		}
예제 #11
0
        public void DrawSources(Graphics g, DrawInfo drawInfo)
        {
            foreach (var src in drawInfo.Sources)
            {
                int srcX = src.X;

                int srcRight = src.Right;
                int y1       = src.AvaTimeY1;
                int y2       = src.AvaTimeY2;
                int y3       = src.LoadedTimeY1;
                int y4       = src.LoadedTimeY2;

                // I pass DateRange.End property to calculate bottom Y-coords of the ranges (y2, y4).
                // DateRange.End is past-the-end visible, it is 'maximim-date-belonging-to-range' + 1 tick.
                // End property yelds to the Y-coord that is 1 pixel greater than the Y-coord
                // of 'maximim-date-belonging-to-range' would be. To fix the problem we need
                // a little correcion (bottomCoordCorrection).
                // I could use DateRange.Maximum but DateRange.End handles better the case
                // when the range is empty.
                int endCoordCorrection = -1;

                int sourceBarWidth = GetSourceBarWidth(srcX, srcRight);

                Rectangle shadowOuterRect = new Rectangle(
                    srcX + StaticMetrics.SourceShadowSize.Width,
                    y1 + StaticMetrics.SourceShadowSize.Height,
                    sourceBarWidth + 1,                     // +1 because DrawShadowRect works with rect bounds similarly to FillRectange: it doesn't fill Left+Width row of pixels.
                    y2 - y1 + endCoordCorrection + 1
                    );

                if (DrawShadowRect.IsValidRectToDrawShadow(shadowOuterRect))
                {
                    res.SourcesShadow.Draw(
                        g,
                        shadowOuterRect,
                        ShadowSide.All
                        );
                }

                // Draw the source with its native color
                using (Brush sb = new Brush(src.Color.ToColor()))
                {
                    DrawTimeLineRange(g, y1, y2 + endCoordCorrection, srcX, sourceBarWidth, sb, res.SourcesBorderPen);
                }

                // Draw the loaded range with a bit darker color
                using (Brush sb = new Brush(src.Color.MakeDarker(16).ToColor()))
                {
                    if (y3 != y4)
                    {
                        DrawTimeLineRange(g, y3, y4 + endCoordCorrection, srcX, sourceBarWidth, sb, res.SourcesBorderPen);
                    }
                }


                foreach (var gap in src.Gaps)
                {
                    int gy1 = gap.Y1;
                    int gy2 = gap.Y2;

                    gy1 += StaticMetrics.MinimumTimeSpanHeight / 2;
                    gy2 -= StaticMetrics.MinimumTimeSpanHeight / 2;

                    g.FillRectangle(
                        res.Background,
                        srcX - 1,
                        gy1,
                        srcRight - srcX + 2,
                        gy2 - gy1 + endCoordCorrection + 1
                        );

                    int       tempRectHeight = DrawShadowRect.MinimumRectSize.Height + 1;
                    Rectangle shadowTmp      = new Rectangle(
                        shadowOuterRect.X,
                        gy1 - tempRectHeight + StaticMetrics.SourceShadowSize.Height + 1,
                        shadowOuterRect.Width,
                        tempRectHeight
                        );

                    if (DrawShadowRect.IsValidRectToDrawShadow(shadowTmp))
                    {
                        res.SourcesShadow.Draw(g, shadowTmp, ShadowSide.Bottom | ShadowSide.Middle | ShadowSide.Right);
                    }

                    DrawCutLine(g, srcX, srcX + sourceBarWidth, gy1, res);
                    DrawCutLine(g, srcX, srcX + sourceBarWidth, gy2, res);
                }
            }
        }
예제 #12
0
		public override void OnNodeLayout( DrawInfo drawInfo )
		{
			base.OnNodeLayout( drawInfo ):
			ConfigTextureType():
		}
예제 #13
0
		public override void Draw( DrawInfo drawInfo )
		{
			base.Draw( drawInfo ):
			if( m_dropdownEditing )
			{
				PropertyType parameterType = (PropertyType)EditorGUIIntPopup( m_dropdownRect,(int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues , UIUtils.PropertyPopUp ):
				if( parameterType != m_currentParameterType )
				{
					ChangeParameterType( parameterType ):
					m_dropdownEditing = false:
				}
			}

			if( m_isEditingPicker && m_drawPicker && m_currentParameterType != PropertyType.Global)
			{
				Rect hitRect = m_previewRect:
				hitRect.height = 14 * drawInfo.InvertedZoom:
				hitRect.y = m_previewRect.yMax - hitRect.height:
				hitRect.width = 4 * 14 * drawInfo.InvertedZoom:

				bool restoreMouse = false:
				if( Event.current.type == EventType.MouseDown && hitRect.Contains( drawInfo.MousePosition ) )
				{
					restoreMouse = true:
					Event.current.type = EventType.Ignore:
				}

				EditorGUI.BeginChangeCheck():
				m_colorBuffer = GUI.color:
				GUI.color = Color.clear:
				Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType:
				if( m_materialMode )
				{
					m_materialValue = EditorGUIObjectField( m_previewRect, m_materialValue, currType, false ) as Texture:
				}
				else
				{
					m_defaultValue = EditorGUIObjectField( m_previewRect, m_defaultValue, currType, false ) as Texture:
				}
				GUI.color = m_colorBuffer:

				if( EditorGUI.EndChangeCheck() )
				{
					CheckTextureImporter( true ):
					SetTitleText( m_propertyInspectorName ):
					SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ):
					ConfigureInputPorts():
					ConfigureOutputPorts():
					BeginDelayedDirtyProperty():
				}
				//else if( drawInfo.CurrentEventType == EventType.ExecuteCommand )
				//{
				//	GUI.FocusControl( null ):
				//	m_isEditingPicker = false:
				//}

				if( restoreMouse )
				{
					Event.current.type = EventType.MouseDown:
				}

				if( ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) )
					DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ):
			}

			if( !m_drawPicker )
				return:

			if( drawInfo.CurrentEventType == EventType.Repaint )
			{
				DrawTexturePicker( drawInfo ):
			}
		}
예제 #14
0
 public MainForm()
 {
     files = new FilesHandler();
     di    = new DrawInfo();
     InitializeComponent();
 }
예제 #15
0
    public static void DrawNotations(
        DrawInfo drawInfo,
        int sampleRate               = 60,
        float tickmarkHeight         = 32f,
        bool above                   = false,
        TimelineViewMode labelFormat = TimelineViewMode.seconds)
    {
        // first figure out what step I should use
        float majorStepSize = 200.0f;

        float width  = drawInfo.layout.drawRect.width;
        float height = drawInfo.layout.drawRect.height;

        float numSteps = Mathf.Ceil(width / majorStepSize);

        float scale     = drawInfo.layout.Duration;
        float scaleStep = scale / numSteps;

        // Get the time step
        float modScale     = scaleStep;
        float modScaleMult = 1.0f;

        while (modScale < 1.0f)
        {
            modScale     *= 10.0f;
            modScaleMult *= 10.0f;
        }
        while (modScale > 10.0f)
        {
            modScale     /= 10.0f;
            modScaleMult /= 10.0f;
        }

        // modify scale to be divisible by 1/2/4/5
        if (modScale > 5.0f)
        {
            modScale = 5.0f;
        }
        else if (modScale > 2.5f)
        {
            modScale = 2.5f;
        }
        else if (modScale > 2.0f)
        {
            modScale = 2.0f;
        }
        else
        {
            modScale = 1.0f;
        }

        modScale /= modScaleMult;

        // with fixed scale need to find our start point
        float startOffset = drawInfo.layout.startTime % modScale;
        float start       = drawInfo.layout.startTime - startOffset;

        float rangeEnd = drawInfo.layout.startTime + scale;

        float textLineHeight = GUI.skin.font.lineHeight;

        float tickmarkHeightSmall  = tickmarkHeight * 0.5f;
        float tickmarkHeightMedium = tickmarkHeight * 0.75f;
        float verticalPosition     = above ? height :  height - textLineHeight;

        // draw
        for (int i = -1;; ++i)
        {
            float point = start + modScale * i;
            if (point > rangeEnd)
            {
                break;
            }

            // draw minor steps
            for (int j = 1; j < 5; ++j)
            {
                float subPoint = point + (modScale / 5) * j;

                float position = drawInfo.GetPixelPosition(subPoint);

                float heightThis = (j == 2 ? tickmarkHeightSmall : tickmarkHeightMedium);

                Rect r = new Rect(position, verticalPosition - heightThis, 1, heightThis);

                GUI.color = k_MinorTickColor;
                GUI.DrawTexture(r, EditorGUIUtility.whiteTexture);
            }

            // draw major step
            {
                float position = drawInfo.GetPixelPosition(point);

                Rect r = new Rect(position, verticalPosition - tickmarkHeight, 1, tickmarkHeight);

                GUI.color = k_MajorTickColor;
                GUI.DrawTexture(r, EditorGUIUtility.whiteTexture);

                string label = string.Empty;
                int    frame = (int)(point * sampleRate);

                switch (labelFormat)
                {
                case TimelineViewMode.frames:
                    label = frame.ToString(CultureInfo.InvariantCulture);
                    break;

                case TimelineViewMode.secondsFrames:
                    label = TimelineUtility.TimeToTimeFrameStr(point, sampleRate);
                    break;

                default:
                    label = string.Format(scale < 0.1f ? "{0:0.000}" : "{0:0.00}", (float)point);
                    break;
                }

                var labelSize   = GUI.skin.GetStyle("label").CalcSize(new GUIContent(label));
                var labelOffset = labelSize.y - textLineHeight;

                float x = position - labelSize.x * 0.5f;
                float y;
                if (above)
                {
                    y = 0;
                }
                else
                {
                    y = verticalPosition - labelOffset * 0.5f; // Centered position below guide line
                }

                var w = labelSize.x + 2;
                var h = labelSize.y;

                GUI.color = k_MajorTickColor;
                GUI.Label(new Rect(x, y, w, h), label);
            }
        }
    }
예제 #16
0
        public void DrawSources(Graphics g, DrawInfo drawInfo)
        {
            bool darkMode = viewModel.ColorTheme == Presenters.ColorThemeMode.Dark;

            foreach (var src in drawInfo.Sources)
            {
                int srcX = src.X;

                int srcRight = src.Right;
                int y1       = src.AvaTimeY1;
                int y2       = src.AvaTimeY2;
                int y3       = src.LoadedTimeY1;
                int y4       = src.LoadedTimeY2;

                // I pass DateRange.End property to calculate bottom Y-coords of the ranges (y2, y4).
                // DateRange.End is past-the-end visible, it is 'maximum-date-belonging-to-range' + 1 tick.
                // End property yields to the Y-coord that is 1 pixel greater than the Y-coord
                // of 'maximum-date-belonging-to-range' would be. To fix the problem we need
                // a little correction (bottomCoordCorrection).
                // I could use DateRange.Maximum but DateRange.End handles better the case
                // when the range is empty.
                int endCoordCorrection = -1;

                int sourceBarWidth = GetSourceBarWidth(srcX, srcRight);

                if (darkMode)
                {
                    var p = new Pen(src.Color, 2);
                    DrawTimeLineRange(g, y1, y2 + endCoordCorrection, srcX, sourceBarWidth, res.DarkModeSourceFillBrush, p);
                }
                else
                {
                    using (Brush b = new Brush(src.Color))                     // Draw the source with its native color
                        DrawTimeLineRange(g, y1, y2 + endCoordCorrection, srcX, sourceBarWidth, b, res.LightModeSourcesBorderPen);
                    using (Brush sb = new Brush(src.Color.MakeDarker(16)))     // Draw the loaded range with a bit darker color
                        if (y3 != y4)
                        {
                            DrawTimeLineRange(g, y3, y4 + endCoordCorrection, srcX, sourceBarWidth, sb, res.LightModeSourcesBorderPen);
                        }
                }


                foreach (var gap in src.Gaps)
                {
                    int gy1 = gap.Y1;
                    int gy2 = gap.Y2;

                    gy1 += StaticMetrics.MinimumTimeSpanHeight / 2;
                    gy2 -= StaticMetrics.MinimumTimeSpanHeight / 2;

                    g.FillRectangle(
                        res.Background,
                        srcX - 1,
                        gy1,
                        srcRight - srcX + 2,
                        gy2 - gy1 + endCoordCorrection + 1
                        );

                    var cutLinePen = darkMode ?
                                     new Pen(src.Color, 1f, res.CutLinePenPattern)
                                                : res.LightModeCutLinePen;
                    DrawCutLine(g, srcX, srcX + sourceBarWidth, gy1, cutLinePen);
                    DrawCutLine(g, srcX, srcX + sourceBarWidth, gy2, cutLinePen);
                }
            }
        }
예제 #17
0
 public override void Draw(TSource subject, Rectangle destination, Rectangle?source  = null, DrawInfo info = default(DrawInfo)) => base.Draw(subject, Convert(destination), source, info);
예제 #18
0
        protected virtual void DrawSprite(int count)
        {
            int   texId   = BlockInfo.textures[curBlock * Side.Sides + Side.Right];
            int   i       = texId / elementsPerAtlas1D;
            float vOrigin = (texId % elementsPerAtlas1D) * invVerElementSize;

            float       x1 = X + 2.50f / 16, y1 = Y, z1 = Z + 2.5f / 16;
            float       x2 = X + 13.5f / 16, y2 = Y + 1, z2 = Z + 13.5f / 16;
            const float u1 = 0, u2 = 15.99f / 16f;
            float       v1 = vOrigin, v2 = vOrigin + invVerElementSize * 15.99f / 16f;

            byte offsetType = BlockInfo.SpriteOffset[curBlock];

            if (offsetType >= 6 && offsetType <= 7)
            {
                spriteRng.SetSeed((X + 1217 * Z) & 0x7fffffff);
                float valX = spriteRng.Next(-3, 3 + 1) / 16.0f;
                float valY = spriteRng.Next(0, 3 + 1) / 16.0f;
                float valZ = spriteRng.Next(-3, 3 + 1) / 16.0f;

                const float stretch = 1.7f / 16.0f;
                x1 += valX - stretch; x2 += valX + stretch;
                z1 += valZ - stretch; z2 += valZ + stretch;
                if (offsetType == 7)
                {
                    y1 -= valY; y2 -= valY;
                }
            }

            DrawInfo part = normalParts[i];
            int      col  = fullBright ? FastColour.WhitePacked : light.LightCol_Sprite_Fast(X, Y, Z);

            if (tinted)
            {
                col = TintBlock(curBlock, col);
            }
            VertexP3fT2fC4b v; v.Colour = col;

            // Draw Z axis
            int index = part.sIndex;

            v.X = x1; v.Y = y1; v.Z = z1; v.U = u2; v.V = v2; part.vertices[index + 0] = v;
            v.Y = y2;                     v.V = v1; part.vertices[index + 1] = v;
            v.X = x2;           v.Z = z2; v.U = u1;           part.vertices[index + 2] = v;
            v.Y = y1;                     v.V = v2; part.vertices[index + 3] = v;

            // Draw Z axis mirrored
            index += part.sAdvance;
            v.X    = x2; v.Y = y1; v.Z = z2; v.U = u2;           part.vertices[index + 0] = v;
            v.Y    = y2;                     v.V = v1; part.vertices[index + 1] = v;
            v.X    = x1;           v.Z = z1; v.U = u1;           part.vertices[index + 2] = v;
            v.Y    = y1;                     v.V = v2; part.vertices[index + 3] = v;

            // Draw X axis
            index += part.sAdvance;
            v.X    = x1; v.Y = y1; v.Z = z2; v.U = u2;           part.vertices[index + 0] = v;
            v.Y    = y2;                     v.V = v1; part.vertices[index + 1] = v;
            v.X    = x2;           v.Z = z1; v.U = u1;           part.vertices[index + 2] = v;
            v.Y    = y1;                     v.V = v2; part.vertices[index + 3] = v;

            // Draw X axis mirrored
            index += part.sAdvance;
            v.X    = x2; v.Y = y1; v.Z = z1; v.U = u2;           part.vertices[index + 0] = v;
            v.Y    = y2;                     v.V = v1; part.vertices[index + 1] = v;
            v.X    = x1;           v.Z = z2; v.U = u1;           part.vertices[index + 2] = v;
            v.Y    = y1;                     v.V = v2; part.vertices[index + 3] = v;

            part.sIndex += 4;
        }
예제 #19
0
 public override void FillRect(Rectangle rectangle, DrawInfo info) => base.FillRect(Convert(rectangle), info);
예제 #20
0
 public void StartDraw(int x, int y)
 {
     drawInfo = new DrawInfo(bitmap, x,y,50,50, 0f,0f,0f);
     Base.drawInfos.Add(drawInfo);
 }
        void TerrainAtlasChanged( object sender, EventArgs e )
        {
            int newArraysCount = game.TerrainAtlas1D.TexIds.Length;
            if( arraysCount == newArraysCount ) return;
            arraysCount = newArraysCount;
            Array.Resize( ref drawInfoNormal, arraysCount );
            Array.Resize( ref drawInfoTranslucent, arraysCount );

            for( int i = 0; i < drawInfoNormal.Length; i++ ) {
                if( drawInfoNormal[i] != null ) continue;
                drawInfoNormal[i] = new DrawInfo();
                drawInfoTranslucent[i] = new DrawInfo();
            }
        }
예제 #22
0
		public override void DrawGUIControls( DrawInfo drawInfo )
		{
			//base.DrawGUIControls( drawInfo ):
		}
예제 #23
0
		public override void OnNodeLogicUpdate( DrawInfo drawInfo )
		{
			base.OnNodeLogicUpdate( drawInfo ):
			UpdateLocalVar():
		}
예제 #24
0
 public unsafe void SetPosition(ref DrawInfo newPosition, in ReadOnlySpan <float> data)
예제 #25
0
 public void StartDraw()
 {
     drawInfo = new DrawInfo(bitmap, StartPositionX, StartPositionY, vehicleSizeX, vehicleSizeY, 0f,0f,0f);
     Base.drawInfos.Add(drawInfo);
 }
예제 #26
0
		public override void Draw( DrawInfo drawInfo )
		{
			base.Draw( drawInfo ):

			if( m_isEditingPicker && m_drawPicker )
			{
				Rect hitRect = m_previewRect:
				hitRect.height = 14 * drawInfo.InvertedZoom:
				hitRect.y = m_previewRect.yMax - hitRect.height:
				hitRect.width = 4 * 14 * drawInfo.InvertedZoom:

				bool restoreMouse = false:
				if( Event.current.type == EventType.MouseDown && hitRect.Contains( drawInfo.MousePosition ) )
				{
					restoreMouse = true:
					Event.current.type = EventType.Ignore:
				}

				EditorGUI.BeginChangeCheck():
				m_colorBuffer = GUI.color:
				GUI.color = Color.clear:
				if( m_materialMode )
					m_materialTextureArray = EditorGUIObjectField( m_previewRect, m_materialTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray:
				else
					m_defaultTextureArray = EditorGUIObjectField( m_previewRect, m_defaultTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray:
				GUI.color = m_colorBuffer:

				if( EditorGUI.EndChangeCheck() )
				{
					CheckTextureImporter( true ):
					SetTitleText( PropertyInspectorName ):
					SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ):
					ConfigureInputPorts():
					ConfigureOutputPorts():
					BeginDelayedDirtyProperty():
					m_requireMaterialUpdate = true:
				}

				if( restoreMouse )
				{
					Event.current.type = EventType.MouseDown:
				}

				if( ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) )
					DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ):
			}

			if( drawInfo.CurrentEventType != EventType.Repaint )
				return:

			switch( m_state )
			{
				default:
				case ReferenceState.Self:
				if( drawInfo.CurrentEventType == EventType.Repaint )
				{
					m_drawPreview = false:
					m_drawPicker = true:

					DrawTexturePicker( drawInfo ):
				}
				break:
				case ReferenceState.Connected:
				if( drawInfo.CurrentEventType == EventType.Repaint )
				{
					m_drawPreview = true:
					m_drawPicker = false:

					if( m_previewTextProp != null )
					{
						SetTitleTextOnCallback( m_previewTextProp.TitleContent.text, ( instance, newTitle ) => instance.TitleContent.text = newTitle + " (Input)" ):
						SetAdditonalTitleText( m_previewTextProp.AdditonalTitleContent.text ):
					}

					// Draw chain lock
					GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ):

					// Draw frame around preview
					GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ):
				}
				break:
				case ReferenceState.Instance:
				{
					m_drawPreview = true:
					m_drawPicker = false:

					if( m_referenceSampler != null )
					{
						SetTitleTextOnCallback( m_referenceSampler.PreviewTextProp.TitleContent.text, ( instance, newTitle ) => instance.TitleContent.text = newTitle + Constants.InstancePostfixStr ):
						SetAdditonalTitleText( m_referenceSampler.PreviewTextProp.AdditonalTitleContent.text ):
					}

					// Draw chain lock
					GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ):

					// Draw frame around preview
					GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ):
				}
				break:
			}
		}
        void PreStretchTiles( int x1, int y1, int z1 )
        {
            invVerElementSize = game.TerrainAtlas1D.invElementSize;
            arraysCount = game.TerrainAtlas1D.TexIds.Length;
            atlas = game.TerrainAtlas1D;

            if( drawInfoNormal == null ) {
                drawInfoNormal = new DrawInfo[arraysCount];
                drawInfoTranslucent = new DrawInfo[arraysCount];
                for( int i = 0; i < drawInfoNormal.Length; i++ ) {
                    drawInfoNormal[i] = new DrawInfo();
                    drawInfoTranslucent[i] = new DrawInfo();
                }
            } else {
                for( int i = 0; i < drawInfoNormal.Length; i++ ) {
                    drawInfoNormal[i].ResetState();
                    drawInfoTranslucent[i].ResetState();
                }
            }
        }
예제 #28
0
		public override void Draw( DrawInfo drawInfo )
		{
			base.Draw( drawInfo ):

			if( !m_isVisible )
				return:

			if( m_isEditingFields && m_currentParameterType != PropertyType.Global)
			{
				EditorGUI.BeginChangeCheck():
				for( int i = 0: i < 3: i++ )
				{
					m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom:
					if( m_materialMode && m_currentParameterType != PropertyType.Constant )
					{
						float val = m_materialValue[ i ]:
						UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ):
						m_materialValue[ i ] = val:
					}
					else
					{
						float val = m_defaultValue[ i ]:
						UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ):
						m_defaultValue[ i ] = val:
					}
				}
				if( EditorGUI.EndChangeCheck() )
				{
					m_requireMaterialUpdate = m_materialMode:
					BeginDelayedDirtyProperty():
				}
			}
			else if( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 )
			{
				bool guiEnabled = GUI.enabled:
				GUI.enabled = m_currentParameterType != PropertyType.Global:

				for( int i = 0: i < 3: i++ )
				{
					m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom:

					Rect fakeField = m_propertyDrawPos:
					fakeField.xMin += LabelWidth * drawInfo.InvertedZoom:
					if( GUI.enabled )
					{
						Rect fakeLabel = m_propertyDrawPos:
						fakeLabel.xMax = fakeField.xMin:
						EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ):
						EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ):
					}

					if( m_materialMode && m_currentParameterType != PropertyType.Constant )
					{
						if( m_previousValue[ i ] != m_materialValue[ i ] )
						{
							m_previousValue[ i ] = m_materialValue[ i ]:
							m_fieldText[ i ] = m_materialValue[ i ].ToString():
						}
					}
					else
					{
						if( m_previousValue[ i ] != m_defaultValue[ i ] )
						{
							m_previousValue[ i ] = m_defaultValue[ i ]:
							m_fieldText[ i ] = m_defaultValue[ i ].ToString():
						}
					}

					GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ):
				}
				GUI.enabled = guiEnabled:
			}
		}
 void TerrainAtlasChanged( object sender, EventArgs e )
 {
     int newArraysCount = game.TerrainAtlas1D.TexIds.Length;
     if( arraysCount > 0 && arraysCount != newArraysCount ) {
         Array.Resize( ref drawInfoNormal, newArraysCount );
         Array.Resize( ref drawInfoTranslucent, newArraysCount );
         for( int i = arraysCount; i < drawInfoNormal.Length; i++ ) {
             drawInfoNormal[i] = new DrawInfo();
             drawInfoTranslucent[i] = new DrawInfo();
         }
     }
     arraysCount = newArraysCount;
 }
예제 #30
0
 public bool Equals(DrawInfo other)
 {
     return(ReferenceEquals(Texture, other.Texture));
 }
예제 #31
0
 public BatchInfo(DrawInfo drawInfo, int startindex, int indexCount)
 {
     DrawInfo   = drawInfo;
     Startindex = startindex;
     IndexCount = indexCount;
 }
예제 #32
0
        protected override void RenderTile(int index)
        {
            if (BlockInfo.Draw[curBlock] == DrawType.Sprite)
            {
                this.fullBright = BlockInfo.FullBright[curBlock];
                this.tinted     = BlockInfo.Tinted[curBlock];
                int count = counts[index + Side.Top];
                if (count != 0)
                {
                    DrawSprite(count);
                }
                return;
            }

            int leftCount = counts[index++], rightCount = counts[index++],
                frontCount = counts[index++], backCount = counts[index++],
                bottomCount = counts[index++], topCount = counts[index++];

            if (leftCount == 0 && rightCount == 0 && frontCount == 0 &&
                backCount == 0 && bottomCount == 0 && topCount == 0)
            {
                return;
            }

            bool fullBright    = BlockInfo.FullBright[curBlock];
            bool isTranslucent = BlockInfo.Draw[curBlock] == DrawType.Translucent;
            int  lightFlags    = BlockInfo.LightOffset[curBlock];

            drawer.minBB = BlockInfo.MinBB[curBlock]; drawer.minBB.Y = 1 - drawer.minBB.Y;
            drawer.maxBB = BlockInfo.MaxBB[curBlock]; drawer.maxBB.Y = 1 - drawer.maxBB.Y;

            Vector3 min = BlockInfo.RenderMinBB[curBlock], max = BlockInfo.RenderMaxBB[curBlock];

            drawer.x1 = X + min.X; drawer.y1 = Y + min.Y; drawer.z1 = Z + min.Z;
            drawer.x2 = X + max.X; drawer.y2 = Y + max.Y; drawer.z2 = Z + max.Z;

            drawer.Tinted     = BlockInfo.Tinted[curBlock];
            drawer.TintColour = BlockInfo.FogColour[curBlock];

            if (leftCount != 0)
            {
                int texLoc = BlockInfo.textures[curBlock * Side.Sides + Side.Left];
                int i      = texLoc / elementsPerAtlas1D;
                int offset = (lightFlags >> Side.Left) & 1;

                DrawInfo part = isTranslucent ? translucentParts[i] : normalParts[i];
                int      col  = fullBright ? FastColour.WhitePacked :
                                X >= offset?light.LightCol_XSide_Fast(X - offset, Y, Z) : light.OutsideXSide;

                drawer.Left(leftCount, col, texLoc, part.vertices, ref part.vIndex[Side.Left]);
            }

            if (rightCount != 0)
            {
                int texLoc = BlockInfo.textures[curBlock * Side.Sides + Side.Right];
                int i      = texLoc / elementsPerAtlas1D;
                int offset = (lightFlags >> Side.Right) & 1;

                DrawInfo part = isTranslucent ? translucentParts[i] : normalParts[i];
                int      col  = fullBright ? FastColour.WhitePacked :
                                X <= (maxX - offset) ? light.LightCol_XSide_Fast(X + offset, Y, Z) : light.OutsideXSide;
                drawer.Right(rightCount, col, texLoc, part.vertices, ref part.vIndex[Side.Right]);
            }

            if (frontCount != 0)
            {
                int texLoc = BlockInfo.textures[curBlock * Side.Sides + Side.Front];
                int i      = texLoc / elementsPerAtlas1D;
                int offset = (lightFlags >> Side.Front) & 1;

                DrawInfo part = isTranslucent ? translucentParts[i] : normalParts[i];
                int      col  = fullBright ? FastColour.WhitePacked :
                                Z >= offset?light.LightCol_ZSide_Fast(X, Y, Z - offset) : light.OutsideZSide;

                drawer.Front(frontCount, col, texLoc, part.vertices, ref part.vIndex[Side.Front]);
            }

            if (backCount != 0)
            {
                int texLoc = BlockInfo.textures[curBlock * Side.Sides + Side.Back];
                int i      = texLoc / elementsPerAtlas1D;
                int offset = (lightFlags >> Side.Back) & 1;

                DrawInfo part = isTranslucent ? translucentParts[i] : normalParts[i];
                int      col  = fullBright ? FastColour.WhitePacked :
                                Z <= (maxZ - offset) ? light.LightCol_ZSide_Fast(X, Y, Z + offset) : light.OutsideZSide;
                drawer.Back(backCount, col, texLoc, part.vertices, ref part.vIndex[Side.Back]);
            }

            if (bottomCount != 0)
            {
                int texLoc = BlockInfo.textures[curBlock * Side.Sides + Side.Bottom];
                int i      = texLoc / elementsPerAtlas1D;
                int offset = (lightFlags >> Side.Bottom) & 1;

                DrawInfo part = isTranslucent ? translucentParts[i] : normalParts[i];
                int      col  = fullBright ? FastColour.WhitePacked : light.LightCol_YBottom_Fast(X, Y - offset, Z);
                drawer.Bottom(bottomCount, col, texLoc, part.vertices, ref part.vIndex[Side.Bottom]);
            }

            if (topCount != 0)
            {
                int texLoc = BlockInfo.textures[curBlock * Side.Sides + Side.Top];
                int i      = texLoc / elementsPerAtlas1D;
                int offset = (lightFlags >> Side.Top) & 1;

                DrawInfo part = isTranslucent ? translucentParts[i] : normalParts[i];
                int      col  = fullBright ? FastColour.WhitePacked : light.LightCol_YTop_Fast(X, (Y + 1) - offset, Z);
                drawer.Top(topCount, col, texLoc, part.vertices, ref part.vIndex[Side.Top]);
            }
        }
예제 #33
0
        private void InternalDrawNode(DrawNode node)
        {
            node.WorldPosition = _transform.Position + node.Position;
            node.ScreenPosition = node.WorldPosition - _layerCamPosition;

            if (node.Visible)
                node.Draw(this);
            else
                return;

            if (node.ChildrenCount == 0)
                return;

            var startTransform = _transform;
            _transform.Position += node.Position;

            if (node.Cascade)
            {
                _transform.Alpha *= node.Alpha;
                _transform.Color *= node.Color.ToVector3();
                _transform.Rotation += node.Rotation;
                _transform.Scale *= node.Scale;
            }

            foreach (var child in node.Children)
                InternalDrawNode(child);

            _transform = startTransform;
        }
        private void DrawTree(List <ChildElement> childElements, DrawInfo parentDrawInfo, Logic.DrawManager drawManager)
        {
            DrawInfo childDrawInfo = new DrawInfo();

            foreach (var child in childElements)
            {
                if (child.AttachedSide == AttachedSides.left || child.AttachedSide == AttachedSides.rigth)
                {
                    childDrawInfo.Heigth = parentDrawInfo.Heigth;
                    childDrawInfo.Width  = child.Width;
                }
                else
                {
                    childDrawInfo.Heigth = child.Height;
                    childDrawInfo.Width  = child.Width;
                }
                switch (child.AttachedSide)
                {
                case AttachedSides.rigth:
                {
                    childDrawInfo.X = parentDrawInfo.X + parentDrawInfo.Width;
                    childDrawInfo.Y = parentDrawInfo.Y + (parentDrawInfo.Heigth - childDrawInfo.Heigth) / 2;
                    break;
                }

                case AttachedSides.left:
                {
                    childDrawInfo.X = parentDrawInfo.X - childDrawInfo.Width;
                    childDrawInfo.Y = parentDrawInfo.Y + (parentDrawInfo.Heigth - childDrawInfo.Heigth) / 2;
                    break;
                }

                case AttachedSides.top:
                {
                    childDrawInfo.X = parentDrawInfo.X + (parentDrawInfo.Width - childDrawInfo.Width) / 2;
                    childDrawInfo.Y = parentDrawInfo.Y - childDrawInfo.Heigth;
                    break;
                }

                case AttachedSides.bottom:
                {
                    childDrawInfo.X = parentDrawInfo.X + (parentDrawInfo.Width - childDrawInfo.Width) / 2;
                    childDrawInfo.Y = parentDrawInfo.Y + parentDrawInfo.Heigth;
                    break;
                }
                }

                //MessageBox.Show("wef");
                drawManager.DrawRectangle(childDrawInfo.Heigth, childDrawInfo.Width, childDrawInfo.X, childDrawInfo.Y, _drawParent);


                if (child.Childrens != null)
                {
                    DrawTree(child.Childrens, new DrawInfo()
                    {
                        Width  = childDrawInfo.Width,
                        Heigth = childDrawInfo.Heigth,
                        X      = childDrawInfo.X,
                        Y      = childDrawInfo.Y
                    }
                             , drawManager);
                }
            }
        }