Added edit logging and whole world rollback
This commit is contained in:
@@ -5,8 +5,10 @@ import com.badlogic.gdx.graphics.Colors;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Interpolation;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import io.anuke.mindustry.Vars;
|
||||
import io.anuke.mindustry.core.GameState.State;
|
||||
import io.anuke.mindustry.input.InputHandler;
|
||||
import io.anuke.mindustry.net.EditLog;
|
||||
import io.anuke.mindustry.resource.*;
|
||||
import io.anuke.mindustry.ui.dialogs.FloatingDialog;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
@@ -24,7 +26,7 @@ import io.anuke.ucore.scene.ui.layout.Table;
|
||||
import io.anuke.ucore.util.Bundles;
|
||||
import io.anuke.ucore.util.Mathf;
|
||||
import io.anuke.ucore.util.Strings;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
|
||||
public class BlocksFragment implements Fragment{
|
||||
@@ -344,7 +346,46 @@ public class BlocksFragment implements Fragment{
|
||||
|
||||
d.show();
|
||||
}
|
||||
|
||||
|
||||
public void showBlockLogs(int x, int y){
|
||||
boolean wasPaused = state.is(State.paused);
|
||||
state.set(State.paused);
|
||||
|
||||
FloatingDialog d = new FloatingDialog("$text.blocks.editlogs");
|
||||
Table table = new Table();
|
||||
table.defaults().pad(1f);
|
||||
ScrollPane pane = new ScrollPane(table, "clear");
|
||||
pane.setFadeScrollBars(false);
|
||||
Table top = new Table();
|
||||
top.left();
|
||||
top.add("[accent]Edit logs for: "+ x + ", " + y);
|
||||
table.add(top).fill().left();
|
||||
table.row();
|
||||
|
||||
d.content().add(pane).grow();
|
||||
|
||||
ArrayList<EditLog> logs = Vars.editLogs.get(x + y * world.width());
|
||||
if(logs == null || logs.isEmpty()) {
|
||||
table.add("$text.block.editlogsnotfound").left();
|
||||
table.row();
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < logs.size(); i++) {
|
||||
EditLog log = logs.get(i);
|
||||
table.add("[gold]" + (i + 1) + ". [white]" + log.info()).left();
|
||||
table.row();
|
||||
}
|
||||
}
|
||||
|
||||
d.buttons().addButton("$text.ok", () -> {
|
||||
if(!wasPaused)
|
||||
state.set(State.playing);
|
||||
d.hide();
|
||||
}).size(110, 50).pad(10f);
|
||||
|
||||
d.show();
|
||||
}
|
||||
|
||||
public void updateItems(){
|
||||
|
||||
itemtable.clear();
|
||||
|
||||
Reference in New Issue
Block a user