mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-02 20:33:50 +07:00
Fixed multithreading
This commit is contained in:
parent
5c120e532f
commit
a04e432aea
@ -37,7 +37,7 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.mmap" android:mimeType="*/*" />
|
<data android:scheme="file" android:host="*" android:pathPattern=".*\\.mmap" android:mimeType="*/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -105,7 +105,9 @@ public class ThreadHandler {
|
|||||||
toRun.clear();
|
toRun.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logic.doUpdate = true;
|
||||||
logic.update();
|
logic.update();
|
||||||
|
logic.doUpdate = false;
|
||||||
|
|
||||||
long elapsed = TimeUtils.timeSinceMillis(time);
|
long elapsed = TimeUtils.timeSinceMillis(time);
|
||||||
long target = (long) (1000 / 60f);
|
long target = (long) (1000 / 60f);
|
||||||
|
@ -5,11 +5,8 @@ import com.badlogic.gdx.utils.ObjectMap;
|
|||||||
import com.badlogic.gdx.utils.ObjectSet;
|
import com.badlogic.gdx.utils.ObjectSet;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
|
|
||||||
/**Wrapper around an ObjectMap for team data.*/
|
/**Class for various team-based utilities.*/
|
||||||
public class TeamInfo {
|
public class TeamInfo {
|
||||||
private final static ObjectSet<Team> empty = new ObjectSet<>();
|
|
||||||
private final static ObjectSet<TeamData> emptyData = new ObjectSet<>();
|
|
||||||
|
|
||||||
private ObjectMap<Team, TeamData> map = new ObjectMap<>();
|
private ObjectMap<Team, TeamData> map = new ObjectMap<>();
|
||||||
private ObjectSet<Team> allies = new ObjectSet<>(),
|
private ObjectSet<Team> allies = new ObjectSet<>(),
|
||||||
enemies = new ObjectSet<>();
|
enemies = new ObjectSet<>();
|
||||||
|
@ -10,7 +10,6 @@ import io.anuke.ucore.scene.Group;
|
|||||||
import io.anuke.ucore.scene.builders.imagebutton;
|
import io.anuke.ucore.scene.builders.imagebutton;
|
||||||
import io.anuke.ucore.scene.builders.label;
|
import io.anuke.ucore.scene.builders.label;
|
||||||
import io.anuke.ucore.scene.builders.table;
|
import io.anuke.ucore.scene.builders.table;
|
||||||
import io.anuke.ucore.util.OS;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.*;
|
import static io.anuke.mindustry.Vars.*;
|
||||||
|
|
||||||
@ -40,13 +39,7 @@ public class MenuFragment implements Fragment{
|
|||||||
|
|
||||||
add(new MenuButton("icon-info", "$text.about.button", ui.about::show));
|
add(new MenuButton("icon-info", "$text.about.button", ui.about::show));
|
||||||
|
|
||||||
add(new MenuButton("icon-menu", OS.isMac ? "$text.credits" : "$text.changelog.title", () -> {
|
add(new MenuButton("icon-tools", "$text.settings", ui.settings::show));
|
||||||
if(OS.isMac){
|
|
||||||
ui.about.showCredits();
|
|
||||||
}else {
|
|
||||||
ui.changelog.show();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
row();
|
row();
|
||||||
|
|
||||||
|
@ -33,42 +33,42 @@ public class DesktopLauncher {
|
|||||||
config.setWindowedMode(960, 540);
|
config.setWindowedMode(960, 540);
|
||||||
config.setWindowIcon("sprites/icon.png");
|
config.setWindowIcon("sprites/icon.png");
|
||||||
|
|
||||||
Application.getApplication().setOpenFileHandler(e -> {
|
|
||||||
List<File> list = e.getFiles();
|
|
||||||
|
|
||||||
File target = list.get(0);
|
|
||||||
|
|
||||||
Gdx.app.postRunnable(() -> {
|
|
||||||
FileHandle file = OS.getAppDataDirectory("Mindustry").child("tmp").child(target.getName());
|
|
||||||
|
|
||||||
Gdx.files.absolute(target.getAbsolutePath()).copyTo(file);
|
|
||||||
|
|
||||||
if(file.extension().equalsIgnoreCase(saveExtension)){ //open save
|
|
||||||
|
|
||||||
if(SaveIO.isSaveValid(file)){
|
|
||||||
try{
|
|
||||||
SaveSlot slot = control.getSaves().importSave(file);
|
|
||||||
ui.load.runLoadSave(slot);
|
|
||||||
}catch (IOException e2){
|
|
||||||
ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e2, false)));
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
ui.showError("$text.save.import.invalid");
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if(file.extension().equalsIgnoreCase(mapExtension)){ //open map
|
|
||||||
Gdx.app.postRunnable(() -> {
|
|
||||||
if (!ui.editor.isShown()) {
|
|
||||||
ui.editor.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
ui.editor.beginEditMap(file.read());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if(OS.isMac) {
|
if(OS.isMac) {
|
||||||
|
Application.getApplication().setOpenFileHandler(e -> {
|
||||||
|
List<File> list = e.getFiles();
|
||||||
|
|
||||||
|
File target = list.get(0);
|
||||||
|
|
||||||
|
Gdx.app.postRunnable(() -> {
|
||||||
|
FileHandle file = OS.getAppDataDirectory("Mindustry").child("tmp").child(target.getName());
|
||||||
|
|
||||||
|
Gdx.files.absolute(target.getAbsolutePath()).copyTo(file);
|
||||||
|
|
||||||
|
if(file.extension().equalsIgnoreCase(saveExtension)){ //open save
|
||||||
|
|
||||||
|
if(SaveIO.isSaveValid(file)){
|
||||||
|
try{
|
||||||
|
SaveSlot slot = control.getSaves().importSave(file);
|
||||||
|
ui.load.runLoadSave(slot);
|
||||||
|
}catch (IOException e2){
|
||||||
|
ui.showError(Bundles.format("text.save.import.fail", Strings.parseException(e2, false)));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
ui.showError("$text.save.import.invalid");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(file.extension().equalsIgnoreCase(mapExtension)){ //open map
|
||||||
|
Gdx.app.postRunnable(() -> {
|
||||||
|
if (!ui.editor.isShown()) {
|
||||||
|
ui.editor.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
ui.editor.beginEditMap(file.read());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
config.setPreferencesConfig(OS.getAppDataDirectoryString("Mindustry"), FileType.Absolute);
|
config.setPreferencesConfig(OS.getAppDataDirectoryString("Mindustry"), FileType.Absolute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user