当前位置: 首页>>代码示例>>C#>>正文


C# Point2.GetX方法代码示例

本文整理汇总了C#中Point2.GetX方法的典型用法代码示例。如果您正苦于以下问题:C# Point2.GetX方法的具体用法?C# Point2.GetX怎么用?C# Point2.GetX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point2的用法示例。


在下文中一共展示了Point2.GetX方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

    // Update is called once per frame
    protected void Update()
    {
        #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR
        _touches = Input.touches;
        #endif
        if (_gui.GetCurrentMode () == PoolDesignerMode.PolygonEdition)
        {
            _cursor = _planTransformation.GetTransformedMousePosition ();

            // on cherche le point et l'edge qui sont sous le curseur
            FindIntersectedPoint ();
            FindIntersectedEdge ();

        //#if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR
        //            if(Input.touchCount == 1)
        //            {
        //                _firstTouch = _planTransformation.GetTouches()[0];
        //                Touch testouch = _touches[0];
        //
        //            if (!_gui.isOnUI () && _firstTouch.phase == TouchPhase.Began)
        //            {
        //                Debug.Log("---------> firstTouch "+_firstTouch.deltaTime+", "+_firstTouch.position+", "+_firstTouch.deltaPosition+", "+_firstTouch.phase);
        //                Debug.Log("---------> testTouch  "+testouch.deltaTime+", "+testouch.position+", "+testouch.deltaPosition+", "+testouch.phase);
        //#else
          //if UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_EDITOR
            if (!_gui.isOnUI () && _planTransformation.GetClickBegan()/*PC.In.Click1Down()*/ && !_gui.IsOpen())
            {
        //#endif
                if(_gui.IsJustCloseMenu())
                {
                    _gui.setIsJustCloseMenu(false);
                    return;
                }
                if (_selectedPointIndexCandidate >= 0) // selection
                {
                    _selectedPointIndex = _selectedPointIndexCandidate;
                    _selectedPoint = _polygon.GetPoints ()[_selectedPointIndex];

                    if (!_polygon.IsClosed () && _selectedPointIndex == 0 /*&& _polygon.GetPoints ().Count > 2*/)
                    {
                        _polygon.Close ();
                        _selectedPointIndex = _polygon.GetPoints ().IndexOf (_selectedPoint);
                    }

                    _canMove = true;
                }
                else if (_selectedEdgeIndexCandidate >= 0) // insert point
                {
                    _selectedEdgeIndex = _selectedEdgeIndexCandidate;
                    _selectedEdge = _polygon.GetEdges ()[_selectedEdgeIndex];

                    Point2 newPoint = new Point2 (_cursor);
                    newPoint.Set(newPoint.GetX()-_offsetWidth, newPoint.GetY()-_offsetHeight);
                    _polygon.InsertPoint (_selectedEdgeIndex, newPoint);

                    _selectedPointIndex = _polygon.GetPoints ().IndexOf (newPoint);
                    _selectedPoint = newPoint;

                    _canMove = true;
                }

                else if (!_polygon.IsClosed ()) // add point
                {
                    Point2 newPoint = new Point2 (_cursor);
                    newPoint.Set(newPoint.GetX()-_offsetWidth, newPoint.GetY()-_offsetHeight);
                    _polygon.AddPoint (newPoint);

                    _selectedPointIndex = _polygon.GetPoints ().Count - 1;
                    _selectedPoint = newPoint;

                    _canMove = true;

                }
                else // deselection
                {
                    _selectedPointIndex = -1;
                    _selectedPoint = null;

                    _selectedEdgeIndex = -1;
                    _selectedEdge = null;
                }

                if (_selectedPointIndex >= 0) // update radius slider values
                {
                    _pointOffset = (Vector2)_selectedPoint - _cursor;

                    if (_selectedPoint.GetJunction () == JunctionType.Broken)
                    {
                        _gui.SetSliderValues (0, 1);
                    }
                    else if (_selectedPoint.GetJunction () == JunctionType.Curved)
                    {
                        ArchedPoint2 ar = _selectedPoint as ArchedPoint2;
                        _gui.SetSliderValues (ar.GetMeasuredRadius () / 100, ar.GetMaxRadius () / 100);
                    }
                }
            }
        //#if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR
        //            }
//.........这里部分代码省略.........
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:101,代码来源:PolygonDrawer.cs


注:本文中的Point2.GetX方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。