Fill() public static method

矩形塗りつぶし
public static Fill ( Rect rect, Color color ) : void
rect UnityEngine.Rect
color UnityEngine.Color
return void
示例#1
0
        /// <summary>
        /// カーソル
        /// </summary>
        void DrawMouseCorsor()
        {
            // マウス位置
            Color col = new Color(1, 1, 1, 0.2f);

            GUIHelper.Fill(mouseData.rect, col);
        }
示例#2
0
        /// <summary>
        ///  ウィンドウ描画
        /// </summary>
        void OnGUI()
        {
            // 更新
            Color colorBackup = GUI.color;

            if (Event.current.type != EventType.Layout &&
                Event.current.type != EventType.Repaint)
            {
                ClearMouse();

                colorBackup = GUI.color;

                // マウス更新
                UpdateMouse();

                this.controls.ForEach(control => {
                    if (!control.bInit)
                    {
                        control.OnInit();
                        control.bInit = true;
                    }
                    control.OnUpdate();
                }
                                      );

                OnUpdate();

                GUI.color = colorBackup;
            }

            // ライン描画とか
            colorBackup = GUI.color;
            if (Event.current.type != EventType.Layout ||
                Event.current.type != EventType.Repaint)
            {
                GUIHelper.Fill(windowRect, bgColor);

                this.controls.ForEach(control => control.OnPaint());

                OnPaint();
            }
            GUI.color = colorBackup;



            DrawFPS();



            // ボタンとか
            BeginWindows();
            colorBackup = GUI.color;
            this.controls.ForEach(control => control.OnDrawGUI());
            GUI.color = colorBackup;
            EndWindows();

            OnDrawGUI();
        }
示例#3
0
        /// <summary>
        /// コネクトボックス表示
        /// </summary>
        void DrawConnect()
        {
            connectBoxList.ForEach(box => {
                GUIHelper.Fill(box.boxRect, box.color);

                //Drawing.Circle(box.boxRect, box.color);
                //GUIHelper.DrawCircle(box.boxRect.center,1.0f,box.color);
            }
                                   );
        }
示例#4
0
        /// <summary>
        ///  ウィンドウ描画
        /// </summary>
        protected override void OnPaint()
        {
            // ノード描画(ラインとか)
            //this.nodeList.ForEach(node => node.OnPaint());



            // 範囲選択描画
            GUIHelper.Fill(m_SelectedArea, new Color(0.5f, 0.5f, 0.5f, 0.5f));
            Rect pos = m_SelectedArea;

            GUIHelper.DrawRect(pos, Color.white, 2);
            //DrawConnect();
            // 簡易図表示
            if (mouseData.IsDrag(MouseButton.Middle))
            {
                float scale = 0.3f;
                float cx    = position.width / 2 - (position.width * scale) / 2;
                float cy    = position.height / 2 - (position.height * scale) / 2;
                foreach (var node in nodeList)
                {
                    Rect r = node.windowRect;

                    r.x      *= scale;
                    r.x      += cx;
                    r.y      *= scale;
                    r.y      += cy;
                    r.width  *= scale;
                    r.height *= scale;
                    GUIHelper.DrawRect(r, Color.red);
                }

                Vector2 winpos = Grid.GridZoomCenterPoint;
                winpos.x = cx;
                winpos.y = cy;
                Rect window = new Rect(winpos, new Vector2(position.width * scale, position.height * scale));
                GUIHelper.DrawRect(window, Color.white);
            }
        }
示例#5
0
        /// <summary>
        /// カーブ描画
        /// </summary>
        /// <param name="start"></param>
        /// <param name="end"></param>
        void DrawNodeCurve(ConnectBox start, ConnectBox end)
        {
            /*
             * Vector3 startPos = new Vector3(start.x + start.width, start.y + start.height / 2, 0);
             * Vector3 endPos = new Vector3(end.x, end.y + end.height / 2, 0);
             * Vector3 startTan = startPos + Vector3.right * 50;
             * Vector3 endTan = endPos + Vector3.left * 50;
             *
             * Handles.DrawBezier(startPos, endPos, startTan, endTan, Color.black, null, 1);
             */

            // x成分
            Vector2   vecX    = (end.boxRect.center - start.boxRect.center);
            const int tanMaxX = 800;
            const int tanMaxY = 300;

            vecX.y = Mathf.Abs(vecX.y);
            //if (startInd == endInd) vecX.y = tanMaxY - vecX.y;
            float lengthX = ((tanMaxX - Mathf.Clamp(vecX.x, 0, tanMaxX)) / 5) * Mathf.Clamp(vecX.y, 0, tanMaxY) / tanMaxY;



            // y成分
            //Vector2 vecY = (end.center - start.center);
            //vecY.x = 0.0f;
            //float lengthY = (tanMax - Mathf.Clamp(vecX.magnitude, 0, tanMax)) / 5;


            //Debug.Log(length.ToString());



            var   startPos = new Vector2(start.boxRect.center.x, start.boxRect.center.y);
            float x1       = start.connectArea == ConnectAreaType.AREA_RIGHT ? start.boxRect.x + lengthX : start.boxRect.x - lengthX;
            float y1       = start.boxRect.y;
            var   startTan = new Vector3(x1, y1, 0f);


            var   endPos = new Vector2(end.boxRect.center.x, end.boxRect.center.y);
            float x2     = end.connectArea == ConnectAreaType.AREA_RIGHT ? endPos.x + lengthX : endPos.x - lengthX;
            float y2     = endPos.y;
            var   endTan = new Vector3(x2, y2, 0f);



            Color shadowCol = new Color(0, 0, 0.3f, 0.06f);

            if (start.active)
            {
                shadowCol.b = 0.8f; shadowCol.g = 0.4f; shadowCol.a = 0.2f;
            }
            if (end.active)
            {
                shadowCol.b = 0.8f; shadowCol.g = 0.4f; shadowCol.a = 0.2f;
            }
            if (start.error)
            {
                shadowCol.b = 0.2f; shadowCol.g = 0.2f; shadowCol.r = 1.0f; shadowCol.a = 0.2f;
            }
            if (end.error)
            {
                shadowCol.b = 0.2f; shadowCol.g = 0.2f; shadowCol.r = 1.0f; shadowCol.a = 0.2f;
            }


            for (int i = 0; i < 3; i++)             // Draw a shadow
            {
                Handles.DrawBezier(startPos, endPos, startTan, endTan, shadowCol, null, (i + 1) * 5);
            }

            Handles.DrawBezier(startPos, endPos, startTan, endTan, Color.gray, null, 3f);

            // 接続先
            GUIHelper.Fill(new Rect(endPos - new Vector2(3, 3), new Vector2(6, 6)), Color.gray);
        }