In addition to above methods you can listen to the following events (check out the Demo.cs script for sample code):
OnClick(Vector3 spherePosition, int mouseButtonIndex);
Occurs when user clicks on the globewith left button. You can use the API Conversion.GetLatLonFromSpherePoint(spherePosition) to retrieve the latitude/longitude coordinates of the clicked position (see demo scene 1 code example).
OnDrag(Vector3 spherePosition);
Occurs when user moves the mouse over the map while holding left button.
OnCityEnter(int cityIndex);
Occurs when cursor hits a city.
OnCityExit(int cityIndex);
Occurs when cursor leaves a city.
OnCityPointerDown(int cityIndex, int buttonIndex);
Occurs when user starts pressing on a city with the mouse/pointer.
OnCityPointerUp(int cityIndex, int buttonIndex);
Occurs when user release button on a city with the mouse/pointer.
OnCityClick(int cityIndex, int buttonIndex);
Occurs when user clicks over a city. If user drags the globe or it doesn’t click fast, this event won’t trigger.
OnCountryBeforeEnter(int countryIndex, int regionIndex, ref bool ignoreCountry);
Occurs when cursor is about to enter a country. You can set ignoreCountry to boolean to ignore this country from highlighthing.
OnCountryEnter(int countryIndex, int regionIndex);
Occurs when cursor is about to enter a country.
OnCountryExit(int countryIndex, int regionIndex);
Occurs when cursor leaves a country.
OnCountryPointerDown(int countryIndex, int regionIndex, int buttonIndex);
Occurs when user starts pressing on a country with the mouse/pointer.
OnCountryPointerUp(int countryIndex, int regionIndex, int buttonIndex);
Occurs when user release utton on a country with the mouse/pointer.
OnCountryClick(int countryIndex, int regionIndex, int buttonIndex);
Occurs when user clicks over a country. If user drags the globe or it doesn’t click fast, this event won’t trigger.
OnProvinceBeforeEnter(int provinceIndex, int regionIndex, ref bool ignoreProvince);
Occurs when cursor is about to enter a province. You can set ignoreProvince to true so this province won’t be highlight.
OnProvinceEnter(int provinceIndex, int regionIndex);
Occurs when cursor enters a province.
OnProvinceExit(int provinceIndex, int regionIndex);
Occurs when cursor leaves a province.
OnProvincePointerDown(int provinceIndex, int regionIndex, int buttonIndex);
Occurs when user starts pressing on a province with the mouse/pointer.
OnProvincePointerUp(int provinceIndex, int regionIndex, int buttonIndex);
Occurs when user releases button on a province with the mouse/pointer.
OnProvinceClick(int countryIndex, int regionIndex, int buttonIndex);
Occurs when user clicks over a province. If user drags the globe or it doesn’t click fast, this event won’t trigger.
OnCellEnter(int cellIndex)
Occurs when pointer enters a cell of the hexagonal grid.
OnCellClick(int cellIndex, int buttonIndex)
Occurs when user clicks a cell of the hexagonal grid.
OnCellExit(int cellIndex)
Occurs when pointer abandon a cell of the hexagonal grid.
OnCellCross(int cellIndex)
Occurs whenthe path finding evaluates a cell. It must return the cost for crossing the cell. If not used, it’s assumed all cells cost 1 point.
OnFlyStart(Vector3 spherePosition)
Fired when a FlyTo operation has started.
OnFlyEnd(Vector3 spherePosition)
Fired when a FlyTo operation has finished and it has reached destination.
bool OnTileRequest(int zoomLevel, int x, int y, out Texture2D texture, out string error)
Use this event to provide your own tile textures as they’re needed.
If your event function returns true, the texture will be used for the tile and no other sources will be tried (provide an error string if the texture cannot be provided and you don’t want Globe to try other sources, otherwise set error to null).
If the event function returns false, any texture wil be ignored.
string OnTileURLRequest(string url, TILE_SERVER server, int zoomLevel, int x, int y)
Use this event to change the tile url on the fly. The event handler received the proposed url but you can return any custom url using the parameters provided of server, zoom level, tile x and y. Or just return the url provided as a result if you want to keep that url.
OnTileRecomputed (List<TileInfo> visibleTiles)
This event is called each time tiles visibility is computed. It receives a list of currently visible tiles.
OnRaycast ()
This event is called when the asset is performing a raycast to determiner cursor position on the globe. You can hook your own event delegate to provide custom ray object to be used. For example:
map.OnRaycast += () => new Ray(origin, direction);