1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Fixed many various things

This commit is contained in:
Anuken 2018-11-07 22:37:34 -05:00
parent 7488dc3ebb
commit cf50d558ba
11 changed files with 36 additions and 32 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
##Packr, build stuff
logs/
/core/assets/mindustry-saves/
/core/assets/mindustry-maps/
/core/assets/bundles/output/

View File

@ -42,12 +42,13 @@ public class TextFieldDialogListener extends ClickListener{
AndroidTextFieldDialog dialog = new AndroidTextFieldDialog();
dialog.setTextPromptListener(text -> {
field.clearText();
field.appendText(text);
field.fire(new ChangeListener.ChangeEvent());
Gdx.graphics.requestRendering();
});
dialog.setTextPromptListener(text ->
Gdx.app.postRunnable(() -> {
field.clearText();
field.appendText(text);
field.fire(new ChangeListener.ChangeEvent());
Gdx.graphics.requestRendering();
}));
if(type == 0){
dialog.setInputType(InputType.TYPE_CLASS_TEXT);

View File

@ -372,6 +372,7 @@ setting.musicvol.name = Music Volume
setting.mutemusic.name = Mute Music
setting.sfxvol.name = SFX Volume
setting.mutesound.name = Mute Sound
setting.crashreport.name = Send Anonymous Crash Reports
text.keybind.title = Rebind Keys
category.general.name = General
category.view.name = View

View File

@ -407,7 +407,7 @@ mode.sandbox.name = Песочница
mode.sandbox.description = Бесконечные ресурсы и нет таймера для волн, но можно самим вызвать волну.
mode.custom.warning = [scarlet]РАЗБЛОКИРОВАННОЕ В ПОЛЬЗОВАТЕЛЬСКИХ ИГРАХ ИЛИ НА СЕРВЕРАХ НЕ СОХРАНЯЕТСЯ[]\n\nИграйте в секторах для разблокировки чего-либо
mode.custom.warning.read = Внимательно прочитайте это!:\n[scarlet]РАЗБЛОКИРОВАННОЕ В ПОЛЬЗОВАТЕЛЬСКИХ ИГРАХ ИЛИ ДРУГИХ РЕЖИМАХ ИГРЫ НЕ РАСПРОСТРАНЯЕТСЯ НА СЕКТОРА ИЛИ ДРУГИЕ РЕЖИМЫ ИГРЫ!\n\n[LIGHT_GRAY](Я бы хотел, чтобы это не было необходимо, но, по-видимому, это так)
mode.freebuild.name = Cвободная\nстройка
mode.freebuild.name = Свободная\nстройка
mode.freebuild.description = ограниченные ресурсы и нет таймера для волн.
mode.pvp.name = Противо-\nстояние
mode.pvp.description = боритесь против других игроков.

View File

@ -28,6 +28,7 @@ import io.anuke.ucore.scene.ui.TextField.TextFieldFilter;
import io.anuke.ucore.scene.ui.TooltipManager;
import io.anuke.ucore.scene.ui.layout.Table;
import io.anuke.ucore.scene.ui.layout.Unit;
import io.anuke.ucore.util.Threads;
import static io.anuke.mindustry.Vars.*;
import static io.anuke.ucore.scene.actions.Actions.*;
@ -239,6 +240,8 @@ public class UI extends SceneModule{
}
public void showInfoFade(String info){
Threads.assertGraphics();
Table table = new Table();
table.setFillParent(true);
table.actions(Actions.fadeOut(7f, Interpolation.fade), Actions.removeActor());
@ -247,6 +250,8 @@ public class UI extends SceneModule{
}
public void showInfo(String info){
Threads.assertGraphics();
new Dialog("$text.info.title", "dialog"){{
getCell(content()).growX();
content().margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);
@ -255,6 +260,8 @@ public class UI extends SceneModule{
}
public void showInfo(String info, Runnable clicked){
Threads.assertGraphics();
new Dialog("$text.info.title", "dialog"){{
getCell(content()).growX();
content().margin(15).add(info).width(400f).wrap().get().setAlignment(Align.center, Align.center);

View File

@ -41,7 +41,7 @@ public class Sectors{
private final AsyncExecutor executor = new AsyncExecutor(6);
public void playSector(Sector sector){
if(sector.hasSave() && SaveIO.breakingVersions.contains(sector.getSave().getBuild())){
if(!headless && sector.hasSave() && SaveIO.breakingVersions.contains(sector.getSave().getBuild())){
sector.getSave().delete();
ui.showInfo("$text.save.old");
}

View File

@ -1,15 +0,0 @@
package io.anuke.mindustry.maps.missions;
import io.anuke.mindustry.Vars;
/**A mission that just displays some text.*/
public class MessageMission extends ActionMission{
public MessageMission(String text){
super(() -> {
if(!Vars.headless){
Vars.ui.showInfo(text);
}
});
}
}

View File

@ -136,7 +136,7 @@ public class SettingsMenuDialog extends SettingsDialog{
game.checkPref("autotarget", true);
}
//game.sliderPref("sensitivity", 100, 10, 300, i -> i + "%");
game.sliderPref("saveinterval", 60, 10, 5 * 120, i -> Bundles.format("setting.seconds", i));
game.sliderPref("saveinterval", 120, 10, 5 * 120, i -> Bundles.format("setting.seconds", i));
game.pref(new Setting(){
@Override
public void add(SettingsTable table){
@ -186,6 +186,10 @@ public class SettingsMenuDialog extends SettingsDialog{
}
});
if(!mobile){
game.checkPref("crashreport", true);
}
graphics.sliderPref("fpscap", 125, 5, 125, 5, s -> (s > 120 ? Bundles.get("setting.fpscap.none") : Bundles.format("setting.fpscap.text", s)));
graphics.checkPref("multithread", mobile, threads::setEnabled);

View File

@ -23,6 +23,16 @@ public class CrashHandler{
public static void handle(Throwable e){
e.printStackTrace();
try{
//check crash report setting
if(!Settings.getBool("crashreport")){
return;
}
}catch(Throwable ignored){
//don't send since we don't know if the user has the setting set
return;
}
if(!OS.isMac){
try{
javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());

View File

@ -30,7 +30,6 @@ import java.util.concurrent.CopyOnWriteArraySet;
import static io.anuke.mindustry.Vars.threads;
public class KryoServer implements ServerProvider {
final boolean tcpOnly = System.getProperty("java.version") == null;
final Server server;
final CopyOnWriteArrayList<KryoConnection> connections = new CopyOnWriteArrayList<>();
final CopyOnWriteArraySet<Integer> missing = new CopyOnWriteArraySet<>();
@ -150,11 +149,7 @@ public class KryoServer implements ServerProvider {
lastconnection = 0;
connections.clear();
missing.clear();
if(tcpOnly){
server.bind(port);
}else{
server.bind(port, port);
}
server.bind(port, port);
serverThread = new Thread(() -> {
try{
@ -172,7 +167,7 @@ public class KryoServer implements ServerProvider {
connections.clear();
lastconnection = 0;
async(server::close);
async(server::stop);
}
@Override

View File

@ -68,7 +68,7 @@ public class ServerControl extends Module{
);
Log.setLogger(new LogHandler(){
DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss");
DateTimeFormatter dateTime = DateTimeFormatter.ofPattern("MM-dd-yyyy | HH:mm:ss");
@Override
public void info(String text, Object... args){