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