Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added option to enable/disable hosting an own server

  • Loading branch information...
commit ace5aef2f0b3c7dd20cda40a00170ed366083222 1 parent 72ac012
@NobodysNightmare authored
View
256 BlockDefender/BlockDefender/AppSettings.Designer.cs
@@ -1,87 +1,87 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.530
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace BlockDefender {
-
-
- [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
- internal sealed partial class AppSettings : global::System.Configuration.ApplicationSettingsBase {
-
- private static AppSettings defaultInstance = ((AppSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AppSettings())));
-
- public static AppSettings Default {
- get {
- return defaultInstance;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("W")]
- public global::Microsoft.Xna.Framework.Input.Keys MoveUp {
- get {
- return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveUp"]));
- }
- set {
- this["MoveUp"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("S")]
- public global::Microsoft.Xna.Framework.Input.Keys MoveDown {
- get {
- return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveDown"]));
- }
- set {
- this["MoveDown"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("A")]
- public global::Microsoft.Xna.Framework.Input.Keys MoveLeft {
- get {
- return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveLeft"]));
- }
- set {
- this["MoveLeft"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("D")]
- public global::Microsoft.Xna.Framework.Input.Keys MoveRight {
- get {
- return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveRight"]));
- }
- set {
- this["MoveRight"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("Escape")]
- public global::Microsoft.Xna.Framework.Input.Keys Exit {
- get {
- return ((global::Microsoft.Xna.Framework.Input.Keys)(this["Exit"]));
- }
- set {
- this["Exit"] = value;
- }
- }
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.239
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace BlockDefender {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
+ internal sealed partial class AppSettings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static AppSettings defaultInstance = ((AppSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new AppSettings())));
+
+ public static AppSettings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("W")]
+ public global::Microsoft.Xna.Framework.Input.Keys MoveUp {
+ get {
+ return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveUp"]));
+ }
+ set {
+ this["MoveUp"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("S")]
+ public global::Microsoft.Xna.Framework.Input.Keys MoveDown {
+ get {
+ return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveDown"]));
+ }
+ set {
+ this["MoveDown"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("A")]
+ public global::Microsoft.Xna.Framework.Input.Keys MoveLeft {
+ get {
+ return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveLeft"]));
+ }
+ set {
+ this["MoveLeft"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("D")]
+ public global::Microsoft.Xna.Framework.Input.Keys MoveRight {
+ get {
+ return ((global::Microsoft.Xna.Framework.Input.Keys)(this["MoveRight"]));
+ }
+ set {
+ this["MoveRight"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Escape")]
+ public global::Microsoft.Xna.Framework.Input.Keys Exit {
+ get {
+ return ((global::Microsoft.Xna.Framework.Input.Keys)(this["Exit"]));
+ }
+ set {
+ this["Exit"] = value;
+ }
+ }
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -94,41 +94,53 @@ internal sealed partial class AppSettings : global::System.Configuration.Applica
this["ListenPort"] = value;
}
}
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("E")]
- public global::Microsoft.Xna.Framework.Input.Keys Interact {
- get {
- return ((global::Microsoft.Xna.Framework.Input.Keys)(this["Interact"]));
- }
- set {
- this["Interact"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("127.0.0.1")]
- public string ConnectHost {
- get {
- return ((string)(this["ConnectHost"]));
- }
- set {
- this["ConnectHost"] = value;
- }
- }
-
- [global::System.Configuration.UserScopedSettingAttribute()]
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- [global::System.Configuration.DefaultSettingValueAttribute("1337")]
- public int ConnectPort {
- get {
- return ((int)(this["ConnectPort"]));
- }
- set {
- this["ConnectPort"] = value;
- }
- }
- }
-}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("E")]
+ public global::Microsoft.Xna.Framework.Input.Keys Interact {
+ get {
+ return ((global::Microsoft.Xna.Framework.Input.Keys)(this["Interact"]));
+ }
+ set {
+ this["Interact"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("127.0.0.1")]
+ public string ConnectHost {
+ get {
+ return ((string)(this["ConnectHost"]));
+ }
+ set {
+ this["ConnectHost"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("1337")]
+ public int ConnectPort {
+ get {
+ return ((int)(this["ConnectPort"]));
+ }
+ set {
+ this["ConnectPort"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("True")]
+ public bool EnableServer {
+ get {
+ return ((bool)(this["EnableServer"]));
+ }
+ set {
+ this["EnableServer"] = value;
+ }
+ }
+ }
+}
View
61 BlockDefender/BlockDefender/AppSettings.settings
@@ -1,33 +1,36 @@
-<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BlockDefender" GeneratedClassName="AppSettings">
- <Profiles />
- <Settings>
- <Setting Name="MoveUp" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
- <Value Profile="(Default)">W</Value>
- </Setting>
- <Setting Name="MoveDown" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
- <Value Profile="(Default)">S</Value>
- </Setting>
- <Setting Name="MoveLeft" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
- <Value Profile="(Default)">A</Value>
- </Setting>
- <Setting Name="MoveRight" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
- <Value Profile="(Default)">D</Value>
- </Setting>
- <Setting Name="Exit" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
- <Value Profile="(Default)">Escape</Value>
- </Setting>
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="BlockDefender" GeneratedClassName="AppSettings">
+ <Profiles />
+ <Settings>
+ <Setting Name="MoveUp" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
+ <Value Profile="(Default)">W</Value>
+ </Setting>
+ <Setting Name="MoveDown" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
+ <Value Profile="(Default)">S</Value>
+ </Setting>
+ <Setting Name="MoveLeft" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
+ <Value Profile="(Default)">A</Value>
+ </Setting>
+ <Setting Name="MoveRight" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
+ <Value Profile="(Default)">D</Value>
+ </Setting>
+ <Setting Name="Exit" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
+ <Value Profile="(Default)">Escape</Value>
+ </Setting>
<Setting Name="ListenPort" Type="System.Int32" Scope="User">
<Value Profile="(Default)">1337</Value>
</Setting>
- <Setting Name="Interact" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
- <Value Profile="(Default)">E</Value>
- </Setting>
- <Setting Name="ConnectHost" Type="System.String" Scope="User">
- <Value Profile="(Default)">127.0.0.1</Value>
- </Setting>
- <Setting Name="ConnectPort" Type="System.Int32" Scope="User">
- <Value Profile="(Default)">1337</Value>
- </Setting>
- </Settings>
+ <Setting Name="Interact" Type="Microsoft.Xna.Framework.Input.Keys" Scope="User">
+ <Value Profile="(Default)">E</Value>
+ </Setting>
+ <Setting Name="ConnectHost" Type="System.String" Scope="User">
+ <Value Profile="(Default)">127.0.0.1</Value>
+ </Setting>
+ <Setting Name="ConnectPort" Type="System.Int32" Scope="User">
+ <Value Profile="(Default)">1337</Value>
+ </Setting>
+ <Setting Name="EnableServer" Type="System.Boolean" Scope="User">
+ <Value Profile="(Default)">True</Value>
+ </Setting>
+ </Settings>
</SettingsFile>
View
7 BlockDefender/BlockDefender/BlockDefenderGame.cs
@@ -38,8 +38,11 @@ public BlockDefenderGame()
protected override void Initialize()
{
- GameServer server = new GameServer(new Map(16, 9), AppSettings.Default.ListenPort);
- server.Start();
+ if (AppSettings.Default.EnableServer)
+ {
+ GameServer server = new GameServer(new Map(16, 9), AppSettings.Default.ListenPort);
+ server.Start();
+ }
NetworkClient = new NetworkClient();
Playground = NetworkClient.EstablishConnection();
View
53 BlockDefender/BlockDefender/app.config
@@ -6,34 +6,37 @@
</sectionGroup>
</configSections>
<userSettings>
- <BlockDefender.AppSettings>
- <setting name="MoveUp" serializeAs="String">
- <value>W</value>
- </setting>
- <setting name="MoveDown" serializeAs="String">
- <value>S</value>
- </setting>
- <setting name="MoveLeft" serializeAs="String">
- <value>A</value>
- </setting>
- <setting name="MoveRight" serializeAs="String">
- <value>D</value>
- </setting>
- <setting name="Exit" serializeAs="String">
- <value>Escape</value>
- </setting>
- <setting name="ListenPort" serializeAs="String">
- <value>1337</value>
- </setting>
- <setting name="ConnectHost" serializeAs="String">
- <value>127.0.0.1</value>
- </setting>
- <setting name="ConnectPort" serializeAs="String">
- <value>1337</value>
- </setting>
+ <BlockDefender.AppSettings>
+ <setting name="MoveUp" serializeAs="String">
+ <value>W</value>
+ </setting>
+ <setting name="MoveDown" serializeAs="String">
+ <value>S</value>
+ </setting>
+ <setting name="MoveLeft" serializeAs="String">
+ <value>A</value>
+ </setting>
+ <setting name="MoveRight" serializeAs="String">
+ <value>D</value>
+ </setting>
+ <setting name="Exit" serializeAs="String">
+ <value>Escape</value>
+ </setting>
+ <setting name="ListenPort" serializeAs="String">
+ <value>1337</value>
+ </setting>
<setting name="Interact" serializeAs="String">
<value>E</value>
</setting>
+ <setting name="ConnectHost" serializeAs="String">
+ <value>127.0.0.1</value>
+ </setting>
+ <setting name="ConnectPort" serializeAs="String">
+ <value>1337</value>
+ </setting>
+ <setting name="EnableServer" serializeAs="String">
+ <value>True</value>
+ </setting>
</BlockDefender.AppSettings>
</userSettings>
</configuration>
Please sign in to comment.
Something went wrong with that request. Please try again.