public static TouchInputEventArgs CreateTouchInputEventArgs(enTouchState State, float PosX, float PosY, int FingerIdx, float DeltaX, float DeltaY) { //以后要改成pool模式 var result = new TouchInputEventArgs(); result.TouchEvent.State = State; result.TouchEvent.PosX = PosX; result.TouchEvent.PosY = PosY; result.TouchEvent.FingerIdx = FingerIdx; result.TouchEvent.DeltaX = DeltaX; result.TouchEvent.DeltaY = DeltaY; return(result); }
public static TouchInputEventArgs CreateTouchInputEventArgsFromeScreenXY( GamePlay.Actor.GActor showActor, float showWidth, float showHeight, float hitLength, enTouchState State, int x, int y, int FingerIdx, float DeltaX, float DeltaY) { if (showActor.Scene == null) { return(null); } if (CEngine.Instance.GameInstance == null) { return(null); } var hitResult = new GamePlay.SceneGraph.VHitResult(Bricks.PhysicsCore.PhyHitFlag.eDEFAULT); if (showActor.Scene.PickActor(out hitResult, CEngine.Instance.GameInstance.GameCamera, x, y, hitLength) != showActor) { return(null); } var triMeshComp = showActor.GetComponent <Bricks.PhysicsCore.CollisionComponent.GPhysicsMeshCollision>(); if (triMeshComp == null) { return(null); } var triMesh = triMeshComp.HostShape.TriGeom; if (triMesh == null) { return(null); } if (hitResult.FaceId == -1) { return(null); } if (triMeshComp.HostShape == null) { return(null); } int faceid = triMeshComp.HostShape.GetTrianglesRemap(hitResult.FaceId); if (faceid == -1) { return(null); } triMesh.GetUV(faceid, hitResult.U, hitResult.V, out ResultUV); var pos = triMesh.GetPos(faceid, hitResult.U, hitResult.V); pos = Vector3.TransformCoordinate(pos, showActor.Placement.DrawTransform); //以后要改成pool模式 var result = new TouchInputEventArgs(); result.TouchEvent.State = State; result.TouchEvent.PosX = ResultUV.X * showWidth; result.TouchEvent.PosY = ResultUV.Y * showHeight; result.TouchEvent.FingerIdx = FingerIdx; result.TouchEvent.DeltaX = DeltaX; result.TouchEvent.DeltaY = DeltaY; return(result); }