Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Console {
- private String[] commands = new String[] {
- // All of your commands here
- },
- lines = new String[1000];
- // 1000, just b/c you probably won't top that any time soon...
- // Now for the character that will appear first on the command line, like: #
- // open EVEIL_PLANZ.txt
- private String forechar = ""; // Make it something like $, or %, or even
- // #...
- private int currentline = 1;
- private ArrayList<File> files = null;
- public Console(String init_text, ArrayList<File> files) {
- this.files = files;
- initText(init_text);
- }
- // Makes the first line of text appear, i.e. Hello, I am HAL 9000,
- // Heuristically programmed ALgorithmic computer
- public void initText(String init_text) {
- lines[0] = init_text;
- currentline++;
- }
- // Should be input by something. Something that you can do.
- public void enter(String command) {
- for(String tempcommand : commands)
- if()//Check if the command matches any in database
- //Do whatever you want that command to do, like, openFile()
- //Move up on the current line!
- currentline++;
- lines[currentline] = forechar;
- }
- // Render all of the lines! Should be called by computer entity or something
- // lower in the hierarchy...
- public void renderScreen() {
- }
- //Used to open a file...
- public void openFile(File file) {
- lines[currentline] = "FILE DUMP: " + file.getContents();
- }
- // Basically just a file that you can open.
- private class File {
- private String contents = "UNEDITED";
- public File(String contents) {
- this.contents = contents;
- }
- public String getContents() {
- return contents;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement