Interne TexturenPakete + Test + Bilddaten hinzugefügt, veraltete externe
pakete aus Projektdatein entfernt
33
src/de/jaujau/UnitTests/TEST_TexturenpaketIntern.java
Executable file
@@ -0,0 +1,33 @@
|
|||||||
|
package de.jaujau.UnitTests;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
import java.awt.Image;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import de.jaujau.daten.TexturenpaketIntern;
|
||||||
|
|
||||||
|
class TEST_TexturenpaketIntern {
|
||||||
|
|
||||||
|
private TexturenpaketIntern paket;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void FehlerFreiesPaketLaden() {
|
||||||
|
paket = new TexturenpaketIntern("/img/texturen/standart", "TestPaket", 0);
|
||||||
|
assertTrue(paket.ladePacket());
|
||||||
|
System.out.println("Name des Texturen Paketes: " + paket.getName());
|
||||||
|
System.out.println("Level des Texturen Paketes: " + paket.getLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void TexturenAusgeben() {
|
||||||
|
paket = new TexturenpaketIntern("/img/texturen/standart", "TestPaket", 0);
|
||||||
|
assertTrue(paket.ladePacket());
|
||||||
|
Image Bilder[] = paket.getTexturen();
|
||||||
|
for(int i = 0; i < 33; i++) {
|
||||||
|
assertTrue(Bilder[i] != null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -16,13 +16,15 @@ class TEST_Texturenpakete {
|
|||||||
pakete = new Texturenpakete();
|
pakete = new Texturenpakete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void test() {
|
void InternesPaket() {
|
||||||
assertTrue(pakete.getAnzahlPakete()==0);
|
|
||||||
assertTrue(pakete.addPaket("StandartTexturenBeta3.zip"));
|
|
||||||
assertTrue(pakete.getAnzahlPakete()==1);
|
assertTrue(pakete.getAnzahlPakete()==1);
|
||||||
|
//assertTrue(pakete.addPaket("StandartTexturenBeta3.zip"));
|
||||||
|
//assertTrue(pakete.getAnzahlPakete()==2);
|
||||||
assertTrue(pakete.setAktivesPaket(0));
|
assertTrue(pakete.setAktivesPaket(0));
|
||||||
assertTrue(pakete.getAktivesPaket()==0);
|
assertTrue(pakete.getAktivesPaket()==0);
|
||||||
|
System.out.println("Test Intern");
|
||||||
System.out.println("Paket Name: " + pakete.getName(0));
|
System.out.println("Paket Name: " + pakete.getName(0));
|
||||||
System.out.println("Paket Level: " + pakete.getLevel(0));
|
System.out.println("Paket Level: " + pakete.getLevel(0));
|
||||||
for(int i = 0; i < 32; i++) {
|
for(int i = 0; i < 32; i++) {
|
||||||
@@ -30,4 +32,20 @@ class TEST_Texturenpakete {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void ExternesPaket() {
|
||||||
|
assertTrue(pakete.getAnzahlPakete()==1);
|
||||||
|
assertTrue(pakete.addPaket("StandartTexturenBeta3.zip"));
|
||||||
|
assertTrue(pakete.getAnzahlPakete()==2);
|
||||||
|
assertTrue(pakete.setAktivesPaket(1));
|
||||||
|
assertTrue(pakete.getAktivesPaket()==1);
|
||||||
|
System.out.println("Test Extern");
|
||||||
|
System.out.println("Paket Name: " + pakete.getName(1));
|
||||||
|
System.out.println("Paket Level: " + pakete.getLevel(1));
|
||||||
|
for(int i = 0; i < 32; i++) {
|
||||||
|
assertTrue(pakete.getTextur(i)!=null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -38,8 +38,8 @@ import javax.imageio.ImageIO;
|
|||||||
*/
|
*/
|
||||||
public class Texturenpaket {
|
public class Texturenpaket {
|
||||||
|
|
||||||
private String name;
|
protected String name; //Protektet weil die abgeleitet Klasse TexturenpaketIntern auf die Werte zugreifen können muss
|
||||||
private int level;
|
protected int level;
|
||||||
private final String pfad;
|
private final String pfad;
|
||||||
|
|
||||||
|
|
||||||
|
61
src/de/jaujau/daten/TexturenpaketIntern.java
Executable file
@@ -0,0 +1,61 @@
|
|||||||
|
package de.jaujau.daten;
|
||||||
|
|
||||||
|
import java.awt.Image;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Klasse für Interne Texturen Pakete deren Bilddaten sich die direkt im jar Archiv befinden
|
||||||
|
* ein Internes Paket muss NICHT geladen werden befor es genutz werden kann!
|
||||||
|
* Interne Pakete werden NICHT auf vollständigkeit geprüft!
|
||||||
|
* @author Sebastian Kacza
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TexturenpaketIntern extends Texturenpaket{
|
||||||
|
|
||||||
|
public String pfad;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Erstelt ein Neues Internes Texturenpaket
|
||||||
|
* @param Pfad Interner Pfad du den Bilddateien z.b. /img/texturen/standart
|
||||||
|
* @param Name Name des Paketes
|
||||||
|
* @param Level Minideslevel des Paketes
|
||||||
|
*/
|
||||||
|
public TexturenpaketIntern(String Pfad ,String Name, int Level) {
|
||||||
|
super(Pfad);
|
||||||
|
name = Name;
|
||||||
|
level = Level;
|
||||||
|
pfad = Pfad;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Das laden der Daten eines Internet Paket ist nicht notwendig!
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean ladePacket() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt alle Bilddatein von dem Texturenpaket als Image Array zurück
|
||||||
|
* @return Image Array der Texturen des Paketes
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Image[] getTexturen() {
|
||||||
|
Image Bilder[] = new Image[33];
|
||||||
|
for(int i = 0; i < 33; i++) {
|
||||||
|
try {
|
||||||
|
Bilder[i] = ImageIO.read(getClass().getResource(pfad +"/" + i + ".png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Bilder[i] = null;
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Bilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -16,6 +16,11 @@ public class Texturenpakete {
|
|||||||
|
|
||||||
public Texturenpakete(){
|
public Texturenpakete(){
|
||||||
TexturenpaketListe = new ArrayList<Texturenpaket>();
|
TexturenpaketListe = new ArrayList<Texturenpaket>();
|
||||||
|
|
||||||
|
//Hinzufügen eines Internen Texturenpaketes
|
||||||
|
TexturenpaketListe.add(new TexturenpaketIntern("/img/texturen/standart", "JauJau Standart Texturen Französisch", 0));
|
||||||
|
|
||||||
|
//Internes Texturenpaket als Aktiv festlegen
|
||||||
AktivesPaket = 0;
|
AktivesPaket = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
src/img/texturen/standart/0.png
Executable file
After Width: | Height: | Size: 9.4 KiB |
BIN
src/img/texturen/standart/1.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
src/img/texturen/standart/10.png
Executable file
After Width: | Height: | Size: 20 KiB |
BIN
src/img/texturen/standart/11.png
Executable file
After Width: | Height: | Size: 21 KiB |
BIN
src/img/texturen/standart/12.png
Executable file
After Width: | Height: | Size: 18 KiB |
BIN
src/img/texturen/standart/13.png
Executable file
After Width: | Height: | Size: 23 KiB |
BIN
src/img/texturen/standart/14.png
Executable file
After Width: | Height: | Size: 43 KiB |
BIN
src/img/texturen/standart/15.png
Executable file
After Width: | Height: | Size: 7.4 KiB |
BIN
src/img/texturen/standart/16.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
src/img/texturen/standart/17.png
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
src/img/texturen/standart/18.png
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
src/img/texturen/standart/19.png
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
src/img/texturen/standart/2.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
src/img/texturen/standart/20.png
Executable file
After Width: | Height: | Size: 35 KiB |
BIN
src/img/texturen/standart/21.png
Executable file
After Width: | Height: | Size: 50 KiB |
BIN
src/img/texturen/standart/22.png
Executable file
After Width: | Height: | Size: 45 KiB |
BIN
src/img/texturen/standart/23.png
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
src/img/texturen/standart/24.png
Executable file
After Width: | Height: | Size: 23 KiB |
BIN
src/img/texturen/standart/25.png
Executable file
After Width: | Height: | Size: 26 KiB |
BIN
src/img/texturen/standart/26.png
Executable file
After Width: | Height: | Size: 30 KiB |
BIN
src/img/texturen/standart/27.png
Executable file
After Width: | Height: | Size: 30 KiB |
BIN
src/img/texturen/standart/28.png
Executable file
After Width: | Height: | Size: 35 KiB |
BIN
src/img/texturen/standart/29.png
Executable file
After Width: | Height: | Size: 50 KiB |
BIN
src/img/texturen/standart/3.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
src/img/texturen/standart/30.png
Executable file
After Width: | Height: | Size: 45 KiB |
BIN
src/img/texturen/standart/31.png
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
src/img/texturen/standart/32.png
Executable file
After Width: | Height: | Size: 64 KiB |
BIN
src/img/texturen/standart/4.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
src/img/texturen/standart/5.png
Executable file
After Width: | Height: | Size: 47 KiB |
BIN
src/img/texturen/standart/6.png
Executable file
After Width: | Height: | Size: 42 KiB |
BIN
src/img/texturen/standart/7.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
src/img/texturen/standart/8.png
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
src/img/texturen/standart/9.png
Executable file
After Width: | Height: | Size: 20 KiB |