further progress
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -19,6 +19,8 @@ logs/
|
|||||||
/tools/build/
|
/tools/build/
|
||||||
/tests/build/
|
/tests/build/
|
||||||
/server/build/
|
/server/build/
|
||||||
|
saves/
|
||||||
|
steam_appid.txt
|
||||||
/test_files/
|
/test_files/
|
||||||
/annotations/build/
|
/annotations/build/
|
||||||
/desktop-sdl/build/
|
/desktop-sdl/build/
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ public class Vars{
|
|||||||
public static boolean android;
|
public static boolean android;
|
||||||
/** whether the game is running on a headless server */
|
/** whether the game is running on a headless server */
|
||||||
public static boolean headless;
|
public static boolean headless;
|
||||||
|
/** whether steam is enabled for this game */
|
||||||
|
public static boolean steam;
|
||||||
/** application data directory, equivalent to {@link io.anuke.arc.Settings#getDataDirectory()} */
|
/** application data directory, equivalent to {@link io.anuke.arc.Settings#getDataDirectory()} */
|
||||||
public static FileHandle dataDirectory;
|
public static FileHandle dataDirectory;
|
||||||
/** data subdirectory used for screenshots */
|
/** data subdirectory used for screenshots */
|
||||||
@@ -217,6 +219,10 @@ public class Vars{
|
|||||||
|
|
||||||
Core.settings.setAppName(appName);
|
Core.settings.setAppName(appName);
|
||||||
|
|
||||||
|
if(steam){
|
||||||
|
Core.settings.setDataDirectory(Core.files.local("saves/"));
|
||||||
|
}
|
||||||
|
|
||||||
dataDirectory = Core.settings.getDataDirectory();
|
dataDirectory = Core.settings.getDataDirectory();
|
||||||
screenshotDirectory = dataDirectory.child("screenshots/");
|
screenshotDirectory = dataDirectory.child("screenshots/");
|
||||||
customMapDirectory = dataDirectory.child("maps/");
|
customMapDirectory = dataDirectory.child("maps/");
|
||||||
|
|||||||
@@ -350,35 +350,37 @@ public class Control implements ApplicationListener{
|
|||||||
|
|
||||||
//display UI scale changed dialog
|
//display UI scale changed dialog
|
||||||
if(Core.settings.getBool("uiscalechanged", false)){
|
if(Core.settings.getBool("uiscalechanged", false)){
|
||||||
FloatingDialog dialog = new FloatingDialog("$confirm");
|
Core.app.post(() -> Core.app.post(() -> {
|
||||||
|
FloatingDialog dialog = new FloatingDialog("$confirm");
|
||||||
|
dialog.setFillParent(true);
|
||||||
|
|
||||||
float[] countdown = {60 * 11};
|
float[] countdown = {60 * 11};
|
||||||
Runnable exit = () -> {
|
Runnable exit = () -> {
|
||||||
Core.settings.put("uiscale", 100);
|
Core.settings.put("uiscale", 100);
|
||||||
Core.settings.put("uiscalechanged", false);
|
Core.settings.put("uiscalechanged", false);
|
||||||
settings.save();
|
settings.save();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
Core.app.exit();
|
Core.app.exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog.setFillParent(false);
|
dialog.cont.label(() -> {
|
||||||
dialog.cont.label(() -> {
|
if(countdown[0] <= 0){
|
||||||
if(countdown[0] <= 0){
|
exit.run();
|
||||||
exit.run();
|
}
|
||||||
}
|
return Core.bundle.format("uiscale.reset", (int)((countdown[0] -= Time.delta()) / 60f));
|
||||||
return Core.bundle.format("uiscale.reset", (int)((countdown[0] -= Time.delta()) / 60f));
|
}).pad(10f).expand().center();
|
||||||
}).pad(10f).expand().left();
|
|
||||||
|
|
||||||
dialog.buttons.defaults().size(200f, 60f);
|
dialog.buttons.defaults().size(200f, 60f);
|
||||||
dialog.buttons.addButton("$uiscale.cancel", exit);
|
dialog.buttons.addButton("$uiscale.cancel", exit);
|
||||||
|
|
||||||
dialog.buttons.addButton("$ok", () -> {
|
dialog.buttons.addButton("$ok", () -> {
|
||||||
Core.settings.put("uiscalechanged", false);
|
Core.settings.put("uiscalechanged", false);
|
||||||
settings.save();
|
settings.save();
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
Core.app.post(dialog::show);
|
dialog.show();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -326,7 +326,7 @@ public class Net{
|
|||||||
|
|
||||||
public static void dispose(){
|
public static void dispose(){
|
||||||
if(clientProvider != null) clientProvider.dispose();
|
if(clientProvider != null) clientProvider.dispose();
|
||||||
if(serverProvider != null) serverProvider.dispose();
|
if(serverProvider != null) serverProvider.close();
|
||||||
clientProvider = null;
|
clientProvider = null;
|
||||||
serverProvider = null;
|
serverProvider = null;
|
||||||
server = false;
|
server = false;
|
||||||
@@ -399,8 +399,5 @@ public class Net{
|
|||||||
|
|
||||||
/** Returns a connection by ID. */
|
/** Returns a connection by ID. */
|
||||||
NetConnection getByID(int id);
|
NetConnection getByID(int id);
|
||||||
|
|
||||||
/** Close all connections. */
|
|
||||||
void dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,18 @@ task dist(type: Jar, dependsOn: classes){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task steamdist(dependsOn: dist){
|
||||||
|
doLast{
|
||||||
|
copy{
|
||||||
|
from "build/libs/Mindustry-linux-release.jar"
|
||||||
|
into "/home/anuke/.steam/steam/steamapps/common/Mindustry"
|
||||||
|
rename { String fileName ->
|
||||||
|
fileName.replace("Mindustry-linux-release", "desktop-release")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
task ikZip(type: Zip){
|
task ikZip(type: Zip){
|
||||||
def filename = "$appName-${getTarget()}-${version}"
|
def filename = "$appName-${getTarget()}-${version}"
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import io.anuke.arc.Files.*;
|
|||||||
import io.anuke.arc.backends.sdl.*;
|
import io.anuke.arc.backends.sdl.*;
|
||||||
import io.anuke.mindustry.*;
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
|
import io.anuke.mindustry.desktopsdl.steam.*;
|
||||||
import io.anuke.mindustry.net.*;
|
import io.anuke.mindustry.net.*;
|
||||||
|
|
||||||
public class DesktopLauncher{
|
public class DesktopLauncher{
|
||||||
@@ -12,7 +13,7 @@ public class DesktopLauncher{
|
|||||||
Platform.instance = new DesktopPlatform(arg);
|
Platform.instance = new DesktopPlatform(arg);
|
||||||
|
|
||||||
Net.setClientProvider(new ArcNetClient());
|
Net.setClientProvider(new ArcNetClient());
|
||||||
Net.setServerProvider(new ArcNetServer());
|
Net.setServerProvider(new ServerSteam(new ArcNetServer()));
|
||||||
|
|
||||||
new SdlApplication(new Mindustry(), new SdlConfig(){{
|
new SdlApplication(new Mindustry(), new SdlConfig(){{
|
||||||
title = "Mindustry";
|
title = "Mindustry";
|
||||||
|
|||||||
@@ -7,14 +7,15 @@ import io.anuke.arc.backends.sdl.jni.*;
|
|||||||
import io.anuke.arc.collection.*;
|
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.util.Timer;
|
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.serialization.*;
|
import io.anuke.arc.util.serialization.*;
|
||||||
|
import io.anuke.mindustry.*;
|
||||||
import io.anuke.mindustry.core.GameState.*;
|
import io.anuke.mindustry.core.GameState.*;
|
||||||
import io.anuke.mindustry.core.*;
|
import io.anuke.mindustry.core.*;
|
||||||
|
import io.anuke.mindustry.desktopsdl.steam.*;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
import io.anuke.mindustry.net.*;
|
|
||||||
import io.anuke.mindustry.net.Net;
|
import io.anuke.mindustry.net.Net;
|
||||||
|
import io.anuke.mindustry.net.*;
|
||||||
import io.anuke.mindustry.ui.dialogs.*;
|
import io.anuke.mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
@@ -46,6 +47,7 @@ public class DesktopPlatform extends Platform{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(useSteam){
|
if(useSteam){
|
||||||
|
Vars.steam = true;
|
||||||
try{
|
try{
|
||||||
SteamAPI.loadLibraries();
|
SteamAPI.loadLibraries();
|
||||||
if(!SteamAPI.init()){
|
if(!SteamAPI.init()){
|
||||||
@@ -53,14 +55,23 @@ public class DesktopPlatform extends Platform{
|
|||||||
}else{
|
}else{
|
||||||
//times per second
|
//times per second
|
||||||
float interval = 20f;
|
float interval = 20f;
|
||||||
|
Interval i = new Interval();
|
||||||
|
|
||||||
//run steam callbacks
|
//run steam callbacks
|
||||||
Events.on(GameLoadEvent.class, event -> {
|
Events.on(GameLoadEvent.class, event -> {
|
||||||
Timer.schedule(() -> {
|
//update callbacks
|
||||||
if(SteamAPI.isSteamRunning()){
|
Core.app.addListener(new ApplicationListener(){
|
||||||
SteamAPI.runCallbacks();
|
@Override
|
||||||
|
public void update(){
|
||||||
|
if(i.get(interval)){
|
||||||
|
if(SteamAPI.isSteamRunning()){
|
||||||
|
SteamAPI.runCallbacks();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 0f, 1f / interval);
|
});
|
||||||
|
|
||||||
|
Core.app.post(() -> new ClientSteam());
|
||||||
});
|
});
|
||||||
//steam shutdown hook
|
//steam shutdown hook
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(SteamAPI::shutdown));
|
Runtime.getRuntime().addShutdownHook(new Thread(SteamAPI::shutdown));
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package io.anuke.mindustry.desktopsdl.steam;
|
package io.anuke.mindustry.desktopsdl.steam;
|
||||||
|
|
||||||
import com.codedisaster.steamworks.*;
|
import com.codedisaster.steamworks.*;
|
||||||
|
import com.codedisaster.steamworks.SteamFriends.*;
|
||||||
|
import com.codedisaster.steamworks.SteamMatchmaking.*;
|
||||||
import com.codedisaster.steamworks.SteamNetworking.*;
|
import com.codedisaster.steamworks.SteamNetworking.*;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
@@ -9,29 +11,36 @@ import io.anuke.mindustry.net.*;
|
|||||||
|
|
||||||
import java.nio.*;
|
import java.nio.*;
|
||||||
|
|
||||||
public class ClientSteam implements SteamNetworkingCallback{
|
public class ClientSteam implements SteamNetworkingCallback, SteamMatchmakingCallback{
|
||||||
private SteamNetworking steam;
|
private SteamNetworking snet;
|
||||||
|
private SteamMatchmaking smat;
|
||||||
|
|
||||||
private ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 128);
|
private ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 128);
|
||||||
//maps steam ID -> valid net connection
|
//maps steam ID -> valid net connection
|
||||||
private IntMap<SteamConnection> connections = new IntMap<>();
|
private IntMap<SteamConnection> connections = new IntMap<>();
|
||||||
|
|
||||||
public ClientSteam(){
|
public ClientSteam(){
|
||||||
steam = new SteamNetworking(this);
|
//snet = new SteamNetworking(this);
|
||||||
|
//smat = new SteamMatchmaking(this);
|
||||||
|
|
||||||
|
//Log.info("Calling createLobby");
|
||||||
|
//SteamAPICall call = smat.createLobby(LobbyType.FriendsOnly, 16);
|
||||||
|
|
||||||
|
/*
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
int length;
|
int length;
|
||||||
SteamID from = new SteamID();
|
SteamID from = new SteamID();
|
||||||
while((length = steam.isP2PPacketAvailable(0)) != 0){
|
while((length = snet.isP2PPacketAvailable(0)) != 0){
|
||||||
try{
|
try{
|
||||||
buffer.position(0);
|
buffer.position(0);
|
||||||
steam.readP2PPacket(from, buffer, 0);
|
snet.readP2PPacket(from, buffer, 0);
|
||||||
}catch(SteamException e){
|
}catch(SteamException e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}){{
|
}){{
|
||||||
setDaemon(true);
|
setDaemon(true);
|
||||||
}}.start();
|
}}.start();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -41,7 +50,7 @@ public class ClientSteam implements SteamNetworkingCallback{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onP2PSessionRequest(SteamID steamIDRemote){
|
public void onP2PSessionRequest(SteamID steamIDRemote){
|
||||||
steam.acceptP2PSessionWithUser(steamIDRemote);
|
snet.acceptP2PSessionWithUser(steamIDRemote);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SteamConnection extends NetConnection{
|
class SteamConnection extends NetConnection{
|
||||||
@@ -83,4 +92,106 @@ public class ClientSteam implements SteamNetworkingCallback{
|
|||||||
//if(connection.isConnected()) connection.close();
|
//if(connection.isConnected()) connection.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoritesListChanged(int ip, int queryPort, int connPort, int appID, int flags, boolean add, int accountID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyInvite(SteamID steamIDUser, SteamID steamIDLobby, long gameID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyEnter(SteamID steamIDLobby, int chatPermissions, boolean blocked, ChatRoomEnterResponse response){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyDataUpdate(SteamID steamIDLobby, SteamID steamIDMember, boolean success){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyChatUpdate(SteamID steamIDLobby, SteamID steamIDUserChanged, SteamID steamIDMakingChange, ChatMemberStateChange stateChange){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyChatMessage(SteamID steamIDLobby, SteamID steamIDUser, ChatEntryType entryType, int chatID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyGameCreated(SteamID steamIDLobby, SteamID steamIDGameServer, int ip, short port){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyMatchList(int lobbiesMatching){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyKicked(SteamID steamIDLobby, SteamID steamIDAdmin, boolean kickedDueToDisconnect){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyCreated(SteamResult result, SteamID steamIDLobby){
|
||||||
|
Log.info("Lobby create callback");
|
||||||
|
Log.info("Lobby {1} created? {0}", result, steamIDLobby.getAccountID());
|
||||||
|
if(result == SteamResult.OK){
|
||||||
|
SteamFriends friends = new SteamFriends(new SteamFriendsCallback(){
|
||||||
|
@Override
|
||||||
|
public void onSetPersonaNameResponse(boolean success, boolean localSuccess, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPersonaStateChange(SteamID steamID, PersonaChange change){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGameOverlayActivated(boolean active){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGameLobbyJoinRequested(SteamID steamIDLobby, SteamID steamIDFriend){
|
||||||
|
Log.info("Requested {0} to join lobby {1}", steamIDFriend.getAccountID(), steamIDLobby.getAccountID());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAvatarImageLoaded(SteamID steamID, int image, int width, int height){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFriendRichPresenceUpdate(SteamID steamIDFriend, int appID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGameRichPresenceJoinRequested(SteamID steamIDFriend, String connect){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGameServerChangeRequested(String server, String password){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
friends.activateGameOverlay(OverlayDialog.Friends);
|
||||||
|
//friends.activateGameOverlayInviteDialog(steamIDLobby);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoritesListAccountsUpdated(SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,160 @@
|
|||||||
|
package io.anuke.mindustry.desktopsdl.steam;
|
||||||
|
|
||||||
|
import com.codedisaster.steamworks.*;
|
||||||
|
import com.codedisaster.steamworks.SteamMatchmaking.*;
|
||||||
|
import com.codedisaster.steamworks.SteamNetworking.*;
|
||||||
|
import io.anuke.arc.*;
|
||||||
|
import io.anuke.arc.collection.*;
|
||||||
|
import io.anuke.arc.util.*;
|
||||||
|
import io.anuke.mindustry.desktopsdl.steam.ClientSteam.*;
|
||||||
|
import io.anuke.mindustry.net.Net.*;
|
||||||
|
import io.anuke.mindustry.net.*;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.*;
|
||||||
|
|
||||||
|
public class ServerSteam implements ServerProvider, SteamNetworkingCallback, SteamMatchmakingCallback{
|
||||||
|
private final static int maxLobbyPlayers = 32;
|
||||||
|
|
||||||
|
private final SteamNetworking snet = new SteamNetworking(this);
|
||||||
|
private final SteamMatchmaking smat = new SteamMatchmaking(this);
|
||||||
|
private final ServerProvider server;
|
||||||
|
|
||||||
|
//buffer for steam API calls
|
||||||
|
private ByteBuffer steamBuffer = ByteBuffer.allocateDirect(1024 * 128);
|
||||||
|
//maps steam ID -> valid net connection
|
||||||
|
private IntMap<SteamConnection> steamConnections = new IntMap<>();
|
||||||
|
|
||||||
|
private SteamID currentLobby;
|
||||||
|
|
||||||
|
public ServerSteam(ServerProvider server){
|
||||||
|
this.server = server;
|
||||||
|
}
|
||||||
|
|
||||||
|
//server overrides
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void host(int port) throws IOException{
|
||||||
|
server.host(port);
|
||||||
|
smat.createLobby(LobbyType.values()[Core.settings.getInt("lobbytype", 1)], maxLobbyPlayers);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendStream(int id, Streamable stream){
|
||||||
|
server.sendStream(id, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void send(Object object, SendMode mode){
|
||||||
|
server.send(object, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendTo(int id, Object object, SendMode mode){
|
||||||
|
server.sendTo(id, object, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendExcept(int id, Object object, SendMode mode){
|
||||||
|
server.sendExcept(id, object, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close(){
|
||||||
|
server.close();
|
||||||
|
if(currentLobby != null){
|
||||||
|
//TODO kick everyone who is in this lobby?
|
||||||
|
smat.leaveLobby(currentLobby);
|
||||||
|
currentLobby = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte[] compressSnapshot(byte[] input){
|
||||||
|
return server.compressSnapshot(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Array<? extends NetConnection> getConnections(){
|
||||||
|
return server.getConnections();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NetConnection getByID(int id){
|
||||||
|
return server.getByID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//steam lobby overrides
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoritesListChanged(int ip, int queryPort, int connPort, int appID, int flags, boolean add, int accountID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyInvite(SteamID steamIDUser, SteamID steamIDLobby, long gameID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyEnter(SteamID steamIDLobby, int chatPermissions, boolean blocked, ChatRoomEnterResponse response){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyDataUpdate(SteamID steamIDLobby, SteamID steamIDMember, boolean success){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyChatUpdate(SteamID steamIDLobby, SteamID steamIDUserChanged, SteamID steamIDMakingChange, ChatMemberStateChange stateChange){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyChatMessage(SteamID steamIDLobby, SteamID steamIDUser, ChatEntryType entryType, int chatID){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyGameCreated(SteamID steamIDLobby, SteamID steamIDGameServer, int ip, short port){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyMatchList(int lobbiesMatching){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyKicked(SteamID steamIDLobby, SteamID steamIDAdmin, boolean kickedDueToDisconnect){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLobbyCreated(SteamResult result, SteamID steamIDLobby){
|
||||||
|
Log.info("Lobby create callback");
|
||||||
|
Log.info("Lobby {1} created? {0}", result, steamIDLobby.getAccountID());
|
||||||
|
if(result == SteamResult.OK){
|
||||||
|
currentLobby = steamIDLobby;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoritesListAccountsUpdated(SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//steam p2p network overrides
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onP2PSessionConnectFail(SteamID steamIDRemote, P2PSessionError sessionError){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onP2PSessionRequest(SteamID steamIDRemote){
|
||||||
|
//accept users on request
|
||||||
|
snet.acceptP2PSessionWithUser(steamIDRemote);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package io.anuke.mindustry.desktopsdl.steam;
|
||||||
|
|
||||||
|
import com.codedisaster.steamworks.*;
|
||||||
|
import com.codedisaster.steamworks.SteamRemoteStorage.*;
|
||||||
|
import io.anuke.mindustry.maps.*;
|
||||||
|
|
||||||
|
public class WorkshopImpl implements SteamUGCCallback{
|
||||||
|
private SteamUGC ugc = new SteamUGC(this);
|
||||||
|
|
||||||
|
public void publishMap(Map map){
|
||||||
|
ugc.createItem(1127400, WorkshopFileType.GameManagedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUGCQueryCompleted(SteamUGCQuery query, int numResultsReturned, int totalMatchingResults, boolean isCachedData, SteamResult result){
|
||||||
|
//ugc.submitItemUpdate()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubscribeItem(SteamPublishedFileID publishedFileID, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUnsubscribeItem(SteamPublishedFileID publishedFileID, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRequestUGCDetails(SteamUGCDetails details, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreateItem(SteamPublishedFileID publishedFileID, boolean needsToAcceptWLA, SteamResult result){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubmitItemUpdate(SteamPublishedFileID publishedFileID, boolean needsToAcceptWLA, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDownloadItemResult(int appID, SteamPublishedFileID publishedFileID, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserFavoriteItemsListChanged(SteamPublishedFileID publishedFileID, boolean wasAddRequest, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSetUserItemVote(SteamPublishedFileID publishedFileID, boolean voteUp, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGetUserItemVote(SteamPublishedFileID publishedFileID, boolean votedUp, boolean votedDown, boolean voteSkipped, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartPlaytimeTracking(SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopPlaytimeTracking(SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStopPlaytimeTrackingForAllItems(SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDeleteItem(SteamPublishedFileID publishedFileID, SteamResult result){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -220,11 +220,6 @@ public class ArcNetServer implements ServerProvider{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dispose(){
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleException(Throwable e){
|
private void handleException(Throwable e){
|
||||||
Time.run(0f, () -> {
|
Time.run(0f, () -> {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user