Exemplo n.º 1
0
	public void Copy(POINTER_INFO ptr)
	{
		type = ptr.type;
		camera = ptr.camera;
		id = ptr.id;
		actionID = ptr.actionID;
		evt = ptr.evt;
		active = ptr.active;
		devicePos = ptr.devicePos;
		origPos = ptr.origPos;
		inputDelta = ptr.inputDelta;
		ray = ptr.ray;
		prevRay = ptr.prevRay;
		rayDepth = ptr.rayDepth;
		isTap = ptr.isTap;
		targetObj = ptr.targetObj;
		layerMask = ptr.layerMask;
		hitInfo = ptr.hitInfo;
	}
Exemplo n.º 2
0
	void Awake()
	{
		// See if we are a superfluous instance:
		if (s_Instance != null)
		{
			Debug.LogError("You can only have one instance of this singleton object in existence.");
		}
		else
			s_Instance = this;

#if (UNITY_IPHONE || UNITY_ANDROID)
		// See if we're supposed to auto-switch to TOUCHPAD:
		if (pointerType == POINTER_TYPE.AUTO_TOUCHPAD)
		{
			if (!Application.isEditor)
				pointerType = POINTER_TYPE.TOUCHPAD;
		}
#endif

		// Determine how many touches should be supported:
		if (pointerType == POINTER_TYPE.TOUCHPAD || pointerType == POINTER_TYPE.TOUCHPAD_AND_RAY)
		{
#if UNITY_IPHONE || UNITY_ANDROID
			iPhoneKeyboard.autorotateToPortrait = autoRotateKeyboardPortrait;
			iPhoneKeyboard.autorotateToPortraitUpsideDown = autoRotateKeyboardPortraitUpsideDown;
			iPhoneKeyboard.autorotateToLandscapeLeft = autoRotateKeyboardLandscapeLeft;
			iPhoneKeyboard.autorotateToLandscapeRight = autoRotateKeyboardLandscapeRight;

			if (iPhoneSettings.model == "iPad")
			{
#endif
			//				if (pointerType == POINTER_TYPE.TOUCHPAD_AND_RAY)
			//					numTouches = 12;
			//				else
			numTouches = 11;
#if UNITY_IPHONE || UNITY_ANDROID
			}
			else
			{
// 				if (pointerType == POINTER_TYPE.TOUCHPAD_AND_RAY)
// 					numTouches = 6;
// 				else
					numTouches = 5;
			}
#endif
		}
		else if (pointerType == POINTER_TYPE.AUTO_TOUCHPAD)
			numTouches = 12;
		else if (pointerType == POINTER_TYPE.MOUSE_AND_RAY)
			numTouches = 1;
		else
			numTouches = 1;

		// Now figure the number of touchpad-based pointers:
		if (pointerType == POINTER_TYPE.AUTO_TOUCHPAD ||
			pointerType == POINTER_TYPE.MOUSE ||
			pointerType == POINTER_TYPE.MOUSE_AND_RAY)
		{
			numTouchPointers = numTouches - 1;
		}
		else
			numTouchPointers = numTouches;

		// Get a reference to the camera:
		if (uiCameras.Length < 1)
		{
			uiCameras = new EZCameraSettings[1];
			uiCameras[0].camera = Camera.main;
		}
		else
		{
			for (int i = 0; i < uiCameras.Length; ++i)
				if (uiCameras[i].camera == null)
					uiCameras[i].camera = Camera.main;
		}

		if (rayCamera == null)
			rayCamera = uiCameras[0].camera;
	}
Exemplo n.º 3
0
	void Awake()
	{
		if (m_awake)
			return;
		m_awake = true;

		// See if we are a superfluous instance:
		if (s_Instance != null)
		{
			ScreenLog.AddMessage("You can only have one instance of this singleton object in existence.", ScreenLogType.Error);
		}
		else
			s_Instance = this;

#if (UNITY_IPHONE || UNITY_ANDROID)
		// See if we're supposed to auto-switch to TOUCHPAD:
		if (pointerType == POINTER_TYPE.AUTO_TOUCHPAD)
		{
			if (!Application.isEditor)
				pointerType = POINTER_TYPE.TOUCHPAD;
		}
#endif

		// Determine how many touches should be supported:
		if (pointerType == POINTER_TYPE.TOUCHPAD || pointerType == POINTER_TYPE.TOUCHPAD_AND_RAY)
		{
#if UNITY_IPHONE || UNITY_ANDROID
			TouchScreenKeyboard.autorotateToPortrait = autoRotateKeyboardPortrait;
			TouchScreenKeyboard.autorotateToPortraitUpsideDown = autoRotateKeyboardPortraitUpsideDown;
			TouchScreenKeyboard.autorotateToLandscapeLeft = autoRotateKeyboardLandscapeLeft;
			TouchScreenKeyboard.autorotateToLandscapeRight = autoRotateKeyboardLandscapeRight;

	#if UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9
			if (SystemInfo.deviceModel == "iPad")
	#else
			if (iPhoneSettings.model == "iPad")
	#endif
			{
#endif
			//				if (pointerType == POINTER_TYPE.TOUCHPAD_AND_RAY)
			//					numTouches = 12;
			//				else
			numTouches = 11;
#if UNITY_IPHONE || UNITY_ANDROID
			}
			else
			{
// 				if (pointerType == POINTER_TYPE.TOUCHPAD_AND_RAY)
// 					numTouches = 6;
// 				else
					numTouches = 5;
			}
#endif
		}
		else if (pointerType == POINTER_TYPE.AUTO_TOUCHPAD)
			numTouches = 12;
		else if (pointerType == POINTER_TYPE.MOUSE_AND_RAY)
			numTouches = 1;
		else
			numTouches = 1;

		// Now figure the number of touchpad-based pointers:
		if (pointerType == POINTER_TYPE.AUTO_TOUCHPAD ||
			pointerType == POINTER_TYPE.MOUSE ||
			pointerType == POINTER_TYPE.MOUSE_AND_RAY)
		{
			numTouchPointers = numTouches - 1;
		}
		else
			numTouchPointers = numTouches;

		// Get a reference to the camera:
		if (uiCameras.Length < 1)
		{
			uiCameras = new EZCameraSettings[1];
			uiCameras[0].camera = Camera.main;
		}
		else
		{
			for (int i = 0; i < uiCameras.Length; ++i)
				if (uiCameras[i].camera == null)
					uiCameras[i].camera = Camera.main;
		}

		if (rayCamera == null)
			rayCamera = uiCameras[0].camera;
		
		dragThreshold = GameValues.defaultDragThreshHold;
	}