Class MapViewLayout
public class MapViewLayout : MonoBehaviour, IPointerClickHandler, IDragHandler, IScrollHandler
- Inheritance
-
MapViewLayout
- Implements
-
IPointerClickHandlerIDragHandlerIScrollHandler
Fields
BottomLeftTile
public TileView BottomLeftTile
Field Value
BottomRightTile
public TileView BottomRightTile
Field Value
CenterCoordiante
public Vector2Int CenterCoordiante
Field Value
- Vector2Int
CenterTile
public TileView CenterTile
Field Value
MoveTileToDirection
public UnityEvent<Vector3> MoveTileToDirection
Field Value
- UnityEvent<Vector3>
OnLocationSelected
public UnityEvent<Coordinates> OnLocationSelected
Field Value
- UnityEvent<Coordinates>
OnMapUpdated
public UnityEvent OnMapUpdated
Field Value
- UnityEvent
OnPositionSelected
public UnityEvent<Vector3> OnPositionSelected
Field Value
- UnityEvent<Vector3>
TopLeftTile
public TileView TopLeftTile
Field Value
TopRightTile
public TileView TopRightTile
Field Value
Properties
CanInput
public bool CanInput { get; set; }
Property Value
CurrentZoomLevel
public float CurrentZoomLevel { get; }
Property Value
PlacableItems
public PlacableItems PlacableItems { get; }
Property Value
Pool
public ObjectPool<TileView> Pool { get; }
Property Value
RectTransform
public RectTransform RectTransform { get; }
Property Value
- RectTransform
ZoomLevel
public int ZoomLevel { get; }
Property Value
Methods
GenerateLayout()
public void GenerateLayout()
GetAllTiles()
public IEnumerable<TileView> GetAllTiles()
Returns
GetPositionForTile(Vector2Int)
public Vector3 GetPositionForTile(Vector2Int coordinate)
Parameters
coordinateVector2Int
Returns
- Vector3
GetTileAtCoordinate(Vector2Int)
public TileView GetTileAtCoordinate(Vector2Int coordinate)
Parameters
coordinateVector2Int
Returns
HasCachedCenterTile(out Vector2Int, out int)
public bool HasCachedCenterTile(out Vector2Int coordinate, out int zoom)
Parameters
coordinateVector2Intzoomint
Returns
HasWorldPositionInMapView(Coordinates, out Vector3)
public bool HasWorldPositionInMapView(Coordinates coordinates, out Vector3 position)
Parameters
coordinatesCoordinatespositionVector3
Returns
HasWorldPositionInMapView(PlacableData, out Vector3)
public bool HasWorldPositionInMapView(PlacableData data, out Vector3 position)
Parameters
dataPlacableDatapositionVector3
Returns
InitializeMapSettings(MapFile)
public void InitializeMapSettings(MapFile settings)
Parameters
settingsMapFile
IsPlacableInBoundsAndContains(PlacableData, out IPlacable)
public bool IsPlacableInBoundsAndContains(PlacableData data, out IPlacable placable)
Parameters
dataPlacableDataplacableIPlacable
Returns
NotifyMapUpdated()
public void NotifyMapUpdated()
OnDrag(PointerEventData)
public void OnDrag(PointerEventData eventData)
Parameters
eventDataPointerEventData
OnPointerClick(PointerEventData)
public void OnPointerClick(PointerEventData eventData)
Parameters
eventDataPointerEventData
OnScroll(PointerEventData)
public void OnScroll(PointerEventData eventData)
Parameters
eventDataPointerEventData
RectSize()
public (float Width, float Height) RectSize()
Returns
SaveCurrentCenterTileToCache()
public void SaveCurrentCenterTileToCache()
SetCenterCoordinate(double, double, bool, bool)
Convenience overload accepting raw latitude/longitude.
public void SetCenterCoordinate(double latitude, double longitude, bool clampToBounds = true, bool instantLoad = true)
Parameters
SetCenterCoordinate(Coordinates, bool, bool)
Sets the map center to the given geographic coordinate at the current zoom. Optionally clamps the input to the configured geographic bounds and regenerates tiles immediately.
public void SetCenterCoordinate(Coordinates coordinates, bool clampToBounds = true, bool instantLoad = true)
Parameters
coordinatesCoordinatesTarget latitude/longitude.
clampToBoundsboolClamp the coordinate to [TopLeft, BottomRight] bounds.
instantLoadboolIf true, clears and rebuilds tiles around the new center immediately.
TileCount()
public (int Col, int Row) TileCount()
Returns
ToggleGeoTags()
public void ToggleGeoTags()
TryGetTileAndNormalizedFromWorldPosition(Vector3, out Coordinates, out float, out float)
Reverse of HasWorldPositionInMapView: given a world position, returns the tile's coordinate (tile X/Y in the current grid) and the normalized position inside that tile (0..1). Returns false if the world position is outside the currently generated tiles or tiles not available.
public bool TryGetTileAndNormalizedFromWorldPosition(Vector3 worldPosition, out Coordinates tileCoordinate, out float normX, out float normY)
Parameters
worldPositionVector3tileCoordinateCoordinatesnormXfloatnormYfloat