Ich dachte mir, dass es mal nützlich wäre, wenigstens ein Thema mit nützlichen Snippets für Shoebill zu haben, also einfach eure Snippets immer dazu posten.
Erstelle einen TextDraw nach GameText Style mit Timerfunktion (Animation):
https://www.youtube.com/watch?v=d_KfqeKoirM
(Credits: Video von Fynn630)
Das habe ich gestern erstellt, um mich mal mit Textdraws auseinanderzusetzen und alles ein wenig 'hübscher' (soweit es von SAMP aus möglich ist^^) zu machen, mit Transitions und Timer. Diese TextdrawObjekte kann man reaktivieren, stoppen, zurücksetzen, im Hintergrund weiterlaufen lassen, statisch, mit Transitions oder einfach nur mit Animation laufen lassen und von der Dauer der Effekte verändern.
package me.alf21.objects;
import java.util.ArrayList;
import net.gtaun.shoebill.Shoebill;
import net.gtaun.shoebill.constant.TextDrawAlign;
import net.gtaun.shoebill.constant.TextDrawFont;
import net.gtaun.shoebill.data.Color;
import net.gtaun.shoebill.object.Destroyable;
import net.gtaun.shoebill.object.Player;
import net.gtaun.shoebill.object.Textdraw;
import net.gtaun.shoebill.object.Timer;
/**
* @author Alf21
* create some styled GameTexts with timer effects visible as bar width increasing and transitions
*/
public class GameTextTD implements Destroyable {
//delay between each animation update
private final static int updateDelay = 50;
//to calculate transition
private static Color backgroundColor = new Color(255,0,0,60),
textColor = new Color(255,255,255,255),
textBackgroundColor = new Color(0,0,0,255),
barColor = new Color(255,255,255,255),
barBackgroundColor = new Color(0,0,0,150);
private Textdraw textTD,
backgroundTD,
topBarTD,
bottomBarTD,
topBarBackgroundTD,
bottomBarBackgroundTD;
private boolean destroyable,
hided,
useAnimation,
useTransition;
private int count,
milliseconds,
transitionMilliseconds;
private Player player;
private Timer timer;
/**
* create static GameTextTD Class without timer
* @param player the target
* @param text the text of TextDraw
*/
public GameTextTD(Player player, String text) {
this.player = player;
destroyable = false;
hided = false;
milliseconds = -1;
useAnimation = false;
transitionMilliseconds = 500;
useTransition = false;
createGameTextTD(text);
}
/**
* create GameTextTD Class with timer to disappear TextDraw Construction after the specified duration
* @param player the target
* @param text the text of TextDraw
* @param milliseconds the duration (MUST be bigger than the updateDelay!)
* @param useAnimation the use of animation
*/
public GameTextTD(Player player, String text, int milliseconds, boolean useAnimation) {
this(player, text);
this.milliseconds = milliseconds;
this.useAnimation = useAnimation;
if(milliseconds >= updateDelay)
initializeTimer();
}
/**
* create GameTextTD Class with timer to disappear TextDraw Construction after the specified duration and transition
* @param player the target
* @param text the text of TextDraw
* @param milliseconds the duration (MUST be bigger than the updateDelay!)
* @param useAnimation the use of animation
* @param useTransition the use of transition (alpha color effects)
*/
public GameTextTD(Player player, String text, int milliseconds, boolean useAnimation, boolean useTransition) {
this(player, text);
this.milliseconds = milliseconds;
this.useAnimation = useAnimation;
this.useTransition = useTransition;
if(milliseconds >= updateDelay)
initializeTimer();
}
/**
* create GameTextTD Class with timer to disappear TextDraw Construction after the specified duration with specified transition delay
* @param player the target
* @param text the text of TextDraw
* @param milliseconds the duration (MUST be bigger than the updateDelay!)
* @param useAnimation the use of animation
* @param transitionMilliseconds the milliseconds of transition (IMPORTANT! need to be bigger than the half of milliseconds)
*/
public GameTextTD(Player player, String text, int milliseconds, boolean useAnimation, int transitionMilliseconds) {
this(player, text);
this.milliseconds = milliseconds;
this.useAnimation = useAnimation;
this.transitionMilliseconds = transitionMilliseconds;
this.useTransition = true;
if(milliseconds >= updateDelay && milliseconds/2 >= transitionMilliseconds)
initializeTimer();
}
/**
* @return the player
*/
public Player getPlayer() {
return player;
}
/**
* to stop, resume or modify the timer / animation
* @return the timer
*/
public Timer getTimer() {
return timer;
}
/**
* to modify the text
* @return the TextDraw
*/
public Textdraw getTextdraw() {
return textTD;
}
/**
* to modify the background
* @return the backgroundTD
*/
public Textdraw getBackgroundTextdraw() {
return backgroundTD;
}
/**
* to modify the bar TextDraws
* @return the barTextdraws an ArrayList of TextDraws
*/
public ArrayList<Textdraw> getBarTextdraws() {
ArrayList<Textdraw> barTextdraws = new ArrayList<Textdraw>();
barTextdraws.add(topBarTD);
barTextdraws.add(bottomBarTD);
return barTextdraws;
}
/**
* to modify the bar background TextDraws
* @return the barBackgroundTextdraws an ArrayList of TextDraws
*/
public ArrayList<Textdraw> getBarBackgroundTextdraws() {
ArrayList<Textdraw> barBackgroundTextdraws = new ArrayList<Textdraw>();
barBackgroundTextdraws.add(topBarBackgroundTD);
barBackgroundTextdraws.add(bottomBarBackgroundTD);
return barBackgroundTextdraws;
}
/**
* @return the destroyable
*/
public boolean isDestroyable() {
return destroyable;
}
/**
* @return the hided
*/
public boolean isHided() {
return hided;
}
//The functions
/**
* hide TextDraw for player
*/
public void hide() {
hided = true;
textTD.hide(player);
topBarTD.hide(player);
bottomBarTD.hide(player);
topBarBackgroundTD.hide(player);
bottomBarBackgroundTD.hide(player);
backgroundTD.hide(player);
}
/**
* hide TextDraw for player
* @param stopTimer stop background calculation of the animation
*/
public void hide(boolean stopTimer) {
if(stopTimer && timer != null && timer.isRunning())
timer.stop();
hide();
}
/**
* show TextDraw for player
*/
public void show() {
hided = false;
backgroundTD.show(player);
topBarBackgroundTD.show(player);
bottomBarBackgroundTD.show(player);
topBarTD.show(player);
bottomBarTD.show(player);
textTD.show(player);
if(timer != null && timer.isDestroyed()) {
reset();
initializeTimer();
}
if(timer != null && !timer.isRunning()) {
timer.start();
}
}
//Advanced timer functions
/**
* initializes the Timer
*/
private void initializeTimer() {
if(milliseconds > 0) {
reset();
timer = Timer.create(updateDelay, (int) milliseconds/updateDelay, (factualInterval) -> {
Shoebill.get().runOnSampThread(() -> {
if(useAnimation) {
float factor = (int) milliseconds/updateDelay;
int transitionFactor = (int) factor;
factor = (640-20) / factor;
if(!hided) {
topBarTD.hide(player);
bottomBarTD.hide(player);
if(useTransition) {
int step = (int) transitionMilliseconds/updateDelay;
if(count <= step-1 || count == step || count >= transitionFactor-(step-2)) {
textTD.hide(player);
topBarBackgroundTD.hide(player);
bottomBarBackgroundTD.hide(player);
backgroundTD.hide(player);
if(count <= step-1) {
backgroundTD.setBoxColor(new Color(backgroundColor.getR(), backgroundColor.getG(), backgroundColor.getB(), backgroundColor.getA()*(count+1)/step));
topBarBackgroundTD.setBoxColor(new Color(barBackgroundColor.getR(), barBackgroundColor.getG(), barBackgroundColor.getB(), barBackgroundColor.getA()*(count+1)/step));
bottomBarBackgroundTD.setBoxColor(new Color(barBackgroundColor.getR(), barBackgroundColor.getG(), barBackgroundColor.getB(), barBackgroundColor.getA()*(count+1)/step));
topBarTD.setBoxColor(new Color(barColor.getR(), barColor.getG(), barColor.getB(), barColor.getA()*(count+1)/step));
bottomBarTD.setBoxColor(new Color(barColor.getR(), barColor.getG(), barColor.getB(), barColor.getA()*(count+1)/step));
textTD.setBackgroundColor(new Color(textBackgroundColor.getR(), textBackgroundColor.getG(), textBackgroundColor.getB(), textBackgroundColor.getA()*(count+1)/step));
textTD.setColor(new Color(textColor.getR(), textColor.getG(), textColor.getB(), textColor.getA()*(count+1)/step));
}
else if(count >= transitionFactor-(step-2)) {
backgroundTD.setBoxColor(new Color(backgroundColor.getR(), backgroundColor.getG(), backgroundColor.getB(), backgroundColor.getA()*(transitionFactor+1-count)/step));
topBarBackgroundTD.setBoxColor(new Color(barBackgroundColor.getR(), barBackgroundColor.getG(), barBackgroundColor.getB(), barBackgroundColor.getA()*(transitionFactor+1-count)/step));
bottomBarBackgroundTD.setBoxColor(new Color(barBackgroundColor.getR(), barBackgroundColor.getG(), barBackgroundColor.getB(), barBackgroundColor.getA()*(transitionFactor+1-count)/step));
topBarTD.setBoxColor(new Color(barColor.getR(), barColor.getG(), barColor.getB(), barColor.getA()*(transitionFactor+1-count)/step));
bottomBarTD.setBoxColor(new Color(barColor.getR(), barColor.getG(), barColor.getB(), barColor.getA()*(transitionFactor+1-count)/step));
textTD.setBackgroundColor(new Color(textBackgroundColor.getR(), textBackgroundColor.getG(), textBackgroundColor.getB(), textBackgroundColor.getA()*(transitionFactor+1-count)/step));
textTD.setColor(new Color(textColor.getR(), textColor.getG(), textColor.getB(), textColor.getA()*(transitionFactor+1-count)/step));
}
else if(count == step) {
backgroundTD.setBoxColor(backgroundColor);
topBarBackgroundTD.setBoxColor(barBackgroundColor);
bottomBarBackgroundTD.setBoxColor(barBackgroundColor);
topBarTD.setBoxColor(barColor);
bottomBarTD.setBoxColor(barColor);
textTD.setBackgroundColor(textBackgroundColor);
textTD.setColor(textColor);
}
backgroundTD.show(player);
topBarBackgroundTD.show(player);
bottomBarBackgroundTD.show(player);
textTD.show(player);
}
}
topBarTD.setTextSize(0, 20+count*factor);
bottomBarTD.setTextSize(0, 20+count*factor);
topBarTD.show(player);
bottomBarTD.show(player);
}
}
if(count == (int) milliseconds/updateDelay) {
reset();
destroyable = true;
}
else count++;
});
});
}
}
/**
* reset the data for timer
*/
private void reset() {
hide(false);
count = 1;
if(useAnimation) {
if(useTransition) {
int i = (int) transitionMilliseconds/updateDelay;
backgroundTD.setBoxColor(new Color(backgroundColor.getR(), backgroundColor.getG(), backgroundColor.getB(), backgroundColor.getA()/i));
topBarBackgroundTD.setBoxColor(new Color(barBackgroundColor.getR(), barBackgroundColor.getG(), barBackgroundColor.getB(), barBackgroundColor.getA()/i));
bottomBarBackgroundTD.setBoxColor(new Color(barBackgroundColor.getR(), barBackgroundColor.getG(), barBackgroundColor.getB(), barBackgroundColor.getA()/i));
topBarTD.setBoxColor(new Color(barColor.getR(), barColor.getG(), barColor.getB(), barColor.getA()/i));
bottomBarTD.setBoxColor(new Color(barColor.getR(), barColor.getG(), barColor.getB(), barColor.getA()/i));
textTD.setBackgroundColor(new Color(textBackgroundColor.getR(), textBackgroundColor.getG(), textBackgroundColor.getB(), textBackgroundColor.getA()/i));
textTD.setColor(new Color(textColor.getR(), textColor.getG(), textColor.getB(), textColor.getA()/i));
}
topBarTD.setTextSize(0, 20);
bottomBarTD.setTextSize(0, 20);
}
destroyable = false;
}
//The TextDraws
/**
* create the textDraws
* @param text the text of TextDraw
*/
private void createGameTextTD(String text) {
backgroundTD = Textdraw.create(320, 177);
backgroundTD.setText("_");
backgroundTD.setAlignment(TextDrawAlign.CENTER);
backgroundTD.setBackgroundColor(Color.BLACK);
backgroundTD.setFont(TextDrawFont.get(1));
backgroundTD.setLetterSize(0.5f, 9.7f);
backgroundTD.setColor(Color.WHITE);
backgroundTD.setOutlineSize(0);
backgroundTD.setProportional(true);
backgroundTD.setUseBox(true);
backgroundTD.setBoxColor(backgroundColor);
backgroundTD.setTextSize(0, 640);
backgroundTD.setSelectable(false);
topBarBackgroundTD = Textdraw.create(320, 177);
topBarBackgroundTD.setText("_");
topBarBackgroundTD.setAlignment(TextDrawAlign.CENTER);
topBarBackgroundTD.setBackgroundColor(Color.BLACK);
topBarBackgroundTD.setFont(TextDrawFont.get(1));
topBarBackgroundTD.setLetterSize(0.5f, -0.3f);
topBarBackgroundTD.setColor(Color.WHITE);
topBarBackgroundTD.setOutlineSize(0);
topBarBackgroundTD.setProportional(true);
topBarBackgroundTD.setUseBox(true);
topBarBackgroundTD.setBoxColor(barBackgroundColor);
topBarBackgroundTD.setTextSize(0, 640);
topBarBackgroundTD.setSelectable(false);
bottomBarBackgroundTD = Textdraw.create(320, 267);
bottomBarBackgroundTD.setText("_");
bottomBarBackgroundTD.setAlignment(TextDrawAlign.CENTER);
bottomBarBackgroundTD.setBackgroundColor(Color.BLACK);
bottomBarBackgroundTD.setFont(TextDrawFont.get(1));
bottomBarBackgroundTD.setLetterSize(0.5f, -0.3f);
bottomBarBackgroundTD.setColor(Color.WHITE);
bottomBarBackgroundTD.setOutlineSize(0);
bottomBarBackgroundTD.setProportional(true);
bottomBarBackgroundTD.setUseBox(true);
bottomBarBackgroundTD.setBoxColor(barBackgroundColor);
bottomBarBackgroundTD.setTextSize(0, 640);
bottomBarBackgroundTD.setSelectable(false);
topBarTD = Textdraw.create(320, 177);
topBarTD.setText("_");
topBarTD.setAlignment(TextDrawAlign.CENTER);
topBarTD.setBackgroundColor(Color.BLACK);
topBarTD.setFont(TextDrawFont.get(1));
topBarTD.setLetterSize(0.5f, -0.3f);
topBarTD.setColor(Color.WHITE);
topBarTD.setOutlineSize(0);
topBarTD.setProportional(true);
topBarTD.setUseBox(true);
topBarTD.setBoxColor(barColor);
topBarTD.setTextSize(0, 640);
topBarTD.setSelectable(false);
bottomBarTD = Textdraw.create(320, 267);
bottomBarTD.setText("_");
bottomBarTD.setAlignment(TextDrawAlign.CENTER);
bottomBarTD.setBackgroundColor(Color.BLACK);
bottomBarTD.setFont(TextDrawFont.get(1));
bottomBarTD.setLetterSize(0.5f, -0.3f);
bottomBarTD.setColor(Color.WHITE);
bottomBarTD.setOutlineSize(0);
bottomBarTD.setProportional(true);
bottomBarTD.setUseBox(true);
bottomBarTD.setBoxColor(barColor);
bottomBarTD.setTextSize(0, 640);
bottomBarTD.setSelectable(false);
textTD = Textdraw.create(320, 214);
textTD.setText(text);
textTD.setAlignment(TextDrawAlign.CENTER);
textTD.setBackgroundColor(textBackgroundColor);
textTD.setFont(TextDrawFont.get(2));
textTD.setLetterSize(0.56f, 1.4f);
textTD.setColor(textColor);
textTD.setOutlineSize(1);
textTD.setProportional(true);
textTD.setUseBox(true);
textTD.setBoxColor(new Color(0,0,0,0));
textTD.setTextSize(89, 620);
textTD.setSelectable(false);
}
/* (non-Javadoc)
* @see net.gtaun.shoebill.object.Destroyable#destroy()
*/
@Override
public void destroy() {
if(timer != null) {
if(timer.isRunning())
timer.stop();
timer.destroy();
timer = null;
}
hide();
textTD.destroy();
bottomBarTD.destroy();
topBarTD.destroy();
bottomBarBackgroundTD.destroy();
topBarBackgroundTD.destroy();
backgroundTD.destroy();
textTD = bottomBarTD = topBarTD = backgroundTD = bottomBarBackgroundTD = topBarBackgroundTD = null;
}
/* (non-Javadoc)
* @see net.gtaun.shoebill.object.Destroyable#isDestroyed()
*/
@Override
public boolean isDestroyed() {
if(textTD != null
|| bottomBarTD != null
|| topBarTD != null
|| backgroundTD != null
|| bottomBarBackgroundTD != null
|| topBarBackgroundTD != null)
return false;
return true;
}
}
Alles anzeigen
Nutzung:
Z.B. im PlayerLifeCycleObject registieren
/**
* @param gameTextTD the gameTextTD to set
*/
public void setGameTextTD(GameTextTD gameTextTD) {
if(this.gameTextTD != null && !this.gameTextTD.isDestroyed())
this.gameTextTD.destroy();
this.gameTextTD = gameTextTD;
}
/**
* @return the gameTextTD
*/
public GameTextTD getGameTextTD() {
return gameTextTD;
}
Alles anzeigen
und dann z.B. in einer Command Object diese Commands registrieren:
@Command
@CommandHelp("/gttd")
public boolean gttd(Player player) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
GameTextTD gameTextTD = new GameTextTD(player, "Static Textdraw");
playerPlayerData.setGameTextTD(gameTextTD);
gameTextTD.show();
return true;
}
@Command
@CommandHelp("/gttd [milliseconds]")
public boolean gttd(Player player, int milliseconds) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
GameTextTD gameTextTD = new GameTextTD(player, "Animated Textdraw", milliseconds, true);
playerPlayerData.setGameTextTD(gameTextTD);
gameTextTD.show();
return true;
}
@Command
@CommandHelp("/gttdt [milliseconds]")
public boolean gttdt(Player player, int milliseconds) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
GameTextTD gameTextTD = new GameTextTD(player, "Animated Textdraw with Transitions", milliseconds, true, true);
playerPlayerData.setGameTextTD(gameTextTD);
gameTextTD.show();
return true;
}
@Command
@CommandHelp("/gttdt [milliseconds] [transitionMilliseconds]")
public boolean gttdt(Player player, int milliseconds, int transitionMilliseconds) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
GameTextTD gameTextTD = new GameTextTD(player, "Animated Textdraw with Transitions", milliseconds, true, transitionMilliseconds);
playerPlayerData.setGameTextTD(gameTextTD);
gameTextTD.show();
return true;
}
@Command
@CommandHelp("/gttdhfalse")
public boolean gttdhfalse(Player player) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
if(playerPlayerData.getGameTextTD() != null)
playerPlayerData.getGameTextTD().hide(false);
return true;
}
@Command
@CommandHelp("/gttdhtrue")
public boolean gttdhtrue(Player player) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
if(playerPlayerData.getGameTextTD() != null)
playerPlayerData.getGameTextTD().hide(true);
return true;
}
@Command
@CommandHelp("/gttds")
public boolean gttds(Player player) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
if(playerPlayerData.getGameTextTD() != null)
playerPlayerData.getGameTextTD().show();
return true;
}
@Command
@CommandHelp("/gttdh")
public boolean gttdh(Player player) {
player.sendMessage("/gttd - create, /gttdhfalse - hide, /gttdhtrue - hide, /gttds - show");
player.sendMessage("/gttdh - help, /gttdstop - stop /gttdresume - resume, /gttdt - transitions");
return true;
}
@Command
@CommandHelp("/gttdstop")
public boolean gttdstop(Player player) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
if(playerPlayerData.getGameTextTD() != null && playerPlayerData.getGameTextTD().getTimer() != null)
playerPlayerData.getGameTextTD().getTimer().stop();
return true;
}
@Command
@CommandHelp("/gttdresume")
public boolean gttdresume(Player player) {
PlayerData playerPlayerData = EventSystem.getInstance().getPlayerLifecycleHolder().getObject(player, PlayerData.class);
if(playerPlayerData.getGameTextTD() != null && playerPlayerData.getGameTextTD().getTimer() != null)
playerPlayerData.getGameTextTD().getTimer().start();
return true;
}
Alles anzeigen
//edit
Converter (SAMP Map = Shoebill Map):
Hier noch ein Converter, der SAMP Maps in ShoebillMaps ändert. Um diese Objekte dann alle zu nutzen, müsst ihr den Output in eine Methode wie zB
public ArrayList<DynamicSampObject> getObjects() packen
package me.alf21.converter;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.PrintStream;
public class SampDynamicObjectConverter2 {
public static void main(String[] args) throws Exception {
//loadObjectData("C:/Users/Username/Desktop/maps/dedust22.txt");
//change the path to your file of SAMP Objects
loadObjectData("C:/Users/Username/Desktop/maps/jail.txt");
}
public static void loadObjectData(String filename) throws Exception {
PrintStream out = new PrintStream(new FileOutputStream(filename + "-converted.txt"));
File file = new File(filename + "-converted.txt");
if(file.exists()) {
file.delete();
file.createNewFile();
}
System.setOut(out);
String str, lineText = "";
try {
File fl = new File(filename);
if (fl.exists()) {
BufferedReader br = new BufferedReader(new FileReader(fl));
boolean bool = false;
System.out.println("ArrayList<DynamicSampObject> tmpobjs = new ArrayList<DynamicSampObject>();");
System.out.println("DynamicSampObject tmpobj;");
while((lineText = br.readLine()) != null)
{
str = lineText.trim();
if (str.matches("\\b.*CreateDynamicObject\\b.*")) {
if(bool) System.out.println("tmpobjs.add(tmpobj);");
bool = true;
str = str.split("CreateDynamicObject\\(")[1];
str = str.replaceAll("\\)\\;", "");
String commentString;
try {
commentString = str.split("\\/\\/")[1];
} catch(Exception e) {
commentString = "...";
}
str = str.split("\\/\\/")[0];
String[] parts = str.split("[,]");
int modelId = Integer.parseInt(parts[0].trim());
float x = Float.parseFloat(parts[1].trim());
float y = Float.parseFloat(parts[2].trim());
float z = Float.parseFloat(parts[3].trim());
float rX = Float.parseFloat(parts[4].trim());
float rY = Float.parseFloat(parts[5].trim());
float rZ = Float.parseFloat(parts[6].trim());
System.out.println("tmpobj = DynamicSampObject.create(" + modelId + ", " +
x + "f, " +
y + "f, " +
z + "f, " +
rX + "f, " +
rY + "f, " +
rZ + "f, " +
"worldId, " +
"interiorId, " +
"streamDistance, " +
"drawDistance" +
"); //" + commentString);
}
else if (str.matches("\\b.*CreateObject\\b.*")) {
if(bool) System.out.println("tmpobjs.add(tmpobj);");
bool = true;
str = str.split("CreateObject\\(")[1];
str = str.replaceAll("\\)\\;", "");
String commentString;
try {
commentString = str.split("\\/\\/")[1];
} catch(Exception e) {
commentString = "...";
}
str = str.split("\\/\\/")[0];
String[] parts = str.split("[,]");
int modelId = Integer.parseInt(parts[0].trim());
float x = Float.parseFloat(parts[1].trim());
float y = Float.parseFloat(parts[2].trim());
float z = Float.parseFloat(parts[3].trim());
float rX = Float.parseFloat(parts[4].trim());
float rY = Float.parseFloat(parts[5].trim());
float rZ = Float.parseFloat(parts[6].trim());
System.out.println("DynamicSampObject tmpobj = DynamicSampObject.create(" + modelId + ", " +
x + "f, " +
y + "f, " +
z + "f, " +
rX + "f, " +
rY + "f, " +
rZ + "f, " +
"worldId, " +
"interiorId, " +
"streamDistance, " +
"drawDistance" +
"); //" + commentString);
}
else if(str.matches("\\b.*SetDynamicObjectMaterial\\b.*")) {
str = str.replaceAll("SetDynamicObjectMaterial\\(", "");
str = str.replaceAll("\\)\\;", "");
str = str.split("\\/\\/")[0];
String[] parts = str.split("[,]");
int materialIndex = Integer.parseInt(parts[1].trim());
int modelId = Integer.parseInt(parts[2].trim());
String txdname = parts[3].trim();
String texturename = parts[4].trim();
// java.awt.Color materialcolor = Color.parseColor(parts[5].trim()); TODO
System.out.println("tmpobj.setObjectMaterial(" + materialIndex + ", " +
modelId + ", " +
txdname + ", " +
texturename + ", " +
"new Color(0)" + //TODO
");");
/* ????
int r = (argb)&0xFF;
int g = (argb>>8)&0xFF;
int b = (argb>>16)&0xFF;
int a = (argb>>24)&0xFF;
*/
}
else {
continue;
}
}
System.out.println("tmpobjs.add(tmpobj);");
System.out.println("return tmpobjs;");
br.close();
}
} catch (Exception ex) {
System.out.println("[Fehler] Verbindung zur Datei '"+filename+"' konnte nicht hergestellt werden!");
ex.printStackTrace();
}
}
}
Alles anzeigen