mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-27 23:07:41 +01:00
Compare commits
19 Commits
spawnchanc
...
sample-bui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d5ca15669 | ||
|
|
4571bea429 | ||
|
|
ecc9a35c69 | ||
|
|
c4d71df4b1 | ||
|
|
a13dac467a | ||
|
|
e305dfd7bf | ||
|
|
80984a43af | ||
|
|
2bc8b65264 | ||
|
|
b2584a24cc | ||
|
|
1626a8340f | ||
|
|
5fe2dfe148 | ||
|
|
abc1e7c912 | ||
|
|
317d6d4216 | ||
|
|
3628386019 | ||
|
|
ada352a02c | ||
|
|
fc0d97aa2f | ||
|
|
7451f582ce | ||
|
|
7b80bf5768 | ||
|
|
ddd98c5a8f |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,7 @@
|
|||||||
/ATCS_v*.jar
|
/ATCS_v*.jar
|
||||||
/Project
|
/Project
|
||||||
/bin
|
/bin
|
||||||
|
/packaging/tmp/
|
||||||
|
packaging/common/lib
|
||||||
|
packaging/common/ATCS.jar
|
||||||
|
packaging/ATCS_*.zip
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<jardesc>
|
<jardesc>
|
||||||
<jar path="ATContentStudio/ATCS_v0.6.19.jar"/>
|
<jar path="ATContentStudio/ATCS_v0.6.20.jar"/>
|
||||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
<options buildIfNeeded="true" compress="true" descriptionLocation="/ATContentStudio/ATCS_JAR.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||||
<selectedProjects/>
|
<selectedProjects/>
|
||||||
|
|||||||
4
build-and-run.sh
Executable file
4
build-and-run.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
export MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||||
|
export CP="lib/*:src:res:hacked-libtiled:siphash-zackehh/src/main/java/:."
|
||||||
|
javac -cp $CP ./src/com/gpl/rpg/atcontentstudio/ATContentStudio.java
|
||||||
|
java -cp $CP $MAIN_CLASS
|
||||||
2
packaging/Manifest.txt
Normal file
2
packaging/Manifest.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
!include MUI2.nsh
|
!include MUI2.nsh
|
||||||
|
|
||||||
!define VERSION "0.6.19"
|
!define VERSION "0.6.20"
|
||||||
!define TRAINER_VERSION "0.1.5"
|
!define TRAINER_VERSION "0.1.5"
|
||||||
!define JAVA_BIN "javaw"
|
!define JAVA_BIN "java"
|
||||||
|
|
||||||
Name "Andor's Trail Content Studio v${VERSION}"
|
Name "Andor's Trail Content Studio v${VERSION}"
|
||||||
OutFile "ATCS_v${VERSION}_Setup.exe"
|
OutFile "ATCS_v${VERSION}_Setup.exe"
|
||||||
@@ -88,7 +88,7 @@ Section install
|
|||||||
file "C:\AT\ATCS_source\lib\AndorsTrainer_v${TRAINER_VERSION}.jar"
|
file "C:\AT\ATCS_source\lib\AndorsTrainer_v${TRAINER_VERSION}.jar"
|
||||||
file "C:\AT\ATCS_source\lib\junit-4.10.jar"
|
file "C:\AT\ATCS_source\lib\junit-4.10.jar"
|
||||||
file "C:\AT\ATCS_source\lib\json_simple-1.1.jar"
|
file "C:\AT\ATCS_source\lib\json_simple-1.1.jar"
|
||||||
file "C:\AT\temp\ATCS_v0.6.19\ATCS_v${VERSION}.jar"
|
file "C:\AT\temp\ATCS_v0.6.20\ATCS_v${VERSION}.jar"
|
||||||
file "C:\AT\ATCS_source\lib\rsyntaxtextarea.jar"
|
file "C:\AT\ATCS_source\lib\rsyntaxtextarea.jar"
|
||||||
file "C:\AT\ATCS_source\lib\prefuse.jar"
|
file "C:\AT\ATCS_source\lib\prefuse.jar"
|
||||||
file "C:\AT\ATCS_source\lib\bsh-2.0b4.jar"
|
file "C:\AT\ATCS_source\lib\bsh-2.0b4.jar"
|
||||||
|
|||||||
18
packaging/common/ATCS.cmd
Normal file
18
packaging/common/ATCS.cmd
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set "ATCS_DIR=%~dp0"
|
||||||
|
set "MAX_MEM=512M"
|
||||||
|
set "JAVA=javaw.exe"
|
||||||
|
set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"
|
||||||
|
set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
|
||||||
|
|
||||||
|
if exist "%ENV_FILE%" (
|
||||||
|
call "%ENV_FILE%"
|
||||||
|
) else (
|
||||||
|
echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
|
||||||
|
echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
|
||||||
|
echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
|
||||||
|
echo.>>"%ENV_FILE%"
|
||||||
|
)
|
||||||
|
|
||||||
|
start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -jar "%ATCS_DIR%\ATCS.jar"
|
||||||
4
packaging/common/ATCS.env
Normal file
4
packaging/common/ATCS.env
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#MAX_MEM=512M
|
||||||
|
#JAVA=java
|
||||||
|
#JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true
|
||||||
|
|
||||||
BIN
packaging/common/ATCS.ico
Normal file
BIN
packaging/common/ATCS.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
21
packaging/common/ATCS.sh
Executable file
21
packaging/common/ATCS.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
ATCS_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
|
||||||
|
|
||||||
|
MAX_MEM=512M
|
||||||
|
|
||||||
|
JAVA=java
|
||||||
|
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
||||||
|
ENV_FILE=${ATCS_DIR}/ATCS.env
|
||||||
|
|
||||||
|
if [ -f ${ENV_FILE} ]; then
|
||||||
|
source ${ENV_FILE}
|
||||||
|
else
|
||||||
|
echo "#MAX_MEM=${MAX_MEM}" >${ENV_FILE}
|
||||||
|
echo "#JAVA=${JAVA}" >>${ENV_FILE}
|
||||||
|
echo "#JAVA_OPTS=${JAVA_OPTS}" >>${ENV_FILE}
|
||||||
|
echo "" >>${ENV_FILE}
|
||||||
|
fi
|
||||||
|
|
||||||
|
export ENV_FILE
|
||||||
|
|
||||||
|
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar ${ATCS_DIR}/ATCS.jar
|
||||||
1
packaging/package-windows.sh
Normal file
1
packaging/package-windows.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
sh ./package.sh -windows
|
||||||
84
packaging/package.sh
Executable file
84
packaging/package.sh
Executable file
@@ -0,0 +1,84 @@
|
|||||||
|
#windows or linux
|
||||||
|
if [ "$1" = "-windows" ] ; then
|
||||||
|
echo "Got '-windows' flag. Running Windows version"
|
||||||
|
LINUX=false
|
||||||
|
else
|
||||||
|
echo "No '-windows' flag. Running linux version"
|
||||||
|
LINUX=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
#read the folder this script should be in (should be the packaging folder inside the ATCS source)
|
||||||
|
PACKAGING_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
|
||||||
|
ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}")
|
||||||
|
TEMP_DIR=${PACKAGING_DIR}/tmp
|
||||||
|
echo "Packaging dir: ${PACKAGING_DIR}"
|
||||||
|
echo "ATCS_SOURCE_DIR: ${ATCS_SOURCE_DIR}"
|
||||||
|
#ATContentStudio
|
||||||
|
JAR_LOCATION="${PACKAGING_DIR}/common/ATCS.jar"
|
||||||
|
MANIFEST_LOCATION=${PACKAGING_DIR}/Manifest.txt
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "Getting version"
|
||||||
|
VERSION=$(cat ${PACKAGING_DIR}/ATCS_latest)
|
||||||
|
echo "Got version ${VERSION}"
|
||||||
|
|
||||||
|
echo "Removing tmp folder"
|
||||||
|
rm -rf ${PACKAGING_DIR}/tmp/
|
||||||
|
echo "recreating tmp folder"
|
||||||
|
mkdir ${PACKAGING_DIR}/tmp/
|
||||||
|
#ATCS_SOURCE_DIR="${PACKAGING_DIR}/.."
|
||||||
|
echo ""
|
||||||
|
#copy manifest to temp folder for editing
|
||||||
|
cp ${MANIFEST_LOCATION} ${TEMP_DIR}
|
||||||
|
MANIFEST_LOCATION=${TEMP_DIR}/Manifest.txt
|
||||||
|
|
||||||
|
#copy lib files to packaged folder?
|
||||||
|
echo 'copying lib files'
|
||||||
|
mkdir -p ${PACKAGING_DIR}/common/lib/
|
||||||
|
cp ${ATCS_SOURCE_DIR}/lib/* ${PACKAGING_DIR}/common/lib/
|
||||||
|
|
||||||
|
cd $ATCS_SOURCE_DIR
|
||||||
|
#set ClassPath variable to use in the building etc.
|
||||||
|
echo 'setting class path'
|
||||||
|
#linux needs a : as seperator while windows needs ;
|
||||||
|
if [ "$LINUX" = true ] ; then
|
||||||
|
CP="lib/*:src:hacked-libtiled:siphash-zackehh/src/main/java"
|
||||||
|
else
|
||||||
|
CP="lib/*;src;hacked-libtiled;siphash-zackehh/src/main/java"
|
||||||
|
fi
|
||||||
|
echo "ClassPath: "
|
||||||
|
echo ${CP}
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
#set build the classes
|
||||||
|
echo 'building java classes'
|
||||||
|
#javac -cp $CP *.java
|
||||||
|
javac -cp $CP ${ATCS_SOURCE_DIR}/src/com/gpl/rpg/atcontentstudio/*.java -d ${TEMP_DIR}
|
||||||
|
echo javac -cp $CP ${ATCS_SOURCE_DIR}/src/com/gpl/rpg/atcontentstudio/*.java -d ${TEMP_DIR}
|
||||||
|
echo ""
|
||||||
|
LIB_PATHS=$(find lib -name '*.jar' | paste -sd' ')
|
||||||
|
echo "LIB_PATHS: ${LIB_PATHS}"
|
||||||
|
# add all lib files to the class path in the temp Manifest
|
||||||
|
echo "Class-Path: . lib/* ${LIB_PATHS}" >>${MANIFEST_LOCATION}
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "creating jar at location: ${JAR_LOCATION}"
|
||||||
|
|
||||||
|
# create the jar file
|
||||||
|
# the command with those parameters requires this format:
|
||||||
|
# jar vmfc <Manifest file> <Jar file (target location)> <all things to add to the jar file>
|
||||||
|
# the things to add always use the whole relative path from the current dir,
|
||||||
|
# so when that is not wanted, the -C <location> thing will change to that dir
|
||||||
|
jar mfc ${MANIFEST_LOCATION} ${JAR_LOCATION} -C ${PACKAGING_DIR}/tmp/ com/gpl/rpg/atcontentstudio/ -C res . -C ${ATCS_SOURCE_DIR}/src .
|
||||||
|
|
||||||
|
echo ''
|
||||||
|
echo "Done creating jar"
|
||||||
|
|
||||||
|
if [ "$LINUX" = true ] ; then
|
||||||
|
cd ${PACKAGING_DIR}
|
||||||
|
echo "Creating archive"
|
||||||
|
tar caf "ATCS_${VERSION}.tar.gz" "common"
|
||||||
|
echo "Created archive at ${PACKAGING_DIR}/ATCS_${VERSION}.tar.gz"
|
||||||
|
else
|
||||||
|
echo "Can't create zip files on windows yet. Please pack the content of the '${PACKAGING_DIR}/common/' folder yourself"
|
||||||
|
fi
|
||||||
@@ -30,7 +30,10 @@ atcs.spritesheet.items_misc_4.category=item
|
|||||||
atcs.spritesheet.items_misc_5.category=item
|
atcs.spritesheet.items_misc_5.category=item
|
||||||
atcs.spritesheet.items_misc_6.category=item
|
atcs.spritesheet.items_misc_6.category=item
|
||||||
atcs.spritesheet.items_necklaces_1.category=item
|
atcs.spritesheet.items_necklaces_1.category=item
|
||||||
|
atcs.spritesheet.items_newb.category=item
|
||||||
|
atcs.spritesheet.items_omgeeky.category=item
|
||||||
atcs.spritesheet.items_omi2.category=item
|
atcs.spritesheet.items_omi2.category=item
|
||||||
|
atcs.spritesheet.items_phoenix01.category=item
|
||||||
atcs.spritesheet.items_reterski_1.category=item
|
atcs.spritesheet.items_reterski_1.category=item
|
||||||
atcs.spritesheet.items_rijackson_1.category=item
|
atcs.spritesheet.items_rijackson_1.category=item
|
||||||
atcs.spritesheet.items_rings_1.category=item
|
atcs.spritesheet.items_rings_1.category=item
|
||||||
@@ -42,16 +45,20 @@ atcs.spritesheet.items_weapons_2.category=item
|
|||||||
atcs.spritesheet.items_weapons_3.category=item
|
atcs.spritesheet.items_weapons_3.category=item
|
||||||
|
|
||||||
atcs.spritesheet.monsters_armor1.category=monster
|
atcs.spritesheet.monsters_armor1.category=monster
|
||||||
|
atcs.spritesheet.monsters_arulirs.category=monster
|
||||||
|
|
||||||
|
atcs.spritesheet.monsters_cats.category=monster
|
||||||
atcs.spritesheet.monsters_dogs.category=monster
|
atcs.spritesheet.monsters_dogs.category=monster
|
||||||
atcs.spritesheet.monsters_eye1.category=monster
|
atcs.spritesheet.monsters_eye1.category=monster
|
||||||
atcs.spritesheet.monsters_eye2.category=monster
|
atcs.spritesheet.monsters_eye2.category=monster
|
||||||
atcs.spritesheet.monsters_eye3.category=monster
|
atcs.spritesheet.monsters_eye3.category=monster
|
||||||
atcs.spritesheet.monsters_eye4.category=monster
|
atcs.spritesheet.monsters_eye4.category=monster
|
||||||
|
atcs.spritesheet.monsters_fatboy73.category=monster
|
||||||
atcs.spritesheet.monsters_ghost1.category=monster
|
atcs.spritesheet.monsters_ghost1.category=monster
|
||||||
|
|
||||||
atcs.spritesheet.monsters_gisons.category=monster
|
atcs.spritesheet.monsters_gisons.category=monster
|
||||||
atcs.spritesheet.monsters_guynmart.category=monster
|
atcs.spritesheet.monsters_guynmart.category=monster
|
||||||
|
|
||||||
atcs.spritesheet.monsters_insects.category=monster
|
atcs.spritesheet.monsters_insects.category=monster
|
||||||
atcs.spritesheet.monsters_karvis1.category=monster
|
atcs.spritesheet.monsters_karvis1.category=monster
|
||||||
atcs.spritesheet.monsters_karvis2.category=monster
|
atcs.spritesheet.monsters_karvis2.category=monster
|
||||||
@@ -65,9 +72,11 @@ atcs.spritesheet.monsters_man1.category=monster
|
|||||||
atcs.spritesheet.monsters_men.category=monster
|
atcs.spritesheet.monsters_men.category=monster
|
||||||
atcs.spritesheet.monsters_men2.category=monster
|
atcs.spritesheet.monsters_men2.category=monster
|
||||||
atcs.spritesheet.monsters_misc.category=monster
|
atcs.spritesheet.monsters_misc.category=monster
|
||||||
|
atcs.spritesheet.monsters_newb_1.category=monster
|
||||||
atcs.spritesheet.monsters_omi1.category=monster
|
atcs.spritesheet.monsters_omi1.category=monster
|
||||||
atcs.spritesheet.monsters_omi1_b.category=monster
|
atcs.spritesheet.monsters_omi1_b.category=monster
|
||||||
atcs.spritesheet.monsters_omi2.category=monster
|
atcs.spritesheet.monsters_omi2.category=monster
|
||||||
|
atcs.spritesheet.monsters_phoenix01.category=monster
|
||||||
atcs.spritesheet.monsters_rats.category=monster
|
atcs.spritesheet.monsters_rats.category=monster
|
||||||
atcs.spritesheet.monsters_redshrike1.category=monster
|
atcs.spritesheet.monsters_redshrike1.category=monster
|
||||||
atcs.spritesheet.monsters_rltiles1.category=monster
|
atcs.spritesheet.monsters_rltiles1.category=monster
|
||||||
@@ -79,7 +88,6 @@ atcs.spritesheet.monsters_skeleton1.category=monster
|
|||||||
atcs.spritesheet.monsters_skeleton2.category=monster
|
atcs.spritesheet.monsters_skeleton2.category=monster
|
||||||
atcs.spritesheet.monsters_snakes.category=monster
|
atcs.spritesheet.monsters_snakes.category=monster
|
||||||
atcs.spritesheet.monsters_tometik1.category=monster
|
atcs.spritesheet.monsters_tometik1.category=monster
|
||||||
atcs.spritesheet.monsters_tometik10.category=monster
|
|
||||||
atcs.spritesheet.monsters_tometik2.category=monster
|
atcs.spritesheet.monsters_tometik2.category=monster
|
||||||
atcs.spritesheet.monsters_tometik3.category=monster
|
atcs.spritesheet.monsters_tometik3.category=monster
|
||||||
atcs.spritesheet.monsters_tometik4.category=monster
|
atcs.spritesheet.monsters_tometik4.category=monster
|
||||||
@@ -88,6 +96,7 @@ atcs.spritesheet.monsters_tometik6.category=monster
|
|||||||
atcs.spritesheet.monsters_tometik7.category=monster
|
atcs.spritesheet.monsters_tometik7.category=monster
|
||||||
atcs.spritesheet.monsters_tometik8.category=monster
|
atcs.spritesheet.monsters_tometik8.category=monster
|
||||||
atcs.spritesheet.monsters_tometik9.category=monster
|
atcs.spritesheet.monsters_tometik9.category=monster
|
||||||
|
atcs.spritesheet.monsters_tometik10.category=monster
|
||||||
atcs.spritesheet.monsters_warrior1.category=monster
|
atcs.spritesheet.monsters_warrior1.category=monster
|
||||||
atcs.spritesheet.monsters_unknown.category=monster
|
atcs.spritesheet.monsters_unknown.category=monster
|
||||||
atcs.spritesheet.monsters_wraiths.category=monster
|
atcs.spritesheet.monsters_wraiths.category=monster
|
||||||
@@ -112,3 +121,12 @@ atcs.spritesheet.monsters_giantbasilisk.sizey=64
|
|||||||
atcs.spritesheet.monsters_hydra1.category=monster
|
atcs.spritesheet.monsters_hydra1.category=monster
|
||||||
atcs.spritesheet.monsters_hydra1.sizex=64
|
atcs.spritesheet.monsters_hydra1.sizex=64
|
||||||
atcs.spritesheet.monsters_hydra1.sizey=64
|
atcs.spritesheet.monsters_hydra1.sizey=64
|
||||||
|
atcs.spritesheet.monsters_newb_2.category=monster
|
||||||
|
atcs.spritesheet.monsters_newb_2.sizex=64
|
||||||
|
atcs.spritesheet.monsters_newb_2.sizey=32
|
||||||
|
atcs.spritesheet.monsters_newb_3.category=monster
|
||||||
|
atcs.spritesheet.monsters_newb_3.sizex=64
|
||||||
|
atcs.spritesheet.monsters_newb_3.sizey=64
|
||||||
|
atcs.spritesheet.monsters_newb_4.category=monster
|
||||||
|
atcs.spritesheet.monsters_newb_4.sizex=32
|
||||||
|
atcs.spritesheet.monsters_newb_4.sizey=64
|
||||||
|
|||||||
@@ -39,24 +39,24 @@ import com.gpl.rpg.atcontentstudio.ui.StudioFrame;
|
|||||||
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
|
import com.gpl.rpg.atcontentstudio.ui.WorkerDialog;
|
||||||
import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
|
import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
|
||||||
|
|
||||||
|
|
||||||
public class ATContentStudio {
|
public class ATContentStudio {
|
||||||
|
|
||||||
public static final String APP_NAME = "Andor's Trail Content Studio";
|
public static final String APP_NAME = "Andor's Trail Content Studio";
|
||||||
public static final String APP_VERSION = "v0.6.19";
|
public static final String APP_VERSION = "v0.6.20";
|
||||||
|
|
||||||
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
|
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
|
||||||
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
|
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
|
||||||
|
|
||||||
public static final String FONT_SCALE_ENV_VAR_NAME = "FONT_SCALE";
|
public static final String FONT_SCALE_ENV_VAR_NAME = "FONT_SCALE";
|
||||||
|
|
||||||
public static boolean STARTED = false;
|
public static boolean STARTED = false;
|
||||||
public static float SCALING=1.0f;
|
public static float SCALING = 1.0f;
|
||||||
public static StudioFrame frame = null;
|
public static StudioFrame frame = null;
|
||||||
|
|
||||||
//Need to keep a strong reference to it, to avoid garbage collection that'll reset these loggers.
|
// Need to keep a strong reference to it, to avoid garbage collection that'll
|
||||||
|
// reset these loggers.
|
||||||
public static final List<Logger> configuredLoggers = new LinkedList<Logger>();
|
public static final List<Logger> configuredLoggers = new LinkedList<Logger>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
@@ -66,18 +66,19 @@ public class ATContentStudio {
|
|||||||
if (fontScaling != null) {
|
if (fontScaling != null) {
|
||||||
try {
|
try {
|
||||||
fontScale = Float.parseFloat(fontScaling);
|
fontScale = Float.parseFloat(fontScaling);
|
||||||
SCALING=fontScale;
|
SCALING = fontScale;
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
System.err.println("Failed to parse font scaling parameter. Using default.");
|
System.err.println("Failed to parse font scaling parameter. Using default.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigCache.init();
|
ConfigCache.init();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String laf = ConfigCache.getFavoriteLaFClassName();
|
String laf = ConfigCache.getFavoriteLaFClassName();
|
||||||
if (laf == null) laf = UIManager.getSystemLookAndFeelClassName();
|
if (laf == null)
|
||||||
|
laf = UIManager.getSystemLookAndFeelClassName();
|
||||||
UIManager.setLookAndFeel(laf);
|
UIManager.setLookAndFeel(laf);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -88,37 +89,40 @@ public class ATContentStudio {
|
|||||||
} catch (UnsupportedLookAndFeelException e) {
|
} catch (UnsupportedLookAndFeelException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scaleUIFont();
|
scaleUIFont();
|
||||||
|
|
||||||
//Need to keep a strong reference to it, to avoid garbage collection that'll reset this setting.
|
// Need to keep a strong reference to it, to avoid garbage collection that'll
|
||||||
|
// reset this setting.
|
||||||
Logger l = Logger.getLogger(ExpressionParser.class.getName());
|
Logger l = Logger.getLogger(ExpressionParser.class.getName());
|
||||||
l.setLevel(Level.OFF);
|
l.setLevel(Level.OFF);
|
||||||
configuredLoggers.add(l);
|
configuredLoggers.add(l);
|
||||||
|
|
||||||
final WorkspaceSelector wsSelect = new WorkspaceSelector();
|
final WorkspaceSelector wsSelect = new WorkspaceSelector();
|
||||||
wsSelect.pack();
|
wsSelect.pack();
|
||||||
Dimension sdim = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension sdim = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
Dimension wdim = wsSelect.getSize();
|
Dimension wdim = wsSelect.getSize();
|
||||||
wsSelect.setLocation((sdim.width - wdim.width)/2, (sdim.height - wdim.height)/2);
|
wsSelect.setLocation((sdim.width - wdim.width) / 2, (sdim.height - wdim.height) / 2);
|
||||||
wsSelect.setVisible(true);
|
wsSelect.setVisible(true);
|
||||||
|
|
||||||
wsSelect.addWindowListener(new WindowAdapter() {
|
wsSelect.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public synchronized void windowClosed(WindowEvent e) {
|
public synchronized void windowClosed(WindowEvent e) {
|
||||||
if (wsSelect.selected != null && !STARTED) {
|
if (wsSelect.selected != null && !STARTED) {
|
||||||
ATContentStudio.STARTED = true;
|
ATContentStudio.STARTED = true;
|
||||||
final File workspaceRoot = new File(wsSelect.selected);
|
final File workspaceRoot = new File(wsSelect.selected);
|
||||||
WorkerDialog.showTaskMessage("Loading your workspace...", null, new Runnable(){
|
WorkerDialog.showTaskMessage("Loading your workspace...", null, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
Workspace.setActive(workspaceRoot);
|
Workspace.setActive(workspaceRoot);
|
||||||
if (Workspace.activeWorkspace.settings.useInternet.getCurrentValue() && Workspace.activeWorkspace.settings.checkUpdates.getCurrentValue()) {
|
if (Workspace.activeWorkspace.settings.useInternet.getCurrentValue()
|
||||||
|
&& Workspace.activeWorkspace.settings.checkUpdates.getCurrentValue()) {
|
||||||
new Thread() {
|
new Thread() {
|
||||||
public void run() {checkUpdate();}
|
public void run() {
|
||||||
|
checkUpdate();
|
||||||
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
frame = new StudioFrame(APP_NAME+" "+APP_VERSION);
|
frame = new StudioFrame(APP_NAME + " " + APP_VERSION);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE);
|
frame.setDefaultCloseOperation(StudioFrame.DO_NOTHING_ON_CLOSE);
|
||||||
};
|
};
|
||||||
@@ -138,7 +142,7 @@ public class ATContentStudio {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkUpdate() {
|
private static void checkUpdate() {
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
try {
|
try {
|
||||||
@@ -146,32 +150,34 @@ public class ATContentStudio {
|
|||||||
in = new BufferedReader(new InputStreamReader(url.openStream()));
|
in = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||||
|
|
||||||
String inputLine, lastLine = null;
|
String inputLine, lastLine = null;
|
||||||
while ((inputLine = in.readLine()) != null) {lastLine = inputLine;}
|
while ((inputLine = in.readLine()) != null) {
|
||||||
|
lastLine = inputLine;
|
||||||
|
}
|
||||||
if (lastLine != null && !lastLine.equals(APP_VERSION)) {
|
if (lastLine != null && !lastLine.equals(APP_VERSION)) {
|
||||||
|
|
||||||
// for copying style
|
|
||||||
JLabel label = new JLabel();
|
|
||||||
Font font = label.getFont();
|
|
||||||
Color color = label.getBackground();
|
|
||||||
|
|
||||||
// create some css from the label's font
|
// for copying style
|
||||||
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
|
JLabel label = new JLabel();
|
||||||
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
|
Font font = label.getFont();
|
||||||
style.append("font-size:" + font.getSize() + "pt;");
|
Color color = label.getBackground();
|
||||||
style.append("background-color: rgb("+color.getRed()+","+color.getGreen()+","+color.getBlue()+");");
|
|
||||||
|
// create some css from the label's font
|
||||||
JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">"
|
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
|
||||||
+ "You are not running the latest ATCS version.<br/>"
|
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
|
||||||
+ "You can get the latest version ("+lastLine+") by clicking the link below.<br/>"
|
style.append("font-size:" + font.getSize() + "pt;");
|
||||||
+ "<a href=\""+DOWNLOAD_URL+"\">"+DOWNLOAD_URL+"</a><br/>"
|
style.append("background-color: rgb(" + color.getRed() + "," + color.getGreen() + "," + color.getBlue()
|
||||||
+ "<br/>"
|
+ ");");
|
||||||
+ "</body></html>");
|
|
||||||
|
JEditorPane ep = new JEditorPane("text/html",
|
||||||
|
"<html><body style=\"" + style + "\">" + "You are not running the latest ATCS version.<br/>"
|
||||||
|
+ "You can get the latest version (" + lastLine + ") by clicking the link below.<br/>"
|
||||||
|
+ "<a href=\"" + DOWNLOAD_URL + "\">" + DOWNLOAD_URL + "</a><br/>" + "<br/>"
|
||||||
|
+ "</body></html>");
|
||||||
|
|
||||||
ep.setEditable(false);
|
ep.setEditable(false);
|
||||||
ep.setBorder(null);
|
ep.setBorder(null);
|
||||||
|
|
||||||
ep.addHyperlinkListener(new HyperlinkListener() {
|
ep.addHyperlinkListener(new HyperlinkListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hyperlinkUpdate(HyperlinkEvent e) {
|
public void hyperlinkUpdate(HyperlinkEvent e) {
|
||||||
try {
|
try {
|
||||||
@@ -185,7 +191,7 @@ public class ATContentStudio {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(null, ep, "Update available", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, ep, "Update available", JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
@@ -194,16 +200,17 @@ public class ATContentStudio {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (in != null) in.close();
|
if (in != null)
|
||||||
|
in.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void scaleUIFont() {
|
public static void scaleUIFont() {
|
||||||
if (SCALING != 1.0f) {
|
if (SCALING != 1.0f) {
|
||||||
System.out.println("Scaling fonts to "+SCALING);
|
System.out.println("Scaling fonts to " + SCALING);
|
||||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||||
Map<Object, Object> newDefaults = new HashMap<Object, Object>();
|
Map<Object, Object> newDefaults = new HashMap<Object, Object>();
|
||||||
for (Enumeration<Object> e = defaults.keys(); e.hasMoreElements();) {
|
for (Enumeration<Object> e = defaults.keys(); e.hasMoreElements();) {
|
||||||
@@ -211,7 +218,7 @@ public class ATContentStudio {
|
|||||||
Object value = defaults.get(key);
|
Object value = defaults.get(key);
|
||||||
if (value instanceof Font) {
|
if (value instanceof Font) {
|
||||||
Font font = (Font) value;
|
Font font = (Font) value;
|
||||||
int newSize = (int)(font.getSize() * SCALING);
|
int newSize = (int) (font.getSize() * SCALING);
|
||||||
if (value instanceof FontUIResource) {
|
if (value instanceof FontUIResource) {
|
||||||
newDefaults.put(key, new FontUIResource(font.getName(), font.getStyle(), newSize));
|
newDefaults.put(key, new FontUIResource(font.getName(), font.getStyle(), newSize));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
BIN
src/com/gpl/rpg/atcontentstudio/img/date.png
Normal file
BIN
src/com/gpl/rpg/atcontentstudio/img/date.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 275 B |
BIN
src/com/gpl/rpg/atcontentstudio/img/time.png
Normal file
BIN
src/com/gpl/rpg/atcontentstudio/img/time.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 703 B |
@@ -68,7 +68,8 @@ public class Dialogue extends JSONElement {
|
|||||||
deactivateSpawnArea,
|
deactivateSpawnArea,
|
||||||
activateMapObjectGroup,
|
activateMapObjectGroup,
|
||||||
deactivateMapObjectGroup,
|
deactivateMapObjectGroup,
|
||||||
changeMapFilter
|
changeMapFilter,
|
||||||
|
mapchange
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +250,7 @@ public class Dialogue extends JSONElement {
|
|||||||
case removeSpawnArea:
|
case removeSpawnArea:
|
||||||
case deactivateSpawnArea:
|
case deactivateSpawnArea:
|
||||||
case changeMapFilter:
|
case changeMapFilter:
|
||||||
|
case mapchange:
|
||||||
reward.map = reward.map_name != null ? proj.getMap(reward.map_name) : null;
|
reward.map = reward.map_name != null ? proj.getMap(reward.map_name) : null;
|
||||||
break;
|
break;
|
||||||
case actorCondition:
|
case actorCondition:
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ public class Requirement extends JSONElement {
|
|||||||
factionScore,
|
factionScore,
|
||||||
random,
|
random,
|
||||||
factionScoreEquals,
|
factionScoreEquals,
|
||||||
wearRemove
|
wearRemove,
|
||||||
|
date,
|
||||||
|
dateEquals,
|
||||||
|
time,
|
||||||
|
timeEquals
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SkillID {
|
public enum SkillID {
|
||||||
@@ -196,6 +200,10 @@ public class Requirement extends JSONElement {
|
|||||||
case factionScore:
|
case factionScore:
|
||||||
case factionScoreEquals:
|
case factionScoreEquals:
|
||||||
case random:
|
case random:
|
||||||
|
case date:
|
||||||
|
case dateEquals:
|
||||||
|
case time:
|
||||||
|
case timeEquals:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.required_obj != null) this.required_obj.addBacklink((GameDataElement) this.parent);
|
if (this.required_obj != null) this.required_obj.addBacklink((GameDataElement) this.parent);
|
||||||
|
|||||||
@@ -260,6 +260,14 @@ public class DefaultIcons {
|
|||||||
public static Image getTimerImage() { return getImage(TIMER_RES); }
|
public static Image getTimerImage() { return getImage(TIMER_RES); }
|
||||||
public static Image getTimerIcon() { return getIcon(TIMER_RES); }
|
public static Image getTimerIcon() { return getIcon(TIMER_RES); }
|
||||||
|
|
||||||
|
private static String DATE_RES = "/com/gpl/rpg/atcontentstudio/img/date.png";
|
||||||
|
public static Image getDateImage() { return getImage(DATE_RES); }
|
||||||
|
public static Image getDateIcon() { return getIcon(DATE_RES); }
|
||||||
|
|
||||||
|
private static String TIME_RES = "/com/gpl/rpg/atcontentstudio/img/date.png";
|
||||||
|
public static Image getTimeImage() { return getImage(TIME_RES); }
|
||||||
|
public static Image getTimeIcon() { return getIcon(TIME_RES); }
|
||||||
|
|
||||||
private static String ALIGNMENT_RES = "/com/gpl/rpg/atcontentstudio/img/alignment.png";
|
private static String ALIGNMENT_RES = "/com/gpl/rpg/atcontentstudio/img/alignment.png";
|
||||||
public static Image getAlignmentImage() { return getImage(ALIGNMENT_RES); }
|
public static Image getAlignmentImage() { return getImage(ALIGNMENT_RES); }
|
||||||
public static Image getAlignmentIcon() { return getIcon(ALIGNMENT_RES); }
|
public static Image getAlignmentIcon() { return getIcon(ALIGNMENT_RES); }
|
||||||
@@ -273,7 +281,7 @@ public class DefaultIcons {
|
|||||||
public static Image getStatusOrangeIcon() { return getIcon(STATUS_ORANGE_RES); }
|
public static Image getStatusOrangeIcon() { return getIcon(STATUS_ORANGE_RES); }
|
||||||
|
|
||||||
private static String STATUS_GREEN_RES = "/com/gpl/rpg/atcontentstudio/img/status_green.png";
|
private static String STATUS_GREEN_RES = "/com/gpl/rpg/atcontentstudio/img/status_green.png";
|
||||||
public static Image getStatusGreenImage() { return getImage(STATUS_GREEN_RES); }
|
public static Image getStatusGreenImage() { return getImage(STATUS_GREEN_RES); }
|
||||||
public static Image getStatusGreenIcon() { return getIcon(STATUS_GREEN_RES); }
|
public static Image getStatusGreenIcon() { return getIcon(STATUS_GREEN_RES); }
|
||||||
|
|
||||||
private static String STATUS_BLUE_RES = "/com/gpl/rpg/atcontentstudio/img/status_blue.png";
|
private static String STATUS_BLUE_RES = "/com/gpl/rpg/atcontentstudio/img/status_blue.png";
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class ExportProjectWizard extends JDialog {
|
|||||||
radioGroup.add(asZip);
|
radioGroup.add(asZip);
|
||||||
overSources = new JRadioButton("... into a game source folder");
|
overSources = new JRadioButton("... into a game source folder");
|
||||||
radioGroup.add(overSources);
|
radioGroup.add(overSources);
|
||||||
asZip.setSelected(true);
|
overSources.setSelected(true);
|
||||||
|
|
||||||
pane.add(asZip, JideBoxLayout.FIX);
|
pane.add(asZip, JideBoxLayout.FIX);
|
||||||
pane.add(overSources, JideBoxLayout.FIX);
|
pane.add(overSources, JideBoxLayout.FIX);
|
||||||
|
|||||||
@@ -384,6 +384,13 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
rewardObj = null;
|
rewardObj = null;
|
||||||
rewardValue = null;
|
rewardValue = null;
|
||||||
break;
|
break;
|
||||||
|
case mapchange:
|
||||||
|
rewardMap = addMapBox(pane, ((Dialogue)target).getProject(), "Map Name: ", reward.map, writable, listener);
|
||||||
|
rewardObjId = addTextField(pane, "Place: ", reward.reward_obj_id, writable, listener);
|
||||||
|
rewardObjIdCombo = null;
|
||||||
|
rewardObj = null;
|
||||||
|
rewardValue = null;
|
||||||
|
break;
|
||||||
case deactivateSpawnArea:
|
case deactivateSpawnArea:
|
||||||
case removeSpawnArea:
|
case removeSpawnArea:
|
||||||
case spawnAll:
|
case spawnAll:
|
||||||
@@ -777,6 +784,26 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
|
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
|
||||||
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
|
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
|
||||||
break;
|
break;
|
||||||
|
case date:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Minimum date value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
|
case dateEquals:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Exact date value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
|
case time:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Minimum time value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
|
case timeEquals:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
||||||
}
|
}
|
||||||
@@ -943,6 +970,10 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
label.setText("Change map filter to "+rewardObjDesc+" on map "+reward.map_name);
|
label.setText("Change map filter to "+rewardObjDesc+" on map "+reward.map_name);
|
||||||
label.setIcon(new ImageIcon(DefaultIcons.getReplaceIcon()));
|
label.setIcon(new ImageIcon(DefaultIcons.getReplaceIcon()));
|
||||||
break;
|
break;
|
||||||
|
case mapchange:
|
||||||
|
label.setText("Teleport to "+rewardObjDesc+" on map "+reward.map_name);
|
||||||
|
label.setIcon(new ImageIcon(DefaultIcons.getMapchangeIcon()));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
label.setText("New, undefined reward");
|
label.setText("New, undefined reward");
|
||||||
@@ -1178,6 +1209,9 @@ public class DialogueEditor extends JSONElementEditor {
|
|||||||
label.setIcon(new ImageIcon(DefaultIcons.getTimerIcon()));
|
label.setIcon(new ImageIcon(DefaultIcons.getTimerIcon()));
|
||||||
} else if (req.type == Requirement.RequirementType.factionScore || req.type == Requirement.RequirementType.factionScoreEquals) {
|
} else if (req.type == Requirement.RequirementType.factionScore || req.type == Requirement.RequirementType.factionScoreEquals) {
|
||||||
label.setIcon(new ImageIcon(DefaultIcons.getAlignmentIcon()));
|
label.setIcon(new ImageIcon(DefaultIcons.getAlignmentIcon()));
|
||||||
|
} else if (req.type == Requirement.RequirementType.date || req.type == Requirement.RequirementType.dateEquals ||
|
||||||
|
req.type == Requirement.RequirementType.time || req.type == Requirement.RequirementType.timeEquals) {
|
||||||
|
label.setIcon(new ImageIcon(DefaultIcons.getDateIcon()));
|
||||||
}
|
}
|
||||||
if (req.type == null) {
|
if (req.type == null) {
|
||||||
label.setText("New, undefined requirement.");
|
label.setText("New, undefined requirement.");
|
||||||
|
|||||||
@@ -731,6 +731,26 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
|||||||
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
|
requirementObjId = addTextField(pane, "Faction ID:", requirement.required_obj_id, writable, listener);
|
||||||
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
|
requirementValue = addIntegerField(pane, "Exact value: ", requirement.required_value, true, writable, listener);
|
||||||
break;
|
break;
|
||||||
|
case date:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Minimum date value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
|
case dateEquals:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Date type YYYYMMTT:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Exact date value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
|
case time:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Minimum time value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
|
case timeEquals:
|
||||||
|
requirementObj = null;
|
||||||
|
requirementObjId = addTextField(pane, "Time type HHMMSS:", requirement.required_obj_id, writable, listener);
|
||||||
|
requirementValue = addIntegerField(pane, "Exact time value: ", requirement.required_value, true, writable, listener);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
requirementNegated = addBooleanBasedCheckBox(pane, "Negate this requirement.", requirement.negated, writable, listener);
|
||||||
@@ -2052,7 +2072,8 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
|
|||||||
area.quantity = (Integer) value;
|
area.quantity = (Integer) value;
|
||||||
}
|
}
|
||||||
} else if (source == respawnSpeedField) {
|
} else if (source == respawnSpeedField) {
|
||||||
if (selectedMapObject instanceof SpawnArea area) {
|
if (selectedMapObject instanceof SpawnArea) {
|
||||||
|
SpawnArea area = (SpawnArea) selectedMapObject;
|
||||||
area.respawnSpeed = (Integer) value;
|
area.respawnSpeed = (Integer) value;
|
||||||
}
|
}
|
||||||
} else if (source == spawnActiveForNewGame) {
|
} else if (source == spawnActiveForNewGame) {
|
||||||
|
|||||||
@@ -1,43 +1,34 @@
|
|||||||
package com.gpl.rpg.atcontentstudio.ui.sprites;
|
package com.gpl.rpg.atcontentstudio.ui.sprites;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.*;
|
||||||
import java.awt.GridBagConstraints;
|
|
||||||
import java.awt.GridBagLayout;
|
|
||||||
import java.awt.Image;
|
|
||||||
import java.awt.Point;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import javax.swing.*;
|
||||||
import javax.swing.ButtonGroup;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JDialog;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JToggleButton;
|
|
||||||
import javax.swing.ScrollPaneConstants;
|
|
||||||
|
|
||||||
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
import com.gpl.rpg.atcontentstudio.ATContentStudio;
|
||||||
import com.gpl.rpg.atcontentstudio.model.Project;
|
import com.gpl.rpg.atcontentstudio.model.Project;
|
||||||
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
|
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
|
||||||
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet.Category;
|
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet.Category;
|
||||||
|
import com.gpl.rpg.atcontentstudio.utils.SpriteUtils;
|
||||||
|
|
||||||
|
|
||||||
public class SpriteChooser extends JDialog {
|
public class SpriteChooser extends JDialog {
|
||||||
|
|
||||||
private static final long serialVersionUID = -6018113265015159521L;
|
private static final long serialVersionUID = -6018113265015159521L;
|
||||||
|
|
||||||
private static final int STD_WIDTH = 32;
|
private static final int STD_WIDTH = 32;
|
||||||
private static final int STD_HEIGHT = 32;
|
private static final int STD_HEIGHT = 32;
|
||||||
private static final int MAX_PER_ROW = 10;
|
private static final int MAX_PER_ROW = 10;
|
||||||
|
|
||||||
public static Map<Project, Map<Spritesheet.Category, SpriteChooser>> cache = new LinkedHashMap<Project, Map<Spritesheet.Category,SpriteChooser>>();
|
public static Map<Project, Map<Spritesheet.Category, SpriteChooser>> cache = new LinkedHashMap<Project, Map<Spritesheet.Category, SpriteChooser>>();
|
||||||
public static Map<Project, Map<Spritesheet.Category, List<Spritesheet>>> cacheValidator = new LinkedHashMap<Project, Map<Category,List<Spritesheet>>>();
|
public static Map<Project, Map<Spritesheet.Category, List<Spritesheet>>> cacheValidator = new LinkedHashMap<Project, Map<Category, List<Spritesheet>>>();
|
||||||
|
|
||||||
|
|
||||||
public static SpriteChooser getChooser(Project proj, Spritesheet.Category category) {
|
public static SpriteChooser getChooser(Project proj, Spritesheet.Category category) {
|
||||||
if (cache.get(proj) == null) {
|
if (cache.get(proj) == null) {
|
||||||
cache.put(proj, new LinkedHashMap<Spritesheet.Category, SpriteChooser>());
|
cache.put(proj, new LinkedHashMap<Spritesheet.Category, SpriteChooser>());
|
||||||
@@ -46,13 +37,13 @@ public class SpriteChooser extends JDialog {
|
|||||||
cache.get(proj).put(category, new SpriteChooser(proj, category));
|
cache.get(proj).put(category, new SpriteChooser(proj, category));
|
||||||
} else {
|
} else {
|
||||||
List<Spritesheet> spritesheets = new ArrayList<Spritesheet>();
|
List<Spritesheet> spritesheets = new ArrayList<Spritesheet>();
|
||||||
for (int i=0; i<proj.getSpritesheetCount(); i++) {
|
for (int i = 0; i < proj.getSpritesheetCount(); i++) {
|
||||||
Spritesheet sheet = proj.getSpritesheet(i);
|
Spritesheet sheet = proj.getSpritesheet(i);
|
||||||
if (sheet.category == category) {
|
if (sheet.category == category) {
|
||||||
spritesheets.add(sheet);
|
spritesheets.add(sheet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( !spritesheets.equals(cacheValidator.get(proj).get(category)) ) {
|
if (!spritesheets.equals(cacheValidator.get(proj).get(category))) {
|
||||||
cache.get(proj).put(category, new SpriteChooser(proj, category));
|
cache.get(proj).put(category, new SpriteChooser(proj, category));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,20 +56,20 @@ public class SpriteChooser extends JDialog {
|
|||||||
wanted.pack();
|
wanted.pack();
|
||||||
return wanted;
|
return wanted;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ButtonGroup group;
|
private ButtonGroup group;
|
||||||
// private IconButton selectedOne = null;
|
// private IconButton selectedOne = null;
|
||||||
// private JButton ok;
|
// private JButton ok;
|
||||||
// private JButton cancel;
|
// private JButton cancel;
|
||||||
|
|
||||||
public String selectedIconId = null;
|
public String selectedIconId = null;
|
||||||
|
|
||||||
public SpriteChooser(Project proj, Category category) {
|
public SpriteChooser(Project proj, Category category) {
|
||||||
super(ATContentStudio.frame);
|
super(ATContentStudio.frame);
|
||||||
setTitle("Select a sprite");
|
setTitle("Select a sprite");
|
||||||
setModalityType(ModalityType.APPLICATION_MODAL);
|
setModalityType(ModalityType.APPLICATION_MODAL);
|
||||||
List<Spritesheet> spritesheets = new ArrayList<Spritesheet>();
|
List<Spritesheet> spritesheets = new ArrayList<Spritesheet>();
|
||||||
for (int i=0; i<proj.getSpritesheetCount(); i++) {
|
for (int i = 0; i < proj.getSpritesheetCount(); i++) {
|
||||||
Spritesheet sheet = proj.getSpritesheet(i);
|
Spritesheet sheet = proj.getSpritesheet(i);
|
||||||
if (sheet.category == category) {
|
if (sheet.category == category) {
|
||||||
spritesheets.add(sheet);
|
spritesheets.add(sheet);
|
||||||
@@ -88,8 +79,8 @@ public class SpriteChooser extends JDialog {
|
|||||||
cacheValidator.put(proj, new LinkedHashMap<Spritesheet.Category, List<Spritesheet>>());
|
cacheValidator.put(proj, new LinkedHashMap<Spritesheet.Category, List<Spritesheet>>());
|
||||||
}
|
}
|
||||||
cacheValidator.get(proj).put(category, spritesheets);
|
cacheValidator.get(proj).put(category, spritesheets);
|
||||||
|
|
||||||
|
|
||||||
JPanel pane = new JPanel();
|
JPanel pane = new JPanel();
|
||||||
pane.setLayout(new GridBagLayout());
|
pane.setLayout(new GridBagLayout());
|
||||||
GridBagConstraints c = new GridBagConstraints();
|
GridBagConstraints c = new GridBagConstraints();
|
||||||
@@ -101,16 +92,20 @@ public class SpriteChooser extends JDialog {
|
|||||||
c.gridheight = 1;
|
c.gridheight = 1;
|
||||||
c.anchor = GridBagConstraints.NORTHWEST;
|
c.anchor = GridBagConstraints.NORTHWEST;
|
||||||
c.fill = GridBagConstraints.BOTH;
|
c.fill = GridBagConstraints.BOTH;
|
||||||
|
|
||||||
List<Point> reservedSlots = new ArrayList<Point>();
|
List<Point> reservedSlots = new ArrayList<Point>();
|
||||||
Point nextFreeSlot = new Point(0, 0);
|
Point nextFreeSlot = new Point(0, 0);
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
Image img;
|
BufferedImage img;
|
||||||
group = new ButtonGroup();
|
group = new ButtonGroup();
|
||||||
|
//For every sprite find a free space in panel:
|
||||||
for (Spritesheet sheet : spritesheets) {
|
for (Spritesheet sheet : spritesheets) {
|
||||||
i = 0;
|
i = -1;
|
||||||
while ((img = sheet.getImage(i)) != null) {
|
while ((img = sheet.getImage(++i)) != null) {
|
||||||
|
if (SpriteUtils.checkIsImageEmpty(img)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
IconButton button = new IconButton(img, sheet.id, i);
|
IconButton button = new IconButton(img, sheet.id, i);
|
||||||
group.add(button);
|
group.add(button);
|
||||||
if (sheet.spriteWidth == STD_WIDTH && sheet.spriteHeight == STD_HEIGHT) {
|
if (sheet.spriteWidth == STD_WIDTH && sheet.spriteHeight == STD_HEIGHT) {
|
||||||
@@ -120,7 +115,7 @@ public class SpriteChooser extends JDialog {
|
|||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy++;
|
c.gridy++;
|
||||||
}
|
}
|
||||||
nextFreeSlot.setLocation(c.gridx, c.gridy);
|
nextFreeSlot.setLocation(c.gridx, c.gridy);
|
||||||
} else {
|
} else {
|
||||||
c.gridwidth = (sheet.spriteWidth / STD_WIDTH) + (sheet.spriteWidth % STD_WIDTH == 0 ? 0 : 1);
|
c.gridwidth = (sheet.spriteWidth / STD_WIDTH) + (sheet.spriteWidth % STD_WIDTH == 0 ? 0 : 1);
|
||||||
c.gridheight = (sheet.spriteHeight / STD_HEIGHT) + (sheet.spriteHeight % STD_HEIGHT == 0 ? 0 : 1);
|
c.gridheight = (sheet.spriteHeight / STD_HEIGHT) + (sheet.spriteHeight % STD_HEIGHT == 0 ? 0 : 1);
|
||||||
@@ -131,14 +126,20 @@ public class SpriteChooser extends JDialog {
|
|||||||
for (int y = c.gridy; y < c.gridy + c.gridwidth; y++) {
|
for (int y = c.gridy; y < c.gridy + c.gridwidth; y++) {
|
||||||
if (reservedSlots.contains(new Point(x, y))) {
|
if (reservedSlots.contains(new Point(x, y))) {
|
||||||
slotOk = false;
|
slotOk = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!slotOk) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (slotOk && c.gridx + c.gridwidth > MAX_PER_ROW) {
|
if (c.gridx + c.gridwidth > MAX_PER_ROW) {
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy++;
|
c.gridy++;
|
||||||
slotOk = false;
|
slotOk = false;
|
||||||
}
|
} else if (!slotOk) {
|
||||||
|
c.gridx++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pane.add(button, c);
|
pane.add(button, c);
|
||||||
for (int x = c.gridx; x < c.gridx + c.gridwidth; x++) {
|
for (int x = c.gridx; x < c.gridx + c.gridwidth; x++) {
|
||||||
@@ -157,15 +158,14 @@ public class SpriteChooser extends JDialog {
|
|||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
c.gridy++;
|
c.gridy++;
|
||||||
}
|
}
|
||||||
nextFreeSlot.setLocation(c.gridx, c.gridy);
|
nextFreeSlot.setLocation(c.gridx, c.gridy);
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ok = new JButton("Ok");
|
// ok = new JButton("Ok");
|
||||||
// cancel = new JButton("Cancel");
|
// cancel = new JButton("Cancel");
|
||||||
|
|
||||||
c.gridx = 0;
|
c.gridx = 0;
|
||||||
boolean emptyLine = false;
|
boolean emptyLine = false;
|
||||||
while (!emptyLine) {
|
while (!emptyLine) {
|
||||||
@@ -178,7 +178,7 @@ public class SpriteChooser extends JDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// JPanel buttonPane = new JPanel();
|
// JPanel buttonPane = new JPanel();
|
||||||
// buttonPane.add(cancel, BorderLayout.WEST);
|
// buttonPane.add(cancel, BorderLayout.WEST);
|
||||||
// buttonPane.add(ok, BorderLayout.EAST);
|
// buttonPane.add(ok, BorderLayout.EAST);
|
||||||
@@ -190,7 +190,7 @@ public class SpriteChooser extends JDialog {
|
|||||||
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||||
wrapper.add(scroller, BorderLayout.CENTER);
|
wrapper.add(scroller, BorderLayout.CENTER);
|
||||||
// wrapper.add(buttonPane, BorderLayout.SOUTH);
|
// wrapper.add(buttonPane, BorderLayout.SOUTH);
|
||||||
|
|
||||||
// ok.addActionListener(new ActionListener() {
|
// ok.addActionListener(new ActionListener() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void actionPerformed(ActionEvent e) {
|
// public void actionPerformed(ActionEvent e) {
|
||||||
@@ -200,7 +200,7 @@ public class SpriteChooser extends JDialog {
|
|||||||
// if (listener != null) listener.iconSelected(selectedIconId);
|
// if (listener != null) listener.iconSelected(selectedIconId);
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// cancel.addActionListener(new ActionListener() {
|
// cancel.addActionListener(new ActionListener() {
|
||||||
// @Override
|
// @Override
|
||||||
// public void actionPerformed(ActionEvent e) {
|
// public void actionPerformed(ActionEvent e) {
|
||||||
@@ -210,21 +210,21 @@ public class SpriteChooser extends JDialog {
|
|||||||
// if (listener != null) listener.iconSelected(null);
|
// if (listener != null) listener.iconSelected(null);
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
setContentPane(wrapper);
|
setContentPane(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpriteChooser.SelectionListener listener = null;
|
private SpriteChooser.SelectionListener listener = null;
|
||||||
|
|
||||||
public void setSelectionListener(SpriteChooser.SelectionListener l) {
|
public void setSelectionListener(SpriteChooser.SelectionListener l) {
|
||||||
listener = l;
|
listener = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class IconButton extends JToggleButton {
|
public class IconButton extends JToggleButton {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7559407153561178455L;
|
private static final long serialVersionUID = 7559407153561178455L;
|
||||||
|
|
||||||
public String sheetId;
|
public String sheetId;
|
||||||
public int spriteIndex;
|
public int spriteIndex;
|
||||||
|
|
||||||
@@ -232,12 +232,12 @@ public class SpriteChooser extends JDialog {
|
|||||||
super(new ImageIcon(img));
|
super(new ImageIcon(img));
|
||||||
this.sheetId = sheetId;
|
this.sheetId = sheetId;
|
||||||
this.spriteIndex = spriteIndex;
|
this.spriteIndex = spriteIndex;
|
||||||
setToolTipText(sheetId+":"+spriteIndex);
|
setToolTipText(sheetId + ":" + spriteIndex);
|
||||||
addActionListener(new ActionListener() {
|
addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (IconButton.this.isSelected()) {
|
if (IconButton.this.isSelected()) {
|
||||||
selectedIconId = IconButton.this.sheetId+":"+IconButton.this.spriteIndex;
|
selectedIconId = IconButton.this.sheetId + ":" + IconButton.this.spriteIndex;
|
||||||
SpriteChooser.this.setVisible(false);
|
SpriteChooser.this.setVisible(false);
|
||||||
SpriteChooser.this.dispose();
|
SpriteChooser.this.dispose();
|
||||||
if (listener != null) listener.iconSelected(selectedIconId);
|
if (listener != null) listener.iconSelected(selectedIconId);
|
||||||
@@ -246,9 +246,9 @@ public class SpriteChooser extends JDialog {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface SelectionListener {
|
public static interface SelectionListener {
|
||||||
public void iconSelected(String selected);
|
public void iconSelected(String selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
src/com/gpl/rpg/atcontentstudio/utils/SpriteUtils.java
Normal file
34
src/com/gpl/rpg/atcontentstudio/utils/SpriteUtils.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package com.gpl.rpg.atcontentstudio.utils;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.awt.image.WritableRaster;
|
||||||
|
|
||||||
|
public final class SpriteUtils {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the image is empty (transparent )
|
||||||
|
*
|
||||||
|
* @param img The image to check
|
||||||
|
* @return true if the image is empty
|
||||||
|
*/
|
||||||
|
public static boolean checkIsImageEmpty(BufferedImage img) {
|
||||||
|
int width = img.getWidth(null);
|
||||||
|
int height = img.getHeight(null);
|
||||||
|
WritableRaster raster = img.getAlphaRaster();
|
||||||
|
if (raster == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int x = 0; x < width; x++) {
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
//get pixel alpha value
|
||||||
|
int alpha = raster.getSample(x, y, 0);
|
||||||
|
//if alpha is not 0 then the pixel is not transparent
|
||||||
|
if (alpha != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//no non-transparent pixel found
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user