mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-11 11:17:11 +07:00
spaghetti eradicated
This commit is contained in:
parent
b2bae64215
commit
e5cf2161d4
@ -295,7 +295,7 @@ public class Renderer implements ApplicationListener{
|
|||||||
|
|
||||||
overlays.drawTop();
|
overlays.drawTop();
|
||||||
|
|
||||||
playerGroup.draw(p -> !p.isDead() && !p.isLocal, Player::drawName);
|
playerGroup.draw(p -> !p.isDead(), Player::drawName);
|
||||||
|
|
||||||
drawLanding();
|
drawLanding();
|
||||||
|
|
||||||
|
@ -383,12 +383,14 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
font.setUseIntegerPositions(false);
|
font.setUseIntegerPositions(false);
|
||||||
font.getData().setScale(0.25f / Scl.scl(1f));
|
font.getData().setScale(0.25f / Scl.scl(1f));
|
||||||
layout.setText(font, name);
|
layout.setText(font, name);
|
||||||
Draw.color(0f, 0f, 0f, 0.3f);
|
|
||||||
Fill.rect(x, y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3);
|
|
||||||
Draw.color();
|
|
||||||
font.setColor(color);
|
|
||||||
|
|
||||||
font.draw(name, x, y + nameHeight, 0, Align.center, false);
|
if(!isLocal){
|
||||||
|
Draw.color(0f, 0f, 0f, 0.3f);
|
||||||
|
Fill.rect(x, y + nameHeight - layout.height / 2, layout.width + 2, layout.height + 3);
|
||||||
|
Draw.color();
|
||||||
|
font.setColor(color);
|
||||||
|
font.draw(name, x, y + nameHeight, 0, Align.center, false);
|
||||||
|
}
|
||||||
|
|
||||||
if(isAdmin){
|
if(isAdmin){
|
||||||
float s = 3f;
|
float s = 3f;
|
||||||
|
@ -55,7 +55,7 @@ public class Pixelator implements Disposable{
|
|||||||
Draw.rect(Draw.wrap(buffer.getTexture()), Core.camera.position.x, Core.camera.position.y, Core.camera.width, -Core.camera.height);
|
Draw.rect(Draw.wrap(buffer.getTexture()), Core.camera.position.x, Core.camera.position.y, Core.camera.width, -Core.camera.height);
|
||||||
Draw.blend();
|
Draw.blend();
|
||||||
|
|
||||||
playerGroup.draw(p -> !p.isDead() && !p.isLocal, Player::drawName);
|
playerGroup.draw(p -> !p.isDead(), Player::drawName);
|
||||||
|
|
||||||
Core.camera.position.set(px, py);
|
Core.camera.position.set(px, py);
|
||||||
Core.settings.put("animatedwater", hadWater);
|
Core.settings.put("animatedwater", hadWater);
|
||||||
|
@ -7,6 +7,7 @@ import com.codedisaster.steamworks.SteamNetworking.*;
|
|||||||
import io.anuke.arc.*;
|
import io.anuke.arc.*;
|
||||||
import io.anuke.arc.collection.*;
|
import io.anuke.arc.collection.*;
|
||||||
import io.anuke.arc.function.*;
|
import io.anuke.arc.function.*;
|
||||||
|
import io.anuke.arc.input.*;
|
||||||
import io.anuke.arc.util.*;
|
import io.anuke.arc.util.*;
|
||||||
import io.anuke.arc.util.pooling.*;
|
import io.anuke.arc.util.pooling.*;
|
||||||
import io.anuke.mindustry.game.EventType.*;
|
import io.anuke.mindustry.game.EventType.*;
|
||||||
@ -35,7 +36,6 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
final ByteBuffer readBuffer = ByteBuffer.allocateDirect(1024 * 4);
|
final ByteBuffer readBuffer = ByteBuffer.allocateDirect(1024 * 4);
|
||||||
|
|
||||||
final CopyOnWriteArrayList<SteamConnection> connections = new CopyOnWriteArrayList<>();
|
final CopyOnWriteArrayList<SteamConnection> connections = new CopyOnWriteArrayList<>();
|
||||||
final CopyOnWriteArrayList<NetConnection> connectionsOut = new CopyOnWriteArrayList<>();
|
|
||||||
final IntMap<SteamConnection> steamConnections = new IntMap<>(); //maps steam ID -> valid net connection
|
final IntMap<SteamConnection> steamConnections = new IntMap<>(); //maps steam ID -> valid net connection
|
||||||
|
|
||||||
SteamID currentLobby, currentServer;
|
SteamID currentLobby, currentServer;
|
||||||
@ -64,11 +64,11 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
try{
|
try{
|
||||||
//accept users on request
|
//accept users on request
|
||||||
if(con == null){
|
if(con == null){
|
||||||
con = new SteamConnection(from);
|
con = new SteamConnection(SteamID.createFromNativeHandle(SteamNativeHandle.getNativeHandle(from)));
|
||||||
Connect c = new Connect();
|
Connect c = new Connect();
|
||||||
c.addressTCP = "steam:" + from.getAccountID();
|
c.addressTCP = "steam:" + from.getAccountID();
|
||||||
|
|
||||||
Log.info("&bRecieved connection: {0}", c.addressTCP);
|
Log.info("&bRecieved STEAM connection: {0}", c.addressTCP);
|
||||||
|
|
||||||
steamConnections.put(from.getAccountID(), con);
|
steamConnections.put(from.getAccountID(), con);
|
||||||
connections.add(con);
|
connections.add(con);
|
||||||
@ -208,8 +208,7 @@ public class SNet implements SteamNetworkingCallback, SteamMatchmakingCallback,
|
|||||||
@Override
|
@Override
|
||||||
public Iterable<? extends NetConnection> getConnections(){
|
public Iterable<? extends NetConnection> getConnections(){
|
||||||
//merge provider connections
|
//merge provider connections
|
||||||
connectionsOut.clear();
|
CopyOnWriteArrayList<NetConnection> connectionsOut = new CopyOnWriteArrayList<>(connections);
|
||||||
connectionsOut.addAll(connections);
|
|
||||||
for(NetConnection c : provider.getConnections()) connectionsOut.add(c);
|
for(NetConnection c : provider.getConnections()) connectionsOut.add(c);
|
||||||
return connectionsOut;
|
return connectionsOut;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user