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


C# TouchPoint.SetGesture方法代码示例

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


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

示例1: Update

    public void Update()
    {
        if( mouseTouchEmulation )
        {
            Vector2 position = new Vector3( Input.mousePosition.x, Input.mousePosition.y );

            // Ray extending from main camera into screen from touch point
            Ray touchRay = Camera.main.ScreenPointToRay(position);
            Debug.DrawRay(touchRay.origin, touchRay.direction * 10, Color.white);

            TouchPoint touch = new TouchPoint(position, -1);

            if( Input.GetMouseButtonDown(0) )
                touch.SetGesture( EventBase.Type.Down );
            else if( Input.GetMouseButtonUp(0) )
                touch.SetGesture( EventBase.Type.Up );
            else if( Input.GetMouseButton(0) )
                touch.SetGesture( EventBase.Type.Move );

            GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
            foreach (GameObject touchObj in touchObjects) {
                touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver);
            }
        }

        lock(eventList.SyncRoot)
        {
            foreach( EventData e in eventList )
            {
                if( (EventBase.ServiceType)e.serviceType == EventBase.ServiceType.ServiceTypePointer )
                {
                    // 2D position of the touch, flipping y-coordinates
                    Vector2 position = new Vector3( e.posx * Screen.width, Screen.height - e.posy * Screen.height );

                    // Ray extending from main camera into screen from touch point
                    Ray touchRay = Camera.main.ScreenPointToRay(position);
                    Debug.DrawRay(touchRay.origin, touchRay.direction * 10, Color.white);

                    TouchPoint touch = new TouchPoint(position, (int)e.sourceId);
                    touch.SetGesture( (EventBase.Type)e.type );

                    GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
                    foreach (GameObject touchObj in touchObjects) {
                        touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver);
                    }
                }

                else
                {
                    GameObject[] omicronObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
                    foreach (GameObject obj in omicronObjects) {
                        obj.BroadcastMessage("OnEvent",e,SendMessageOptions.DontRequireReceiver);
                    }
                }
            }

            // Clear the list (TODO: probably should set the Processed flag instead and cleanup elsewhere)
            eventList.Clear();
        }
    }
开发者ID:petrosferdinand,项目名称:omicron-sdk,代码行数:60,代码来源:OmicronInputScript.cs

示例2: Update

	public void Update()
	{
		if( mouseTouchEmulation )
			{
				Vector2 position = new Vector3( Input.mousePosition.x, Input.mousePosition.y );
						
				// Ray extending from main camera into screen from touch point
				Ray touchRay = Camera.main.ScreenPointToRay(position);
				Debug.DrawRay(touchRay.origin, touchRay.direction * 10, Color.white);
						
				TouchPoint touch = new TouchPoint(position, -1);
				
				if( Input.GetMouseButtonDown(0) )
					touch.SetGesture( EventBase.Type.Down );
				else if( Input.GetMouseButtonUp(0) )
					touch.SetGesture( EventBase.Type.Up );
				else if( Input.GetMouseButton(0) )
					touch.SetGesture( EventBase.Type.Move );
				
				//GameObject[] touchObjects = GameObject.FindGameObjectsWithTag("OmicronListener");
				//foreach (GameObject touchObj in touchObjects) {
				//	touchObj.BroadcastMessage("OnTouch",touch,SendMessageOptions.DontRequireReceiver);
				//}
			}
			
			lock(eventList.SyncRoot)
			{
				foreach( EventData e in eventList )
				{
					ArrayList activeClients = new ArrayList();
					foreach( OmicronEventClient c in omicronClients )
					{
						if( !c.IsFlaggedForRemoval() )
						{
							c.BroadcastMessage("OnEvent",e,SendMessageOptions.DontRequireReceiver);
							activeClients.Add(c);
						}
					}
					omicronClients = activeClients;
					
					#if USING_GETREAL3D
					if(getReal3D.Cluster.isMaster)
					{
						getReal3D.RpcManager.call ("AddStringEvent", OmicronConnectorClient.EventDataToString(e));
					}
					#endif
				}
				
				// Clear the list (TODO: probably should set the Processed flag instead and cleanup elsewhere)
				eventList.Clear();
			}
	}
开发者ID:khaerul10056,项目名称:module-omicron,代码行数:52,代码来源:OmicronManager.cs


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