Newer
Older
JumpingGame / src / main / java / entities / modelExtentions / Flags.java
package entities.modelExtentions;

import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;

public class Flags {

    private ArrayList<Integer> values = new ArrayList<>();

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    public Flags() {
        Path file = Paths.get("resources/stage.txt");
        String[] data = new String[1];

        try {
            List<String> lines = Files.readAllLines(file, Charset.forName("Shift-JIS"));

            for (int i = 0; i < lines.size(); i++) data = lines.get(i).split(",");
            for (int i = 0; i < data.length; i++) values.add(Integer.parseInt(data[i]));

        } catch (IOException e) {
            System.out.println("Failed to load stage.txt");
        }
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // getter
    public ArrayList<Integer> getValues() {
        return values;
    }
    //---------------------------------------------------------------
}