Skip to content

Commit

Permalink
A.1.1
Browse files Browse the repository at this point in the history
-Completed GUI (Except Profile Preferences)
-Added IconMap modification
-Examples fully functional
-Patch method
  • Loading branch information
yodarocks1 committed Jun 7, 2020
1 parent c1f6e6d commit ad5ff84
Show file tree
Hide file tree
Showing 40 changed files with 1,879 additions and 409 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/Construct Mod Loader/code_signing.crt
/Construct Mod Loader/launch4j.exe - Shortcut.lnk
/Construct Mod Loader/L4j/jre/
/Construct Mod Loader/L4j/launch4j.log
/Construct Mod Loader/Construct Mod Loader.msi
/Construct Mod Loader/ConstructModLoader.jar
/Construct Mod Loader/L4j/
/Construct Mod Loader/CML App.ico
/Construct Mod Loader/launch4jconfig.xml
/Construct Mod Loader/
1 change: 1 addition & 0 deletions nbproject/configs/Dev.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
run.jvmargs=-Dolaunch=false
2 changes: 2 additions & 0 deletions nbproject/configs/ReadOnly.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
javafx.main.class=cml.NewGUI
run.jvmargs=-Dolaunch=false -Domodify=false
8 changes: 6 additions & 2 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=Construct Mod Loader
application.vendor=BCD - CML
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
Expand Down Expand Up @@ -74,16 +75,19 @@ javafx.classpath.extension=\
${platforms.JDK_1.8.home}/jre/lib/javaws.jar:\
${platforms.JDK_1.8.home}/jre/lib/deploy.jar:\
${platforms.JDK_1.8.home}/jre/lib/plugin.jar
javafx.deploy.adddesktopshortcut=false
javafx.deploy.addstartmenushortcut=false
javafx.deploy.adddesktopshortcut=true
javafx.deploy.addstartmenushortcut=true
javafx.deploy.allowoffline=true
# If true, application update mode is set to 'background', if false, update mode is set to 'eager'
javafx.deploy.backgroundupdate=false
javafx.deploy.disable.proxy=false
javafx.deploy.embedJNLP=true
javafx.deploy.icon=
javafx.deploy.icon.native=Construct Mod Loader/Construct Mod Loader.ico
javafx.deploy.includeDT=true
javafx.deploy.installpermanently=false
javafx.deploy.permissionselevated=false
javafx.deploy.splash=Construct Mod Loader/Splash.jpg
# Set true to prevent creation of temporary copy of deployment artifacts before each run (disables concurrent runs)
javafx.disable.concurrent.runs=false
# Set true to enable multiple concurrent runs of the same WebStart or Run-in-Browser project
Expand Down
29 changes: 28 additions & 1 deletion src/cml/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
*/
package cml;

import cml.beans.Profile;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
Expand All @@ -15,7 +18,31 @@
public class Constants {

public static final String FOLDERS_LOCATION = "C:\\Program Files (x86)\\Construct\\folders.txt";
public static final String VERSION = "A.1.0";
public static final String VERSION = "+A.1.1";
public static final String LAUNCH_COMMAND = "rundll32 url.dll,FileProtocolHandler steam://rungameid/387990";
public static final ZoneOffset ZONE = OffsetDateTime.now().getOffset();
public static final Runnable ON_DELETE_FINISH = () -> {
Profile checkMe = Main.activeProfile.get();
try {
Thread.sleep(500);
} catch (InterruptedException ex) {
Logger.getLogger(Constants.class.getName()).log(Level.INFO, "On Delete Finish interrupted");
}
if (!checkMe.getDirectory().exists()) {
Main.activeProfile.setValue(Profile.DELETED);
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
Logger.getLogger(Constants.class.getName()).log(Level.INFO, "On Delete Finish interrupted");
}
Main.updateProfileList();
}
};
public static final String IGNORE_PREFIX = "_._";
public static final String IGNORE_SUFFIX = "_._";
public static final String LOG_FOLDER_NAME = IGNORE_PREFIX + "logs" + IGNORE_SUFFIX;
public static final String OBJECT_FOLDER_LOCATION = "Data\\CML-Objects";
public static final String OBJECT_FOLDER_CODE = "$GAME_DATA/CML-Objects";
public static final String PATCH_FOLDER_NAME = IGNORE_PREFIX + "patches" + IGNORE_SUFFIX;

}
87 changes: 87 additions & 0 deletions src/cml/ErrorManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* Copyright (C) 2020 benne
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cml;

import java.util.ArrayList;
import java.util.List;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;

/**
*
* @author benne
*/
public class ErrorManager {

private static final ErrorManager NO_ERROR = new ErrorManager(false);
private static final ErrorManager ERROR = new ErrorManager(true);

public static ObjectProperty<ErrorManager> State = new SimpleObjectProperty(NO_ERROR);

private final List<String> causes = new ArrayList();
private final boolean error;

private ErrorManager(boolean error) {
this.error = error;
}

public void removeCause(String cause) {
if (this.error) {
if (this.causes.remove(cause) ) {
System.out.println((char) 27 + "[34;1mUser Error resolved: \"" + cause + "\"\n"
+ " Remaining errors: " + causes.size() + (char) 27 + "[0m");
}
if (this.causes.isEmpty()) {
State.setValue(NO_ERROR);
}
}
}

public void addCause(String cause) {
if (!this.error) {
ERROR.addCause(cause);
State.setValue(ERROR);
} else if (!causes.contains(cause)) {
System.out.println((char) 27 + "[31;1;5mUser Error caught: \"" + cause + "\"" + (char) 27 + "[0m");
this.causes.add(cause);
}
}

public List<String> getCauses() {
return this.causes;
}

public boolean isError() {
return this.error;
}

public static void addStateCause(String cause) {
State.getValue().addCause(cause);
}

public static void removeStateCause(String cause) {
State.getValue().removeCause(cause);
}

public static boolean isStateError() {
return State.getValue().isError();
}

public static void printNonUserError(String error) {
System.out.println((char) 27 + "[31;1;5m" + error + (char) 27 + "[0m");
}
}
45 changes: 40 additions & 5 deletions src/cml/Images.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package cml;

import java.util.ArrayList;
import java.util.List;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.Background;
Expand All @@ -14,6 +16,7 @@
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.media.Media;
import javafx.util.Duration;

/**
*
Expand All @@ -23,11 +26,19 @@ public class Images {
public static final Background BACKGROUND;
public static final Media LAUNCH_SOUND;
public static final ImageView HEADER;
public static final SpriteAnimation DELETE_SELECT_ANIM;
public static final SpriteAnimation DELETE_PRESS_ANIM;
public static final Image DELETE_PRESS_START;
public static final Image DELETE_PRESS_FINAL;
public static final Image ICON;
public static final Image ICON_ERROR;
public static final Image ICON_SUCCESS;
public static final Image BLANK;
public static final Image LAUNCH;
public static final Image LAUNCH_SELECT;
public static final Image LAUNCH_PRESS;
public static final Image LAUNCH_ERROR;
public static final Image LAUNCH_SUCCESS;
public static final Image SETTINGS;
public static final Image SETTINGS_SELECT;
public static final Image SETTINGS_PRESS;
Expand All @@ -44,8 +55,6 @@ public class Images {
public static final Image OPEN_SELECT;
public static final Image OPEN_PRESS;
public static final Image DELETE;
public static final Image DELETE_SELECT_ANIM;
public static final Image DELETE_PRESS_ANIM;
public static final Image SCROLL;
public static final Image SCROLL_SELECT;
public static final Image SCROLL_PRESS;
Expand All @@ -64,11 +73,39 @@ public class Images {
BACKGROUND = new Background(new BackgroundImage(new Image(Images.class.getClassLoader().getResourceAsStream("media/AdaptableBackground/Background.jpg")), BackgroundRepeat.REPEAT, BackgroundRepeat.REPEAT, BackgroundPosition.DEFAULT, BackgroundSize.DEFAULT));
LAUNCH_SOUND = new Media(Images.class.getClassLoader().getResource("media/Sound/launchCML.mp3").toString());
HEADER = new ImageView(new Image(Images.class.getClassLoader().getResourceAsStream("media/AdaptableBackground/Header.jpg")));
ICON = new Image(Images.class.getClassLoader().getResourceAsStream("media/CML.ico"));
int i = 1;
List<Image> deleteSelectFrames = new ArrayList();
while (true) {
try {
deleteSelectFrames.add(new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Delete/ButtonSelect" + i + ".png")));
} catch (NullPointerException ex) {
break;
}
i++;
}
DELETE_SELECT_ANIM = new SpriteAnimation(deleteSelectFrames, Duration.millis(100));
List<Image> deletePressFrames = new ArrayList();
i = 1;
while (true) {
try {
deletePressFrames.add(new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Delete/ButtonPressed" + i + ".png")));
} catch (NullPointerException ex) {
break;
}
i++;
}
DELETE_PRESS_ANIM = new SpriteAnimation(deletePressFrames, Duration.millis(100), Constants.ON_DELETE_FINISH);
DELETE_PRESS_START = DELETE_PRESS_ANIM.getFrames().get(0);
DELETE_PRESS_FINAL = DELETE_PRESS_ANIM.getFrames().get(DELETE_PRESS_ANIM.getFrames().size() - 1);
ICON = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Icon/CML.ico.png"));
ICON_ERROR = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Icon/CML Error.ico.png"));
ICON_SUCCESS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Icon/CML Success.ico.png"));
BLANK = new Image(Images.class.getClassLoader().getResourceAsStream("media/Blank.png"));
LAUNCH = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Launch/Launch.jpg"));
LAUNCH_SELECT = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Launch/LaunchSelect.jpg"));
LAUNCH_PRESS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Launch/LaunchPressed.jpg"));
LAUNCH_ERROR = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Launch/LaunchError.jpg"));
LAUNCH_SUCCESS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Launch/LaunchSuccess.jpg"));
SETTINGS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Properties/Button.png"));
SETTINGS_SELECT = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Properties/ButtonSelect.png"));
SETTINGS_PRESS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Properties/ButtonPressed.png"));
Expand All @@ -85,8 +122,6 @@ public class Images {
OPEN_SELECT = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/OpenFolder/ButtonSelect.png"));
OPEN_PRESS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/OpenFolder/ButtonPressed.png"));
DELETE = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Delete/Button.png"));
DELETE_SELECT_ANIM =new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Delete/ButtonSelect.gif"));
DELETE_PRESS_ANIM = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Delete/ButtonPressed.gif"));
SCROLL = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Slider/Slider.png"));
SCROLL_SELECT = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Slider/SliderSelect.png"));
SCROLL_PRESS = new Image(Images.class.getClassLoader().getResourceAsStream("media/MultiStateIcons/Slider/SliderHeld.png"));
Expand Down
Loading

0 comments on commit ad5ff84

Please sign in to comment.