Fixed tilemaps with missing function

This commit is contained in:
Richard Davey 2020-10-08 11:07:05 +01:00
parent 9a61c62997
commit 114201f497
3 changed files with 80 additions and 15 deletions

View file

@ -0,0 +1,48 @@
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var CONST = require('../const');
var HexagonalTileToWorldXY = require('./HexagonalTileToWorldXY');
var IsometricTileToWorldXY = require('./IsometricTileToWorldXY');
var NOOP = require('../../utils/NOOP');
var StaggeredTileToWorldXY = require('./StaggeredTileToWorldXY');
var TileToWorldXY = require('./TileToWorldXY');
/**
* Gets the correct function to use to translate tiles, based on the map orientation.
*
* @function Phaser.Tilemaps.Components.GetTileToWorldXYFunction
* @since 3.50.0
*
* @param {number} orientation - The Tilemap orientation constant.
*
* @return {(Phaser.Tilemaps.Components.TileToWorldXY|Phaser.Tilemaps.Components.IsometricTileToWorldXY|Phaser.Tilemaps.Components.HexagonalTileToWorldXY|Phaser.Tilemaps.Components.StaggeredTileToWorldXY)} The function to use to translate tiles for the given map type.
*/
var GetTileToWorldXYFunction = function (orientation)
{
if (orientation === CONST.ORTHOGONAL)
{
return TileToWorldXY;
}
else if (orientation === CONST.ISOMETRIC)
{
return IsometricTileToWorldXY;
}
else if (orientation === CONST.HEXAGONAL)
{
return HexagonalTileToWorldXY;
}
else if (orientation === CONST.STAGGERED)
{
return StaggeredTileToWorldXY;
}
else
{
return NOOP;
}
};
module.exports = GetTileToWorldXYFunction;

View file

@ -5,39 +5,39 @@
*/
var CONST = require('../const');
var HexagonalTileToWorldXY = require('./HexagonalTileToWorldXY');
var IsometricTileToWorldXY = require('./IsometricTileToWorldXY');
var HexagonalWorldToTileXY = require('./HexagonalWorldToTileXY');
var IsometricWorldToTileXY = require('./IsometricWorldToTileXY');
var NOOP = require('../../utils/NOOP');
var StaggeredTileToWorldXY = require('./StaggeredTileToWorldXY');
var TileToWorldXY = require('./TileToWorldXY');
var StaggeredWorldToTileXY = require('./StaggeredWorldToTileXY');
var WorldToTileXY = require('./WorldToTileXY');
/**
* Gets the correct function to use to translate tiles, based on the map orientation.
*
* @function Phaser.Tilemaps.Components.GetTileToWorldXYFunction
* @function Phaser.Tilemaps.Components.GetWorldToTileXYFunction
* @since 3.50.0
*
* @param {number} orientation - The Tilemap orientation constant.
*
* @return {(Phaser.Tilemaps.Components.TileToWorldXY|Phaser.Tilemaps.Components.IsometricTileToWorldXY|Phaser.Tilemaps.Components.HexagonalTileToWorldXY|Phaser.Tilemaps.Components.StaggeredTileToWorldXY)} The function to use to translate tiles for the given map type.
* @return {(Phaser.Tilemaps.Components.WorldToTileXY|Phaser.Tilemaps.Components.IsometricWorldToTileXY|Phaser.Tilemaps.Components.HexagonalWorldToTileXY|Phaser.Tilemaps.Components.StaggeredWorldToTileXY)} The function to use to translate tiles for the given map type.
*/
var GetTileToWorldXYFunction = function (orientation)
var GetWorldToTileXYFunction = function (orientation)
{
if (orientation === CONST.ORTHOGONAL)
{
return TileToWorldXY;
return WorldToTileXY;
}
else if (orientation === CONST.ISOMETRIC)
{
return IsometricTileToWorldXY;
return IsometricWorldToTileXY;
}
else if (orientation === CONST.HEXAGONAL)
{
return HexagonalTileToWorldXY;
return HexagonalWorldToTileXY;
}
else if (orientation === CONST.STAGGERED)
{
return StaggeredTileToWorldXY;
return StaggeredWorldToTileXY;
}
else
{
@ -45,4 +45,4 @@ var GetTileToWorldXYFunction = function (orientation)
}
};
module.exports = GetTileToWorldXYFunction;
module.exports = GetWorldToTileXYFunction;

View file

@ -12,27 +12,39 @@ module.exports = {
CalculateFacesAt: require('./CalculateFacesAt'),
CalculateFacesWithin: require('./CalculateFacesWithin'),
CheckIsoBounds: require('./CheckIsoBounds'),
Copy: require('./Copy'),
CreateFromTiles: require('./CreateFromTiles'),
CullBounds: require('./CullBounds'),
CullTiles: require('./CullTiles'),
Fill: require('./Fill'),
FilterTiles: require('./FilterTiles'),
FindByIndex: require('./FindByIndex'),
FindTile: require('./FindTile'),
ForEachTile: require('./ForEachTile'),
GetCullTilesFunction: require('./GetCullTilesFunction'),
GetTileAt: require('./GetTileAt'),
GetTileAtWorldXY: require('./GetTileAtWorldXY'),
GetTilesWithin: require('./GetTilesWithin'),
GetTilesWithinShape: require('./GetTilesWithinShape'),
GetTilesWithinWorldXY: require('./GetTilesWithinWorldXY'),
GetTileToWorldXFunction: require('./GetTileToWorldXFunction'),
GetTileToWorldXYFunction: require('./GetTileToWorldXYFunction'),
GetTileToWorldYFunction: require('./GetTileToWorldYFunction'),
GetWorldToTileXFunction: require('./GetWorldToTileXFunction'),
GetWorldToTileYFunction: require('./GetWorldToTileYFunction'),
GetWorldToTileXYFunction: require('./GetWorldToTileXYFunction'),
GetWorldToTileYFunction: require('./GetWorldToTileYFunction'),
HasTileAt: require('./HasTileAt'),
HasTileAtWorldXY: require('./HasTileAtWorldXY'),
HexagonalWorldToTileY: require('./HexagonalWorldToTileY'),
HexagonalCullBounds: require('./HexagonalCullBounds'),
HexagonalCullTiles: require('./HexagonalCullTiles'),
HexagonalTileToWorldXY: require('./HexagonalTileToWorldXY'),
HexagonalTileToWorldY: require('./HexagonalTileToWorldY'),
HexagonalWorldToTileXY: require('./HexagonalWorldToTileXY'),
HexagonalWorldToTileY: require('./HexagonalWorldToTileY'),
IsInLayerBounds: require('./IsInLayerBounds'),
IsometricCullTiles: require('./IsometricCullTiles'),
IsometricTileToWorldXY: require('./IsometricTileToWorldXY'),
IsometricWorldToTileXY: require('./IsometricWorldToTileXY'),
PutTileAt: require('./PutTileAt'),
PutTileAtWorldXY: require('./PutTileAtWorldXY'),
@ -42,6 +54,7 @@ module.exports = {
RemoveTileAtWorldXY: require('./RemoveTileAtWorldXY'),
RenderDebug: require('./RenderDebug'),
ReplaceByIndex: require('./ReplaceByIndex'),
RunCull: require('./RunCull'),
SetCollision: require('./SetCollision'),
SetCollisionBetween: require('./SetCollisionBetween'),
SetCollisionByExclusion: require('./SetCollisionByExclusion'),
@ -52,8 +65,12 @@ module.exports = {
SetTileIndexCallback: require('./SetTileIndexCallback'),
SetTileLocationCallback: require('./SetTileLocationCallback'),
Shuffle: require('./Shuffle'),
StaggeredWorldToTileY: require('./StaggeredWorldToTileY'),
StaggeredCullBounds: require('./StaggeredCullBounds'),
StaggeredCullTiles: require('./StaggeredCullTiles'),
StaggeredTileToWorldXY: require('./StaggeredTileToWorldXY'),
StaggeredTileToWorldY: require('./StaggeredTileToWorldY'),
StaggeredWorldToTileXY: require('./StaggeredWorldToTileXY'),
StaggeredWorldToTileY: require('./StaggeredWorldToTileY'),
SwapByIndex: require('./SwapByIndex'),
TileToWorldX: require('./TileToWorldX'),
TileToWorldXY: require('./TileToWorldXY'),