erland.game.tileadventure
Class TileMapEditor

java.lang.Object
  extended by erland.game.tileadventure.MapEditor
      extended by erland.game.tileadventure.TileMapEditor
All Implemented Interfaces:
GamePanelInterface
Direct Known Subclasses:
AnimationEditor, MapObjectEditor, RoomMapEditor, WorldMapEditor

public abstract class TileMapEditor
extends MapEditor


Field Summary
protected  BlockContainerData cont
          Block container for the editor area
protected  BlockContainerData contPalette
          Block container for the block select area
protected  ParameterSerializable extendedLevelInfo
          Extended information about the currently edited level/block
protected  ENumberSpinner heightLevelSpinner
          Spinner that changes the current height level edited
protected  int levelNo
          Currently edited level/block number
protected  ENumberSpinner levelNoSpinner
          Spinner that changes the current level/block edited
protected  MapObjectContainerInterface mapBlocks
          Blocks in the editor area
protected  MapObjectContainerInterface paletteBlocks
          Blocks in the select block area
 
Fields inherited from class erland.game.tileadventure.MapEditor
BUTTON_EXIT, BUTTON_LOAD, BUTTON_SAVE
 
Constructor Summary
TileMapEditor()
           
 
Method Summary
protected  MapObjectInterface cloneBlock(MapObjectInterface block, IrregularBlockContainerInterface cont, int x, int y, int z)
          Clone specified block
 void drawHoveringFrame(Graphics g, int posX, int posY)
           
 void drawSelectedFrame(Graphics g, MapObjectInterface selectedBlock)
           
protected  ParameterSerializable getExtendedLevelInfo()
          Get extended information about the currently edited level/block
protected  int getFirstPaletteBlock()
          Get block number of the first block in the select block area
protected  String getHeightLabelText()
          Get the text that should be shown to the user that indicates which height level of the map that is currently edited, for example "Height:" If this method returns null, no height spinner will be visible
protected abstract  String getLevelFileGroupLabel()
          Get the name that is used for the currently edited object type when it is stored to file, for example "level"
protected abstract  String getLevelFileLabel()
          Get the name that is used for a list of the currently edited object type when it is stored to file, for example "levels"
protected  String getLevelLabelText()
          Get the text that should be shown to the user that indicates what short of object this editor makes it possible for the user to edit, for example "Level:"
protected abstract  LevelManager getLevelManager()
          Gets the level manager or create a new one if it does not already exist
protected  int getLevelNo()
          Get currently edited level/block
protected abstract  Image getMapBlockImage()
          Get an image which is based on subimages of all blocks in the block select area
protected  MapObjectContainerInterface getMapBlocks()
          Get matrix with all blocks in the map
protected  IrregularBlockContainerInterface getMapContainer()
          Get block container for the map area
protected  int getMapPosZ()
           
protected  int getMaxHeight()
          Get the maximum height levels of blocks
protected  int getMaxLevel()
          Get the maximum allowed number of levels/blocks
protected  int getNoOfPaletteBlocks()
          Get the number of blocks in the select block area
protected  MapObjectInterface getPaletteBlock(int blockNo)
          Get a new block based on the specified block from the select block area
protected  MapObjectContainerInterface getPaletteBlocks()
          Get matrix with all blocks in the block selection area
protected  IrregularBlockContainerInterface getPaletteContainer()
          Get block container for the block selection area
protected abstract  int getSelectSizeX()
          Get the horizontal number of blocks in the select block area
protected abstract  int getSelectSizeY()
          Get the vertical number of blocks in the select block area
protected abstract  int getSizeX()
          Get the horizontal number of blocks in main editor area
protected abstract  int getSizeY()
          Get the vertical number of blocks in the main editor area
protected abstract  int getSizeZ()
          Get the height number of blocks in the main editor area
 void init(GameEnvironmentInterface environment)
           
protected  void initButtons(EPanel panel)
          Create and initialize all buttons
protected  void initHeightChangeButtons(EPanel panel)
          Creates buttons for changing currently edited height level
protected  void initLevelChangeButtons(EPanel panel)
          Creates buttons for changing currently edited level/blocks
protected  boolean isEmptyAllowed()
          Checks if it is allowed to have positions in the map without any block
protected  void loadButton()
          Called when the standard load button is pressed, a new map should be loaded
protected  MapObjectContainerInterface prepareAfterLoad(MapObjectContainerInterface blocks)
          Prepare the map container after loading new map data
protected  MapObjectContainerInterface prepareForSave(MapObjectContainerInterface blocks)
          Prepare the map container for save
protected  void saveButton(MapObjectContainerInterface blocks)
          Called when the standard save button is pressed, the current blocks in the map area should be saved to the map
protected  void setExtendedLevelInfo(ParameterSerializable info)
          Set the extended information for the currently edited level/block
protected  void updateBlocks()
          Update all blocks
 
Methods inherited from class erland.game.tileadventure.MapEditor
clickedMapBlock, clickedSelectBlock, draw, drawBlock, drawFinish, drawMapBlocks, drawPaletteBlocks, exit, exitButton, exitFinish, getDefaultButtons, getEnvironment, getPalettePosZ, hoverMapBlock, initButtonPanel, initDefaultButtons, initFinish, isExit, leftMouseDragged, leftMousePressed, mouseHovering, prepareNewBlock, setCheatmode, setMapBlock, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cont

protected BlockContainerData cont
Block container for the editor area


contPalette

protected BlockContainerData contPalette
Block container for the block select area


mapBlocks

protected MapObjectContainerInterface mapBlocks
Blocks in the editor area


paletteBlocks

protected MapObjectContainerInterface paletteBlocks
Blocks in the select block area


levelNoSpinner

protected ENumberSpinner levelNoSpinner
Spinner that changes the current level/block edited


levelNo

protected int levelNo
Currently edited level/block number


extendedLevelInfo

protected ParameterSerializable extendedLevelInfo
Extended information about the currently edited level/block


heightLevelSpinner

protected ENumberSpinner heightLevelSpinner
Spinner that changes the current height level edited

Constructor Detail

TileMapEditor

public TileMapEditor()
Method Detail

init

public void init(GameEnvironmentInterface environment)
Specified by:
init in interface GamePanelInterface
Overrides:
init in class MapEditor

getLevelFileLabel

protected abstract String getLevelFileLabel()
Get the name that is used for a list of the currently edited object type when it is stored to file, for example "levels"

Returns:
The name of the currently edited object type used in storage

getLevelFileGroupLabel

protected abstract String getLevelFileGroupLabel()
Get the name that is used for the currently edited object type when it is stored to file, for example "level"

Returns:
The name of the currently edited object type used in storage

getSizeX

protected abstract int getSizeX()
Get the horizontal number of blocks in main editor area

Returns:
The horizontal number of blocks

getSizeY

protected abstract int getSizeY()
Get the vertical number of blocks in the main editor area

Returns:
The vertical number of blocks

getSizeZ

protected abstract int getSizeZ()
Get the height number of blocks in the main editor area

Returns:
The height number of blocks

getSelectSizeX

protected abstract int getSelectSizeX()
Get the horizontal number of blocks in the select block area

Returns:
The horizontal number of blocks

getSelectSizeY

protected abstract int getSelectSizeY()
Get the vertical number of blocks in the select block area

Returns:
The vertical number of blocks

getMapBlockImage

protected abstract Image getMapBlockImage()
Get an image which is based on subimages of all blocks in the block select area

Returns:

getMapContainer

protected IrregularBlockContainerInterface getMapContainer()
Description copied from class: MapEditor
Get block container for the map area

Specified by:
getMapContainer in class MapEditor
Returns:
The block container

getPaletteContainer

protected IrregularBlockContainerInterface getPaletteContainer()
Description copied from class: MapEditor
Get block container for the block selection area

Specified by:
getPaletteContainer in class MapEditor
Returns:
The block container

getPaletteBlock

protected MapObjectInterface getPaletteBlock(int blockNo)
Get a new block based on the specified block from the select block area

Parameters:
blockNo - Block number of the block to get
Returns:
A newly created block

getFirstPaletteBlock

protected int getFirstPaletteBlock()
Get block number of the first block in the select block area

Returns:
The block number

getNoOfPaletteBlocks

protected int getNoOfPaletteBlocks()
Get the number of blocks in the select block area

Returns:
The number of blocks

getPaletteBlocks

protected MapObjectContainerInterface getPaletteBlocks()
Description copied from class: MapEditor
Get matrix with all blocks in the block selection area

Specified by:
getPaletteBlocks in class MapEditor
Returns:
Matrix with the blocks

getMapBlocks

protected MapObjectContainerInterface getMapBlocks()
Description copied from class: MapEditor
Get matrix with all blocks in the map

Specified by:
getMapBlocks in class MapEditor
Returns:
Matrix with the blocks

cloneBlock

protected MapObjectInterface cloneBlock(MapObjectInterface block,
                                        IrregularBlockContainerInterface cont,
                                        int x,
                                        int y,
                                        int z)
Description copied from class: MapEditor
Clone specified block

Specified by:
cloneBlock in class MapEditor
Parameters:
block - Block to clone
cont - Block container to put new block in
x - X position to put new block at
y - Y position to put new block at
z - Z position to put new block at
Returns:
Newly cloned block

isEmptyAllowed

protected boolean isEmptyAllowed()
Description copied from class: MapEditor
Checks if it is allowed to have positions in the map without any block

Specified by:
isEmptyAllowed in class MapEditor
Returns:
true/false (Empty positions allowed/No empty positions allowed)

getLevelLabelText

protected String getLevelLabelText()
Get the text that should be shown to the user that indicates what short of object this editor makes it possible for the user to edit, for example "Level:"

Returns:
The name of the currently edited object type used in user interface

getHeightLabelText

protected String getHeightLabelText()
Get the text that should be shown to the user that indicates which height level of the map that is currently edited, for example "Height:" If this method returns null, no height spinner will be visible

Returns:
The name of the currently edited object type used in user interface

getMaxHeight

protected int getMaxHeight()
Get the maximum height levels of blocks

Returns:
The maximum numer of height levels of blocks

getMaxLevel

protected int getMaxLevel()
Get the maximum allowed number of levels/blocks

Returns:
The maximum numer of levels/blocks

initLevelChangeButtons

protected void initLevelChangeButtons(EPanel panel)
Creates buttons for changing currently edited level/blocks

Parameters:
panel -

initHeightChangeButtons

protected void initHeightChangeButtons(EPanel panel)
Creates buttons for changing currently edited height level

Parameters:
panel -

initButtons

protected void initButtons(EPanel panel)
Description copied from class: MapEditor
Create and initialize all buttons

Overrides:
initButtons in class MapEditor
Parameters:
panel - EPanel to put buttons on

getLevelNo

protected int getLevelNo()
Get currently edited level/block

Returns:
Block/level number of the currently edited block

getExtendedLevelInfo

protected ParameterSerializable getExtendedLevelInfo()
Get extended information about the currently edited level/block

Returns:
Extended level/block information

setExtendedLevelInfo

protected void setExtendedLevelInfo(ParameterSerializable info)
Set the extended information for the currently edited level/block

Parameters:
info - Extended level/block information

prepareForSave

protected MapObjectContainerInterface prepareForSave(MapObjectContainerInterface blocks)
Prepare the map container for save

Parameters:
blocks - The map container with all the blocks
Returns:
The new or unmodified map container which should be saved

saveButton

protected void saveButton(MapObjectContainerInterface blocks)
Description copied from class: MapEditor
Called when the standard save button is pressed, the current blocks in the map area should be saved to the map

Overrides:
saveButton in class MapEditor
Parameters:
blocks - The blocks in the map area

prepareAfterLoad

protected MapObjectContainerInterface prepareAfterLoad(MapObjectContainerInterface blocks)
Prepare the map container after loading new map data

Parameters:
blocks - The map container with all the blocks
Returns:
The new or unmodified map container which should be used

loadButton

protected void loadButton()
Description copied from class: MapEditor
Called when the standard load button is pressed, a new map should be loaded

Overrides:
loadButton in class MapEditor

updateBlocks

protected void updateBlocks()
Description copied from class: MapEditor
Update all blocks

Overrides:
updateBlocks in class MapEditor

getMapPosZ

protected int getMapPosZ()
Overrides:
getMapPosZ in class MapEditor

getLevelManager

protected abstract LevelManager getLevelManager()
Gets the level manager or create a new one if it does not already exist

Returns:
The LevelManager object which we should use

drawSelectedFrame

public void drawSelectedFrame(Graphics g,
                              MapObjectInterface selectedBlock)
Specified by:
drawSelectedFrame in class MapEditor

drawHoveringFrame

public void drawHoveringFrame(Graphics g,
                              int posX,
                              int posY)
Specified by:
drawHoveringFrame in class MapEditor


Copyright © 2003-2006 Erland Isaksson. All Rights Reserved.