mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-29 15:49:49 +01:00
add: _get_tiled_object_caster
This commit is contained in:
@@ -168,6 +168,8 @@ class RawTiledObject(TypedDict):
|
||||
type: str
|
||||
properties: Properties
|
||||
template: Template
|
||||
ellipse: bool
|
||||
point: bool
|
||||
|
||||
|
||||
RawTiledObjects = List[RawTiledObject]
|
||||
@@ -279,6 +281,22 @@ def _get_tiled_object_caster(
|
||||
if raw_tiled_object.get("ellipse"):
|
||||
return _cast_ellipse
|
||||
|
||||
if raw_tiled_object.get("point"):
|
||||
return _cast_point
|
||||
|
||||
if raw_tiled_object.get("gid"):
|
||||
# Only Tile objects have the `gid` key (I think)
|
||||
return _cast_tile
|
||||
|
||||
if raw_tiled_object.get("polygon"):
|
||||
return _cast_polygon
|
||||
|
||||
if raw_tiled_object.get("polyline"):
|
||||
return _cast_polyline
|
||||
|
||||
if raw_tiled_object.get("text"):
|
||||
return _cast_text
|
||||
|
||||
raise RuntimeError("No caster found for TiledObject")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user