Tutorial fixes
This commit is contained in:
@@ -344,8 +344,8 @@ public class Control implements ApplicationListener{
|
||||
Platform.instance.updateRPC();
|
||||
|
||||
//play tutorial on stop
|
||||
if(!settings.getBool("tutorial", false)){
|
||||
Core.app.post(this::playTutorial);
|
||||
if(!settings.getBool("playedtutorial", false)){
|
||||
Core.app.post(() -> Core.app.post(this::playTutorial));
|
||||
}
|
||||
|
||||
//display UI scale changed dialog
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package io.anuke.mindustry.game;
|
||||
|
||||
import io.anuke.arc.Core;
|
||||
import io.anuke.arc.Events;
|
||||
import io.anuke.arc.*;
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.content.Items;
|
||||
import io.anuke.mindustry.game.EventType.UnlockEvent;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.game.EventType.*;
|
||||
import io.anuke.mindustry.type.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
import static io.anuke.mindustry.Vars.state;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
/** Stores player unlocks. Clientside only. */
|
||||
public class GlobalData{
|
||||
@@ -40,7 +38,9 @@ public class GlobalData{
|
||||
}
|
||||
|
||||
public void addItem(Item item, int amount){
|
||||
unlockContent(item);
|
||||
if(amount > 0){
|
||||
unlockContent(item);
|
||||
}
|
||||
modified = true;
|
||||
items.getAndIncrement(item, 0, amount);
|
||||
state.stats.itemsDelivered.getAndIncrement(item, 0, amount);
|
||||
|
||||
@@ -20,7 +20,7 @@ import static io.anuke.mindustry.Vars.*;
|
||||
/** Handles tutorial state. */
|
||||
public class Tutorial{
|
||||
private static final int mineCopper = 18;
|
||||
private static final int blocksToBreak = 3, blockOffset = 5;
|
||||
private static final int blocksToBreak = 3, blockOffset = -6;
|
||||
|
||||
private ObjectSet<String> events = new ObjectSet<>();
|
||||
private ObjectIntMap<Block> blocksPlaced = new ObjectIntMap<>();
|
||||
@@ -179,7 +179,7 @@ public class Tutorial{
|
||||
state.wave = 5;
|
||||
|
||||
//end tutorial, never show it again
|
||||
Core.settings.put("tutorial", true);
|
||||
Core.settings.put("playedtutorial", true);
|
||||
Core.settings.save();
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class Tutorial{
|
||||
Tile core = state.teams.get(defaultTeam).cores.first();
|
||||
for(int i = 0; i < blocksToBreak; i++){
|
||||
world.removeBlock(world.ltile(core.x + blockOffset, core.y + i));
|
||||
world.tile(core.x + blockOffset, core.y + i).setBlock(Blocks.scrapWall);
|
||||
world.tile(core.x + blockOffset, core.y + i).setBlock(Blocks.scrapWall, defaultTeam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -457,7 +457,7 @@ public class MobileInput extends InputHandler implements GestureListener{
|
||||
selecting = hasRequest(cursor) && isPlacing() && mode == placing;
|
||||
|
||||
//call tap events
|
||||
if(pointer == 0 && !selecting && mode == none){
|
||||
if(pointer == 0 && !selecting){
|
||||
if(!tryTapPlayer(worldx, worldy) && Core.settings.getBool("keyboard")){
|
||||
//shoot on touch down when in keyboard mode
|
||||
player.isShooting = true;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class PausedDialog extends FloatingDialog{
|
||||
void showQuitConfirm(){
|
||||
ui.showConfirm("$confirm", state.rules.tutorial ? "$quit.confirm.tutorial" : "$quit.confirm", () -> {
|
||||
if(state.rules.tutorial){
|
||||
Core.settings.put("tutorial", true);
|
||||
Core.settings.put("playedtutorial", true);
|
||||
Core.settings.save();
|
||||
}
|
||||
wasClient = Net.client();
|
||||
|
||||
@@ -141,40 +141,23 @@ public class SettingsMenuDialog extends SettingsDialog{
|
||||
game.pref(new Setting(){
|
||||
@Override
|
||||
public void add(SettingsTable table){
|
||||
table.addButton("$settings.cleardata", () -> {
|
||||
FloatingDialog dialog = new FloatingDialog("$settings.cleardata");
|
||||
dialog.setFillParent(false);
|
||||
dialog.cont.defaults().size(230f, 60f).pad(3);
|
||||
dialog.addCloseButton();
|
||||
dialog.cont.addButton("$settings.clearunlocks", () -> {
|
||||
ui.showConfirm("$confirm", "$settings.clear.confirm", () -> {
|
||||
data.reset();
|
||||
dialog.hide();
|
||||
});
|
||||
});
|
||||
dialog.cont.row();
|
||||
dialog.cont.addButton("$settings.clearall", () -> {
|
||||
ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||
ObjectMap<String, Object> map = new ObjectMap<>();
|
||||
for(String value : Core.settings.keys()){
|
||||
if(value.contains("usid") || value.contains("uuid")){
|
||||
map.put(value, Core.settings.getString(value));
|
||||
}
|
||||
}
|
||||
Core.settings.clear();
|
||||
Core.settings.putAll(map);
|
||||
Core.settings.save();
|
||||
table.addButton("$settings.cleardata", () -> ui.showConfirm("$confirm", "$settings.clearall.confirm", () -> {
|
||||
ObjectMap<String, Object> map = new ObjectMap<>();
|
||||
for(String value : Core.settings.keys()){
|
||||
if(value.contains("usid") || value.contains("uuid")){
|
||||
map.put(value, Core.settings.getString(value));
|
||||
}
|
||||
}
|
||||
Core.settings.clear();
|
||||
Core.settings.putAll(map);
|
||||
Core.settings.save();
|
||||
|
||||
for(FileHandle file : dataDirectory.list()){
|
||||
file.deleteDirectory();
|
||||
}
|
||||
for(FileHandle file : dataDirectory.list()){
|
||||
file.deleteDirectory();
|
||||
}
|
||||
|
||||
Core.app.exit();
|
||||
});
|
||||
});
|
||||
dialog.cont.row();
|
||||
dialog.show();
|
||||
}).size(220f, 60f).pad(6).left();
|
||||
Core.app.exit();
|
||||
})).size(220f, 60f).pad(6).left();
|
||||
table.add();
|
||||
table.row();
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ZoneInfoDialog extends FloatingDialog{
|
||||
cont.row();
|
||||
cont.table(desc -> {
|
||||
desc.left().defaults().left().width(Core.graphics.isPortrait() ? 350f : 500f);
|
||||
desc.pane(t -> t.marginRight(12f).add(zone.description).wrap().growX()).fillX().maxHeight(mobile ? 240f : 400f).pad(2).padBottom(8f).get().setScrollingDisabled(true, false);
|
||||
desc.pane(t -> t.marginRight(12f).add(zone.description).wrap().growX()).fillX().maxHeight(mobile ? 300f : 450f).pad(2).padBottom(8f).get().setScrollingDisabled(true, false);
|
||||
desc.row();
|
||||
|
||||
desc.table(t -> {
|
||||
|
||||
@@ -419,7 +419,8 @@ public class HudFragment extends Fragment{
|
||||
/** Show unlock notification for a new recipe. */
|
||||
public void showUnlock(UnlockableContent content){
|
||||
//some content may not have icons... yet
|
||||
if(content.getContentIcon() == null || state.is(State.menu)) return;
|
||||
//also don't play in the tutorial to prevent confusion
|
||||
if(content.getContentIcon() == null || state.is(State.menu) || state.rules.tutorial) return;
|
||||
|
||||
Sounds.message.play();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user