Control settings, more server settings, selecting character face
This commit is contained in:
@@ -243,7 +243,7 @@ namespace Launcher2
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ToggleFullScreen(object obj)
|
private bool ToggleFullScreen(GUITickBox tickBox)
|
||||||
{
|
{
|
||||||
settings.FullScreenEnabled = !settings.FullScreenEnabled;
|
settings.FullScreenEnabled = !settings.FullScreenEnabled;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
<Compile Include="Source\Networking\NetStats.cs" />
|
<Compile Include="Source\Networking\NetStats.cs" />
|
||||||
<Compile Include="Source\Networking\ReliableSender.cs" />
|
<Compile Include="Source\Networking\ReliableSender.cs" />
|
||||||
<Compile Include="Source\Particles\ParticleEmitter.cs" />
|
<Compile Include="Source\Particles\ParticleEmitter.cs" />
|
||||||
|
<Compile Include="Source\Screens\NetLobbySettings.cs" />
|
||||||
<Compile Include="Source\Screens\ServerListScreen.cs" />
|
<Compile Include="Source\Screens\ServerListScreen.cs" />
|
||||||
<Compile Include="Source\Utils\Rand.cs" />
|
<Compile Include="Source\Utils\Rand.cs" />
|
||||||
<Compile Include="Source\Events\PropertyTask.cs" />
|
<Compile Include="Source\Events\PropertyTask.cs" />
|
||||||
@@ -225,7 +226,6 @@
|
|||||||
<Compile Include="Source\Screens\LobbyScreen.cs" />
|
<Compile Include="Source\Screens\LobbyScreen.cs" />
|
||||||
<Compile Include="Source\Screens\MainMenuScreen.cs" />
|
<Compile Include="Source\Screens\MainMenuScreen.cs" />
|
||||||
<Compile Include="Source\Screens\NetLobbyScreen.cs" />
|
<Compile Include="Source\Screens\NetLobbyScreen.cs" />
|
||||||
<Compile Include="Source\Screens\SettingsScreen.cs" />
|
|
||||||
<Compile Include="Source\Screens\Screen.cs" />
|
<Compile Include="Source\Screens\Screen.cs" />
|
||||||
<Compile Include="Source\GameSettings.cs" />
|
<Compile Include="Source\GameSettings.cs" />
|
||||||
<Compile Include="Source\Sounds\OggSound.cs" />
|
<Compile Include="Source\Sounds\OggSound.cs" />
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
<sound file="beep.ogg" type="OnUse" range="500.0"/>
|
<sound file="beep.ogg" type="OnUse" range="500.0"/>
|
||||||
</Controller>
|
</Controller>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<RequiredItem name="Screwdriver" type="Equipped"/>
|
<RequiredItem name="Screwdriver" type="Equipped"/>
|
||||||
<output name="signal_out"/>
|
<output name="signal_out"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||||
aimpos="35,-10" handle1="0,0" attachable="true" attachedbydefault="true" aimable="true">
|
aimpos="35,-10" handle1="0,0" attachable="true" attachedbydefault="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<item name="Welding Tool"/>
|
<item name="Welding Tool"/>
|
||||||
</fixrequirement>
|
</fixrequirement>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
<input name="set_state"/>
|
<input name="set_state"/>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<item name="Welding Tool"/>
|
<item name="Welding Tool"/>
|
||||||
</fixrequirement>
|
</fixrequirement>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
<input name="set_state"/>
|
<input name="set_state"/>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<LightComponent color="1.0,1.0,1.0,1.0" range ="800.0" powerconsumption="50"/>
|
<LightComponent color="1.0,1.0,1.0,1.0" range ="800.0" powerconsumption="50"/>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="power"/>
|
<input name="power"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<GuiFrame rect="0,0,350,160" alignment="Center" color="0.0,0.0,0.0,0.6"/>
|
<GuiFrame rect="0,0,350,160" alignment="Center" color="0.0,0.0,0.0,0.6"/>
|
||||||
</PowerTransfer>
|
</PowerTransfer>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<RequiredSkill name="Electrical Engineering" level="30"/>
|
<RequiredSkill name="Electrical Engineering" level="30"/>
|
||||||
<StatusEffect type="OnFailure" target="Character">
|
<StatusEffect type="OnFailure" target="Character">
|
||||||
<Explosion range="100.0" damage="5" stun="10" force="2.0" flames="false" shockwave="false" sparks="true"/>
|
<Explosion range="100.0" damage="5" stun="10" force="2.0" flames="false" shockwave="false" sparks="true"/>
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
|
<StatusEffect type="OnActive" target="Contained" targetnames="loadable" Condition="2.0"/>
|
||||||
</PowerContainer>
|
</PowerContainer>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<StatusEffect type="OnFailure" target="Character">
|
<StatusEffect type="OnFailure" target="Character">
|
||||||
<Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/>
|
<Explosion range="100.0" damage="15" stun="10" force="3.0" flames="false" shockwave="false" sparks="true"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
<GuiFrame rect="0,0,0.3,0.3" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
||||||
</PowerContainer>
|
</PowerContainer>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<StatusEffect type="OnFailure" target="Character">
|
<StatusEffect type="OnFailure" target="Character">
|
||||||
<Explosion range="100.0" damage="30" stun="20" force="5.0" shockwave="false" sparks="true"/>
|
<Explosion range="100.0" damage="30" stun="20" force="5.0" shockwave="false" sparks="true"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|||||||
@@ -80,13 +80,13 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||||
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="signal_in1"/>
|
<input name="signal_in1"/>
|
||||||
<input name="signal_in2"/>
|
<input name="signal_in2"/>
|
||||||
@@ -108,12 +108,12 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||||
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="signal_in1"/>
|
<input name="signal_in1"/>
|
||||||
<input name="signal_in2"/>
|
<input name="signal_in2"/>
|
||||||
@@ -135,12 +135,12 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||||
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="signal_in"/>
|
<input name="signal_in"/>
|
||||||
<output name="signal_out"/>
|
<output name="signal_out"/>
|
||||||
@@ -163,11 +163,11 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
<input name="set_state"/>
|
<input name="set_state"/>
|
||||||
@@ -188,12 +188,12 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||||
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<output name="signal_out"/>
|
<output name="signal_out"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
@@ -212,12 +212,12 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]"
|
||||||
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="signal_in"/>
|
<input name="signal_in"/>
|
||||||
<input name="set_output"/>
|
<input name="set_output"/>
|
||||||
@@ -239,12 +239,12 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"
|
<Holdable selectkey="Action" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"
|
||||||
slots="Any,RightHand,LeftHand" msg="Detach [Wrench]">
|
slots="Any,RightHand,LeftHand" msg="Detach [Wrench]">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="signal_in"/>
|
<input name="signal_in"/>
|
||||||
<output name="signal_out"/>
|
<output name="signal_out"/>
|
||||||
@@ -264,12 +264,12 @@
|
|||||||
|
|
||||||
<Body width="16" height="16"/>
|
<Body width="16" height="16"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"
|
<Holdable selectkey="Action" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true"
|
||||||
slots="Any,RightHand,LeftHand" msg="Detach [Wrench]">
|
slots="Any,RightHand,LeftHand" msg="Detach [Wrench]">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="signal_in"/>
|
<input name="signal_in"/>
|
||||||
<output name="signal_out"/>
|
<output name="signal_out"/>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/>
|
<sound file="engine.ogg" type="OnActive" range="3000.0" volume="CurrentVolume" loop="true"/>
|
||||||
</Engine>
|
</Engine>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power_in"/>
|
||||||
<input name="set_force"/>
|
<input name="set_force"/>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>
|
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>
|
||||||
</Radar>
|
</Radar>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power_in"/>
|
||||||
<input name="velocity_in"/>
|
<input name="velocity_in"/>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>
|
<ScreenOverlay texture="Content/Items/Engine/radarOverlay.png" origin="0.5,0.5"/>
|
||||||
</Radar>
|
</Radar>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power_in"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
<GuiFrame rect="0,0,0.5,0.5" alignment="Center" color="0.0,0.0,0.0,0.8"/>
|
||||||
</MiniMap>
|
</MiniMap>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power_in"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<Containable name="Oxygen Tank"/>
|
<Containable name="Oxygen Tank"/>
|
||||||
</ItemContainer>
|
</ItemContainer>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power_in"/>
|
||||||
</ConnectionPanel>
|
</ConnectionPanel>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrFlow" volumemultiplier="0.01" loop="true"/>
|
<sound file="pump.ogg" type="OnActive" range="800.0" volume="CurrFlow" volumemultiplier="0.01" loop="true"/>
|
||||||
</Pump>
|
</Pump>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<input name="power_in"/>
|
<input name="power_in"/>
|
||||||
<input name="toggle"/>
|
<input name="toggle"/>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
</Reactor>
|
</Reactor>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver" type="Equipped"/>
|
<requireditem name="Screwdriver" type="Equipped"/>
|
||||||
<output name="power_out"/>
|
<output name="power_out"/>
|
||||||
<output name="temperature_out"/>
|
<output name="temperature_out"/>
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
<Body width="16" height="9"/>
|
<Body width="16" height="9"/>
|
||||||
|
|
||||||
<Holdable selectkey="ActionHit" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
<Holdable selectkey="Action" slots="Any,RightHand,LeftHand" msg="Detach [Wrench]" aimpos="35,-10" handle1="0,0" attachable="true" aimable="true">
|
||||||
<requireditem name="Wrench" type="Equipped"/>
|
<requireditem name="Wrench" type="Equipped"/>
|
||||||
</Holdable>
|
</Holdable>
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<Containable name="explosive"/>
|
<Containable name="explosive"/>
|
||||||
</ItemContainer>
|
</ItemContainer>
|
||||||
|
|
||||||
<ConnectionPanel selectkey="ActionHit" canbeselected = "true" msg="Rewire [Screwdriver]">
|
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
|
||||||
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
<requireditem name="Screwdriver,Wire" type="Equipped"/>
|
||||||
<input name="activate">
|
<input name="activate">
|
||||||
<StatusEffect type="OnUse" target="Contained" Condition="-100.0"/>
|
<StatusEffect type="OnUse" target="Contained" Condition="-100.0"/>
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
<GUIListBox
|
<GUIListBox
|
||||||
color="0.5, 0.5, 0.5, 1.0"
|
color="0.5, 0.5, 0.5, 1.0"
|
||||||
|
|
||||||
textcolor="1.0, 1.0, 1.0, 1.0"
|
textcolor="1.0, 1.0, 1.0, 1.0"
|
||||||
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
||||||
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0" sourcerect ="0.0, 90.0, 0.0, 100.0"/>
|
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0" sourcerect ="0.0, 90.0, 0.0, 100.0"/>
|
||||||
@@ -39,16 +38,23 @@
|
|||||||
</GUIListBox>
|
</GUIListBox>
|
||||||
|
|
||||||
<GUIScrollBar
|
<GUIScrollBar
|
||||||
color="0.5, 0.5, 0.5, 1.0"
|
color="0.3, 0.3, 0.3, 1.0"
|
||||||
|
|
||||||
textcolor="1.0, 1.0, 1.0, 1.0"
|
textcolor="1.0, 1.0, 1.0, 1.0"
|
||||||
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
||||||
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0"/>
|
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0"/>
|
||||||
</GUIScrollBar>
|
</GUIScrollBar>
|
||||||
|
|
||||||
|
<GUIDropDown
|
||||||
|
color="0.3, 0.3, 0.3, 1.0"
|
||||||
|
textcolor="1.0, 1.0, 1.0, 1.0"
|
||||||
|
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
||||||
|
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0"/>
|
||||||
|
</GUIDropDown>
|
||||||
|
|
||||||
<GUITextBox
|
<GUITextBox
|
||||||
color="0.5, 0.5, 0.5, 1.0"
|
color="0.5, 0.5, 0.5, 1.0"
|
||||||
|
hovercolor="0.8, 0.8, 0.8, 1.0"
|
||||||
textcolor="1.0, 1.0, 1.0, 1.0"
|
textcolor="1.0, 1.0, 1.0, 1.0"
|
||||||
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
outlinecolor="0.5, 0.57, 0.6, 1.0">
|
||||||
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0" sourcerect ="0.0, 90.0, 0.0, 100.0"/>
|
<Sprite texture="Content/UI/uiBackground.png" size="0.0, 0.0" sourcerect ="0.0, 90.0, 0.0, 100.0"/>
|
||||||
|
|||||||
@@ -286,18 +286,24 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
|
|
||||||
keys = new Key[Enum.GetNames(typeof(InputType)).Length];
|
keys = new Key[Enum.GetNames(typeof(InputType)).Length];
|
||||||
keys[(int)InputType.Select] = new Key(false);
|
|
||||||
keys[(int)InputType.ActionHeld] = new Key(true);
|
|
||||||
keys[(int)InputType.ActionHit] = new Key(false);
|
|
||||||
keys[(int)InputType.SecondaryHit] = new Key(false);
|
|
||||||
keys[(int)InputType.SecondaryHeld] = new Key(true);
|
|
||||||
|
|
||||||
keys[(int)InputType.Left] = new Key(true);
|
for (int i = 0; i < Enum.GetNames(typeof(InputType)).Length; i++)
|
||||||
keys[(int)InputType.Right] = new Key(true);
|
{
|
||||||
keys[(int)InputType.Up] = new Key(true);
|
keys[i] = new Key(GameMain.Config.KeyBind((InputType)i));
|
||||||
keys[(int)InputType.Down] = new Key(true);
|
}
|
||||||
|
|
||||||
keys[(int)InputType.Run] = new Key(true);
|
//keys[(int)InputType.Select] = new Key(GameMain.Config.KeyBind(InputType.Select));
|
||||||
|
//keys[(int)InputType.ActionHeld] = new Key(true);
|
||||||
|
//keys[(int)InputType.ActionHit] = new Key(false);
|
||||||
|
//keys[(int)InputType.SecondaryHit] = new Key(false);
|
||||||
|
//keys[(int)InputType.SecondaryHeld] = new Key(true);
|
||||||
|
|
||||||
|
//keys[(int)InputType.Left] = new Key(true);
|
||||||
|
//keys[(int)InputType.Right] = new Key(true);
|
||||||
|
//keys[(int)InputType.Up] = new Key(true);
|
||||||
|
//keys[(int)InputType.Down] = new Key(true);
|
||||||
|
|
||||||
|
//keys[(int)InputType.Run] = new Key(true);
|
||||||
|
|
||||||
selectedItems = new Item[2];
|
selectedItems = new Item[2];
|
||||||
|
|
||||||
@@ -410,16 +416,22 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetInputState(InputType inputType)
|
public bool IsKeyHit(InputType inputType)
|
||||||
{
|
{
|
||||||
return keys[(int)inputType].State;
|
return keys[(int)inputType].Hit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsKeyDown(InputType inputType)
|
||||||
|
{
|
||||||
|
return keys[(int)inputType].Held;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearInputs()
|
public void ClearInputs()
|
||||||
{
|
{
|
||||||
foreach (Key key in keys)
|
foreach (Key key in keys)
|
||||||
{
|
{
|
||||||
key.State = false;
|
key.Hit = false;
|
||||||
|
key.Held = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,10 +489,10 @@ namespace Barotrauma
|
|||||||
if (isDead || AnimController.StunTimer>0.0f) return;
|
if (isDead || AnimController.StunTimer>0.0f) return;
|
||||||
|
|
||||||
Vector2 targetMovement = Vector2.Zero;
|
Vector2 targetMovement = Vector2.Zero;
|
||||||
if (GetInputState(InputType.Left)) targetMovement.X -= 1.0f;
|
if (IsKeyDown(InputType.Left)) targetMovement.X -= 1.0f;
|
||||||
if (GetInputState(InputType.Right)) targetMovement.X += 1.0f;
|
if (IsKeyDown(InputType.Right)) targetMovement.X += 1.0f;
|
||||||
if (GetInputState(InputType.Up)) targetMovement.Y += 1.0f;
|
if (IsKeyDown(InputType.Up)) targetMovement.Y += 1.0f;
|
||||||
if (GetInputState(InputType.Down)) targetMovement.Y -= 1.0f;
|
if (IsKeyDown(InputType.Down)) targetMovement.Y -= 1.0f;
|
||||||
|
|
||||||
//the vertical component is only used for falling through platforms and climbing ladders when not in water,
|
//the vertical component is only used for falling through platforms and climbing ladders when not in water,
|
||||||
//so the movement can't be normalized or the character would walk slower when pressing down/up
|
//so the movement can't be normalized or the character would walk slower when pressing down/up
|
||||||
@@ -490,7 +502,7 @@ namespace Barotrauma
|
|||||||
if (length > 0.0f) targetMovement = targetMovement / length;
|
if (length > 0.0f) targetMovement = targetMovement / length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir) && GetInputState(InputType.Run))
|
if (Math.Sign(targetMovement.X) == Math.Sign(AnimController.Dir) && IsKeyDown(InputType.Run))
|
||||||
targetMovement *= 3.0f;
|
targetMovement *= 3.0f;
|
||||||
|
|
||||||
targetMovement *= SpeedMultiplier;
|
targetMovement *= SpeedMultiplier;
|
||||||
@@ -520,21 +532,21 @@ namespace Barotrauma
|
|||||||
if (selectedItems[i] == null) continue;
|
if (selectedItems[i] == null) continue;
|
||||||
if (i == 1 && selectedItems[0] == selectedItems[1]) continue;
|
if (i == 1 && selectedItems[0] == selectedItems[1]) continue;
|
||||||
|
|
||||||
if (GetInputState(InputType.ActionHeld)) selectedItems[i].Use(deltaTime, this);
|
if (IsKeyDown(InputType.Use)) selectedItems[i].Use(deltaTime, this);
|
||||||
if (GetInputState(InputType.SecondaryHeld) && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
|
if (IsKeyDown(InputType.Aim) && selectedItems[i] != null) selectedItems[i].SecondaryUse(deltaTime, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedConstruction != null)
|
if (selectedConstruction != null)
|
||||||
{
|
{
|
||||||
if (GetInputState(InputType.ActionHeld)) selectedConstruction.Use(deltaTime, this);
|
if (IsKeyDown(InputType.Use)) selectedConstruction.Use(deltaTime, this);
|
||||||
if (selectedConstruction != null && GetInputState(InputType.SecondaryHeld)) selectedConstruction.SecondaryUse(deltaTime, this);
|
if (selectedConstruction != null && IsKeyDown(InputType.Aim)) selectedConstruction.SecondaryUse(deltaTime, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsNetworkPlayer)
|
if (IsNetworkPlayer)
|
||||||
{
|
{
|
||||||
foreach (Key key in keys)
|
foreach (Key key in keys)
|
||||||
{
|
{
|
||||||
key.Reset();
|
key.ResetHit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -658,24 +670,30 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!DisableControls)
|
if (!DisableControls)
|
||||||
{
|
{
|
||||||
keys[(int)InputType.Left].SetState(PlayerInput.KeyDown(Keys.A));
|
for (int i = 0; i < keys.Length; i++ )
|
||||||
keys[(int)InputType.Right].SetState(PlayerInput.KeyDown(Keys.D));
|
{
|
||||||
keys[(int)InputType.Up].SetState(PlayerInput.KeyDown(Keys.W));
|
keys[i].SetState();
|
||||||
keys[(int)InputType.Down].SetState(PlayerInput.KeyDown(Keys.S));
|
}
|
||||||
|
|
||||||
keys[(int)InputType.Select].SetState(PlayerInput.KeyHit(Keys.E));
|
// keys[(int)InputType.Left].SetState(GameMain.Config.KeyBind(inpu));
|
||||||
keys[(int)InputType.ActionHit].SetState(PlayerInput.LeftButtonClicked());
|
//keys[(int)InputType.Right].SetState(PlayerInput.KeyDown(Keys.D));
|
||||||
keys[(int)InputType.ActionHeld].SetState(PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed);
|
//keys[(int)InputType.Up].SetState(PlayerInput.KeyDown(Keys.W));
|
||||||
keys[(int)InputType.SecondaryHit].SetState(PlayerInput.RightButtonClicked());
|
//keys[(int)InputType.Down].SetState(PlayerInput.KeyDown(Keys.S));
|
||||||
keys[(int)InputType.SecondaryHeld].SetState(PlayerInput.GetMouseState.RightButton == ButtonState.Pressed);
|
|
||||||
|
|
||||||
keys[(int)InputType.Run].SetState(PlayerInput.KeyDown(Keys.LeftShift));
|
//keys[(int)InputType.Select].SetState(PlayerInput.KeyHit(Keys.E));
|
||||||
|
//keys[(int)InputType.ActionHit].SetState(PlayerInput.LeftButtonClicked());
|
||||||
|
//keys[(int)InputType.ActionHeld].SetState(PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed);
|
||||||
|
//keys[(int)InputType.SecondaryHit].SetState(PlayerInput.RightButtonClicked());
|
||||||
|
//keys[(int)InputType.SecondaryHeld].SetState(PlayerInput.GetMouseState.RightButton == ButtonState.Pressed);
|
||||||
|
|
||||||
|
//keys[(int)InputType.Run].SetState(PlayerInput.KeyDown(Keys.LeftShift));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (Key key in keys)
|
foreach (Key key in keys)
|
||||||
{
|
{
|
||||||
key.SetState(false);
|
if (key == null) continue;
|
||||||
|
key.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -743,7 +761,12 @@ namespace Barotrauma
|
|||||||
if (closestItem.Pick(this))
|
if (closestItem.Pick(this))
|
||||||
{
|
{
|
||||||
new NetworkEvent(NetworkEventType.PickItem, ID, true,
|
new NetworkEvent(NetworkEventType.PickItem, ID, true,
|
||||||
new int[] { closestItem.ID, GetInputState(InputType.Select) ? 1 : 0, GetInputState(InputType.ActionHit) ? 1 : 0 });
|
new int[]
|
||||||
|
{
|
||||||
|
closestItem.ID,
|
||||||
|
IsKeyHit(InputType.Select) ? 1 : 0,
|
||||||
|
IsKeyHit(InputType.Use) ? 1 : 0
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -756,7 +779,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetInputState(InputType.Select))
|
if (IsKeyHit(InputType.Select))
|
||||||
{
|
{
|
||||||
if (selectedCharacter != null)
|
if (selectedCharacter != null)
|
||||||
{
|
{
|
||||||
@@ -1186,30 +1209,30 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
case NetworkEventType.EntityUpdate:
|
case NetworkEventType.EntityUpdate:
|
||||||
var hasInputs =
|
var hasInputs =
|
||||||
GetInputState(InputType.Left) ||
|
IsKeyDown(InputType.Left) ||
|
||||||
GetInputState(InputType.Right) ||
|
IsKeyDown(InputType.Right) ||
|
||||||
GetInputState(InputType.Up) ||
|
IsKeyDown(InputType.Up) ||
|
||||||
GetInputState(InputType.Down) ||
|
IsKeyDown(InputType.Down) ||
|
||||||
GetInputState(InputType.ActionHeld) ||
|
IsKeyDown(InputType.Use) ||
|
||||||
GetInputState(InputType.SecondaryHeld);
|
IsKeyDown(InputType.Aim);
|
||||||
|
|
||||||
message.Write(hasInputs);
|
message.Write(hasInputs);
|
||||||
message.Write((float)NetTime.Now);
|
message.Write((float)NetTime.Now);
|
||||||
|
|
||||||
if (!hasInputs) return true;
|
if (!hasInputs) return true;
|
||||||
|
|
||||||
message.Write(keys[(int)InputType.ActionHeld].Dequeue);
|
message.Write(keys[(int)InputType.Use].DequeueHeld);
|
||||||
|
|
||||||
bool secondaryHeld = keys[(int)InputType.SecondaryHeld].Dequeue;
|
bool secondaryHeld = keys[(int)InputType.Aim].DequeueHeld;
|
||||||
message.Write(secondaryHeld);
|
message.Write(secondaryHeld);
|
||||||
|
|
||||||
message.Write(keys[(int)InputType.Left].Dequeue);
|
message.Write(keys[(int)InputType.Left].Held);
|
||||||
message.Write(keys[(int)InputType.Right].Dequeue);
|
message.Write(keys[(int)InputType.Right].Held);
|
||||||
|
|
||||||
message.Write(keys[(int)InputType.Up].Dequeue);
|
message.Write(keys[(int)InputType.Up].Held);
|
||||||
message.Write(keys[(int)InputType.Down].Dequeue);
|
message.Write(keys[(int)InputType.Down].Held);
|
||||||
|
|
||||||
message.Write(keys[(int)InputType.Run].Dequeue);
|
message.Write(keys[(int)InputType.Run].Held);
|
||||||
|
|
||||||
if (secondaryHeld)
|
if (secondaryHeld)
|
||||||
{
|
{
|
||||||
@@ -1386,18 +1409,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
AnimController.IsStanding = true;
|
AnimController.IsStanding = true;
|
||||||
|
|
||||||
keys[(int)InputType.ActionHeld].State = actionKeyState;
|
keys[(int)InputType.Use].Held = actionKeyState;
|
||||||
keys[(int)InputType.SecondaryHeld].State = secondaryKeyState;
|
keys[(int)InputType.Aim].Held = secondaryKeyState;
|
||||||
|
|
||||||
if (sendingTime <= LastNetworkUpdate) return;
|
if (sendingTime <= LastNetworkUpdate) return;
|
||||||
|
|
||||||
keys[(int)InputType.Left].State = leftKeyState;
|
keys[(int)InputType.Left].Held = leftKeyState;
|
||||||
keys[(int)InputType.Right].State = rightKeyState;
|
keys[(int)InputType.Right].Held = rightKeyState;
|
||||||
|
|
||||||
keys[(int)InputType.Up].State = upKeyState;
|
keys[(int)InputType.Up].Held = upKeyState;
|
||||||
keys[(int)InputType.Down].State = downKeyState;
|
keys[(int)InputType.Down].Held = downKeyState;
|
||||||
|
|
||||||
keys[(int)InputType.Run].State = runState;
|
keys[(int)InputType.Run].Held = runState;
|
||||||
|
|
||||||
float dir = 1.0f;
|
float dir = 1.0f;
|
||||||
Vector2 pos = Vector2.Zero;
|
Vector2 pos = Vector2.Zero;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public int Salary;
|
public int Salary;
|
||||||
|
|
||||||
public int HeadSpriteId;
|
private int headSpriteId;
|
||||||
private Sprite headSprite;
|
private Sprite headSprite;
|
||||||
|
|
||||||
public bool StartItemsGiven;
|
public bool StartItemsGiven;
|
||||||
@@ -44,6 +44,23 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int HeadSpriteId
|
||||||
|
{
|
||||||
|
get { return headSpriteId; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
int oldId = headSpriteId;
|
||||||
|
|
||||||
|
headSpriteId = value;
|
||||||
|
Vector2 spriteRange = headSpriteRange[gender == Gender.Male ? 0 : 1];
|
||||||
|
|
||||||
|
if (headSpriteId < (int)spriteRange.X) headSpriteId = (int)(spriteRange.Y-1);
|
||||||
|
if (headSpriteId > (int)spriteRange.Y) headSpriteId = (int)(spriteRange.X);
|
||||||
|
|
||||||
|
if (headSpriteId != oldId) headSprite = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Gender Gender
|
public Gender Gender
|
||||||
{
|
{
|
||||||
get { return gender; }
|
get { return gender; }
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
return filePaths;
|
return filePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoadAll(string folder)
|
public static void LoadAll(string folder)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(folder))
|
if (!Directory.Exists(folder))
|
||||||
@@ -189,6 +190,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
string[] files = Directory.GetFiles(folder, "*.xml");
|
string[] files = Directory.GetFiles(folder, "*.xml");
|
||||||
|
|
||||||
|
list.Clear();
|
||||||
|
|
||||||
foreach (string filePath in files)
|
foreach (string filePath in files)
|
||||||
{
|
{
|
||||||
ContentPackage package = new ContentPackage(filePath);
|
ContentPackage package = new ContentPackage(filePath);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace Barotrauma
|
|||||||
public static void ExecuteCommand(string command, GameMain game)
|
public static void ExecuteCommand(string command, GameMain game)
|
||||||
{
|
{
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
if (GameMain.Client!=null)
|
if (GameMain.Client != null)
|
||||||
{
|
{
|
||||||
ThrowError("Console commands are disabled in multiplayer mode");
|
ThrowError("Console commands are disabled in multiplayer mode");
|
||||||
return;
|
return;
|
||||||
@@ -216,7 +216,7 @@ namespace Barotrauma
|
|||||||
case "control":
|
case "control":
|
||||||
if (commands.Length < 2) break;
|
if (commands.Length < 2) break;
|
||||||
commands[1] = commands[1].ToLower();
|
commands[1] = commands[1].ToLower();
|
||||||
Character.Controlled = Character.CharacterList.Find(c => c.Name.ToLower() == commands[1]);
|
Character.Controlled = Character.CharacterList.Find(c => !c.IsNetworkPlayer && c.Name.ToLower() == commands[1]);
|
||||||
break;
|
break;
|
||||||
case "heal":
|
case "heal":
|
||||||
if (Character.Controlled != null)
|
if (Character.Controlled != null)
|
||||||
|
|||||||
@@ -169,8 +169,7 @@ namespace EventInput
|
|||||||
|
|
||||||
public static void OnCharEntered(char character)
|
public static void OnCharEntered(char character)
|
||||||
{
|
{
|
||||||
if (CharEntered != null)
|
if (CharEntered != null) CharEntered(null, new CharacterEventArgs(character, 0));
|
||||||
CharEntered(null, new CharacterEventArgs(character, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static IntPtr HookProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
|
static IntPtr HookProc(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam)
|
||||||
@@ -186,6 +185,7 @@ namespace EventInput
|
|||||||
case WM_KEYDOWN:
|
case WM_KEYDOWN:
|
||||||
if (KeyDown != null)
|
if (KeyDown != null)
|
||||||
KeyDown(null, new KeyEventArgs((Keys)wParam));
|
KeyDown(null, new KeyEventArgs((Keys)wParam));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYUP:
|
case WM_KEYUP:
|
||||||
|
|||||||
@@ -143,6 +143,11 @@ namespace Barotrauma
|
|||||||
set { selectedColor = value; }
|
set { selectedColor = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static KeyboardDispatcher KeyboardDispatcher
|
||||||
|
{
|
||||||
|
get { return keyboardDispatcher; }
|
||||||
|
}
|
||||||
|
|
||||||
protected GUIComponent(GUIStyle style)
|
protected GUIComponent(GUIStyle style)
|
||||||
{
|
{
|
||||||
Visible = true;
|
Visible = true;
|
||||||
@@ -227,7 +232,7 @@ namespace Barotrauma
|
|||||||
foreach (Sprite sprite in sprites)
|
foreach (Sprite sprite in sprites)
|
||||||
{
|
{
|
||||||
Vector2 startPos = new Vector2(rect.X, rect.Y);
|
Vector2 startPos = new Vector2(rect.X, rect.Y);
|
||||||
Vector2 size = new Vector2(sprite.SourceRect.Width, sprite.SourceRect.Height);
|
Vector2 size = new Vector2(Math.Min(sprite.SourceRect.Width,rect.Width), Math.Min(sprite.SourceRect.Height,rect.Height));
|
||||||
|
|
||||||
if (sprite.size.X == 0.0f) size.X = rect.Width;
|
if (sprite.size.X == 0.0f) size.X = rect.Width;
|
||||||
if (sprite.size.Y == 0.0f) size.Y = rect.Height;
|
if (sprite.size.Y == 0.0f) size.Y = rect.Height;
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public class GUIDropDown : GUIComponent
|
public class GUIDropDown : GUIComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public delegate bool OnSelectedHandler(GUIComponent selected);
|
||||||
|
public OnSelectedHandler OnSelected;
|
||||||
|
|
||||||
private GUIButton button;
|
private GUIButton button;
|
||||||
private GUIListBox listBox;
|
private GUIListBox listBox;
|
||||||
|
|
||||||
@@ -65,6 +69,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Dropped = false;
|
Dropped = false;
|
||||||
|
|
||||||
|
if (OnSelected != null) OnSelected(component);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace Barotrauma
|
|||||||
parent.AddChild(this);
|
parent.AddChild(this);
|
||||||
|
|
||||||
isHorizontal = (rect.Width > rect.Height);
|
isHorizontal = (rect.Width > rect.Height);
|
||||||
frame = new GUIFrame(new Rectangle(0,0,0,0), Color.White, style, this);
|
frame = new GUIFrame(new Rectangle(0,0,0,0), Color.Black*0.8f, style, this);
|
||||||
//AddChild(frame);
|
//AddChild(frame);
|
||||||
|
|
||||||
//System.Diagnostics.Debug.WriteLine(frame.rect);
|
//System.Diagnostics.Debug.WriteLine(frame.rect);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -216,7 +217,7 @@ namespace Barotrauma
|
|||||||
if (state == ComponentState.Hover) currColor = hoverColor;
|
if (state == ComponentState.Hover) currColor = hoverColor;
|
||||||
if (state == ComponentState.Selected) currColor = selectedColor;
|
if (state == ComponentState.Selected) currColor = selectedColor;
|
||||||
|
|
||||||
GUI.DrawRectangle(spriteBatch, rect, currColor*(currColor.A/255.0f), true);
|
if (currColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
|
||||||
|
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
@@ -233,6 +234,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrawChildren(spriteBatch);
|
DrawChildren(spriteBatch);
|
||||||
|
|
||||||
|
if (OutlineColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, OutlineColor * (currColor.A / 255.0f), false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ using Microsoft.Xna.Framework.Input;
|
|||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
|
|
||||||
delegate void TextBoxEvent(GUITextBox sender);
|
delegate void TextBoxEvent(GUITextBox sender, Keys key);
|
||||||
|
|
||||||
class GUITextBox : GUIComponent, IKeyboardSubscriber
|
class GUITextBox : GUIComponent, IKeyboardSubscriber
|
||||||
{
|
{
|
||||||
public event TextBoxEvent Clicked;
|
public event TextBoxEvent OnSelected;
|
||||||
|
|
||||||
bool caretVisible;
|
bool caretVisible;
|
||||||
float caretTimer;
|
float caretTimer;
|
||||||
@@ -19,7 +19,9 @@ namespace Barotrauma
|
|||||||
GUITextBlock textBlock;
|
GUITextBlock textBlock;
|
||||||
|
|
||||||
public delegate bool OnEnterHandler(GUITextBox textBox, string text);
|
public delegate bool OnEnterHandler(GUITextBox textBox, string text);
|
||||||
public OnEnterHandler OnEnter;
|
public OnEnterHandler OnEnterPressed;
|
||||||
|
|
||||||
|
public event TextBoxEvent OnKeyHit;
|
||||||
|
|
||||||
public delegate bool OnTextChangedHandler(GUITextBox textBox, string text);
|
public delegate bool OnTextChangedHandler(GUITextBox textBox, string text);
|
||||||
public OnTextChangedHandler OnTextChanged;
|
public OnTextChangedHandler OnTextChanged;
|
||||||
@@ -68,6 +70,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool CaretEnabled;
|
||||||
|
|
||||||
public String Text
|
public String Text
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -97,6 +101,7 @@ namespace Barotrauma
|
|||||||
//ensure that text cannot be larger than the box
|
//ensure that text cannot be larger than the box
|
||||||
Text = textBlock.Text.Substring(0, textBlock.Text.Length - 1);
|
Text = textBlock.Text.Substring(0, textBlock.Text.Length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,10 +135,13 @@ namespace Barotrauma
|
|||||||
parent.AddChild(this);
|
parent.AddChild(this);
|
||||||
|
|
||||||
textBlock = new GUITextBlock(new Rectangle(0,0,0,0), "", color, textColor, textAlignment, style, this);
|
textBlock = new GUITextBlock(new Rectangle(0,0,0,0), "", color, textColor, textAlignment, style, this);
|
||||||
textBlock.Padding = new Vector4(10.0f, 0.0f, 10.0f, 0.0f);
|
|
||||||
if (style != null) style.Apply(textBlock, this);
|
if (style != null) style.Apply(textBlock, this);
|
||||||
|
textBlock.Padding = new Vector4(3.0f, 0.0f, 3.0f, 0.0f);
|
||||||
|
|
||||||
previousMouse = PlayerInput.GetMouseState;
|
previousMouse = PlayerInput.GetMouseState;
|
||||||
|
|
||||||
|
CaretEnabled = true;
|
||||||
//SetTextPos();
|
//SetTextPos();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +149,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Selected = true;
|
Selected = true;
|
||||||
keyboardDispatcher.Subscriber = this;
|
keyboardDispatcher.Subscriber = this;
|
||||||
if (Clicked != null) Clicked(this);
|
//if (Clicked != null) Clicked(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deselect()
|
public void Deselect()
|
||||||
@@ -158,27 +166,37 @@ namespace Barotrauma
|
|||||||
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
||||||
if (!Enabled) return;
|
if (!Enabled) return;
|
||||||
|
|
||||||
caretTimer += deltaTime;
|
if (CaretEnabled)
|
||||||
caretVisible = ((caretTimer*1000.0f) % 1000) < 500;
|
{
|
||||||
|
caretTimer += deltaTime;
|
||||||
|
caretVisible = ((caretTimer*1000.0f) % 1000) < 500;
|
||||||
|
}
|
||||||
|
|
||||||
if (rect.Contains(PlayerInput.MousePosition))
|
if (rect.Contains(PlayerInput.MousePosition))
|
||||||
{
|
{
|
||||||
state = ComponentState.Hover;
|
state = ComponentState.Hover;
|
||||||
if (PlayerInput.LeftButtonClicked()) Select();
|
if (PlayerInput.LeftButtonClicked())
|
||||||
|
{
|
||||||
|
Select();
|
||||||
|
if (OnSelected != null) OnSelected(this, Keys.None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
state = ComponentState.None;
|
state = ComponentState.None;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textBlock.State = state;
|
||||||
|
|
||||||
if (keyboardDispatcher.Subscriber == this)
|
if (keyboardDispatcher.Subscriber == this)
|
||||||
{
|
{
|
||||||
Character.DisableControls = true;
|
Character.DisableControls = true;
|
||||||
if (OnEnter != null && PlayerInput.KeyHit(Keys.Enter))
|
if (OnEnterPressed != null && PlayerInput.KeyHit(Keys.Enter))
|
||||||
{
|
{
|
||||||
string input = Text;
|
string input = Text;
|
||||||
Text = "";
|
Text = "";
|
||||||
OnEnter(this, input);
|
OnEnterPressed(this, input);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,6 +210,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
DrawChildren(spriteBatch);
|
DrawChildren(spriteBatch);
|
||||||
|
|
||||||
|
if (!CaretEnabled) return;
|
||||||
|
|
||||||
Vector2 caretPos = textBlock.CaretPos;
|
Vector2 caretPos = textBlock.CaretPos;
|
||||||
|
|
||||||
if (caretVisible && Selected)
|
if (caretVisible && Selected)
|
||||||
@@ -224,14 +244,14 @@ namespace Barotrauma
|
|||||||
if (Text.Length > 0)
|
if (Text.Length > 0)
|
||||||
Text = Text.Substring(0, Text.Length - 1);
|
Text = Text.Substring(0, Text.Length - 1);
|
||||||
break;
|
break;
|
||||||
case '\r': //return
|
//case '\r': //return
|
||||||
if (OnEnterPressed != null)
|
// if (OnEnterPressed != null)
|
||||||
OnEnterPressed(this);
|
// OnEnterPressed(this);
|
||||||
break;
|
// break;
|
||||||
case '\t': //tab
|
//case '\t': //tab
|
||||||
if (OnTabPressed != null)
|
// if (OnTabPressed != null)
|
||||||
OnTabPressed(this);
|
// OnTabPressed(this);
|
||||||
break;
|
// break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OnTextChanged != null) OnTextChanged(this, Text);
|
if (OnTextChanged != null) OnTextChanged(this, Text);
|
||||||
@@ -239,10 +259,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void ReceiveSpecialInput(Keys key)
|
public void ReceiveSpecialInput(Keys key)
|
||||||
{
|
{
|
||||||
|
if (OnKeyHit != null) OnKeyHit(this, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public event TextBoxEvent OnEnterPressed;
|
//public event TextBoxEvent OnTabPressed;
|
||||||
public event TextBoxEvent OnTabPressed;
|
|
||||||
|
|
||||||
public bool Selected
|
public bool Selected
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Barotrauma
|
|||||||
GUIFrame box;
|
GUIFrame box;
|
||||||
GUITextBlock text;
|
GUITextBlock text;
|
||||||
|
|
||||||
public delegate bool OnSelectedHandler(object obj);
|
public delegate bool OnSelectedHandler(GUITickBox obj);
|
||||||
public OnSelectedHandler OnSelected;
|
public OnSelectedHandler OnSelected;
|
||||||
|
|
||||||
private bool selected;
|
private bool selected;
|
||||||
|
|||||||
@@ -12,10 +12,15 @@ namespace Barotrauma
|
|||||||
public class GameSettings
|
public class GameSettings
|
||||||
{
|
{
|
||||||
private GUIFrame settingsFrame;
|
private GUIFrame settingsFrame;
|
||||||
|
private GUIButton applyButton;
|
||||||
|
|
||||||
private float soundVolume, musicVolume;
|
private float soundVolume, musicVolume;
|
||||||
|
|
||||||
private Keys[] keyMapping;
|
private KeyOrMouse[] keyMapping;
|
||||||
|
|
||||||
|
|
||||||
|
private bool unsavedSettings;
|
||||||
|
|
||||||
|
|
||||||
public GUIFrame SettingsFrame
|
public GUIFrame SettingsFrame
|
||||||
{
|
{
|
||||||
@@ -26,6 +31,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public KeyOrMouse KeyBind(InputType inputType)
|
||||||
|
{
|
||||||
|
return keyMapping[(int)inputType];
|
||||||
|
}
|
||||||
|
|
||||||
public int GraphicsWidth { get; set; }
|
public int GraphicsWidth { get; set; }
|
||||||
public int GraphicsHeight { get; set; }
|
public int GraphicsHeight { get; set; }
|
||||||
|
|
||||||
@@ -37,6 +47,19 @@ namespace Barotrauma
|
|||||||
public bool AutoCheckUpdates { get; set; }
|
public bool AutoCheckUpdates { get; set; }
|
||||||
public bool WasGameUpdated { get; set; }
|
public bool WasGameUpdated { get; set; }
|
||||||
|
|
||||||
|
public bool UnsavedSettings
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return unsavedSettings;
|
||||||
|
}
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
unsavedSettings = value;
|
||||||
|
if (applyButton != null) applyButton.Selected = unsavedSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public float SoundVolume
|
public float SoundVolume
|
||||||
{
|
{
|
||||||
get { return soundVolume; }
|
get { return soundVolume; }
|
||||||
@@ -59,6 +82,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public GameSettings(string filePath)
|
public GameSettings(string filePath)
|
||||||
{
|
{
|
||||||
|
ContentPackage.LoadAll(ContentPackage.Folder);
|
||||||
|
|
||||||
Load(filePath);
|
Load(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,14 +125,17 @@ namespace Barotrauma
|
|||||||
SoundVolume = ToolBox.GetAttributeFloat(doc.Root, "soundvolume", 1.0f);
|
SoundVolume = ToolBox.GetAttributeFloat(doc.Root, "soundvolume", 1.0f);
|
||||||
MusicVolume = ToolBox.GetAttributeFloat(doc.Root, "musicvolume", 0.3f);
|
MusicVolume = ToolBox.GetAttributeFloat(doc.Root, "musicvolume", 0.3f);
|
||||||
|
|
||||||
keyMapping = new Keys[Enum.GetNames(typeof(InputType)).Length];
|
keyMapping = new KeyOrMouse[Enum.GetNames(typeof(InputType)).Length];
|
||||||
keyMapping[(int)InputType.Up] = Keys.W;
|
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W);
|
||||||
keyMapping[(int)InputType.Down] = Keys.S;
|
keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S);
|
||||||
keyMapping[(int)InputType.Left] = Keys.A;
|
keyMapping[(int)InputType.Left] = new KeyOrMouse(Keys.A);
|
||||||
keyMapping[(int)InputType.Right] = Keys.D;
|
keyMapping[(int)InputType.Right] = new KeyOrMouse(Keys.D);
|
||||||
keyMapping[(int)InputType.Run] = Keys.LeftShift;
|
keyMapping[(int)InputType.Run] = new KeyOrMouse(Keys.LeftShift);
|
||||||
keyMapping[(int)InputType.Chat] = Keys.Tab;
|
keyMapping[(int)InputType.Chat] = new KeyOrMouse(Keys.Tab);
|
||||||
keyMapping[(int)InputType.Select] = Keys.E;
|
keyMapping[(int)InputType.Select] = new KeyOrMouse(Keys.E);
|
||||||
|
|
||||||
|
keyMapping[(int)InputType.Use] = new KeyOrMouse(0);
|
||||||
|
keyMapping[(int)InputType.Aim] = new KeyOrMouse(1);
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
@@ -124,19 +152,31 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
InputType inputType;
|
InputType inputType;
|
||||||
Keys key;
|
Keys key;
|
||||||
if (Enum.TryParse(attribute.Name.ToString(), true, out inputType) &&
|
int mouseButton;
|
||||||
Enum.TryParse(attribute.Value.ToString(), true, out key))
|
if (Enum.TryParse(attribute.Name.ToString(), true, out inputType))
|
||||||
{
|
{
|
||||||
keyMapping[(int)inputType] = key;
|
if (Enum.TryParse(attribute.Value.ToString(), true, out key))
|
||||||
|
{
|
||||||
|
keyMapping[(int)inputType] = new KeyOrMouse(key);
|
||||||
|
}
|
||||||
|
else if (int.TryParse(attribute.Value.ToString(), out mouseButton))
|
||||||
|
{
|
||||||
|
keyMapping[(int)inputType] = new KeyOrMouse(mouseButton);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UnsavedSettings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save(string filePath)
|
public void Save(string filePath)
|
||||||
{
|
{
|
||||||
|
UnsavedSettings = false;
|
||||||
|
|
||||||
XDocument doc = new XDocument();
|
XDocument doc = new XDocument();
|
||||||
|
|
||||||
if (doc.Root == null)
|
if (doc.Root == null)
|
||||||
@@ -173,12 +213,12 @@ namespace Barotrauma
|
|||||||
new XAttribute("path", SelectedContentPackage.Path)));
|
new XAttribute("path", SelectedContentPackage.Path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
doc.Save(filePath);
|
doc.Save(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ChangeSoundVolume(float barScroll)
|
private bool ChangeSoundVolume(float barScroll)
|
||||||
{
|
{
|
||||||
|
UnsavedSettings = true;
|
||||||
SoundVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f);
|
SoundVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -186,49 +226,152 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool ChangeMusicVolume(float barScroll)
|
private bool ChangeMusicVolume(float barScroll)
|
||||||
{
|
{
|
||||||
|
UnsavedSettings = true;
|
||||||
MusicVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f);
|
MusicVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ToggleFullScreen(object userData)
|
||||||
|
{
|
||||||
|
UnsavedSettings = true;
|
||||||
|
FullScreenEnabled = !FullScreenEnabled;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetSettingsFrame()
|
||||||
|
{
|
||||||
|
settingsFrame = null;
|
||||||
|
}
|
||||||
|
|
||||||
private void CreateSettingsFrame()
|
private void CreateSettingsFrame()
|
||||||
{
|
{
|
||||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, GUI.Style);
|
settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, GUI.Style);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Sound volume:", GUI.Style, settingsFrame);
|
new GUITextBlock(new Rectangle(0,-30,0,30), "Settings",GUI.Style,Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
|
||||||
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, 20, 150, 20), GUI.Style,0.1f, settingsFrame);
|
|
||||||
|
int x=0, y = 10;
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, y, 20, 20), "Resolution", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||||
|
var resolutionDD = new GUIDropDown(new Rectangle(0, y + 20, 180, 20), "", GUI.Style, settingsFrame);
|
||||||
|
|
||||||
|
var supportedModes = new List<DisplayMode>();
|
||||||
|
foreach (DisplayMode mode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes)
|
||||||
|
{
|
||||||
|
if (supportedModes.FirstOrDefault(m => m.Width == mode.Width && m.Height == mode.Height) != null) continue;
|
||||||
|
|
||||||
|
resolutionDD.AddItem(mode.Width + "x" + mode.Height, mode);
|
||||||
|
supportedModes.Add(mode);
|
||||||
|
|
||||||
|
if (GraphicsWidth == mode.Width && GraphicsHeight == mode.Height) resolutionDD.SelectItem(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resolutionDD.SelectedItemData == null)
|
||||||
|
{
|
||||||
|
resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Last());
|
||||||
|
}
|
||||||
|
|
||||||
|
y += 50;
|
||||||
|
|
||||||
|
var fullScreenTick = new GUITickBox(new Rectangle(x, y, 20, 20), "Fullscreen", Alignment.TopLeft, settingsFrame);
|
||||||
|
fullScreenTick.OnSelected = ToggleFullScreen;
|
||||||
|
fullScreenTick.Selected = FullScreenEnabled;
|
||||||
|
|
||||||
|
y += 50;
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", GUI.Style, settingsFrame);
|
||||||
|
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y+20, 150, 20), GUI.Style,0.1f, settingsFrame);
|
||||||
soundScrollBar.BarScroll = SoundVolume;
|
soundScrollBar.BarScroll = SoundVolume;
|
||||||
soundScrollBar.OnMoved = ChangeSoundVolume;
|
soundScrollBar.OnMoved = ChangeSoundVolume;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 40, 100, 20), "Music volume:", GUI.Style, settingsFrame);
|
new GUITextBlock(new Rectangle(0, y+40, 100, 20), "Music volume:", GUI.Style, settingsFrame);
|
||||||
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, 60, 150, 20), GUI.Style, 0.1f, settingsFrame);
|
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y+60, 150, 20), GUI.Style, 0.1f, settingsFrame);
|
||||||
musicScrollBar.BarScroll = MusicVolume;
|
musicScrollBar.BarScroll = MusicVolume;
|
||||||
musicScrollBar.OnMoved = ChangeMusicVolume;
|
musicScrollBar.OnMoved = ChangeMusicVolume;
|
||||||
|
|
||||||
int x = 250;
|
x = 200;
|
||||||
int y = 60;
|
y = 10;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(x, 40, 100, 20), "Controls:", GUI.Style, settingsFrame);
|
new GUITextBlock(new Rectangle(x, y, 20, 20), "Content package", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||||
|
var contentPackageDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", GUI.Style, settingsFrame);
|
||||||
|
|
||||||
|
foreach (ContentPackage contentPackage in ContentPackage.list)
|
||||||
|
{
|
||||||
|
contentPackageDD.AddItem(contentPackage.Name, contentPackage);
|
||||||
|
|
||||||
|
if (SelectedContentPackage == contentPackage) contentPackageDD.SelectItem(contentPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
y += 50;
|
||||||
|
new GUITextBlock(new Rectangle(x, y, 100, 20), "Controls:", GUI.Style, settingsFrame);
|
||||||
|
y += 30;
|
||||||
var inputNames = Enum.GetNames(typeof(InputType));
|
var inputNames = Enum.GetNames(typeof(InputType));
|
||||||
for (int i = 0; i< inputNames.Length; i++)
|
for (int i = 0; i< inputNames.Length; i++)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(x, y, 100, 20), inputNames[i]+": ", GUI.Style, settingsFrame);
|
new GUITextBlock(new Rectangle(x, y, 100, 20), inputNames[i]+": ", GUI.Style, settingsFrame);
|
||||||
var keyBox = new GUITextBox(new Rectangle(x + 100, y, 70, 15), GUI.Style, settingsFrame);
|
var keyBox = new GUITextBox(new Rectangle(x + 100, y, 120, 15), GUI.Style, settingsFrame);
|
||||||
keyBox.Text = keyMapping[i].ToString();
|
keyBox.Text = keyMapping[i].ToString();
|
||||||
keyBox.OnTextChanged = MapKey;
|
keyBox.UserData = i;
|
||||||
|
keyBox.OnSelected += KeyBoxSelected;
|
||||||
|
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||||
|
|
||||||
y += 20;
|
y += 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
var applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Apply", GUI.Style, settingsFrame);
|
applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Apply", Alignment.BottomRight, GUI.Style, settingsFrame);
|
||||||
applyButton.OnClicked = ApplyClicked;
|
applyButton.OnClicked = ApplyClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool MapKey(GUITextBox textBox, string text)
|
private void KeyBoxSelected(GUITextBox textBox, Keys key)
|
||||||
{
|
{
|
||||||
|
textBox.Text = "";
|
||||||
|
CoroutineManager.StartCoroutine(WaitForKeyPress(textBox));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool MarkUnappliedChanges(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
UnsavedSettings = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool SelectResolution(GUIComponent selected)
|
||||||
|
{
|
||||||
|
DisplayMode mode = selected.UserData as DisplayMode;
|
||||||
|
if (mode == null) return false;
|
||||||
|
|
||||||
|
GraphicsWidth = mode.Width;
|
||||||
|
GraphicsHeight = mode.Height;
|
||||||
|
|
||||||
|
UnsavedSettings = true;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private IEnumerable<object> WaitForKeyPress(GUITextBox keyBox)
|
||||||
|
{
|
||||||
|
while (keyBox.Selected && PlayerInput.GetKeyboardState.GetPressedKeys().Length==0)
|
||||||
|
{
|
||||||
|
if (Screen.Selected != GameMain.MainMenuScreen) yield return CoroutineStatus.Success;
|
||||||
|
|
||||||
|
yield return CoroutineStatus.Running;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnsavedSettings = true;
|
||||||
|
|
||||||
|
Keys key = PlayerInput.GetKeyboardState.GetPressedKeys()[0];
|
||||||
|
|
||||||
|
int keyIndex = (int)keyBox.UserData;
|
||||||
|
keyMapping[keyIndex] = new KeyOrMouse(key);
|
||||||
|
|
||||||
|
keyBox.Text = key.ToString("G");
|
||||||
|
keyBox.Deselect();
|
||||||
|
|
||||||
|
yield return CoroutineStatus.Success;
|
||||||
|
}
|
||||||
|
|
||||||
private bool ApplyClicked(GUIButton button, object userData)
|
private bool ApplyClicked(GUIButton button, object userData)
|
||||||
{
|
{
|
||||||
Save("config.xml");
|
Save("config.xml");
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ namespace Barotrauma.Items.Components
|
|||||||
public override bool Use(float deltaTime, Character character = null)
|
public override bool Use(float deltaTime, Character character = null)
|
||||||
{
|
{
|
||||||
if (!attachable || item.body==null) return true;
|
if (!attachable || item.body==null) return true;
|
||||||
if (character != null && !character.GetInputState(InputType.SecondaryHeld)) return false;
|
if (character != null && !character.IsKeyDown(InputType.Aim)) return false;
|
||||||
|
|
||||||
item.Drop();
|
item.Drop();
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
|
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
|
||||||
|
|
||||||
ac.HoldItem(deltaTime, item, handlePos, holdPos, aimPos, picker.GetInputState(InputType.SecondaryHeld), holdAngle);
|
ac.HoldItem(deltaTime, item, handlePos, holdPos, aimPos, picker.IsKeyDown(InputType.Aim), holdAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Flip(Item item)
|
protected void Flip(Item item)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ namespace Barotrauma.Items.Components
|
|||||||
public override bool Use(float deltaTime, Character character = null)
|
public override bool Use(float deltaTime, Character character = null)
|
||||||
{
|
{
|
||||||
if (character == null || reloadTimer>0.0f) return false;
|
if (character == null || reloadTimer>0.0f) return false;
|
||||||
if (!character.GetInputState(InputType.SecondaryHeld) || hitting) return false;
|
if (!character.IsKeyDown(InputType.Aim) || hitting) return false;
|
||||||
|
|
||||||
user = character;
|
user = character;
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
foreach (Limb l in character.AnimController.Limbs)
|
foreach (Limb l in character.AnimController.Limbs)
|
||||||
{
|
{
|
||||||
item.body.FarseerBody.IgnoreCollisionWith(l.body.FarseerBody);
|
//item.body.FarseerBody.IgnoreCollisionWith(l.body.FarseerBody);
|
||||||
|
|
||||||
if (character.AnimController.InWater) continue;
|
if (character.AnimController.InWater) continue;
|
||||||
if (l.type == LimbType.LeftFoot || l.type == LimbType.LeftThigh || l.type == LimbType.LeftLeg) continue;
|
if (l.type == LimbType.LeftFoot || l.type == LimbType.LeftThigh || l.type == LimbType.LeftLeg) continue;
|
||||||
@@ -107,7 +107,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
reloadTimer -= deltaTime;
|
reloadTimer -= deltaTime;
|
||||||
|
|
||||||
if (!picker.GetInputState(InputType.SecondaryHeld) && !hitting) hitPos = 0.0f;
|
if (!picker.IsKeyDown(InputType.Aim) && !hitting) hitPos = 0.0f;
|
||||||
|
|
||||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
|
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (!hitting)
|
if (!hitting)
|
||||||
{
|
{
|
||||||
if (picker.GetInputState(InputType.SecondaryHeld))
|
if (picker.IsKeyDown(InputType.Aim))
|
||||||
{
|
{
|
||||||
hitPos = (float)System.Math.Min(hitPos+deltaTime*5.0f, MathHelper.Pi*0.7f);
|
hitPos = (float)System.Math.Min(hitPos+deltaTime*5.0f, MathHelper.Pi*0.7f);
|
||||||
|
|
||||||
@@ -167,10 +167,10 @@ namespace Barotrauma.Items.Components
|
|||||||
item.body.CollisionCategories = Physics.CollisionMisc;
|
item.body.CollisionCategories = Physics.CollisionMisc;
|
||||||
item.body.CollidesWith = Physics.CollisionWall;
|
item.body.CollidesWith = Physics.CollisionWall;
|
||||||
|
|
||||||
foreach (Limb l in picker.AnimController.Limbs)
|
//foreach (Limb l in picker.AnimController.Limbs)
|
||||||
{
|
//{
|
||||||
item.body.FarseerBody.RestoreCollisionWith(l.body.FarseerBody);
|
// item.body.FarseerBody.RestoreCollisionWith(l.body.FarseerBody);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Barotrauma.Items.Components
|
|||||||
public override bool Use(float deltaTime, Character character = null)
|
public override bool Use(float deltaTime, Character character = null)
|
||||||
{
|
{
|
||||||
if (character == null) return false;
|
if (character == null) return false;
|
||||||
if (!character.GetInputState(InputType.SecondaryHeld) || reload > 0.0f) return false;
|
if (!character.IsKeyDown(InputType.Aim) || reload > 0.0f) return false;
|
||||||
IsActive = true;
|
IsActive = true;
|
||||||
reload = 1.0f;
|
reload = 1.0f;
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ namespace Barotrauma.Items.Components
|
|||||||
public override bool Use(float deltaTime, Character character = null)
|
public override bool Use(float deltaTime, Character character = null)
|
||||||
{
|
{
|
||||||
if (character == null) return false;
|
if (character == null) return false;
|
||||||
if (!character.GetInputState(InputType.SecondaryHeld)) return false;
|
if (!character.IsKeyDown(InputType.Aim)) return false;
|
||||||
|
|
||||||
//if (DoesUseFail(character)) return false;
|
//if (DoesUseFail(character)) return false;
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
else if ((targetLimb = (targetBody.UserData as Limb)) != null)
|
else if ((targetLimb = (targetBody.UserData as Limb)) != null)
|
||||||
{
|
{
|
||||||
if (character.GetInputState(InputType.SecondaryHeld))
|
if (character.IsKeyDown(InputType.Aim))
|
||||||
{
|
{
|
||||||
targetLimb.character.Health += limbFixAmount * degreeOfSuccess;
|
targetLimb.character.Health += limbFixAmount * degreeOfSuccess;
|
||||||
//isActive = true;
|
//isActive = true;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ namespace Barotrauma.Items.Components
|
|||||||
public override bool Use(float deltaTime, Character character = null)
|
public override bool Use(float deltaTime, Character character = null)
|
||||||
{
|
{
|
||||||
if (character == null) return false;
|
if (character == null) return false;
|
||||||
if (!character.GetInputState(InputType.SecondaryHeld) || throwing) return false;
|
if (!character.IsKeyDown(InputType.Aim) || throwing) return false;
|
||||||
|
|
||||||
//Vector2 diff = Vector2.Normalize(character.CursorPosition - character.AnimController.RefLimb.Position);
|
//Vector2 diff = Vector2.Normalize(character.CursorPosition - character.AnimController.RefLimb.Position);
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (!item.body.Enabled) return;
|
if (!item.body.Enabled) return;
|
||||||
if (!picker.HasSelectedItem(item)) IsActive = false;
|
if (!picker.HasSelectedItem(item)) IsActive = false;
|
||||||
|
|
||||||
if (!picker.GetInputState(InputType.SecondaryHeld) && !throwing) throwPos = 0.0f;
|
if (!picker.IsKeyDown(InputType.Aim) && !throwing) throwPos = 0.0f;
|
||||||
|
|
||||||
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
|
ApplyStatusEffects(ActionType.OnActive, deltaTime, picker);
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
if (!throwing)
|
if (!throwing)
|
||||||
{
|
{
|
||||||
if (picker.GetInputState(InputType.SecondaryHeld))
|
if (picker.IsKeyDown(InputType.Aim))
|
||||||
{
|
{
|
||||||
throwPos = (float)System.Math.Min(throwPos+deltaTime*5.0f, MathHelper.Pi*0.7f);
|
throwPos = (float)System.Math.Min(throwPos+deltaTime*5.0f, MathHelper.Pi*0.7f);
|
||||||
|
|
||||||
|
|||||||
@@ -63,6 +63,8 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
currPowerConsumption = Math.Abs(targetForce)/100.0f * powerConsumption;
|
currPowerConsumption = Math.Abs(targetForce)/100.0f * powerConsumption;
|
||||||
|
|
||||||
|
if (powerConsumption == 0.0f) voltage = 1.0f;
|
||||||
|
|
||||||
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
|
Force = MathHelper.Lerp(force, (voltage < minVoltage) ? 0.0f : targetForce, 0.1f);
|
||||||
if (Force != 0.0f)
|
if (Force != 0.0f)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
|
item.body.FarseerBody.RestoreCollisionWith(stickTarget);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
DebugConsole.ThrowError("Failed to restore collision with stickTarget", e);
|
DebugConsole.ThrowError("Failed to restore collision with stickTarget", e);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (character != Character.Controlled || character != user) return;
|
if (character != Character.Controlled || character != user) return;
|
||||||
|
|
||||||
if (Screen.Selected != GameMain.EditMapScreen &&
|
if (Screen.Selected != GameMain.EditMapScreen &&
|
||||||
character.GetInputState(InputType.Select) &&
|
character.IsKeyHit(InputType.Select) &&
|
||||||
character.SelectedConstruction==this.item) character.SelectedConstruction = null;
|
character.SelectedConstruction==this.item) character.SelectedConstruction = null;
|
||||||
|
|
||||||
Connection.DrawConnections(spriteBatch, this, character);
|
Connection.DrawConnections(spriteBatch, this, character);
|
||||||
|
|||||||
@@ -727,7 +727,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
namesBox.Text = relatedItem.JoinedNames;
|
namesBox.Text = relatedItem.JoinedNames;
|
||||||
namesBox.UserData = new ObjectProperty(property, relatedItem);
|
namesBox.UserData = new ObjectProperty(property, relatedItem);
|
||||||
namesBox.OnEnter = EnterProperty;
|
namesBox.OnEnterPressed = EnterProperty;
|
||||||
namesBox.OnTextChanged = PropertyChanged;
|
namesBox.OnTextChanged = PropertyChanged;
|
||||||
|
|
||||||
y += 30;
|
y += 30;
|
||||||
@@ -754,7 +754,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
propertyBox.UserData = objectProperty;
|
propertyBox.UserData = objectProperty;
|
||||||
propertyBox.OnEnter = EnterProperty;
|
propertyBox.OnEnterPressed = EnterProperty;
|
||||||
propertyBox.OnTextChanged = PropertyChanged;
|
propertyBox.OnTextChanged = PropertyChanged;
|
||||||
y = y + height+10;
|
y = y + height+10;
|
||||||
}
|
}
|
||||||
@@ -879,8 +879,8 @@ namespace Barotrauma
|
|||||||
bool pickHit = false, selectHit = false;
|
bool pickHit = false, selectHit = false;
|
||||||
if (Screen.Selected == GameMain.EditMapScreen)
|
if (Screen.Selected == GameMain.EditMapScreen)
|
||||||
{
|
{
|
||||||
pickHit = picker.GetInputState(InputType.Select);
|
pickHit = picker.IsKeyHit(InputType.Select);
|
||||||
selectHit = picker.GetInputState(InputType.Select);
|
selectHit = picker.IsKeyHit(InputType.Select);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -891,13 +891,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else if (forceActionKey)
|
else if (forceActionKey)
|
||||||
{
|
{
|
||||||
if (ic.PickKey == InputType.ActionHit) pickHit = true;
|
if (ic.PickKey == InputType.Use) pickHit = true;
|
||||||
if (ic.SelectKey == InputType.ActionHit) selectHit = true;
|
if (ic.SelectKey == InputType.Use) selectHit = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pickHit = picker.GetInputState(ic.PickKey);
|
pickHit = picker.IsKeyHit(ic.PickKey);
|
||||||
selectHit = picker.GetInputState(ic.SelectKey);
|
selectHit = picker.IsKeyHit(ic.SelectKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,7 +925,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (picker.SelectedConstruction == this)
|
if (picker.SelectedConstruction == this)
|
||||||
{
|
{
|
||||||
if (picker.GetInputState(InputType.Select)) picker.SelectedConstruction = null;
|
if (picker.IsKeyHit(InputType.Select)) picker.SelectedConstruction = null;
|
||||||
}
|
}
|
||||||
else if (selected)
|
else if (selected)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.Black, Alignment.TopLeft, null, editingHUD);
|
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.Black, Alignment.TopLeft, null, editingHUD);
|
||||||
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
|
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
|
||||||
propertyBox.Text = string.Join(", ", idCardTags);
|
propertyBox.Text = string.Join(", ", idCardTags);
|
||||||
propertyBox.OnEnter = EnterIDCardTags;
|
propertyBox.OnEnterPressed = EnterIDCardTags;
|
||||||
propertyBox.OnTextChanged = TextBoxChanged;
|
propertyBox.OnTextChanged = TextBoxChanged;
|
||||||
y = y + 30;
|
y = y + 30;
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ namespace Barotrauma
|
|||||||
propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
|
propertyBox = new GUITextBox(new Rectangle(100, y, 200, 20), GUI.Style, editingHUD);
|
||||||
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
||||||
|
|
||||||
propertyBox.OnEnter = EnterAssignedJob;
|
propertyBox.OnEnterPressed = EnterAssignedJob;
|
||||||
propertyBox.OnTextChanged = TextBoxChanged;
|
propertyBox.OnTextChanged = TextBoxChanged;
|
||||||
y = y + 30;
|
y = y + 30;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,8 @@ using Barotrauma.Networking.ReliableMessages;
|
|||||||
|
|
||||||
namespace Barotrauma.Networking
|
namespace Barotrauma.Networking
|
||||||
{
|
{
|
||||||
class GameServer : NetworkMember
|
partial class GameServer : NetworkMember
|
||||||
{
|
{
|
||||||
public bool ShowNetStats;
|
|
||||||
|
|
||||||
public List<Client> connectedClients = new List<Client>();
|
public List<Client> connectedClients = new List<Client>();
|
||||||
|
|
||||||
//for keeping track of disconnected clients in case the reconnect shortly after
|
//for keeping track of disconnected clients in case the reconnect shortly after
|
||||||
@@ -26,39 +24,11 @@ namespace Barotrauma.Networking
|
|||||||
private NetServer server;
|
private NetServer server;
|
||||||
private NetPeerConfiguration config;
|
private NetPeerConfiguration config;
|
||||||
|
|
||||||
private TimeSpan sparseUpdateInterval = new TimeSpan(0, 0, 0, 3);
|
|
||||||
private DateTime sparseUpdateTimer;
|
private DateTime sparseUpdateTimer;
|
||||||
|
|
||||||
private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 40);
|
|
||||||
private DateTime refreshMasterTimer;
|
private DateTime refreshMasterTimer;
|
||||||
|
|
||||||
private BanList banList;
|
|
||||||
|
|
||||||
private bool masterServerResponded;
|
private bool masterServerResponded;
|
||||||
|
|
||||||
private bool registeredToMaster;
|
|
||||||
|
|
||||||
private string password;
|
|
||||||
|
|
||||||
private bool autoRestart;
|
|
||||||
|
|
||||||
public bool AutoRestart
|
|
||||||
{
|
|
||||||
get { return (connectedClients.Count==0) ? false : autoRestart; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
autoRestart = value;
|
|
||||||
|
|
||||||
AutoRestartTimer = autoRestart ? 20.0f : 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public float AutoRestartTimer;
|
|
||||||
|
|
||||||
public BanList BanList
|
|
||||||
{
|
|
||||||
get { return banList; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
||||||
{
|
{
|
||||||
var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 25), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
|
var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 25), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
|
||||||
@@ -238,6 +208,7 @@ namespace Barotrauma.Networking
|
|||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (ShowNetStats) netStats.Update(deltaTime);
|
if (ShowNetStats) netStats.Update(deltaTime);
|
||||||
|
if (settingsFrame != null) settingsFrame.Update(deltaTime);
|
||||||
|
|
||||||
if (!started) return;
|
if (!started) return;
|
||||||
|
|
||||||
@@ -1034,6 +1005,8 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (settingsFrame != null) settingsFrame.Draw(spriteBatch);
|
||||||
|
|
||||||
if (!ShowNetStats) return;
|
if (!ShowNetStats) return;
|
||||||
|
|
||||||
int width = 200, height = 300;
|
int width = 200, height = 300;
|
||||||
@@ -1292,16 +1265,6 @@ namespace Barotrauma.Networking
|
|||||||
return preferredClient;
|
return preferredClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private byte PlayerCountToByte(int playerCount, int maxPlayers)
|
|
||||||
{
|
|
||||||
byte byteVal = (byte)playerCount;
|
|
||||||
|
|
||||||
byteVal |= (byte)((maxPlayers-1) << 4);
|
|
||||||
|
|
||||||
return byteVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// sends some random data to the clients
|
/// sends some random data to the clients
|
||||||
/// use for debugging purposes
|
/// use for debugging purposes
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ namespace Barotrauma.Networking
|
|||||||
new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25),
|
new Rectangle(chatBox.Rect.X, chatBox.Rect.Y + chatBox.Rect.Height + 20, chatBox.Rect.Width, 25),
|
||||||
Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, GUI.Style, inGameHUD);
|
Color.White * 0.5f, Color.Black, Alignment.TopLeft, Alignment.Left, GUI.Style, inGameHUD);
|
||||||
chatMsgBox.Font = GUI.SmallFont;
|
chatMsgBox.Font = GUI.SmallFont;
|
||||||
chatMsgBox.OnEnter = EnterChatMessage;
|
chatMsgBox.OnEnterPressed = EnterChatMessage;
|
||||||
|
|
||||||
crewButton = new GUIButton(new Rectangle(chatBox.Rect.Right-80, chatBox.Rect.Y-30, 80, 20), "Crew", GUI.Style, inGameHUD);
|
crewButton = new GUIButton(new Rectangle(chatBox.Rect.Right-80, chatBox.Rect.Y-30, 80, 20), "Crew", GUI.Style, inGameHUD);
|
||||||
crewButton.OnClicked = ToggleCrewFrame;
|
crewButton.OnClicked = ToggleCrewFrame;
|
||||||
@@ -175,17 +175,6 @@ namespace Barotrauma.Networking
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//protected void UpdateCrewFrame(List<Client> connectedClients)
|
|
||||||
//{
|
|
||||||
// List<Character> characterList = new List<Character>();
|
|
||||||
// foreach (Client c in connectedClients)
|
|
||||||
// {
|
|
||||||
// if (c.character != null && c.inGame) characterList.Add(c.character);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// CreateCrewFrame(characterList);
|
|
||||||
//}
|
|
||||||
|
|
||||||
public bool EnterChatMessage(GUITextBox textBox, string message)
|
public bool EnterChatMessage(GUITextBox textBox, string message)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(message)) return false;
|
if (string.IsNullOrWhiteSpace(message)) return false;
|
||||||
@@ -268,6 +257,15 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public virtual void Disconnect() { }
|
public virtual void Disconnect() { }
|
||||||
|
|
||||||
|
protected byte PlayerCountToByte(int playerCount, int maxPlayers)
|
||||||
|
{
|
||||||
|
byte byteVal = (byte)playerCount;
|
||||||
|
|
||||||
|
byteVal |= (byte)((maxPlayers - 1) << 4);
|
||||||
|
|
||||||
|
return byteVal;
|
||||||
|
}
|
||||||
|
|
||||||
public static int ByteToPlayerCount(byte byteVal, out int maxPlayers)
|
public static int ByteToPlayerCount(byte byteVal, out int maxPlayers)
|
||||||
{
|
{
|
||||||
maxPlayers = (byteVal >> 4)+1;
|
maxPlayers = (byteVal >> 4)+1;
|
||||||
|
|||||||
@@ -7,62 +7,177 @@ namespace Barotrauma
|
|||||||
public enum InputType
|
public enum InputType
|
||||||
{
|
{
|
||||||
Select,
|
Select,
|
||||||
ActionHit, ActionHeld,
|
Use,
|
||||||
SecondaryHit, SecondaryHeld,
|
Aim,
|
||||||
Left, Right, Up, Down,
|
Up, Down, Left, Right,
|
||||||
Run, Chat
|
Run, Chat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class KeyOrMouse
|
||||||
|
{
|
||||||
|
Keys keyBinding;
|
||||||
|
int? mouseButton;
|
||||||
|
|
||||||
|
public KeyOrMouse(Keys keyBinding)
|
||||||
|
{
|
||||||
|
this.keyBinding = keyBinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyOrMouse(int mouseButton)
|
||||||
|
{
|
||||||
|
this.mouseButton = mouseButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsDown()
|
||||||
|
{
|
||||||
|
if (mouseButton==null)
|
||||||
|
{
|
||||||
|
return PlayerInput.KeyDown(keyBinding);
|
||||||
|
}
|
||||||
|
else if (mouseButton == 0)
|
||||||
|
{
|
||||||
|
return PlayerInput.LeftButtonDown();
|
||||||
|
}
|
||||||
|
else if (mouseButton == 1)
|
||||||
|
{
|
||||||
|
return PlayerInput.RightButtonDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsHit()
|
||||||
|
{
|
||||||
|
if (mouseButton == null)
|
||||||
|
{
|
||||||
|
return PlayerInput.KeyHit(keyBinding);
|
||||||
|
}
|
||||||
|
else if (mouseButton == 0)
|
||||||
|
{
|
||||||
|
return PlayerInput.LeftButtonClicked();
|
||||||
|
}
|
||||||
|
else if (mouseButton == 1)
|
||||||
|
{
|
||||||
|
return PlayerInput.RightButtonClicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (mouseButton==null)
|
||||||
|
{
|
||||||
|
return keyBinding.ToString();
|
||||||
|
}
|
||||||
|
else if (mouseButton==0)
|
||||||
|
{
|
||||||
|
return "Mouse1";
|
||||||
|
}
|
||||||
|
else if (mouseButton==1)
|
||||||
|
{
|
||||||
|
return "Mouse2";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "None";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Key
|
class Key
|
||||||
{
|
{
|
||||||
private bool state, stateQueue;
|
private bool hit, hitQueue;
|
||||||
private bool canBeHeld;
|
private bool held, heldQueue;
|
||||||
|
|
||||||
public bool CanBeHeld
|
|
||||||
{
|
|
||||||
get { return canBeHeld; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public Key(bool canBeHeld)
|
KeyOrMouse binding;
|
||||||
|
|
||||||
|
//public bool CanBeHeld
|
||||||
|
//{
|
||||||
|
// get { return canBeHeld; }
|
||||||
|
//}
|
||||||
|
|
||||||
|
public Key(KeyOrMouse binding)
|
||||||
{
|
{
|
||||||
this.canBeHeld = canBeHeld;
|
this.binding = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool State
|
public bool Hit
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return state;
|
return hit;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
//if (value == false) return;
|
hit = value;
|
||||||
state = value;
|
|
||||||
//if (value) stateQueue = value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetState(bool value)
|
public bool Held
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return held;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
held = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyOrMouse State
|
||||||
|
{
|
||||||
|
get { return binding; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetState()
|
||||||
{
|
{
|
||||||
state = value;
|
hit = binding.IsHit();
|
||||||
if (value) stateQueue = value;
|
if (hit) hitQueue = true;
|
||||||
|
|
||||||
|
held = binding.IsDown();
|
||||||
|
if (held) heldQueue = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Dequeue
|
public bool Dequeue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
bool value = stateQueue;
|
bool value = hitQueue;
|
||||||
stateQueue = false;
|
hitQueue = false;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public bool DequeueHeld
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
bool value = heldQueue;
|
||||||
|
heldQueue = false;
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
hit = false;
|
||||||
|
held = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ResetHit()
|
||||||
{
|
{
|
||||||
if (!canBeHeld) state = false;
|
hit = false;
|
||||||
//stateQueue = false;
|
//stateQueue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ResetHeld()
|
||||||
|
{
|
||||||
|
held = false;
|
||||||
|
//stateQueue = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PlayerInput
|
public static class PlayerInput
|
||||||
|
|||||||
@@ -199,6 +199,23 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void SelectTab(Tab tab)
|
public void SelectTab(Tab tab)
|
||||||
{
|
{
|
||||||
|
int oldTab = selectedTab;
|
||||||
|
|
||||||
|
|
||||||
|
if (GameMain.Config.UnsavedSettings)
|
||||||
|
{
|
||||||
|
var applyBox = new GUIMessageBox("Apply changes?", "Do you want to apply the settings or discard the changes?",
|
||||||
|
new string[] {"Apply", "Discard"});
|
||||||
|
applyBox.Buttons[0].OnClicked += applyBox.Close;
|
||||||
|
applyBox.Buttons[0].OnClicked += ApplySettings;
|
||||||
|
applyBox.Buttons[0].UserData = tab;
|
||||||
|
applyBox.Buttons[1].OnClicked += applyBox.Close;
|
||||||
|
applyBox.Buttons[1].OnClicked += DiscardSettings;
|
||||||
|
applyBox.Buttons[1].UserData = tab;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
selectedTab = (int)tab;
|
selectedTab = (int)tab;
|
||||||
|
|
||||||
switch (selectedTab)
|
switch (selectedTab)
|
||||||
@@ -207,11 +224,29 @@ namespace Barotrauma
|
|||||||
UpdateLoadScreen();
|
UpdateLoadScreen();
|
||||||
break;
|
break;
|
||||||
case (int)Tab.Settings:
|
case (int)Tab.Settings:
|
||||||
|
GameMain.Config.ResetSettingsFrame();
|
||||||
menuTabs[(int)Tab.Settings] = GameMain.Config.SettingsFrame;
|
menuTabs[(int)Tab.Settings] = GameMain.Config.SettingsFrame;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ApplySettings(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
GameMain.Config.Save("config.xml");
|
||||||
|
selectedTab = (int)obj;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool DiscardSettings(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
GameMain.Config.Load("config.xml");
|
||||||
|
selectedTab = (int)obj;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private bool TutorialButtonClicked(GUIButton button, object obj)
|
private bool TutorialButtonClicked(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
TutorialMode.StartTutorial();
|
TutorialMode.StartTutorial();
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ namespace Barotrauma
|
|||||||
//server info panel ------------------------------------------------------------
|
//server info panel ------------------------------------------------------------
|
||||||
|
|
||||||
infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), GUI.Style, menu);
|
infoFrame = new GUIFrame(new Rectangle(0, 0, (int)(panelRect.Width * 0.7f), (int)(panelRect.Height * 0.6f)), GUI.Style, menu);
|
||||||
//infoFrame.Padding = GUI.style.smallPadding;
|
infoFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f); ;
|
||||||
|
|
||||||
//chatbox ----------------------------------------------------------------------
|
//chatbox ----------------------------------------------------------------------
|
||||||
GUIFrame chatFrame = new GUIFrame(
|
GUIFrame chatFrame = new GUIFrame(
|
||||||
@@ -127,11 +127,12 @@ namespace Barotrauma
|
|||||||
(int)(panelRect.Width * 0.7f),
|
(int)(panelRect.Width * 0.7f),
|
||||||
(int)(panelRect.Height * 0.4f - 20)),
|
(int)(panelRect.Height * 0.4f - 20)),
|
||||||
GUI.Style, menu);
|
GUI.Style, menu);
|
||||||
|
chatFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 40.0f);
|
||||||
|
|
||||||
chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, GUI.Style, chatFrame);
|
chatBox = new GUIListBox(new Rectangle(0,0,0,chatFrame.Rect.Height-80), Color.White, GUI.Style, chatFrame);
|
||||||
textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, GUI.Style, chatFrame);
|
textBox = new GUITextBox(new Rectangle(0, 25, 0, 25), Alignment.Bottom, GUI.Style, chatFrame);
|
||||||
textBox.Font = GUI.SmallFont;
|
textBox.Font = GUI.SmallFont;
|
||||||
textBox.OnEnter = EnterChatMessage;
|
textBox.OnEnterPressed = EnterChatMessage;
|
||||||
|
|
||||||
//player info panel ------------------------------------------------------------
|
//player info panel ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -148,6 +149,8 @@ namespace Barotrauma
|
|||||||
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.4f - 20)),
|
(int)(panelRect.Width * 0.3f - 20), (int)(panelRect.Height * 0.4f - 20)),
|
||||||
GUI.Style, menu);
|
GUI.Style, menu);
|
||||||
|
|
||||||
|
playerListFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 40.0f);
|
||||||
|
|
||||||
playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.Style, playerListFrame);
|
playerList = new GUIListBox(new Rectangle(0,0,0,0), null, GUI.Style, playerListFrame);
|
||||||
playerList.OnSelected = SelectPlayer;
|
playerList.OnSelected = SelectPlayer;
|
||||||
|
|
||||||
@@ -278,10 +281,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (IsServer && GameMain.Server != null)
|
if (IsServer && GameMain.Server != null)
|
||||||
{
|
{
|
||||||
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
|
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||||
startButton.OnClicked = GameMain.Server.StartGameClicked;
|
startButton.OnClicked = GameMain.Server.StartGameClicked;
|
||||||
startButton.UserData = "startButton";
|
startButton.UserData = "startButton";
|
||||||
|
|
||||||
|
GUIButton settingsButton = new GUIButton(new Rectangle(-100, 0, 80, 30), "Settings", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||||
|
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
||||||
|
settingsButton.UserData = "settingsButton";
|
||||||
|
|
||||||
var banListButton = new GUIButton(new Rectangle(0, 30, 100, 20), "Banned IPs", Alignment.BottomRight, GUI.Style, playerList.Parent);
|
var banListButton = new GUIButton(new Rectangle(0, 30, 100, 20), "Banned IPs", Alignment.BottomRight, GUI.Style, playerList.Parent);
|
||||||
banListButton.OnClicked = GameMain.Server.BanList.ToggleBanFrame;
|
banListButton.OnClicked = GameMain.Server.BanList.ToggleBanFrame;
|
||||||
banListButton.UserData = "banListButton";
|
banListButton.UserData = "banListButton";
|
||||||
@@ -299,6 +306,10 @@ namespace Barotrauma
|
|||||||
playYourself.OnSelected = TogglePlayYourself;
|
playYourself.OnSelected = TogglePlayYourself;
|
||||||
playYourself.UserData = "playyourself";
|
playYourself.UserData = "playyourself";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GameMain.Server.RandomizeSeed) seedBox.Text = ToolBox.RandomSeed(8);
|
||||||
|
if (GameMain.Server.SubSelectionMode == SelectionMode.Random) subList.Select(Rand.Range(0,subList.CountChildren));
|
||||||
|
if (GameMain.Server.ModeSelectionMode == SelectionMode.Random) modeList.Select(Rand.Range(0, modeList.CountChildren));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -322,12 +333,18 @@ namespace Barotrauma
|
|||||||
playYourself.UserData = "playyourself";
|
playYourself.UserData = "playyourself";
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(60, 30, 200, 30), "Name: ", GUI.Style, myPlayerFrame);
|
new GUITextBlock(new Rectangle(100, 30, 200, 30), "Name: ", GUI.Style, myPlayerFrame);
|
||||||
|
|
||||||
GUITextBox playerName = new GUITextBox(new Rectangle(60, 55, 0, 20),
|
GUITextBox playerName = new GUITextBox(new Rectangle(100, 55, 0, 20), Alignment.TopLeft, GUI.Style, myPlayerFrame);
|
||||||
Alignment.TopLeft, GUI.Style, myPlayerFrame);
|
|
||||||
playerName.Text = characterInfo.Name;
|
playerName.Text = characterInfo.Name;
|
||||||
playerName.OnEnter += ChangeCharacterName;
|
playerName.OnEnterPressed += ChangeCharacterName;
|
||||||
|
|
||||||
|
GUIButton toggleHead = new GUIButton(new Rectangle(00, 50, 20, 20), "<", GUI.Style, myPlayerFrame);
|
||||||
|
toggleHead.UserData = -1;
|
||||||
|
toggleHead.OnClicked = ToggleHead;
|
||||||
|
toggleHead = new GUIButton(new Rectangle(40, 50, 20, 20), ">", GUI.Style, myPlayerFrame);
|
||||||
|
toggleHead.UserData = 1;
|
||||||
|
toggleHead.OnClicked = ToggleHead;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 100, 200, 30), "Gender: ", GUI.Style, myPlayerFrame);
|
new GUITextBlock(new Rectangle(0, 100, 200, 30), "Gender: ", GUI.Style, myPlayerFrame);
|
||||||
|
|
||||||
@@ -374,9 +391,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool TogglePlayYourself(object obj)
|
private bool TogglePlayYourself(GUITickBox tickBox)
|
||||||
{
|
{
|
||||||
GUITickBox tickBox = obj as GUITickBox;
|
|
||||||
if (tickBox.Selected)
|
if (tickBox.Selected)
|
||||||
{
|
{
|
||||||
GameMain.Server.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, GameMain.Server.Name);
|
GameMain.Server.CharacterInfo = new CharacterInfo(Character.HumanConfigFile, GameMain.Server.Name);
|
||||||
@@ -398,16 +414,13 @@ namespace Barotrauma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ToggleAutoRestart(object obj)
|
private bool ToggleAutoRestart(GUITickBox tickBox)
|
||||||
{
|
{
|
||||||
if (GameMain.Server == null) return false;
|
if (GameMain.Server == null) return false;
|
||||||
|
|
||||||
GUITickBox tickBox = obj as GUITickBox;
|
|
||||||
if (tickBox==null) return false;
|
|
||||||
|
|
||||||
GameMain.Server.AutoRestart = tickBox.Selected;
|
GameMain.Server.AutoRestart = tickBox.Selected;
|
||||||
|
|
||||||
GameMain.Server.UpdateNetLobby(obj);
|
GameMain.Server.UpdateNetLobby(tickBox);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -622,10 +635,23 @@ namespace Barotrauma
|
|||||||
GUIComponent existing = myPlayerFrame.FindChild("playerhead");
|
GUIComponent existing = myPlayerFrame.FindChild("playerhead");
|
||||||
if (existing != null) myPlayerFrame.RemoveChild(existing);
|
if (existing != null) myPlayerFrame.RemoveChild(existing);
|
||||||
|
|
||||||
GUIImage image = new GUIImage(new Rectangle(0, 40, 30, 30), characterInfo.HeadSprite, Alignment.TopLeft, myPlayerFrame);
|
GUIImage image = new GUIImage(new Rectangle(20, 40, 30, 30), characterInfo.HeadSprite, Alignment.TopLeft, myPlayerFrame);
|
||||||
image.UserData = "playerhead";
|
image.UserData = "playerhead";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ToggleHead(GUIButton button, object userData)
|
||||||
|
{
|
||||||
|
int dir = (int)userData;
|
||||||
|
|
||||||
|
if (GameMain.NetworkMember.CharacterInfo == null) return true;
|
||||||
|
|
||||||
|
GameMain.NetworkMember.CharacterInfo.HeadSpriteId += dir;
|
||||||
|
|
||||||
|
UpdatePreviewPlayer(GameMain.NetworkMember.CharacterInfo);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool SwitchGender(GUIButton button, object obj)
|
private bool SwitchGender(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
Gender gender = (Gender)obj;
|
Gender gender = (Gender)obj;
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Barotrauma.Networking
|
||||||
|
{
|
||||||
|
enum SelectionMode
|
||||||
|
{
|
||||||
|
Manual = 0, Random = 1, Vote = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
partial class GameServer : NetworkMember
|
||||||
|
{
|
||||||
|
public bool ShowNetStats;
|
||||||
|
|
||||||
|
private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 40);
|
||||||
|
private TimeSpan sparseUpdateInterval = new TimeSpan(0, 0, 0, 3);
|
||||||
|
|
||||||
|
private SelectionMode subSelectionMode, modeSelectionMode;
|
||||||
|
|
||||||
|
private bool randomizeSeed;
|
||||||
|
|
||||||
|
private bool registeredToMaster;
|
||||||
|
|
||||||
|
private BanList banList;
|
||||||
|
|
||||||
|
private string password;
|
||||||
|
|
||||||
|
private GUIFrame settingsFrame;
|
||||||
|
|
||||||
|
public float AutoRestartTimer;
|
||||||
|
|
||||||
|
private bool autoRestart;
|
||||||
|
|
||||||
|
public bool AutoRestart
|
||||||
|
{
|
||||||
|
get { return (connectedClients.Count == 0) ? false : autoRestart; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
autoRestart = value;
|
||||||
|
|
||||||
|
AutoRestartTimer = autoRestart ? 20.0f : 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionMode SubSelectionMode
|
||||||
|
{
|
||||||
|
get { return subSelectionMode; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public SelectionMode ModeSelectionMode
|
||||||
|
{
|
||||||
|
get { return modeSelectionMode; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool RandomizeSeed
|
||||||
|
{
|
||||||
|
get { return randomizeSeed; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public BanList BanList
|
||||||
|
{
|
||||||
|
get { return banList; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateSettingsFrame()
|
||||||
|
{
|
||||||
|
settingsFrame = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsHeight), Color.Black*0.5f);
|
||||||
|
|
||||||
|
GUIFrame innerFrame = new GUIFrame(new Rectangle(0,0,400,400), null, Alignment.Center, GUI.Style, settingsFrame);
|
||||||
|
|
||||||
|
var randomizeLevelBox = new GUITickBox(new Rectangle(0, 0, 20, 20), "Randomize level seed", Alignment.Left, innerFrame);
|
||||||
|
randomizeLevelBox.OnSelected = ToggleRandomizeSeed;
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, 35, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
|
||||||
|
var selectionFrame = new GUIFrame(new Rectangle(0, 60, 300, 20), null, innerFrame);
|
||||||
|
for (int i = 0; i<3; i++)
|
||||||
|
{
|
||||||
|
var selectionTick = new GUITickBox(new Rectangle(i * 100, 00, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
|
||||||
|
selectionTick.Selected = i == (int)subSelectionMode;
|
||||||
|
selectionTick.OnSelected = SwitchSubSelection;
|
||||||
|
selectionTick.UserData = (SelectionMode)i;
|
||||||
|
}
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, 85, 100, 20), "Mode selection:", GUI.Style, innerFrame);
|
||||||
|
selectionFrame = new GUIFrame(new Rectangle(0, 110, 300, 20), null, innerFrame);
|
||||||
|
for (int i = 0; i<3; i++)
|
||||||
|
{
|
||||||
|
var selectionTick = new GUITickBox(new Rectangle(i*100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
|
||||||
|
selectionTick.Selected = i == (int)modeSelectionMode;
|
||||||
|
selectionTick.OnSelected = SwitchModeSelection;
|
||||||
|
selectionTick.UserData = (SelectionMode)i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool SwitchSubSelection(GUITickBox tickBox)
|
||||||
|
{
|
||||||
|
subSelectionMode = (SelectionMode)tickBox.UserData;
|
||||||
|
|
||||||
|
foreach (GUIComponent otherTickBox in tickBox.Parent.children)
|
||||||
|
{
|
||||||
|
if (otherTickBox == tickBox) continue;
|
||||||
|
((GUITickBox)otherTickBox).Selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool SwitchModeSelection(GUITickBox tickBox)
|
||||||
|
{
|
||||||
|
modeSelectionMode = (SelectionMode)tickBox.UserData;
|
||||||
|
|
||||||
|
foreach (GUIComponent otherTickBox in tickBox.Parent.children)
|
||||||
|
{
|
||||||
|
if (otherTickBox == tickBox) continue;
|
||||||
|
((GUITickBox)otherTickBox).Selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ToggleRandomizeSeed(GUITickBox tickBox)
|
||||||
|
{
|
||||||
|
randomizeSeed = tickBox.Selected;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ToggleSettingsFrame(GUIButton button, object obj)
|
||||||
|
{
|
||||||
|
if (settingsFrame==null)
|
||||||
|
{
|
||||||
|
CreateSettingsFrame();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
settingsFrame = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
|
||||||
{
|
|
||||||
class SettingsScreen : Screen
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -46,18 +46,13 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if WINDOWS
|
|
||||||
using (Stream fileStream = File.OpenRead(path))
|
|
||||||
return FromStream(fileStream, preMultiplyAlpha);
|
|
||||||
#endif
|
|
||||||
#if LINUX
|
|
||||||
using (Stream fileStream = File.OpenRead(path))
|
using (Stream fileStream = File.OpenRead(path))
|
||||||
{
|
{
|
||||||
var texture = Texture2D.FromStream(_graphicsDevice, fileStream);
|
var texture = Texture2D.FromStream(_graphicsDevice, fileStream);
|
||||||
texture = PreMultiplyAlpha(texture);
|
texture = PreMultiplyAlpha(texture);
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
@@ -68,36 +63,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WINDOWS
|
|
||||||
private static Texture2D FromStream(Stream stream, bool preMultiplyAlpha = true)
|
|
||||||
{
|
|
||||||
Texture2D texture;
|
|
||||||
|
|
||||||
if (_needsBmp)
|
|
||||||
{
|
|
||||||
// Load image using GDI because Texture2D.FromStream doesn't support BMP
|
|
||||||
using (Image image = Image.FromStream(stream))
|
|
||||||
{
|
|
||||||
// Now create a MemoryStream which will be passed to Texture2D after converting to PNG internally
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
|
||||||
{
|
|
||||||
image.Save(ms, ImageFormat.Png);
|
|
||||||
ms.Seek(0, SeekOrigin.Begin);
|
|
||||||
texture = Texture2D.FromStream(_graphicsDevice, ms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
texture = Texture2D.FromStream(_graphicsDevice, stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preMultiplyAlpha) texture = PreMultiplyAlpha(texture);
|
|
||||||
|
|
||||||
return texture;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private static Texture2D PreMultiplyAlpha(Texture2D texture)
|
private static Texture2D PreMultiplyAlpha(Texture2D texture)
|
||||||
{
|
{
|
||||||
// Setup a render target to hold our final texture which will have premulitplied alpha values
|
// Setup a render target to hold our final texture which will have premulitplied alpha values
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user