예제 #1
0
 private void UF_UpdateUnLockDebugger()
 {
     if (IsActive)
     {
         return;
     }
     if (DeviceInput.UF_Down(0))
     {
         if (mPassIdx >= UnlockPassSqueue.Length)
         {
             IsActive = true;
             mPassIdx = 0;
             return;
         }
         else
         {
             int side = UF_ClickSideType(DeviceInput.UF_DownPosition(0));
             if (side == UnlockPassSqueue[mPassIdx])
             {
                 mPassIdx++;
             }
             else
             {
                 mPassIdx = 0;
             }
         }
     }
 }
예제 #2
0
        public void OnPointerUp(PointerEventData eventData)
        {
            if (!this.enabled)
            {
                return;
            }
            if (DeviceInput.UF_Up(0))
            {
                //Vector2 anchoredPosition = this.rectTransform.anchoredPosition;
                if (autoBack)
                {
                    if (smoothBack <= 0)
                    {
                        this.transform.localPosition = m_SourceLPosition;
                    }
                    else
                    {
                        FrameHandle.UF_AddCoroutine(UF_ISmoothBack(this.transform.localPosition, m_SourceLPosition, smoothBack));
                    }
                }

                m_IsDragging = canDrag && false;

                //判断Group中的碰撞
                if (m_DragGroup != null)
                {
                    m_DragGroup.UF_UpdateCollision(this, eventData);
                }

                if (!string.IsNullOrEmpty(ePressUp))
                {
                    MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_UI_OPERA, ePressUp, eParam, this);
                }
            }
        }
예제 #3
0
        private Vector3 UF_GetPressPosition()
        {
            Vector3 pos = UIManager.UICamera.ScreenToWorldPoint(DeviceInput.UF_PressPosition(0));

            pos.z = this.transform.position.z;
            return(pos);
        }
예제 #4
0
        private void UpdateInput()
        {
            if (maskGraphicTrigger && DeviceInput.UF_Press(0))
            {
                if (uiCamera == null)
                {
                    return;
                }
                //停止复位
                m_IsResumePoint = false;

                if (!m_IsPress)
                {
                    m_SourceDragPos = DeviceInput.UF_DownPosition(0);
                    joyRoot.gameObject.transform.position = uiCamera.ScreenToWorldPoint(m_SourceDragPos);
                    m_IsPress = true;
                    UF_CallDelegateEvent(m_EventJoyPressDown);
                    UF_CallUnityEvent(m_UEventPressDown);
                }
                if (m_IsPress)
                {
                    m_TargetDragPos = DeviceInput.UF_PressPosition(0);
                    float dist   = Vector3.Distance(m_SourceDragPos, m_TargetDragPos);
                    float limitV = limtPointDistance * Screen.width / UIManager.FixedWidth;

                    if (dist > limitV)
                    {
                        m_TargetDragPos = m_SourceDragPos + (m_TargetDragPos - m_SourceDragPos).normalized * limitV;
                    }
                    if (joyPoint != null)
                    {
                        joyPoint.gameObject.transform.position = uiCamera.ScreenToWorldPoint(m_TargetDragPos);
                    }
//					float angle = 0;
                    Vector3 _moveVector = MathX.UF_Foward(m_SourceDragPos, m_TargetDragPos);
                    if (dist > deadZoom)
                    {
                        m_MoveForward = new Vector3(_moveVector.x, gravity, _moveVector.y).normalized;
                        UF_CallDelegateEvent(m_EventJoyPressMove);
                        UF_UpdateRotate(m_MoveForward);
                    }
                }
            }
            else
            {
                if (m_IsPress)
                {
                    m_IsPress = false;
                    UF_ResumePoint(); UF_UpdateRevertRoot();
                    UF_CallDelegateEvent(m_EventJoyPressUp);
                    UF_CallUnityEvent(m_UEventPressUp);
                }
            }
        }
예제 #5
0
 void Update()
 {
     if (m_UseDragRotate && m_IsDrag)
     {
         m_RotateAngle -= DeviceInput.UF_HorizontalDelta(0) * m_SpeedRotate;
         if (m_Preview != null)
         {
             m_Preview.UF_SetEuler(new Vector3(0, m_RotateAngle, 0));
         }
     }
 }
예제 #6
0
        // Update is called once per frame
        public void UF_OnUpdate()
        {
            if (!IsActive)
            {
                return;
            }
            if (m_IsPress && UsePress)
            {
                m_CurrentPressTime += GTime.RunDeltaTime;
                if (m_CurrentPressTime >= PressInterval)
                {
                    m_CurrentPressTime = 0;
                    RaycastHit hit;
                    Camera     camera = Camera.main;
                    if (camera != null && !IsUIRayCast() && Physics.Raycast(camera.ScreenPointToRay(DeviceInput.UF_PressPosition(0)), out hit, Distance))
                    {
                        MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_LUA, DefineLuaEvent.E_RAYCAST_HIT, hit);
                    }
                }
                if (!DeviceInput.UF_Press(0))
                {
                    m_CurrentPressTime = 0;
                }
            }
            else
            {
                if (DeviceInput.UF_Down(0))
                {
                    RaycastHit hit;
                    Camera     camera = Camera.main;
                    if (camera != null && !IsUIRayCast() && Physics.Raycast(camera.ScreenPointToRay(DeviceInput.UF_PressPosition(0)), out hit, Distance))
                    {
                        if (UsePress)
                        {
                            m_IsPress          = true;
                            m_CurrentPressTime = 0;
                        }
                        MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_LUA, DefineLuaEvent.E_RAYCAST_HIT, hit);
                    }
                }
            }

            if (!DeviceInput.UF_Press())
            {
                m_IsPress = false;
            }
        }
예제 #7
0
        void Update()
        {
            if (!m_BeginDraw)
            {
                return;
            }

            UF_updatePenPressure();

            Vector3 clickPoint = DeviceInput.UF_PressPosition(0);
            Vector2 pos;

            if (RectTransformUtility.ScreenPointToLocalPointInRectangle(this.rectTransform, clickPoint, canvas.worldCamera, out pos))
            {
                m_CurPoint = pos;
                if (m_NewBegin)
                {
                    m_LastPoint = m_CurPoint;
                    m_NewBegin  = false;
                }
                if (m_CurPoint != m_LastPoint)
                {
                    UF_DrawCircle((int)pos.x, (int)pos.y, m_CurPenSize, penColor, false);
                    //点插值补偿
                    float distance = Vector2.Distance(m_CurPoint, m_LastPoint);
                    float hfPSize  = m_CurPenSize / 2;
                    if (((int)distance) > hfPSize)
                    {
                        int     count   = (int)(distance / hfPSize + 1);
                        Vector2 current = Vector2.zero;
                        float   p       = 0;
                        for (int k = 0; k < count; k++)
                        {
                            p         = (float)k / (float)count;
                            current.x = m_LastPoint.x * p + m_CurPoint.x * (1 - p);
                            current.y = m_LastPoint.y * p + m_CurPoint.y * (1 - p);

                            UF_DrawCircle((int)current.x, (int)current.y, m_CurPenSize, penColor, false);
                        }
                    }
                    this.UF_Apply();
                    m_LastPoint = m_CurPoint;
                }
            }
        }
예제 #8
0
        private void UF_OnInputDown()
        {
            Ray ray = UIManager.UICamera.ScreenPointToRay(DeviceInput.UF_DownPosition(0));

            if (Physics.Raycast(ray, out m_RayHit, 10000))
            {
                if (m_RayHit.collider.gameObject == this.gameObject)
                {
                    m_IsDrag        = true;
                    m_LastClickTime = System.Environment.TickCount;
                    m_SoundAngle    = gameObject.transform.localEulerAngles.y;

                    if (useClickAnimate)
                    {
                        UF_PlayAnimation(presetAnimation);
                    }
                }
            }
        }
예제 #9
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (!this.enabled)
     {
         return;
     }
     if (DeviceInput.UF_Down(0))
     {
         m_SourceLPosition = this.transform.localPosition;
         m_IsDragging      = canDrag && true;
         if (!centerAligned)
         {
             m_AlignedDPos = this.transform.position - UF_GetPressPosition();
         }
         if (!string.IsNullOrEmpty(ePressDown))
         {
             MessageSystem.UF_GetInstance().UF_Send(DefineEvent.E_UI_OPERA, ePressDown, eParam, this);
         }
     }
 }
예제 #10
0
        private void UF_UpdateRotate()
        {
            if (useDragRotate)
            {
                if (!m_IsDrag)
                {
                    if (DeviceInput.UF_Down(0))
                    {
                        UF_OnInputDown();
                    }
                }
                else
                {
                    if (DeviceInput.UF_Up(0))
                    {
                        UF_OnInputUp();
                        return;
                    }

                    m_SoundAngle -= DeviceInput.UF_HorizontalDelta(0) * speedRotate;
                    gameObject.transform.localEulerAngles = new Vector3(gameObject.transform.localEulerAngles.x, m_SoundAngle, gameObject.transform.eulerAngles.z);
                }
            }
        }