public TouchPlaceInfo CreatePlaceInfo(string name) { TouchPlaceInfo info = new TouchPlaceInfo(name, new Define.RectF(100f, 200f, 200f, 100f)); touchPlaceList.Add(info); return(info); }
public TouchInfo GetTouchInfo(string n) { TouchPlaceInfo info = GetTouchPlace(n); if (info != null) { return(info.touch); } return(null); }
public void TouchCheck() { #if UNITY_EDITOR if (Input.GetMouseButtonDown(0)) { TouchPlaceInfo info = GetTouchPlace(Input.mousePosition); if (info != null) { info.touch.began(); } } // else if(Input.GetMouseButton(0)) // { // TouchPlaceInfo info = GetTouchPlace(Input.mousePosition); // if(info != null) // { // info.touch.moved(); // } // } // else if(Input.GetMouseButtonUp(0)) // { // TouchPlaceInfo info = GetTouchPlace(Input.mousePosition); // if(info != null) // { // info.touch.TouchEnd(); // } // } #else if (Input.touchCount > 0) { for (int i = 0; i < Input.touchCount; ++i) { touchs = Input.GetTouch(i); if (touchs.phase == TouchPhase.Began) { TouchPlaceInfo info = GetTouchPlace(touchs); if (info != null) { info.touch.touch = touchs; info.touch.began(); } } else if (touchs.phase == TouchPhase.Moved) { TouchInfo info = GetTouchInfo(touchs); if (info != null) { info.moved(); } } else if (touchs.phase == TouchPhase.Ended) { TouchInfo info = GetTouchInfo(touchs); if (info != null) { info.TouchEnd(); } } } } #endif }