Package com.starpoints.editor
Class StarpointEditor
- java.lang.Object
-
- com.starpoints.game.Game
-
- com.starpoints.editor.StarpointEditor
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Runnable
public class StarpointEditor extends Game implements java.lang.Runnable
The Starpoint level editor. Extends Game for directly providing test mode.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.starpoints.game.Game
Game.FlashState
-
-
Field Summary
Fields Modifier and Type Field Description protected EditorClickModeclickModeCurrent click mode (edit or mark).protected static booleanDEBUGDebug flag.protected java.lang.StringeditingEnemyCurrently selected enemy.protected java.lang.StringeditingFogCurrently selected for.protected java.lang.StringeditingItemCurrently selected item.protected booleanexitUpdateThreadFlag for keeping updater thread running.static Figure[]figureListArray of figures for editing purposes.protected java.util.HashMap<java.lang.String,Figure>figureMapMaps figure classes to corresponding editing figure.static java.lang.String[]figuresEnemy figures.static intFLASHITEM_COUNTNumber of possible initial items in FlashAnimations.static java.lang.String[]flashitemClassesItem classes available in FlashAnimations (for game entry).protected PainterfocussedPainterCurrently focussed painter.static java.lang.String[]fogsArray of fog classes.protected java.lang.String[]HELPTEXTSjava.lang.String[]itemCategoriesCategories for item selection.static java.lang.String[][]itemClassesItem classes.protected Item[][]itemListArray of items and item categories for editing purposes.protected java.util.HashMap<java.lang.String,Item>itemMapMaps item classes to the corresponding editing item.protected java.util.LinkedList<LevelChangeListener>levelChangeListenerList of levelchange event listeners.static intPLANET_COUNTNumber of flash animation planets.java.lang.String[]planetNamesPlanet names.protected PointselectedPointThe currently selected point.protected ThingselectedThingThe currently selected thing.static java.lang.String[]shopitemClassesItem classes available in shop.static java.lang.String[]soundNames-
Fields inherited from class com.starpoints.game.Game
bonusManager, controller, currentLevel, currentLevelInfo, currentState, DEBUG_ROUNDS, EXTRALIVES, FADECOUNT, finalScore, FLASH_ANIMATION_COUNT, FLASH_FADE_IN_COUNT, FLASH_FADE_OUT_COUNT, FLASH_FIGURE_COUNT, FLASH_TO_NEXT_COUNT, flashAnimationIndex, flashFx, flashOldField, flashState, fx, gameAnimation, gameInfo, gameOverState, gameOverTexts, gameRoutine, gameWinner, gotExtraLife, isUpdating, levelCount, levelEnemies, levelFigures, levelPlayers, levelSet, MAX_LEVELOVERMODE, maxStartLevel, message, mode, modeCount, playerFigures, replay, replayer, scoreEntered, selectedLevel, shop, thingNextID
-
-
Constructor Summary
Constructors Constructor Description StarpointEditor(StarpointController controller, GameInfo gameInfo)Creates a new StarpointEditor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlashInfoaddFlashAnimationText(java.lang.String text, int xpos, int ypos, double factor, int color)Adds the given text to the FlashAnimationInfo.voidaddLevelChangeListener(LevelChangeListener listener)FlashInfoaddSelectedFlashImageIndex(int xpos, int ypos, double factor)Adds the selected flash image to the FlashAnimationInfo.voidconfirm()Call to confirm confirm questionprotected voidcreateAndPlaceEnemyFigures(LevelInfo li, java.util.List<Figure> figures, Field field, java.util.List<java.lang.Integer> ids)Initializes the enemy figures for a new level and places tham.voidcreateFigures()Creates the editor figures.voidcreateFogs()Initializes the fog classes.voidcreateNewLevelSet()Creates a new level set.GameStatecreateState()Creates a GameState object representing the current state of the game.voiddeleteLevel()Deletes the currently selected level.EnemyInfofindEnemyInfo(Point p)Finds the enemy info for an enemy on the given point.FlashInfofindFlashInfo(int xpos, int ypos)Searches for a planet image or text at the given coordinates.ItemInfofindItemInfo(Point p)Finds the item info for an item on the given point.ItemInfofindItemInfo(PointState p)Finds the item info for an item on the given point.FlashInfofindPlanetFlashInfo(int xpos, int ypos)Searches for a planet image at the given coordinates.ItemInfofindRandomItemInfo(java.lang.String simpleName)Returns the random item info for the given classname in the currently selected LevelInfo.intfindSoundIndex(java.lang.String search)Finds the search string (or ones beginning with this string) index in the soundNames array.FlashInfofindTextFlashInfo(int xpos, int ypos)Searches for a text at the given coordinates.protected voidfireLevelSetChangedEvent()Fires a level set change event.EditorClickModegetClickMode()Gets the current click mode.intgetEditingColor()java.lang.StringgetEditingEnemy()Gets the selected Enemy.java.lang.StringgetEditingFog()java.lang.StringgetEditingItem()EditingModegetEditingMode()Gets the current editing mode.FlashAnimationInfogetFlashAnimationInfo()Gets the current FlashAnimationInfo.ItemgetFlashAnimationItem(int index)Gets the flash animation item for the given index.PaintergetFocussedPainter()Gets the currently focussed editor painter.java.lang.StringgetHelpText()ItemgetItemForClassname(java.lang.String className)Gets the item for the given class name.Item[][]getItemList()Gets the array of shop items.LevelInfogetLevelInfo()Gets the (normal) current LevelInfo.protected java.io.InputStreamgetLevelInputStream()Gets the InputStream for reading level information.protected java.lang.StringgetLevelResourceName()Gets the resource name for the LevelIni-File.LevelSetgetLevelSet()Gets the LevelSet.FileManagergetLevelSetManager()Gets the level set manager.ShopItemInfogetOrCreateShopItem(int itemIndex)Gets or creates a new ShopItemInfo for the given item index (referring to StarpointEditor.shopItems).java.lang.StringgetPlanetImage(int index)Gets the planet image for the given index.ItemInfogetSelectedFlashAnimationItem()intgetSelectedFlashImageIndex()Gets the selected flash image index.PointgetSelectedPoint()Gets the currently selected point.ShopItemInfogetSelectedShopItem()Gets the currently selected ShopItemInfo.ThinggetSelectedThing()Gets the currently selected Thing.ShopInfogetShopInfo()Gets the current ShopInfo.ItemgetShopItemForClassname(java.lang.String className)Gets the shop item for the given class name.booleanhasFixedItem(Point p)Checks, if the point has a fixed item on it.booleanhasFixedItem(PointState p)Checks, if the point has a fixed item on it.protected voidinitializeFlashAnimationInfo(FlashAnimationInfo currentLevelInfo)Initializes the flash animation with the given FlashAnimationInfo.voidinitializeLevelSet()Initializes the LevelSet from the Level ini file.protected voidinitializePlayerLists()protected ShopinitializeShop(ShopInfo si)(Re-)Initializes the shop with the given ShopInfo.voidinsertCopyLevel()Inserts a copy of the current level or shop.voidinsertFlashAnimation()Inserts a new FlashAnimation (by copying the initialization info from the previous one).protected voidinsertLevelInfo(AbstractLevelInfo levelInfo)Inserts a new LevelInfo behind the currently selected and selects it.voidinsertNewLevel()Inserts a new level.voidinsertShop()Inserts a new shop.booleanisFlashTextInfo(FlashInfo selectedFlashInfo)Checks, if the given FlashInfo is in the list of text infos of the current FlashAnimationInfo.booleanisHasUnsavedChanges()booleanisInitialized()booleanisRandomPoint(PointState p)booleanisSelectingLevelSet()Checks, if level set selection is active.booleanisShowingHelp()booleanisShowingThingProps()Checks, if a thing properties of selected thing or shop item should be shown.booleanisWaitingForConfirm()Checks if editor is waiting for confirm answer.voidloadLevelSet(java.lang.String filename, java.lang.String info)Loads a level set from the given file and quits the level selection mode.voidpointClicked(Point p, boolean mouse1)Handles a mouse click on a field editor point.voidquitEditor()Quits the editor (stops the update timer).voidquitLevelSetSelection()Quits the levelset selection.voidreinitialize()Reinitializes the Editor levelbooleanremoveFlashImageOrText(int xpos, int ypos)Removes a flash image or text at the given position from the FlashAnimationInfo.voidremoveLevelChangeListener(LevelChangeListener listener)voidremoveShopInfoItem(int itemIndex)voidresetLevel()Resets the current level or shop or animation to the state when starting editing it.StarpointEditorrestart()Restarts the editor (restarts the update timer).voidrun()Frequently updates the field if a normal level is edited.booleansaveLevelSet()Saves the current state of the edited level set to the file "customLevel.ini".voidselectLevel(int n)Steps to the level.protected voidselectLevelInternal()Internally handles level selection.voidselectNextLevel()Steps fore to the previous level.voidselectPreviousLevel()Steps back to the previous level.voidsetClickMode(EditorClickMode clickMode)Sets the ClickMode.voidsetEditingColor(int editingColor)voidsetEditingEnemy(java.lang.String editingEnemy)Sets the selected Enemy.voidsetEditingFog(java.lang.String editingFog)voidsetEditingItem(java.lang.String editingItem)voidsetEditingMode(EditingMode editingMode)Sets the current editing mode.voidsetFocussedPainter(Painter focussedPainter)Sets the currently focussed editor painter.voidsetSelectedFlashAnimationItem(ItemInfo i)voidsetSelectedFlashAnimationItemProperties(int energy, int maxEnergy)voidsetSelectedFlashImageIndex(int selectedFlashImageIndex)Sets the selected flash image index.voidsetSelectedPoint(Point selectedPoint)Sets the selected point (and as well selects anything on this point.)voidsetSelectedShopItem(ShopItemInfo shopItem)voidsetSelectedShopItemProperties(int price, int energy, int maxEnergy, int maxCond)Applies the properties to the currently selected shop item (and to the currently edited shop info.).voidsetSelectedThing(Item item)voidsetSelectedThingProperties(int energy, int maxEnergy)Sets energy and maxenergy for the selected thing.voidsetUnsavedChanges()Sets unsaved changes to true.voidshowHelp()Shows help or switches to the next help page.voidstartLevelSetSelection()Starts selection of saved level sets.protected voidswitchLevelAfterLevelOver()Switches to the next levels flash effect after all level over messages are shown.protected booleanswitchToNextLevel()Switches to the next level.voidtestGame()Starts a test game with the currently selected level.voidunconfirm()Call to cancel confirm question-
Methods inherited from class com.starpoints.game.Game
adjustPlayerForLevel, allAlive, canEnterScoreList, clearLevelItems, createAndPlacePlayerFigures, createFigureFromInfo, createGameStateReplay, createItem, createItem, createPlayerFigure, currentLevelHasFlashAnimation, determineGameWinner, determineLevelOverMessages, determineLevelOverString, determineLevelWinner, determineNextExtraLifeCount, displayMessage, fillGameState, findAndPlaceEnemy, findEnemyInfoForClassName, findPreviousFlashAnimationInfo, finishFlashAnimation, finishLevelSelection, gameFinishAnimation, gameOver, getAnimationInfo, getBonusManager, getController, getCurrentLevelInfo, getCurrentState, getDefaultExplosionRadius, getEffects, getEnemyCount, getField, getFlashAnimationIndex, getFlashAnimationInfos, getFlashAnimationSound, getGameInfo, getGameInfoFileName, getGameMode, getGameTiming, getHeatFactor, getInitialFlashInformation, getLastBonus, getLastWinner, getLevel, getLevelCount, getLevelEnemies, getLevelFigures, getLevelFinishedText, getMaxStartLevel, getMessage, getMessageColor, getOptions, getPlayerCount, getPlayers, getReplayer, getReplayTiming, getRoundCount, getSelectedLevel, getShop, getSoundFx, getStartLevel, getTiming, giveExtraLives, hideGameMessage, informReplayer, initializeFlashAnimations, initializeGameComponents, initializeNextLevel, isBackgroundFlickering, isDuringLevel, isFlashing, isGameFinished, isGameOver, isLevelOver, isShowingFigureVisisbility, isShowingFlashAnimation, isShowingReplay, isSkippable, isSteppingToNextLevel, onAfterLoad, onAfterSave, onBeforeSave, placeEnemyFigure, placeFiguresForLevel, placeFogs, placeItems, placePlayerFigure, quitReplay, readNextLevelInfo, registerThingMove, reinitFigure, replay, requestThingMoves, setController, setMaxStartLevel, setRoundCount, setState, skip, skipIntoGame, startGame, startGameFinishedFlash, startLevelOver, startReplay, stepToNextLevel, switchToLevelIntro, update
-
-
-
-
Field Detail
-
DEBUG
protected static final boolean DEBUG
Debug flag.- See Also:
- Constant Field Values
-
PLANET_COUNT
public static final int PLANET_COUNT
Number of flash animation planets.- See Also:
- Constant Field Values
-
itemCategories
public java.lang.String[] itemCategories
Categories for item selection.
-
itemClasses
public static java.lang.String[][] itemClasses
Item classes.
-
shopitemClasses
public static java.lang.String[] shopitemClasses
Item classes available in shop.
-
flashitemClasses
public static java.lang.String[] flashitemClasses
Item classes available in FlashAnimations (for game entry).
-
FLASHITEM_COUNT
public static final int FLASHITEM_COUNT
Number of possible initial items in FlashAnimations.
-
figures
public static java.lang.String[] figures
Enemy figures.
-
soundNames
public static java.lang.String[] soundNames
-
figureList
public static Figure[] figureList
Array of figures for editing purposes.
-
fogs
public static java.lang.String[] fogs
Array of fog classes.
-
itemList
protected Item[][] itemList
Array of items and item categories for editing purposes.
-
itemMap
protected java.util.HashMap<java.lang.String,Item> itemMap
Maps item classes to the corresponding editing item.
-
figureMap
protected java.util.HashMap<java.lang.String,Figure> figureMap
Maps figure classes to corresponding editing figure.
-
exitUpdateThread
protected boolean exitUpdateThread
Flag for keeping updater thread running.
-
clickMode
protected EditorClickMode clickMode
Current click mode (edit or mark).
-
levelChangeListener
protected java.util.LinkedList<LevelChangeListener> levelChangeListener
List of levelchange event listeners.
-
editingItem
protected java.lang.String editingItem
Currently selected item.
-
editingEnemy
protected java.lang.String editingEnemy
Currently selected enemy.
-
editingFog
protected java.lang.String editingFog
Currently selected for.
-
focussedPainter
protected Painter focussedPainter
Currently focussed painter.
-
selectedPoint
protected Point selectedPoint
The currently selected point.
-
selectedThing
protected Thing selectedThing
The currently selected thing.
-
planetNames
public java.lang.String[] planetNames
Planet names.
-
HELPTEXTS
protected final java.lang.String[] HELPTEXTS
-
-
Constructor Detail
-
StarpointEditor
public StarpointEditor(StarpointController controller, GameInfo gameInfo)
Creates a new StarpointEditor.- Parameters:
controller- The Controller.gameInfo- The GameInfo.
-
-
Method Detail
-
createState
public GameState createState()
Creates a GameState object representing the current state of the game.- Overrides:
createStatein classGame- Returns:
- The GameState.
-
getLevelInputStream
protected java.io.InputStream getLevelInputStream()
Gets the InputStream for reading level information.- Overrides:
getLevelInputStreamin classGame- Returns:
- A resource input string from the controller to the game infos ini file.
-
createFigures
public void createFigures()
Creates the editor figures.
-
createFogs
public void createFogs()
Initializes the fog classes.
-
initializeLevelSet
public void initializeLevelSet()
Initializes the LevelSet from the Level ini file. Replaces the GameInfos level ini file by either the first own saved level set, or starts in level set selection mode, if more than one exist.- Overrides:
initializeLevelSetin classGame
-
getLevelSetManager
public FileManager getLevelSetManager()
Gets the level set manager.- Returns:
- The LevelSet Manager
-
getLevelResourceName
protected java.lang.String getLevelResourceName()
Gets the resource name for the LevelIni-File.- Overrides:
getLevelResourceNamein classGame- Returns:
- "customLevel.ini".
-
selectPreviousLevel
public void selectPreviousLevel()
Steps back to the previous level.- Overrides:
selectPreviousLevelin classGame
-
selectNextLevel
public void selectNextLevel()
Steps fore to the previous level.- Overrides:
selectNextLevelin classGame
-
selectLevel
public void selectLevel(int n)
Steps to the level.- Parameters:
n- The level index.
-
switchToNextLevel
protected boolean switchToNextLevel()
Switches to the next level. If the last level has been reached, currentLevel is set to null and false is returned- Overrides:
switchToNextLevelin classGame- Returns:
- true, if there is a next level.
-
selectLevelInternal
protected void selectLevelInternal()
Internally handles level selection.
-
createAndPlaceEnemyFigures
protected void createAndPlaceEnemyFigures(LevelInfo li, java.util.List<Figure> figures, Field field, java.util.List<java.lang.Integer> ids)
Initializes the enemy figures for a new level and places tham.- Overrides:
createAndPlaceEnemyFiguresin classGame- Parameters:
li- The LevelInfo.figures- The list of figures to add the enemies to.field- The field.ids- A list of already placed figures ids.
-
reinitialize
public void reinitialize()
Reinitializes the Editor level
-
getLevelInfo
public LevelInfo getLevelInfo()
Gets the (normal) current LevelInfo. If a FlashAnimation or shop is currently edited, it returns the info of the last selected normal level.- Returns:
- The current orr last selected LevelInfo.
-
getFlashAnimationInfo
public FlashAnimationInfo getFlashAnimationInfo()
Gets the current FlashAnimationInfo. If no FlashAnimation is currently edited, it returns null.- Returns:
- The current FlashAnimation or null.
-
getShopInfo
public ShopInfo getShopInfo()
Gets the current ShopInfo. If no ShopInfo is currently edited, it returns null.- Returns:
- The current ShopInfo or null.
-
run
public void run()
Frequently updates the field if a normal level is edited.- Specified by:
runin interfacejava.lang.Runnable
-
getEditingMode
public EditingMode getEditingMode()
Gets the current editing mode.- Returns:
- The editing mode.
-
setEditingMode
public void setEditingMode(EditingMode editingMode)
Sets the current editing mode.- Parameters:
editingMode- The editing mode.
-
pointClicked
public void pointClicked(Point p, boolean mouse1)
Handles a mouse click on a field editor point. Either colors the point, or places an item, enemy or fog. if mouse-flag is false, the point color is randomized, or thing is removed from point.- Parameters:
p- The point.mouse1- Flag, if first mouse button was clicked.
-
setEditingColor
public void setEditingColor(int editingColor)
-
setEditingItem
public void setEditingItem(java.lang.String editingItem)
-
setSelectedThing
public void setSelectedThing(Item item)
-
setEditingFog
public void setEditingFog(java.lang.String editingFog)
-
addLevelChangeListener
public void addLevelChangeListener(LevelChangeListener listener)
-
removeLevelChangeListener
public void removeLevelChangeListener(LevelChangeListener listener)
-
getFocussedPainter
public Painter getFocussedPainter()
Gets the currently focussed editor painter.- Returns:
- The focussed painter.
-
setFocussedPainter
public void setFocussedPainter(Painter focussedPainter)
Sets the currently focussed editor painter.- Parameters:
focussedPainter- The focussed painter.
-
resetLevel
public void resetLevel()
Resets the current level or shop or animation to the state when starting editing it.
-
hasFixedItem
public boolean hasFixedItem(PointState p)
Checks, if the point has a fixed item on it.- Parameters:
p- The point.- Returns:
- true, if point contains fixed item.
-
hasFixedItem
public boolean hasFixedItem(Point p)
Checks, if the point has a fixed item on it.- Parameters:
p- The point.- Returns:
- true, if point contains fixed item.
-
findItemInfo
public ItemInfo findItemInfo(Point p)
Finds the item info for an item on the given point.- Parameters:
p- The point.- Returns:
- The item info or null, if no enemy on this point.
-
findItemInfo
public ItemInfo findItemInfo(PointState p)
Finds the item info for an item on the given point.- Parameters:
p- The point.- Returns:
- The item info or null, if no enemy on this point.
-
findEnemyInfo
public EnemyInfo findEnemyInfo(Point p)
Finds the enemy info for an enemy on the given point.- Parameters:
p- The point.- Returns:
- The enemy info or null, if no enemy on this point.
-
quitEditor
public void quitEditor()
Quits the editor (stops the update timer).
-
restart
public StarpointEditor restart()
Restarts the editor (restarts the update timer).- Returns:
- This editor.
-
getLevelSet
public LevelSet getLevelSet()
Gets the LevelSet.- Overrides:
getLevelSetin classGame- Returns:
- The LevelSet.
-
deleteLevel
public void deleteLevel()
Deletes the currently selected level.
-
insertNewLevel
public void insertNewLevel()
Inserts a new level.
-
insertCopyLevel
public void insertCopyLevel()
Inserts a copy of the current level or shop.
-
insertShop
public void insertShop()
Inserts a new shop.
-
insertFlashAnimation
public void insertFlashAnimation()
Inserts a new FlashAnimation (by copying the initialization info from the previous one).
-
insertLevelInfo
protected void insertLevelInfo(AbstractLevelInfo levelInfo)
Inserts a new LevelInfo behind the currently selected and selects it.- Parameters:
levelInfo- The LevelInfo to insert.
-
fireLevelSetChangedEvent
protected void fireLevelSetChangedEvent()
Fires a level set change event.
-
setSelectedThingProperties
public void setSelectedThingProperties(int energy, int maxEnergy)Sets energy and maxenergy for the selected thing.- Parameters:
energy- The energy.maxEnergy- The max energy.
-
findRandomItemInfo
public ItemInfo findRandomItemInfo(java.lang.String simpleName)
Returns the random item info for the given classname in the currently selected LevelInfo.- Parameters:
simpleName- The Classname.- Returns:
- The random ItemInfo for the classname, or null, if item class is not in the list of random items.
-
getEditingEnemy
public java.lang.String getEditingEnemy()
Gets the selected Enemy.- Returns:
- The Enemy.
-
setEditingEnemy
public void setEditingEnemy(java.lang.String editingEnemy)
Sets the selected Enemy.- Parameters:
editingEnemy- The Enemy.
-
getClickMode
public EditorClickMode getClickMode()
Gets the current click mode.- Returns:
- The ClickMode.
-
setClickMode
public void setClickMode(EditorClickMode clickMode)
Sets the ClickMode.- Parameters:
clickMode- The new click mode.
-
getHelpText
public java.lang.String getHelpText()
- Returns:
- the helpIndex
-
isShowingHelp
public boolean isShowingHelp()
- Returns:
- the helpIndex
-
isWaitingForConfirm
public boolean isWaitingForConfirm()
Checks if editor is waiting for confirm answer.- Returns:
- the helpIndex
-
showHelp
public void showHelp()
Shows help or switches to the next help page.
-
getSelectedThing
public Thing getSelectedThing()
Gets the currently selected Thing. Might be either a fixed item on the field or a random item.- Returns:
- The currently selected Thing.
-
getSelectedShopItem
public ShopItemInfo getSelectedShopItem()
Gets the currently selected ShopItemInfo.- Returns:
- The currently selected ShopItemInfo.
-
setSelectedShopItem
public void setSelectedShopItem(ShopItemInfo shopItem)
-
getSelectedPoint
public Point getSelectedPoint()
Gets the currently selected point.- Returns:
- The currently selected point.
-
setSelectedPoint
public void setSelectedPoint(Point selectedPoint)
Sets the selected point (and as well selects anything on this point.)- Parameters:
selectedPoint- The point to select.
-
isShowingThingProps
public boolean isShowingThingProps()
Checks, if a thing properties of selected thing or shop item should be shown.- Returns:
- true, if a thing properties of selected thing or shop item should be shown.
-
getItemList
public Item[][] getItemList()
Gets the array of shop items.- Returns:
- The item array (first index is category).
-
getItemForClassname
public Item getItemForClassname(java.lang.String className)
Gets the item for the given class name.- Parameters:
className- Item class.- Returns:
- The item.
-
getFlashAnimationItem
public Item getFlashAnimationItem(int index)
Gets the flash animation item for the given index.- Parameters:
index- Item index.- Returns:
- The item.
-
getShopItemForClassname
public Item getShopItemForClassname(java.lang.String className)
Gets the shop item for the given class name.- Parameters:
className- Item class.- Returns:
- The item.
-
getOrCreateShopItem
public ShopItemInfo getOrCreateShopItem(int itemIndex)
Gets or creates a new ShopItemInfo for the given item index (referring to StarpointEditor.shopItems).- Parameters:
itemIndex- The index.- Returns:
- The ShopItemInfo.
-
removeShopInfoItem
public void removeShopInfoItem(int itemIndex)
-
testGame
public void testGame()
Starts a test game with the currently selected level.
-
initializeShop
protected Shop initializeShop(ShopInfo si)
(Re-)Initializes the shop with the given ShopInfo.- Overrides:
initializeShopin classGame- Parameters:
si- The ShopInfo.- Returns:
- The Shop.
-
initializeFlashAnimationInfo
protected void initializeFlashAnimationInfo(FlashAnimationInfo currentLevelInfo)
Initializes the flash animation with the given FlashAnimationInfo.- Overrides:
initializeFlashAnimationInfoin classGame- Parameters:
currentLevelInfo- The FlashAnimationInfo.
-
initializePlayerLists
protected void initializePlayerLists()
-
switchLevelAfterLevelOver
protected void switchLevelAfterLevelOver()
Switches to the next levels flash effect after all level over messages are shown. Determines whether to show replay first. Otherwise, either the next level is initialized, or the game finish animation is started, if the last level is over.- Overrides:
switchLevelAfterLevelOverin classGame
-
saveLevelSet
public boolean saveLevelSet()
Saves the current state of the edited level set to the file "customLevel.ini".- Returns:
- true, if saving was successful.
-
findSoundIndex
public int findSoundIndex(java.lang.String search)
Finds the search string (or ones beginning with this string) index in the soundNames array.- Parameters:
search- The search string.- Returns:
- The first index in the array or -1, if not contained.
-
setSelectedShopItemProperties
public void setSelectedShopItemProperties(int price, int energy, int maxEnergy, int maxCond)Applies the properties to the currently selected shop item (and to the currently edited shop info.).- Parameters:
price- The Price.energy- The Energy.maxEnergy- The MaxEnergy.maxCond- The item max condition.
-
getSelectedFlashImageIndex
public int getSelectedFlashImageIndex()
Gets the selected flash image index.- Returns:
- the selectedFlashImageIndex
-
setSelectedFlashImageIndex
public void setSelectedFlashImageIndex(int selectedFlashImageIndex)
Sets the selected flash image index.- Parameters:
selectedFlashImageIndex- The selectedFlashImageIndex to set.
-
addSelectedFlashImageIndex
public FlashInfo addSelectedFlashImageIndex(int xpos, int ypos, double factor)
Adds the selected flash image to the FlashAnimationInfo.- Parameters:
xpos- The x position to place to.ypos- The y position to place to.factor- Scaling factor.- Returns:
- The created FlashInfo.
-
removeFlashImageOrText
public boolean removeFlashImageOrText(int xpos, int ypos)Removes a flash image or text at the given position from the FlashAnimationInfo.- Parameters:
xpos- The x position to remove from.ypos- The y position to remove from.- Returns:
- true, if there is an image to remove, false otherwise.
-
findFlashInfo
public FlashInfo findFlashInfo(int xpos, int ypos)
Searches for a planet image or text at the given coordinates.- Parameters:
xpos- X.ypos- Y.- Returns:
- The FlashInfo for the planet or text or null, if none found.
-
findPlanetFlashInfo
public FlashInfo findPlanetFlashInfo(int xpos, int ypos)
Searches for a planet image at the given coordinates.- Parameters:
xpos- X.ypos- Y.- Returns:
- The FlashInfo for the planet or null, if none found.
-
findTextFlashInfo
public FlashInfo findTextFlashInfo(int xpos, int ypos)
Searches for a text at the given coordinates.- Parameters:
xpos- X.ypos- Y.- Returns:
- The FlashInfo for the planet or null, if none found.
-
getPlanetImage
public java.lang.String getPlanetImage(int index)
Gets the planet image for the given index.- Parameters:
index- The index.- Returns:
- The planet image.
-
createNewLevelSet
public void createNewLevelSet()
Creates a new level set.
-
addFlashAnimationText
public FlashInfo addFlashAnimationText(java.lang.String text, int xpos, int ypos, double factor, int color)
Adds the given text to the FlashAnimationInfo.- Parameters:
text- The text.xpos- The x position to place to.ypos- The y position to place to.factor- Scaling factor.color- Text color.- Returns:
- The created FlashInfo.
-
startLevelSetSelection
public void startLevelSetSelection()
Starts selection of saved level sets.
-
isSelectingLevelSet
public boolean isSelectingLevelSet()
Checks, if level set selection is active.- Returns:
- true, if selecting level set.
-
quitLevelSetSelection
public void quitLevelSetSelection()
Quits the levelset selection.
-
loadLevelSet
public void loadLevelSet(java.lang.String filename, java.lang.String info)Loads a level set from the given file and quits the level selection mode.- Parameters:
filename- LevelSet file.info- LevelSet info.
-
isFlashTextInfo
public boolean isFlashTextInfo(FlashInfo selectedFlashInfo)
Checks, if the given FlashInfo is in the list of text infos of the current FlashAnimationInfo.- Parameters:
selectedFlashInfo- The FlashInfo.- Returns:
- true, if the given FlashInfo is in the list of text infos of the current FlashAnimationInfo.
-
getEditingColor
public int getEditingColor()
- Returns:
- the editingColor
-
getEditingFog
public java.lang.String getEditingFog()
-
getEditingItem
public java.lang.String getEditingItem()
-
getSelectedFlashAnimationItem
public ItemInfo getSelectedFlashAnimationItem()
-
setSelectedFlashAnimationItem
public void setSelectedFlashAnimationItem(ItemInfo i)
-
setSelectedFlashAnimationItemProperties
public void setSelectedFlashAnimationItemProperties(int energy, int maxEnergy)
-
isRandomPoint
public boolean isRandomPoint(PointState p)
-
isInitialized
public boolean isInitialized()
- Returns:
- the initialized
-
confirm
public void confirm()
Call to confirm confirm question
-
unconfirm
public void unconfirm()
Call to cancel confirm question
-
isHasUnsavedChanges
public boolean isHasUnsavedChanges()
- Returns:
- the hasUnsavedChanges
-
setUnsavedChanges
public void setUnsavedChanges()
Sets unsaved changes to true.
-
-