Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        /// <summary>
        /// sets the lines for this renderer
        /// </summary>
        /// <param name="lines"></param>
        internal void SetLines(List <LineSegement> lines)
        {
            //    mUseCache = false;
            mLines   = lines;
            mMinX    = float.PositiveInfinity;
            mMinY    = float.PositiveInfinity;
            mMaxX    = float.NegativeInfinity;
            mMaxY    = float.NegativeInfinity;
            mControl = GetComponentInParent <SensitivityControl>();

            if (mLines != null)
            {
                for (int i = 0; i < mLines.Count; i++)
                {
                    LineSegement seg         = mLines[i];
                    int          totalPoints = seg.PointCount;
                    for (int j = 0; j < totalPoints; j++)
                    {
                        Vector3 point = seg.getPoint(j);
                        mMinX = Mathf.Min(mMinX, point.x);
                        mMinY = Mathf.Min(mMinY, point.y);
                        mMaxX = Mathf.Max(mMaxX, point.x);
                        mMaxY = Mathf.Max(mMaxY, point.y);
                    }
                }
            }

            SetAllDirty();
            mIsMouseIn = false;
            for (int i = 0; i < mHoverObjectes.Count; i++)
            {
                mHoverObjectes[i].gameObject.SetActive(false);
                mHoverFreeObjects.Add(mHoverObjectes[i]);
            }
            mHoverObjectes.Clear();

            if (mCurrentHover != null)
            {
                mCurrentHover.gameObject.SetActive(false);
                mHoverFreeObjects.Add(mCurrentHover);
                mCurrentHover = null;
            }
            mPickedI = mPickedJ = -1;
            Rebuild(CanvasUpdate.PreRender);
        }
Ejemplo n.º 2
0
        internal void ModifyLines(List <Vector4> lines)
        {
            //mUseCache = false;
            if (mLines.Count == 0)
            {
                mLines.Add(new LineSegement(lines.ToArray()));
                return;
            }
            //bool regenerate = false;
            //if(mLines[0].)
            mLines[0].ModifiyLines(lines);
            mMinX    = float.PositiveInfinity;
            mMinY    = float.PositiveInfinity;
            mMaxX    = float.NegativeInfinity;
            mMaxY    = float.NegativeInfinity;
            mControl = GetComponentInParent <SensitivityControl>();

            if (mLines != null)
            {
                for (int i = 0; i < mLines.Count; i++)
                {
                    LineSegement seg         = mLines[i];
                    int          totalPoints = seg.PointCount;
                    for (int j = 0; j < totalPoints; j++)
                    {
                        Vector3 point = seg.getPoint(j);
                        mMinX = Mathf.Min(mMinX, point.x);
                        mMinY = Mathf.Min(mMinY, point.y);
                        mMaxX = Mathf.Max(mMaxX, point.x);
                        mMaxY = Mathf.Max(mMaxY, point.y);
                    }
                }
                //   lines.Add()
            }
            SetVerticesDirty();
            Rebuild(CanvasUpdate.PostLayout);
            mForceMouseMove = true;
        }