started gui
This commit is contained in:
parent
0ae6adc481
commit
6efc71e646
4
.project
4
.project
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>assignment_2</name>
|
<name>app</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
</natures>
|
</natures>
|
||||||
<filteredResources>
|
<filteredResources>
|
||||||
<filter>
|
<filter>
|
||||||
<id>1675021093357</id>
|
<id>1675085397960</id>
|
||||||
<name></name>
|
<name></name>
|
||||||
<type>30</type>
|
<type>30</type>
|
||||||
<matcher>
|
<matcher>
|
||||||
|
|
|
||||||
51
pom.xml
51
pom.xml
|
|
@ -1,20 +1,25 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.r0r5chach</groupId>
|
||||||
<groupId>org.r0r5chach</groupId>
|
<artifactId>app</artifactId>
|
||||||
<artifactId>assignment_2</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>17</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-controls</artifactId>
|
||||||
|
<version>17.0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-fxml</artifactId>
|
||||||
|
<version>17.0.0.1</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
|
@ -27,5 +32,29 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.0</version>
|
||||||
|
<configuration>
|
||||||
|
<release>17</release>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.openjfx</groupId>
|
||||||
|
<artifactId>javafx-maven-plugin</artifactId>
|
||||||
|
<version>0.0.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>default-cli</id>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.r0r5chach.App</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
/**
|
/**
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
|
@ -11,11 +11,11 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
import org.r0r5chach.r6.R6Attacker;
|
import com.r0r5chach.r6.R6Attacker;
|
||||||
import org.r0r5chach.r6.R6Defender;
|
import com.r0r5chach.r6.R6Defender;
|
||||||
import org.r0r5chach.r6.R6Player;
|
import com.r0r5chach.r6.R6Player;
|
||||||
import org.r0r5chach.valorant.ValorantAgent;
|
import com.r0r5chach.valorant.ValorantAgent;
|
||||||
import org.r0r5chach.valorant.ValorantPlayer;
|
import com.r0r5chach.valorant.ValorantPlayer;
|
||||||
|
|
||||||
|
|
||||||
public class CompetitorList {
|
public class CompetitorList {
|
||||||
|
|
@ -164,7 +164,7 @@ public class CompetitorList {
|
||||||
FileWriter report = null;
|
FileWriter report = null;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
path = Path.of("src/main/resources/report"+count+ ".txt");
|
path = Path.of("src/main/resources/com/r0r5chach/report"+count+ ".txt");
|
||||||
exists = Files.exists(path);
|
exists = Files.exists(path);
|
||||||
|
|
||||||
if(exists) {
|
if(exists) {
|
||||||
|
|
@ -201,7 +201,7 @@ public class CompetitorList {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String reportTemplate() throws IOException {
|
private String reportTemplate() throws IOException {
|
||||||
return Files.readString(Path.of("src/main/resources/report.template"));
|
return Files.readString(Path.of("src/main/resources/com/r0r5chach/report.template"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.r0r5chach;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
|
||||||
|
public class Main extends Application {
|
||||||
|
private static Scene scene;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage stage) throws IOException {
|
||||||
|
scene = new Scene(loadFXML("main"), 640, 480);
|
||||||
|
stage.setScene(scene);
|
||||||
|
stage.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setRoot(String fxml) throws IOException {
|
||||||
|
scene.setRoot(loadFXML(fxml));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Parent loadFXML(String fxml) throws IOException {
|
||||||
|
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource(fxml + ".fxml"));
|
||||||
|
return fxmlLoader.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
launch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.r0r5chach;
|
||||||
|
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.ListView;
|
||||||
|
|
||||||
|
public class MainController {
|
||||||
|
private CompetitorList competitors;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private ListView<Competitor> competitorsList;
|
||||||
|
public MainController() {
|
||||||
|
loadCompetitors();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadCompetitors(){
|
||||||
|
this.competitors = new Manager().getCompetitors();
|
||||||
|
this.competitorsList = new ListView<Competitor>(FXCollections.observableList(this.competitors.getCompetitors()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package org.r0r5chach;
|
package com.r0r5chach;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import static org.r0r5chach.CompetitorList.createErrorLog;
|
import static com.r0r5chach.CompetitorList.createErrorLog;
|
||||||
|
|
||||||
public class Manager {
|
public class Manager {
|
||||||
|
|
||||||
|
|
@ -23,14 +23,14 @@ public class Manager {
|
||||||
report = competitors.createReportFile();
|
report = competitors.createReportFile();
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
report = new File(createErrorLog(e, "src/main/resource/log.txt"));
|
report = new File(createErrorLog(e, "src/main/resource/com/r0r5chach/log.txt"));
|
||||||
}
|
}
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
File valorantPlayers = new File("src/main/resources/valorantPlayers.txt");
|
File valorantPlayers = new File("src/main/resources/com/r0r5chach/valorantPlayers.txt");
|
||||||
File r6Players = new File("src/main/resources/r6Players.txt");
|
File r6Players = new File("src/main/resources/com/r0r5chach/r6Players.txt");
|
||||||
try {
|
try {
|
||||||
competitors = new CompetitorList();
|
competitors = new CompetitorList();
|
||||||
competitors.readCompetitors(valorantPlayers);
|
competitors.readCompetitors(valorantPlayers);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class that defines a name and it's parts
|
* Class that defines a name and it's parts
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach;
|
package com.r0r5chach;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach.r6;
|
package com.r0r5chach.r6;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach.r6;
|
package com.r0r5chach.r6;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package org.r0r5chach.r6;
|
package com.r0r5chach.r6;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.r0r5chach.Competitor;
|
import com.r0r5chach.Competitor;
|
||||||
import org.r0r5chach.Name;
|
import com.r0r5chach.Name;
|
||||||
import org.r0r5chach.Rank;
|
import com.r0r5chach.Rank;
|
||||||
|
|
||||||
public class R6Player extends Competitor{
|
public class R6Player extends Competitor{
|
||||||
private R6Attacker favoriteAttacker;
|
private R6Attacker favoriteAttacker;
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package org.r0r5chach.valorant;
|
package com.r0r5chach.valorant;
|
||||||
|
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package org.r0r5chach.valorant;
|
package com.r0r5chach.valorant;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.r0r5chach.Competitor;
|
import com.r0r5chach.Competitor;
|
||||||
import org.r0r5chach.Name;
|
import com.r0r5chach.Name;
|
||||||
import org.r0r5chach.Rank;
|
import com.r0r5chach.Rank;
|
||||||
/**
|
/**
|
||||||
* Class that defines the various attributes and methods associated with a Valorant Player
|
* Class that defines the various attributes and methods associated with a Valorant Player
|
||||||
* @author r0r5chach
|
* @author r0r5chach
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
module com.r0r5chach {
|
||||||
|
requires transitive javafx.graphics;
|
||||||
|
|
||||||
|
requires javafx.controls;
|
||||||
|
requires javafx.fxml;
|
||||||
|
|
||||||
|
opens com.r0r5chach to javafx.fxml;
|
||||||
|
exports com.r0r5chach;
|
||||||
|
}
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
package org.r0r5chach;
|
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
|
|
||||||
public class Main {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Manager manager = new Manager();
|
|
||||||
try {
|
|
||||||
System.out.println(Files.readString(manager.getReport().toPath()));
|
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
System.out.println("reading error");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.ListView?>
|
||||||
|
<?import javafx.scene.control.SplitPane?>
|
||||||
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
|
|
||||||
|
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
|
<children>
|
||||||
|
<SplitPane dividerPositions="0.29797979797979796" prefHeight="452.0" prefWidth="600.0">
|
||||||
|
<items>
|
||||||
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0">
|
||||||
|
<children>
|
||||||
|
<ListView fx:id="competitors" prefHeight="398.0" prefWidth="175.0" />
|
||||||
|
</children>
|
||||||
|
</AnchorPane>
|
||||||
|
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0" />
|
||||||
|
</items>
|
||||||
|
</SplitPane>
|
||||||
|
</children>
|
||||||
|
</VBox>
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
package com.r0r5chach;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.Main;
|
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
package com.r0r5chach;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.Manager;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
package com.r0r5chach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.Name;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
package com.r0r5chach;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.Rank;
|
|
||||||
|
|
||||||
|
|
||||||
public class RankTest {
|
public class RankTest {
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
|
package com.r0r5chach;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.valorant.ValorantAgent;
|
import com.r0r5chach.valorant.ValorantAgent;
|
||||||
|
|
||||||
public class ValorantAgentTest {
|
public class ValorantAgentTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -1,9 +1,8 @@
|
||||||
|
package com.r0r5chach;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.r0r5chach.Name;
|
import com.r0r5chach.valorant.ValorantAgent;
|
||||||
import org.r0r5chach.Rank;
|
import com.r0r5chach.valorant.ValorantPlayer;
|
||||||
import org.r0r5chach.valorant.ValorantAgent;
|
|
||||||
import org.r0r5chach.valorant.ValorantPlayer;
|
|
||||||
public class ValorantPlayerTest {
|
public class ValorantPlayerTest {
|
||||||
@Test
|
@Test
|
||||||
public void valorantPlayerTest() {
|
public void valorantPlayerTest() {
|
||||||
Loading…
Reference in New Issue