a few fixes #1
4
.gitignore
vendored
4
.gitignore
vendored
@ -9,4 +9,6 @@ build
|
|||||||
/data
|
/data
|
||||||
/backup
|
/backup
|
||||||
/output
|
/output
|
||||||
*.zip
|
*.zip
|
||||||
|
|
||||||
|
.idea
|
||||||
|
11
build.gradle
11
build.gradle
@ -4,6 +4,8 @@ plugins {
|
|||||||
|
|
||||||
archivesBaseName = "Mario Kart World Tracker"
|
archivesBaseName = "Mario Kart World Tracker"
|
||||||
version = '1.0.1'
|
version = '1.0.1'
|
||||||
|
var mainClassName = 'speiger.src.ui.MapPanel'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
@ -13,7 +15,7 @@ sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = co
|
|||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes "Main-Class": 'speiger.src.ui.MapPanel'
|
attributes "Main-Class": mainClassName
|
||||||
}
|
}
|
||||||
from {
|
from {
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
@ -27,7 +29,7 @@ task baseJar(type: Jar) {
|
|||||||
exclude('assets/images/images.zip')
|
exclude('assets/images/images.zip')
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
manifest {
|
manifest {
|
||||||
attributes "Main-Class": 'speiger.src.ui.MapPanel'
|
attributes "Main-Class": mainClassName
|
||||||
}
|
}
|
||||||
from {
|
from {
|
||||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
@ -35,6 +37,11 @@ task baseJar(type: Jar) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task run(type: JavaExec) {
|
||||||
|
classpath = sourceSets.main.runtimeClasspath
|
||||||
|
mainClass.set(mainClassName)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
@ -52,6 +52,7 @@ public class Registry {
|
|||||||
Map<UUID, Collectable> collectables = new LinkedHashMap<>();
|
Map<UUID, Collectable> collectables = new LinkedHashMap<>();
|
||||||
Set<UUID> completed = new HashSet<>();
|
Set<UUID> completed = new HashSet<>();
|
||||||
Object syncObj = new Object();
|
Object syncObj = new Object();
|
||||||
|
boolean bulkOperationActive = false;
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
parseRegistry("/assets/data/medals.json", CollectableType.MEDAL);
|
parseRegistry("/assets/data/medals.json", CollectableType.MEDAL);
|
||||||
@ -202,14 +203,22 @@ public class Registry {
|
|||||||
|
|
||||||
public void markComplete(UUID id) {
|
public void markComplete(UUID id) {
|
||||||
completed.add(id);
|
completed.add(id);
|
||||||
save();
|
if (bulkOperationActive) save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unmarkComplete(UUID id) {
|
public void unmarkComplete(UUID id) {
|
||||||
completed.remove(id);
|
completed.remove(id);
|
||||||
save();
|
if (bulkOperationActive) save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setBulkOperation(boolean bulk) {
|
||||||
|
bulkOperationActive = bulk;
|
||||||
|
|
||||||
|
if (!bulk) {
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isCompleted(UUID id) {
|
public boolean isCompleted(UUID id) {
|
||||||
return completed.contains(id);
|
return completed.contains(id);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ public class MapPanel extends JPanel {
|
|||||||
panel.setCompletionState(true);
|
panel.setCompletionState(true);
|
||||||
}, null));
|
}, null));
|
||||||
bulk.add(item("Uncomplete Visible", T -> {
|
bulk.add(item("Uncomplete Visible", T -> {
|
||||||
panel.setCompletionState(false);
|
panel.setCompletionState(false);
|
||||||
}, null));
|
}, null));
|
||||||
bar.add(bulk);
|
bar.add(bulk);
|
||||||
JMenu fuckups = new JMenu("I Fucked up");
|
JMenu fuckups = new JMenu("I Fucked up");
|
||||||
@ -345,7 +345,11 @@ public class MapPanel extends JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCompletionState(boolean value) {
|
public void setCompletionState(boolean value) {
|
||||||
|
Registry.INSTANCE.setBulkOperation(true);
|
||||||
visibleMarkers.forEach(T -> T.setCompletion(value));
|
visibleMarkers.forEach(T -> T.setCompletion(value));
|
||||||
|
Registry.INSTANCE.setBulkOperation(false);
|
||||||
|
EventQueue.invokeLater(this::repaint);
|
||||||
|
if(progressUpdate != null) progressUpdate.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user