Package fr.formiko.views
Class ViewCLI
java.lang.Object
fr.formiko.views.ViewCLI
- All Implemented Interfaces:
fr.formiko.usual.Progression,View
View Console Line Interface.
- Author:
- Hydrolien
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanLaunch action game part.booleanclose()close all the thing that need to be close after using view.booleanendActionGame(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame) Stop game and print the end menu.booleanprivate intgetActionMenu(int maxValue) Return an aviable action in a menu.private StringReturn the color depending of the status of c for playingAnt.intgetAntChoice(int[] t) Return the chosen value for ant action.private FourmiSelect an ant from playingAnt anthill.getCCase()get a CCase from the payer.transforme a String to a CCase and return it.private intgetIntBetween(int minValue, int maxValue) Return an int between minValue & maxValue.Return the value of the looked CCase.private StringAsk a save name to the user.booleanini()Initialize all the thing that need to be Initialize before using view.voidloadingMessage(String message, int percentageDone) Print a loading message.makeUserChooseOnArray(String[] array, String varName) Make user choose in a String array.booleanLoad the game load menu.booleanmenuMain()Load main menu.booleanLoad new game menu.booleanLoad the options menu.booleanpersonalise a game menu.voidPrint a message.voidmove(ObjetSurCarteAId o, CCase from, CCase to) move ObjetSurCarteAId.booleanpaint()Refrech actual view.intStop game and print the escape menu.voidpopUpMessage(String message) Print a message in a new window.popUpQuestion(String message) Print a question in a new window.booleanpopUpQuestionYN(String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a question in a new window.private voidPrint all action aviable in a menu.private voidPrint tToPrint.private voidPrint anthill of the playing ant.private voidprintMap()Print map of the actual Partie.voidsetDownloadingMessage(String message) Update downloading message.booleansetLookedCCase(CCase cc) Change the value of the loked Case.voidsetMoveMode(boolean b) Default fontion to move.voidset playing ant.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.formiko.usual.Progression
closeLauncher, iniLauncher, setButtonRetryVisible, setDownloadingValueMethods inherited from interface fr.formiko.views.View
centerOverCase, getMoveMode, isBladesEnable, makeUserChooseInt, popUpQuestionYN, popUpQuestionYN, waitForEndTurn
-
Field Details
-
scannerAnswer
-
tToPrint
-
cLIMap
-
sep
-
actionGameOn
private boolean actionGameOn
-
-
Constructor Details
-
ViewCLI
public ViewCLI()
-
-
Method Details
-
getActionGameOn
public boolean getActionGameOn()- Specified by:
getActionGameOnin interfaceView
-
ini
public boolean ini()Initialize all the thing that need to be Initialize before using view. -
close
public boolean close()close all the thing that need to be close after using view. -
paint
public boolean paint()Refrech actual view. -
actionGame
public boolean actionGame()Launch action game part.- Specified by:
actionGamein interfaceView- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
pauseActionGame
public int pauseActionGame()Stop game and print the escape menu.
This action can only be run if action game is on.- Specified by:
pauseActionGamein interfaceView- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
endActionGame
public boolean endActionGame(boolean withButton, int nextLevel, String message, GJoueur gj, boolean canResumeGame) Stop game and print the end menu.
This action can only be run if action game is on.- Specified by:
endActionGamein interfaceView- Parameters:
withButton- true if we need to add button "return to main menu" and "next level".nextLevel- the number of the next level to link to the button. -1 = no next level.message- message to print.gj- sorted player list to print.- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
setLookedCCase
Change the value of the loked Case.
We need to repaint the information about this Case.
This action can only be run if action game is on.- Specified by:
setLookedCCasein interfaceView- Returns:
- Return true if it work well. (Nothing goes wrong.)
-
getLookedCCase
Return the value of the looked CCase.
This action can only be run if action game is on and cLIMap have been created.- Specified by:
getLookedCCasein interfaceView- Returns:
- lookedCCase.
-
getCCase
get a CCase from the payer.
It read Strings like this: "b13", "2c"
This action can only be run if action game is on. -
getAntChoice
public int getAntChoice(int[] t) Return the chosen value for ant action.
This action can only be run if action game is on.- Specified by:
getAntChoicein interfaceView- Returns:
- Return ant choice.
-
message
Print a message.
If message.equals("") we may need to delete last message, but we don't need to print a new message. -
loadingMessage
Print a loading message.- Specified by:
loadingMessagein interfaceView- Parameters:
message- the message to print.percentageDone- the percentage of loading curently done.
-
popUpMessage
Print a message in a new window.- Specified by:
popUpMessagein interfaceView- Parameters:
message- the message to print.
-
popUpQuestion
Print a question in a new window.- Specified by:
popUpQuestionin interfaceView- Parameters:
message- the message to print.- Returns:
- the answer.
-
popUpQuestionYN
public boolean popUpQuestionYN(String message, boolean important, fr.formiko.usual.CheckFunction cf) Print a question in a new window.- Specified by:
popUpQuestionYNin interfaceView- Parameters:
message- the message to print.important- some gui action will be done if truecf- CheckFunction to use to get text, default checked & launch function- Returns:
- the answer.
-
setPlayingAnt
set playing ant.
This action can only be run if action game is on.- Specified by:
setPlayingAntin interfaceView
-
move
move ObjetSurCarteAId.
This action can only be run if action game is on.
This action do noting on view cli. -
setDownloadingMessage
Update downloading message.- Specified by:
setDownloadingMessagein interfacefr.formiko.usual.Progression
-
setMoveMode
public void setMoveMode(boolean b) Default fontion to move.- Specified by:
setMoveModein interfaceView
-
getAntFromFere
Select an ant from playingAnt anthill. -
printActionMenu
private void printActionMenu()Print all action aviable in a menu. -
printArray
private void printArray()Print tToPrint. -
printMap
private void printMap()Print map of the actual Partie. -
printFereInColor
private void printFereInColor()Print anthill of the playing ant. -
getAllyAntInColor
Return the color depending of the status of c for playingAnt.- Parameters:
c- The Creature to inspect to know if it is ally, enemy or neutral (or equals to playingAnt).
-
getActionMenu
private int getActionMenu(int maxValue) Return an aviable action in a menu.
stop stop the game. cheat alowed to write 1 cheat code. -
getIntBetween
private int getIntBetween(int minValue, int maxValue) Return an int between minValue & maxValue.
stop stop the game. cheat alowed to write 1 cheat code. -
getSaveName
Ask a save name to the user.
If nothing is choose, save will have defaultName.
Save name will be file save for every os. -
getCCaseFromString
transforme a String to a CCase and return it.
This action can only be run if action game is on.- Parameters:
s- String like this: "b13", "2c"- Returns:
- Selected CCase or null if it fail.
-
makeUserChooseOnArray
Make user choose in a String array.- Specified by:
makeUserChooseOnArrayin interfaceView- Parameters:
array- the array where to choosevarName- the name of the variable tp choose
-