public static CGRectApplyAffineTransform ( |
||
rect | ||
transform | ||
return |
public Rect getBounds() { Rect rect = new Rect(); for (var ent = _tiles.head; ent != null; ent = ent.next) { Vector2 sptSize = ent.obj.spriteFrame.originalSize / UIWindow.PIXEL_PER_UNIT; Rect sptRect = new Rect(-sptSize / 2, sptSize); sptRect = CGAffineTransform.CGRectApplyAffineTransform(sptRect, ent.obj.transform); rect = ccUtils.RectUnion(rect, sptRect); } rect.position *= UIWindow.PIXEL_PER_UNIT; rect.size *= UIWindow.PIXEL_PER_UNIT; return(rect); }
public Tile getTile(Vector2 positionInNodeSpace) { Vector2 uPositionInNodeSpace = positionInNodeSpace / UIWindow.PIXEL_PER_UNIT; for (var ent = _tiles.head; ent != null; ent = ent.next) { Vector2 sptSize = ent.obj.spriteFrame.originalSize / UIWindow.PIXEL_PER_UNIT; Rect sptRect = new Rect(-sptSize / 2, sptSize); sptRect = CGAffineTransform.CGRectApplyAffineTransform(sptRect, ent.obj.transform); if (sptRect.Contains(uPositionInNodeSpace)) { return(ent.obj); } } return(null); }
public void removeTiles(Vector2 positionInNodeSpace) { Vector2 uPositionInNodeSpace = positionInNodeSpace / UIWindow.PIXEL_PER_UNIT; for (var ent = _tiles.head; ent != null; ent = ent.next) { Vector2 sptSize = ent.obj.spriteFrame.originalSize / UIWindow.PIXEL_PER_UNIT; Rect sptRect = new Rect(-sptSize / 2, sptSize); sptRect = CGAffineTransform.CGRectApplyAffineTransform(sptRect, ent.obj.transform); if (sptRect.Contains(uPositionInNodeSpace)) { _tiles.DL_DELETE(ent.obj); } } _meshDirty = true; }