void Awake() { rt = GetComponent <RectTransform> (); duration = LauncherController.ANIM_DURATION; pageLayout = GetComponent <PageLayout> (); mPageController = GameObject.FindGameObjectWithTag("PageController").GetComponent <PageController> (); posY = 0f; orginPosition = rt.anchoredPosition3D; mLauncherController = GameObject.FindGameObjectWithTag("GameController").GetComponent <LauncherController> (); mLauncherController.Log(TAG, "CutCardsTween Awake() pageNumber:" + pageLayout.pageNumber + " OrginPosition:" + orginPosition.ToString()); }
public void OnLongClick(PointerEventData lastEventData) { mLauncherController.Log(TAG, "OnLongClick: lastEventData.position=" + lastEventData.position); DestroySelectedBackground(); RectTransform rt = gameObject.GetComponent <RectTransform> (); float posZ = LauncherController.ICON_RISING_DISTANCE; mLauncherController.Log(TAG, "OnLongClick: AnchorPos3D=" + rt.anchoredPosition3D); Vector3 toPos = new Vector3(rt.anchoredPosition3D.x, rt.anchoredPosition3D.y, posZ); Tweener tw = rt.DOAnchorPos3D(toPos, LauncherController.ANIM_DURATION); tw.OnComplete(test); dragMe = gameObject.AddComponent <DragMe> (); dragMe.mLauncherController = mLauncherController; dragMe.launcherModel = mLauncherController.launcherModel; dragMe.OnPointerDown(lastEventData); TrashController trashController = mLauncherController.trashRange.GetComponent <TrashController> (); trashController.Rise(); }
private Vector2 offset; //离物体右下角的距离 #region IPointerDownHandler implementation public void OnPointerDown(PointerEventData eventData) { mLauncherController.Log(TAG, "OnPointerDown eventData.position:" + eventData.position); RectTransform rt = GetComponent <RectTransform> (); float x = eventData.position.x - rt.anchoredPosition.x; float y = eventData.position.y - rt.anchoredPosition.y; offset = new Vector2(x, y); var dragIconParent = FindInParents <PageController>(gameObject); if (dragIconParent == null) { return; } // We have clicked something that can be dragged. // What we want to do is create an icon for this. m_DraggingIcons[eventData.pointerId] = gameObject; m_DraggingIcons[eventData.pointerId].transform.SetParent(dragIconParent.transform, false); m_DraggingIcons[eventData.pointerId].transform.SetAsLastSibling(); }
public void OnDrop(PointerEventData data) { mLauncherController.Log (TAG, "OnDrop"); Fall (); if (controlFlag) { controlFlag = false; GameObject originalObj = mIconDragController.currentDragIcon; IconController iconController = originalObj.GetComponent<IconController> (); iconController.showText (); uninstallApp = iconController.getApp (); AskForUninstall (uninstallApp.packageName); } }
//listener callback #region IPointerDownHandler implementation public void OnPointerDown(PointerEventData eventData) { mLauncherController.Log(TAG, "OnPointerDown"); }
void Log(string tag, string msg) { launcherController.Log(tag, msg); }
void Start(){ mLauncherController = GameObject.FindGameObjectWithTag ("GameController").GetComponent<LauncherController>(); mIconDragController = mLauncherController.iconDragController; mLauncherController.Log (TAG, "Start"); }
public void Reset() { rt.DOAnchorPos3D(orginPosition, LauncherController.ANIM_DURATION); mLauncherController.Log(TAG, "Reset pageNumber:" + pageLayout.pageNumber + " OrginPosition:" + orginPosition + " anchoredPosition3D:" + rt.anchoredPosition3D); linkagePosition = -1; }
//listener callback #region IPointerDownHandler implementation public void OnPointerDown(PointerEventData eventData) { mLauncherController.Log(TAG, "OnPointerDown"); CorrectingUtils.PointerEventCorrecting(ref eventData, -launcherModel.navigationBarHeight); if (!touchInfo.touchable) { mLauncherController.Log(TAG, "OnPointerDown !touchInfo.touchable"); return; } int index = PointToIndex(eventData.position); mLauncherController.Log(TAG, "OnPointerDown PointToIndex index:" + index); App app = mLauncherController.appList [index]; mLauncherController.Log(TAG, "OnPointerDown app:" + app.appName); if (!mIconDragController.IsIconDragMode()) { longClickUtils.OnPointerDown(eventData); touchInfo.pointerDownX = eventData.position.x; touchInfo.pointerDownY = eventData.position.y; if (!app.isPlaceholder) { mLauncherController.Log(TAG, "OnPointerDown showSelected"); showSelected(eventData); } } if (!touchInfo.pageBeginDrag) { // Debug.Log ("OnBeginDrag time:"+Time.time); mLauncherController.Log(TAG, "OnPointerDown:if (!touchInfo.pageBeginDrag) "); touchInfo.beginTime = Time.time; touchInfo.currentTouchPos = eventData.position; touchInfo.beginDragPos = eventData.position; touchInfo.pageBeginDrag = true; touchInfo.pageDragId = eventData.pointerId; } }