info popup

This commit is contained in:
J-VdS
2020-09-22 18:40:04 +02:00
parent a418d7e59f
commit 51065b57c4
7 changed files with 27 additions and 29 deletions

View File

@@ -40,8 +40,6 @@ public class Rules{
public boolean reactorExplosions = true;
/** Whether schematics are allowed */
public boolean schematicAllowed = true;
/** Whether copying is allowed */
public boolean copyAllowed = true;
/** Whether units use and require ammo. */
public boolean unitAmmo = false;
/** How fast unit pads build units. */

View File

@@ -329,7 +329,7 @@ public class DesktopInput extends InputHandler{
table.button(Icon.paste, Styles.clearPartiali, () -> {
ui.schematics.show();
}).tooltip("Schematics").disabled(d -> !state.rules.schematicAllowed);
}).tooltip("Schematics");
table.button(Icon.tree, Styles.clearPartiali, () -> {
ui.research.show();
@@ -387,8 +387,6 @@ public class DesktopInput extends InputHandler{
if(Core.input.keyTap(Binding.schematic_menu) && !Core.scene.hasKeyboard()){
if(ui.schematics.isShown()){
ui.schematics.hide();
}else if(!state.rules.schematicAllowed) {
ui.showInfoToast("@schematic.disabled", 3f);
}else{
ui.schematics.show();
ui.schematics.focusSearchField();
@@ -401,14 +399,10 @@ public class DesktopInput extends InputHandler{
}
if(Core.input.keyRelease(Binding.schematic_select) && !Core.scene.hasKeyboard()){
if(!state.rules.copyAllowed){
ui.showInfoToast("@schematic.copydisabled", 3f);
}else {
lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY);
useSchematic(lastSchematic);
if (selectRequests.isEmpty()) {
lastSchematic = null;
}
lastSchematic = schematics.create(schemX, schemY, rawCursorX, rawCursorY);
useSchematic(lastSchematic);
if (selectRequests.isEmpty()) {
lastSchematic = null;
}
}

View File

@@ -485,15 +485,11 @@ public class MobileInput extends InputHandler implements GestureListener{
lineMode = false;
}else if(mode == schematicSelect){
if(!state.rules.copyAllowed){
ui.showInfoToast("@schematic.copydisabled", 3f);
}else {
selectRequests.clear();
lastSchematic = schematics.create(lineStartX, lineStartY, lastLineX, lastLineY);
useSchematic(lastSchematic);
if (selectRequests.isEmpty()) {
lastSchematic = null;
}
selectRequests.clear();
lastSchematic = schematics.create(lineStartX, lineStartY, lastLineX, lastLineY);
useSchematic(lastSchematic);
if (selectRequests.isEmpty()) {
lastSchematic = null;
}
schematicMode = false;
mode = none;

View File

@@ -135,6 +135,7 @@ public class CustomRulesDialog extends BaseDialog{
title("@rules.title.resourcesbuilding");
check("@rules.infiniteresources", b -> rules.infiniteResources = b, () -> rules.infiniteResources);
check("@rules.reactorexplosions", b -> rules.reactorExplosions = b, () -> rules.reactorExplosions);
check("@rules.schematic", b-> rules.schematicAllowed = b, () -> rules.schematicAllowed);
number("@rules.buildcostmultiplier", false, f -> rules.buildCostMultiplier = f, () -> rules.buildCostMultiplier, () -> !rules.infiniteResources);
number("@rules.buildspeedmultiplier", f -> rules.buildSpeedMultiplier = f, () -> rules.buildSpeedMultiplier);
number("@rules.deconstructrefundmultiplier", false, f -> rules.deconstructRefundMultiplier = f, () -> rules.deconstructRefundMultiplier, () -> !rules.infiniteResources);

View File

@@ -12,6 +12,7 @@ import arc.scene.ui.TextButton.*;
import arc.scene.ui.layout.*;
import arc.struct.*;
import arc.util.*;
import mindustry.Vars;
import mindustry.game.*;
import mindustry.gen.*;
import mindustry.graphics.*;
@@ -64,8 +65,12 @@ public class SchematicsDialog extends BaseDialog{
t.update(() -> {
if(Core.input.keyTap(Binding.chat) && Core.scene.getKeyboardFocus() == searchField && firstSchematic != null){
control.input.useSchematic(firstSchematic);
hide();
if(!Vars.state.rules.schematicAllowed){
ui.showInfo("@schematic.disabled");
}else {
control.input.useSchematic(firstSchematic);
hide();
}
}
});
@@ -146,8 +151,12 @@ public class SchematicsDialog extends BaseDialog{
if(state.isMenu()){
showInfo(s);
}else{
control.input.useSchematic(s);
hide();
if(!Vars.state.rules.schematicAllowed){
ui.showInfo("@schematic.disabled");
}else{
control.input.useSchematic(s);
hide();
}
}
}).pad(4).style(Styles.cleari).get();

View File

@@ -90,7 +90,7 @@ public class HudFragment extends Fragment{
select.button(Icon.menu, style, ui.paused::show);
flip = select.button(Icon.upOpen, style, this::toggleMenus).get();
select.button(Icon.paste, style, ui.schematics::show).disabled(d -> !state.rules.schematicAllowed);
select.button(Icon.paste, style, ui.schematics::show);
select.button(Icon.pause, style, () -> {
if(net.active()){