Cleanup
This commit is contained in:
@@ -224,6 +224,7 @@ editor.generation = Generation:
|
|||||||
editor.ingame = Edit In-Game
|
editor.ingame = Edit In-Game
|
||||||
editor.publish.workshop = Publish On Workshop
|
editor.publish.workshop = Publish On Workshop
|
||||||
editor.newmap = New Map
|
editor.newmap = New Map
|
||||||
|
workshop = Workshop
|
||||||
waves.title = Waves
|
waves.title = Waves
|
||||||
waves.remove = Remove
|
waves.remove = Remove
|
||||||
waves.never = <never>
|
waves.never = <never>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package io.anuke.mindustry.core;
|
|||||||
|
|
||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.Input.*;
|
import io.anuke.arc.Input.*;
|
||||||
import io.anuke.arc.collection.*;
|
|
||||||
import io.anuke.arc.files.*;
|
import io.anuke.arc.files.*;
|
||||||
import io.anuke.arc.function.*;
|
import io.anuke.arc.function.*;
|
||||||
import io.anuke.arc.math.*;
|
import io.anuke.arc.math.*;
|
||||||
@@ -26,8 +25,8 @@ public interface Platform{
|
|||||||
/** Steam: Share a map on the workshop.*/
|
/** Steam: Share a map on the workshop.*/
|
||||||
default void publishMap(Map map){}
|
default void publishMap(Map map){}
|
||||||
|
|
||||||
/** Steam: Find workshop maps.*/
|
/** Steam: Open workshop for maps.*/
|
||||||
default void findMaps(String query, Consumer<Array<PostedMap>> result){}
|
default void openWorkshop(){}
|
||||||
|
|
||||||
/** Get the networking implementation.*/
|
/** Get the networking implementation.*/
|
||||||
default NetProvider getNet(){
|
default NetProvider getNet(){
|
||||||
@@ -111,16 +110,4 @@ public interface Platform{
|
|||||||
/** Stops forcing the app into landscape orientation.*/
|
/** Stops forcing the app into landscape orientation.*/
|
||||||
default void endForceLandscape(){
|
default void endForceLandscape(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Specifies a map posted in the steam workshop.*/
|
|
||||||
interface PostedMap{
|
|
||||||
String name();
|
|
||||||
String author();
|
|
||||||
String description();
|
|
||||||
String gamemode();
|
|
||||||
void openPage();
|
|
||||||
void subscribe();
|
|
||||||
boolean subscribed();
|
|
||||||
void preview(Consumer<FileHandle> file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,6 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
public DeployDialog deploy;
|
public DeployDialog deploy;
|
||||||
public TechTreeDialog tech;
|
public TechTreeDialog tech;
|
||||||
public MinimapDialog minimap;
|
public MinimapDialog minimap;
|
||||||
public BrowseMapsDialog browse;
|
|
||||||
|
|
||||||
public Cursor drillCursor, unloadCursor;
|
public Cursor drillCursor, unloadCursor;
|
||||||
|
|
||||||
@@ -218,7 +217,6 @@ public class UI implements ApplicationListener, Loadable{
|
|||||||
deploy = new DeployDialog();
|
deploy = new DeployDialog();
|
||||||
tech = new TechTreeDialog();
|
tech = new TechTreeDialog();
|
||||||
minimap = new MinimapDialog();
|
minimap = new MinimapDialog();
|
||||||
browse = new BrowseMapsDialog();
|
|
||||||
|
|
||||||
Group group = Core.scene.root;
|
Group group = Core.scene.root;
|
||||||
|
|
||||||
|
|||||||
@@ -582,7 +582,6 @@ public class MapEditorDialog extends Dialog implements Disposable{
|
|||||||
|
|
||||||
if(Core.input.ctrl()){
|
if(Core.input.ctrl()){
|
||||||
//alt mode select
|
//alt mode select
|
||||||
//TODO these keycode are unusable, tweak later
|
|
||||||
for(int i = 0; i < view.getTool().altModes.length + 1; i++){
|
for(int i = 0; i < view.getTool().altModes.length + 1; i++){
|
||||||
if(Core.input.keyTap(KeyCode.valueOf("NUM_" + (i + 1)))){
|
if(Core.input.keyTap(KeyCode.valueOf("NUM_" + (i + 1)))){
|
||||||
view.getTool().mode = i - 1;
|
view.getTool().mode = i - 1;
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
package io.anuke.mindustry.ui.dialogs;
|
|
||||||
|
|
||||||
import io.anuke.arc.*;
|
|
||||||
import io.anuke.arc.assets.*;
|
|
||||||
import io.anuke.arc.graphics.*;
|
|
||||||
import io.anuke.arc.math.*;
|
|
||||||
import io.anuke.arc.scene.ui.*;
|
|
||||||
import io.anuke.arc.scene.ui.layout.*;
|
|
||||||
import io.anuke.arc.util.*;
|
|
||||||
import io.anuke.mindustry.*;
|
|
||||||
import io.anuke.mindustry.core.Platform.*;
|
|
||||||
import io.anuke.mindustry.gen.*;
|
|
||||||
import io.anuke.mindustry.graphics.*;
|
|
||||||
import io.anuke.mindustry.ui.*;
|
|
||||||
|
|
||||||
import static io.anuke.mindustry.Vars.platform;
|
|
||||||
|
|
||||||
public class BrowseMapsDialog extends FloatingDialog{
|
|
||||||
|
|
||||||
public BrowseMapsDialog(){
|
|
||||||
super("$maps.browse");
|
|
||||||
shown(this::setup);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
cont.clear();
|
|
||||||
|
|
||||||
cont.addImage(Icon.refresh);
|
|
||||||
platform.findMaps("", list -> {
|
|
||||||
Table maps = new Table();
|
|
||||||
maps.marginRight(24);
|
|
||||||
|
|
||||||
ScrollPane pane = new ScrollPane(maps);
|
|
||||||
pane.setFadeScrollBars(false);
|
|
||||||
|
|
||||||
int maxwidth = Mathf.clamp((int)(Core.graphics.getWidth() / Scl.scl(230)), 1, 8);
|
|
||||||
float mapsize = 200f;
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for(PostedMap map : list){
|
|
||||||
|
|
||||||
if(i % maxwidth == 0){
|
|
||||||
maps.row();
|
|
||||||
}
|
|
||||||
|
|
||||||
TextButton button = maps.addButton("", Styles.cleart, map::openPage).width(mapsize).pad(8).get();
|
|
||||||
button.clearChildren();
|
|
||||||
button.margin(9);
|
|
||||||
button.add(map.name()).width(mapsize - 18f).center().get().setEllipsis(true);
|
|
||||||
button.row();
|
|
||||||
button.addImage().growX().pad(4).color(Pal.gray);
|
|
||||||
button.row();
|
|
||||||
Stack stack = button.stack(new Image(Icon.refresh)).size(mapsize - 20f).get();
|
|
||||||
map.preview(file -> {
|
|
||||||
Core.assets.load(new AssetDescriptor<>(file, Texture.class)).loaded = ct -> {
|
|
||||||
Texture tex = (Texture)ct;
|
|
||||||
stack.clearChildren();
|
|
||||||
stack.add(new Image(tex).setScaling(Scaling.fit));
|
|
||||||
stack.add(new BorderImage(tex).setScaling(Scaling.fit));
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Vars.maps.all().size == 0){
|
|
||||||
maps.add("$maps.none");
|
|
||||||
}
|
|
||||||
|
|
||||||
cont.add(buttons).growX();
|
|
||||||
cont.row();
|
|
||||||
cont.add(pane).uniformX();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -153,7 +153,6 @@ public class MenuFragment extends Fragment{
|
|||||||
container.table(background, t -> {
|
container.table(background, t -> {
|
||||||
t.defaults().width(width).height(70f);
|
t.defaults().width(width).height(70f);
|
||||||
|
|
||||||
//todo buttons should be small
|
|
||||||
buttons(t,
|
buttons(t,
|
||||||
new Buttoni("$play", Icon.play2Small,
|
new Buttoni("$play", Icon.play2Small,
|
||||||
new Buttoni("$campaign", Icon.play2Small, ui.deploy::show),
|
new Buttoni("$campaign", Icon.play2Small, ui.deploy::show),
|
||||||
@@ -162,7 +161,7 @@ public class MenuFragment extends Fragment{
|
|||||||
new Buttoni("$loadgame", Icon.loadSmall, ui.load::show),
|
new Buttoni("$loadgame", Icon.loadSmall, ui.load::show),
|
||||||
new Buttoni("$tutorial", Icon.infoSmall, control::playTutorial)
|
new Buttoni("$tutorial", Icon.infoSmall, control::playTutorial)
|
||||||
),
|
),
|
||||||
steam ? new Buttoni("$maps.browse", Icon.saveSmall, ui.browse::show) : null,
|
steam ? new Buttoni("$workshop", Icon.saveSmall, platform::openWorkshop) : null,
|
||||||
new Buttoni("$editor", Icon.editorSmall, ui.maps::show),
|
new Buttoni("$editor", Icon.editorSmall, ui.maps::show),
|
||||||
new Buttoni("$settings", Icon.toolsSmall, ui.settings::show),
|
new Buttoni("$settings", Icon.toolsSmall, ui.settings::show),
|
||||||
new Buttoni("$about.button", Icon.infoSmall, ui.about::show),
|
new Buttoni("$about.button", Icon.infoSmall, ui.about::show),
|
||||||
|
|||||||
@@ -171,6 +171,11 @@ public class DesktopLauncher extends ClientLauncher{
|
|||||||
return steam ? SVars.net : new ArcNetImpl();
|
return steam ? SVars.net : new ArcNetImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openWorkshop(){
|
||||||
|
SVars.net.friends.activateGameOverlayToWebPage("https://steamcommunity.com/app/1127400/workshop/");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishMap(Map map){
|
public void publishMap(Map map){
|
||||||
SVars.workshop.publishMap(map);
|
SVars.workshop.publishMap(map);
|
||||||
|
|||||||
Reference in New Issue
Block a user