//------------------------------------------------------------------------- InputController() { RenderFingerGesturesGameObject = GameObject.Find("Main Object"); if (RenderFingerGesturesGameObject == null) { Debug.LogError("InputController init error -- Cannot found Main Object GameObject"); } mClientFingerGestures = RenderFingerGesturesGameObject.GetComponent <ClientFingerGestures>(); mClientFingerGestures.onFingerLongPress += (Vector2 fingerPos) => { if (mActiveInput && onFingerLongPress != null) { mCurrentMousePosition = pixel2logicPos(fingerPos); onFingerLongPress(pixel2logicPos(fingerPos)); } }; mClientFingerGestures.onFingerUp += (Vector2 fingerPos) => { if (mActiveInput && onFingerUp != null) { mMouseDown = false; mCurrentMousePosition = pixel2logicPos(fingerPos); onFingerUp(); } }; mClientFingerGestures.onFingerFingerSwipe += OnFingerSwipe; mClientFingerGestures.onFingerDown += onFingerDown; mClientFingerGestures.onFingerDragMove += (Vector2 fingerPos) => { if (!mActiveInput) { return; } mCurrentMousePosition = pixel2logicPos(fingerPos); if (mActiveInput && onFingerDragMove != null) { onFingerDragMove(pixel2logicPos(fingerPos)); } }; mGameCamera = GameObject.Find("tk2dCameraObject").GetComponent <Camera>(); mUICamera = GameObject.Find("UI Camera").GetComponent <Camera>(); }
//------------------------------------------------------------------------- InputController() { RenderFingerGesturesGameObject = GameObject.Find("Main Object"); if (RenderFingerGesturesGameObject == null) { Debug.LogError("InputController init error -- Cannot found Main Object GameObject"); } mClientFingerGestures = RenderFingerGesturesGameObject.GetComponent<ClientFingerGestures>(); mClientFingerGestures.onFingerLongPress += (Vector2 fingerPos) => { if (mActiveInput && onFingerLongPress != null) { mCurrentMousePosition = pixel2logicPos(fingerPos); onFingerLongPress(pixel2logicPos(fingerPos)); } }; mClientFingerGestures.onFingerUp += (Vector2 fingerPos) => { if (mActiveInput && onFingerUp != null) { mMouseDown = false; mCurrentMousePosition = pixel2logicPos(fingerPos); onFingerUp(); } }; mClientFingerGestures.onFingerFingerSwipe += OnFingerSwipe; mClientFingerGestures.onFingerDown += onFingerDown; mClientFingerGestures.onFingerDragMove += (Vector2 fingerPos) => { if (!mActiveInput) return; mCurrentMousePosition = pixel2logicPos(fingerPos); if (mActiveInput && onFingerDragMove != null) { onFingerDragMove(pixel2logicPos(fingerPos)); } }; mGameCamera = GameObject.Find("tk2dCameraObject").GetComponent<Camera>(); mUICamera = GameObject.Find("UI Camera").GetComponent<Camera>(); }