mirror of
				https://github.com/Klagarge/PokeHES.git
				synced 2025-11-04 05:09:18 +00:00 
			
		
		
		
	ok
This commit is contained in:
		@@ -23,7 +23,7 @@ public class PokeMudry extends PortableApplication {
 | 
			
		||||
    private long beginTime;
 | 
			
		||||
    private long lastMesure;
 | 
			
		||||
 | 
			
		||||
    public static boolean front_montant = false;
 | 
			
		||||
    public static boolean risingFront = false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
@@ -138,14 +138,14 @@ public class PokeMudry extends PortableApplication {
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onKeyDown(int keycode) {
 | 
			
		||||
        super.onKeyDown(keycode);
 | 
			
		||||
        front_montant = true;
 | 
			
		||||
        risingFront = true;
 | 
			
		||||
        controller.keyStatus.put(keycode, true);
 | 
			
		||||
        sp.screenManager.getActiveScreen().onKeyUp(keycode);
 | 
			
		||||
    }
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onKeyUp(int keycode) {
 | 
			
		||||
        super.onKeyUp(keycode);
 | 
			
		||||
        front_montant = false;
 | 
			
		||||
        risingFront = false;
 | 
			
		||||
        controller.keyStatus.put(keycode, false);
 | 
			
		||||
        sp.screenManager.getActiveScreen().onKeyDown(keycode);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
	public void onInit() {
 | 
			
		||||
        //display the question
 | 
			
		||||
        //generate the fonts
 | 
			
		||||
		unbuntuRegularBlack = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.BLACK);
 | 
			
		||||
		unbuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 45, Color.WHITE);
 | 
			
		||||
	}
 | 
			
		||||
@@ -41,7 +41,9 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void onGraphicRender(GdxGraphics g) {
 | 
			
		||||
		//color the background in black
 | 
			
		||||
		g.clear(Color.BLACK);
 | 
			
		||||
		//display the dialog, theenemy and the player
 | 
			
		||||
		displayDialog(g);
 | 
			
		||||
		displayEnemy(g);
 | 
			
		||||
		displayPlayer(g);
 | 
			
		||||
@@ -53,16 +55,18 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
		unbuntuRegularWhite.dispose();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//set the images for the player and the enemy
 | 
			
		||||
	public void setImg(){
 | 
			
		||||
		enemyImg = new BitmapImage(b.e.getImgBattle()); //width : 192, height : 240
 | 
			
		||||
		playerImg = new BitmapImage(b.player.getImgBattle());
 | 
			
		||||
		playerImg = new BitmapImage(b.player.getImgBattle()); //width : 192, height : 240
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	//set the battle
 | 
			
		||||
	public void setBattle(Battle battle) {
 | 
			
		||||
		this.b = battle;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//create a font with a file .ttf ,  a height and a color
 | 
			
		||||
	public BitmapFont generateFont(String file, int height, Color c ){
 | 
			
		||||
		//Generate font with the file .ttf
 | 
			
		||||
		BitmapFont font;
 | 
			
		||||
@@ -78,48 +82,38 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public void displayDialog(GdxGraphics g){
 | 
			
		||||
		//dialog background
 | 
			
		||||
		//draw the background
 | 
			
		||||
		g.drawFilledRectangle(Settings.SIDE/2, HEIGHT_DIALOG/2 + EDGE, WIDTH_DIALOG, HEIGHT_DIALOG, 0);
 | 
			
		||||
 | 
			
		||||
		//dialog
 | 
			
		||||
		//draw the dialog
 | 
			
		||||
		if(b == null) return;
 | 
			
		||||
		if(b.getLine() == null) return;
 | 
			
		||||
		g.drawString(15, 260, b.getLine(), unbuntuRegularBlack);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	public void displayEnemy(GdxGraphics g){
 | 
			
		||||
		//draw image
 | 
			
		||||
		g.drawPicture(Settings.SIDE - (192/2), Settings.SIDE-240/2, enemyImg);
 | 
			
		||||
		//draw pv
 | 
			
		||||
		g.drawString(300, Settings.SIDE - 15 , "PV : " + b.pvEnemy + " / " + b.e.getPvInit(), unbuntuRegularWhite);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  	}
 | 
			
		||||
 | 
			
		||||
	public void displayPlayer(GdxGraphics g){
 | 
			
		||||
		//draw image
 | 
			
		||||
 | 
			
		||||
		g.drawPicture((192/2), HEIGHT_DIALOG + 10 + 240/2, playerImg);
 | 
			
		||||
		//draw pv
 | 
			
		||||
		//draw pv and xp
 | 
			
		||||
		g.drawString(255, HEIGHT_DIALOG + 100 , "XP : " + b.xpPlayer + " / " + b.player.getXpMax() + "\nPV : " + b.player.getPv() + " / " + Settings.TIME*60, unbuntuRegularWhite);              
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	public void manage(Controller c, Battle battle){
 | 
			
		||||
		if(PokeMudry.front_montant){
 | 
			
		||||
 | 
			
		||||
		//add a rising front to have one impulsion
 | 
			
		||||
		if(PokeMudry.risingFront){
 | 
			
		||||
			//the enemi is attacking
 | 
			
		||||
			if( battle.getAttackOn() == false){
 | 
			
		||||
				if (c.keyStatus.get(Input.Keys.SPACE)){
 | 
			
		||||
					battle.action(-1);
 | 
			
		||||
				}
 | 
			
		||||
				if (c.keyStatus.get(Input.Keys.ENTER)){
 | 
			
		||||
					battle.screenBattleOn = battle.screenBattleOn;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//the enemi is speaking
 | 
			
		||||
			if(battle.getAttackOn() == true){
 | 
			
		||||
				if (c.keyStatus.get(Input.Keys.NUM_1)){
 | 
			
		||||
					battle.action(1);
 | 
			
		||||
@@ -132,17 +126,10 @@ public class ScreenBattle extends RenderingScreen{
 | 
			
		||||
				}
 | 
			
		||||
				else if (c.keyStatus.get(Input.Keys.NUM_4)){
 | 
			
		||||
					battle.action(4);
 | 
			
		||||
					
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			//mettre le front à false jusqu'à ce que le bouton soit relâché
 | 
			
		||||
			PokeMudry.front_montant = false;
 | 
			
		||||
			PokeMudry.risingFront = false;
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,20 +1,15 @@
 | 
			
		||||
package Screen;
 | 
			
		||||
 | 
			
		||||
import com.badlogic.gdx.Gdx;
 | 
			
		||||
import com.badlogic.gdx.Input;
 | 
			
		||||
import com.badlogic.gdx.files.FileHandle;
 | 
			
		||||
import com.badlogic.gdx.graphics.Color;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
 | 
			
		||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
 | 
			
		||||
 | 
			
		||||
import Control.Controller;
 | 
			
		||||
import Entity.Player;
 | 
			
		||||
import Game.Battle;
 | 
			
		||||
import Main.PokeMudry;
 | 
			
		||||
import Main.Settings;
 | 
			
		||||
 | 
			
		||||
import ch.hevs.gdx2d.components.bitmaps.BitmapImage;
 | 
			
		||||
import ch.hevs.gdx2d.components.screen_management.RenderingScreen;
 | 
			
		||||
import ch.hevs.gdx2d.lib.GdxGraphics;
 | 
			
		||||
 | 
			
		||||
@@ -23,16 +18,19 @@ public class ScreenEnd extends RenderingScreen{
 | 
			
		||||
    private String textEnd = null;
 | 
			
		||||
    private BitmapFont unbuntuRegularWhite;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onInit() {
 | 
			
		||||
        //generate a new font
 | 
			
		||||
        unbuntuRegularWhite = generateFont("./Data/font/Ubuntu-Regular.ttf", 30, Color.WHITE);
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    protected void onGraphicRender(GdxGraphics g) {
 | 
			
		||||
        //color the background in black
 | 
			
		||||
        g.clear(Color.BLACK);
 | 
			
		||||
 | 
			
		||||
        //display the text
 | 
			
		||||
        if(textEnd != null) g.drawStringCentered(Settings.SIDE/2, textEnd, unbuntuRegularWhite);
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
@@ -42,6 +40,7 @@ public class ScreenEnd extends RenderingScreen{
 | 
			
		||||
		unbuntuRegularWhite.dispose();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    //set a different text if the player win or loose
 | 
			
		||||
    public void setText(Player p){
 | 
			
		||||
        if(p.getXp() >= p.getXpMax()){
 | 
			
		||||
            textEnd = "Bravo, tu as réussi ton année avec " + p.getXp()/100.0 + " crédits en " + (Settings.TIME*60-p.getPv()) + " secondes.\n\nMais, seras-tu près pour le prochain....";
 | 
			
		||||
@@ -51,7 +50,7 @@ public class ScreenEnd extends RenderingScreen{
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //create a font with a file .ttf ,  a height and a color
 | 
			
		||||
    public BitmapFont generateFont(String file, int height, Color c ){
 | 
			
		||||
		//Generate font with the file .ttf
 | 
			
		||||
		BitmapFont font;
 | 
			
		||||
 
 | 
			
		||||
@@ -30,10 +30,12 @@ public class Attack {
 | 
			
		||||
        return attack+ "  " + answer1+ "  " + answer2+ "  " + answer3+ "  " + answer4+ "  " + xp;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //return the answer with teh number i in the array s
 | 
			
		||||
    public String getAnswer(int i){
 | 
			
		||||
        return s[i];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //return the true answer to verify the answer of the player
 | 
			
		||||
    public String getTrueAnswer(){
 | 
			
		||||
        return answer1;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -12,13 +12,10 @@ public class FightData {
 | 
			
		||||
    private  File file;
 | 
			
		||||
    private static String regex = ";";
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public int nbre_line =0;
 | 
			
		||||
 | 
			
		||||
    public FightData(String branch) {
 | 
			
		||||
        file = new File("./Data/Battle/Fight/" + branch + ".csv");
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void readFile() {
 | 
			
		||||
@@ -54,7 +51,7 @@ public class FightData {
 | 
			
		||||
        return attacks;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //return the vector with one attak
 | 
			
		||||
    //return the vector with one attack
 | 
			
		||||
    public Attack getAttack(int a){
 | 
			
		||||
        return attacks.get(a);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ public class Line {
 | 
			
		||||
    public String line;
 | 
			
		||||
    public boolean attackOn;
 | 
			
		||||
 | 
			
		||||
    //in the battle screen the line is played and attack on is used by the button
 | 
			
		||||
    Line( String line, boolean attackOn){
 | 
			
		||||
        this.line = line;
 | 
			
		||||
        this.attackOn = attackOn;
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,6 @@ public class SpeechData {
 | 
			
		||||
 | 
			
		||||
    Vector<String> speechs = new Vector<String>();
 | 
			
		||||
    File file;
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    public SpeechData(String name){
 | 
			
		||||
        file = new File("./Data/Battle/Speech/" + name + ".txt");
 | 
			
		||||
@@ -18,15 +17,15 @@ public class SpeechData {
 | 
			
		||||
    
 | 
			
		||||
    public void readFile() {
 | 
			
		||||
        String line = "";
 | 
			
		||||
 | 
			
		||||
        // try to read the file of the speech of the enemy
 | 
			
		||||
        try {
 | 
			
		||||
            FileReader f = new FileReader(file, StandardCharsets.UTF_8);
 | 
			
		||||
            BufferedReader bf = new BufferedReader(f); 
 | 
			
		||||
 | 
			
		||||
            //read and add a new line in the vector speechs
 | 
			
		||||
            line = bf.readLine(); 
 | 
			
		||||
            while(line != null){
 | 
			
		||||
                
 | 
			
		||||
                speechs.add(line);
 | 
			
		||||
 | 
			
		||||
                line = bf.readLine();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -37,6 +36,7 @@ public class SpeechData {
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
    //return the element i an teh vector speechs
 | 
			
		||||
    public String getSpeechs(int i) {
 | 
			
		||||
        return speechs.elementAt(i);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,8 @@
 | 
			
		||||
package Text;
 | 
			
		||||
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
 | 
			
		||||
import Entity.Enemy;
 | 
			
		||||
import Entity.Character.Direction;
 | 
			
		||||
 | 
			
		||||
import java.text.Normalizer;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Vector;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
 | 
			
		||||
public class TextEnemy {
 | 
			
		||||
@@ -20,16 +16,6 @@ public class TextEnemy {
 | 
			
		||||
    private int[] orderAnswer;
 | 
			
		||||
 | 
			
		||||
    private Vector<int[]> currentData;
 | 
			
		||||
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
        TextEnemy t  = new TextEnemy(new Enemy("Mudry", 10, 15, "lumberjack_sheet32", "desert", 25, "informatique", Direction.NULL));
 | 
			
		||||
 | 
			
		||||
        t.generateText();
 | 
			
		||||
 | 
			
		||||
        for(Line l : t.lines) {
 | 
			
		||||
            System.out.println(l.line);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public TextEnemy(Enemy e){
 | 
			
		||||
        //generate the vector of fight
 | 
			
		||||
@@ -45,6 +31,7 @@ public class TextEnemy {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //generate a random array width different number
 | 
			
		||||
    public static int[] randomGenerate( int min, int max, int nbreRandom){
 | 
			
		||||
        //create an array with all the number I need
 | 
			
		||||
        int[] a = new int[max-min+1];
 | 
			
		||||
@@ -79,21 +66,23 @@ public class TextEnemy {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //generate the text who is displays in battle screen
 | 
			
		||||
    public void generateText(){
 | 
			
		||||
        int i =1;
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        //introduction line
 | 
			
		||||
        String introduction = formatLine(speechData.getSpeechs(0), CUT);
 | 
			
		||||
        lines.add(new Line(introduction, false));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        //generate a random array for determin the order of the attack
 | 
			
		||||
        orderAttack = randomGenerate(0, fightData.nbre_line-1, 4);
 | 
			
		||||
 | 
			
		||||
        //go trough which attack 
 | 
			
		||||
        for(int j=0; j<4;j++){
 | 
			
		||||
            int[] currentRandom = new int[5];
 | 
			
		||||
            currentRandom[0] = orderAttack[j];
 | 
			
		||||
 | 
			
		||||
            //generate the order of the answer
 | 
			
		||||
            //generate a random array to determin the order of the answer
 | 
			
		||||
            orderAnswer = randomGenerate(0, 3, 4);
 | 
			
		||||
 | 
			
		||||
            //save the order of answer and attack
 | 
			
		||||
@@ -111,13 +100,15 @@ public class TextEnemy {
 | 
			
		||||
            //attack and answer (number on vector : 1-4) 
 | 
			
		||||
            lines.add(new Line(attack + "\n" +answer1 + "\n" + answer2 + "\n" + answer3 + "\n" + answer4, true));
 | 
			
		||||
 | 
			
		||||
            
 | 
			
		||||
            //save the order of the answer
 | 
			
		||||
            currentData.add(currentRandom);
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        /* 
 | 
			
		||||
        for(int[] a : currentData){
 | 
			
		||||
            System.out.println(Arrays.toString(a));
 | 
			
		||||
        }
 | 
			
		||||
        */
 | 
			
		||||
 | 
			
		||||
        //finish (win and death)
 | 
			
		||||
        String dead = formatLine(speechData.getSpeechs(5),CUT);
 | 
			
		||||
@@ -126,11 +117,12 @@ public class TextEnemy {
 | 
			
		||||
        lines.add(new Line(alive, false));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    //get the saved order of the attacks and answer
 | 
			
		||||
    public Vector<int[]> getCurrentData() {
 | 
			
		||||
        return currentData;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    //format a String with a specific length of char
 | 
			
		||||
    public String formatLine(String line, int cut){
 | 
			
		||||
 | 
			
		||||
        String cutLine = "";
 | 
			
		||||
@@ -139,20 +131,20 @@ public class TextEnemy {
 | 
			
		||||
        int startC = 0;
 | 
			
		||||
        int stoppC = cut;
 | 
			
		||||
        
 | 
			
		||||
        //check if the line is shorter than the character limit 
 | 
			
		||||
        if(cut>line.length()-1){
 | 
			
		||||
            newLine  =line;
 | 
			
		||||
        }
 | 
			
		||||
        else{
 | 
			
		||||
            
 | 
			
		||||
            //create a array with the line
 | 
			
		||||
            char[] c = new char[line.length()];
 | 
			
		||||
 | 
			
		||||
            for(int i=0; i<c.length;i++){
 | 
			
		||||
                c[i] = line.charAt(i);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
            while(true){
 | 
			
		||||
                //cut the line only if there is a space
 | 
			
		||||
                for(int i =stoppC; i>=startC; i--){
 | 
			
		||||
                    if(c[i] == ' '){
 | 
			
		||||
                        stoppC = i;
 | 
			
		||||
@@ -163,17 +155,19 @@ public class TextEnemy {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //découper le mot 
 | 
			
		||||
                //cut the line
 | 
			
		||||
                for(int i=startC;i<=stoppC;i++){
 | 
			
		||||
                    cutLine += c[i];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //rebuild the line with the line breaks
 | 
			
		||||
                newLine +=  cutLine+"\n";
 | 
			
		||||
                cutLine = "";
 | 
			
		||||
 | 
			
		||||
                //increase the start of the cut
 | 
			
		||||
                startC = stoppC + 1;
 | 
			
		||||
 | 
			
		||||
                
 | 
			
		||||
                //check if we can cut with the number specific or if it is shorter or it is finished
 | 
			
		||||
                if(c.length-1-stoppC <=0){
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,107 +0,0 @@
 | 
			
		||||
 | 
			
		||||
import Text.*;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.ListIterator;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
import java.util.RandomAccess;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class testYann{
 | 
			
		||||
    public static void main(String[] args) {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        String text = "aaaaaa aaaaaa\naaaaaa aaaaaa";
 | 
			
		||||
        String newText ="";
 | 
			
		||||
        String cutLine = "";
 | 
			
		||||
        String newLine = "";
 | 
			
		||||
 | 
			
		||||
        int cut = 6;
 | 
			
		||||
 | 
			
		||||
        int startC = 0;
 | 
			
		||||
        int stoppC = cut;
 | 
			
		||||
 | 
			
		||||
        String[] s = text.split("\n");
 | 
			
		||||
 | 
			
		||||
        for(String line : s){
 | 
			
		||||
            System.out.println(line);
 | 
			
		||||
 | 
			
		||||
            if(cut>line.length()-1){
 | 
			
		||||
                newLine  =line;
 | 
			
		||||
            }
 | 
			
		||||
            else{
 | 
			
		||||
                
 | 
			
		||||
                char[] c = new char[line.length()];
 | 
			
		||||
    
 | 
			
		||||
                for(int i=0; i<c.length;i++){
 | 
			
		||||
                    c[i] = line.charAt(i);
 | 
			
		||||
                }
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
    
 | 
			
		||||
                while(true){
 | 
			
		||||
                    for(int i =stoppC; i>=startC; i--){
 | 
			
		||||
                        if(c[i] == ' '){
 | 
			
		||||
                            stoppC = i;
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                        else if(stoppC == c.length-1){
 | 
			
		||||
                            break;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
    
 | 
			
		||||
                    //découper le mot 
 | 
			
		||||
                    for(int i=startC;i<=stoppC;i++){
 | 
			
		||||
                        cutLine += c[i];
 | 
			
		||||
                    }
 | 
			
		||||
    
 | 
			
		||||
                    newLine +=  cutLine+"\n";
 | 
			
		||||
                    cutLine = "";
 | 
			
		||||
    
 | 
			
		||||
                    startC = stoppC + 1;
 | 
			
		||||
    
 | 
			
		||||
                    
 | 
			
		||||
                    if(c.length-1-stoppC <=0){
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                    else if(c.length-1-stoppC <= cut){
 | 
			
		||||
                        stoppC = c.length-1;
 | 
			
		||||
                    }
 | 
			
		||||
                    else{
 | 
			
		||||
                        stoppC += cut;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            newText += newLine + "\n";
 | 
			
		||||
        
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
       
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        System.out.println(newText);
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
       
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user