GameServer - Merged with Standalone Server and modified some stuff, still compile errors, will try to merge with other

This commit is contained in:
Dennis Andersen 2014-02-16 01:12:27 +01:00
parent 21c640c6e1
commit 9d0148c5c2
23 changed files with 346 additions and 140 deletions

View File

@ -9,7 +9,7 @@ using namespace System::Security::Permissions;
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
// //
[assembly:AssemblyTitleAttribute("PhysicsGameCLIWrapper")]; [assembly:AssemblyTitleAttribute("StandaloneServerCLIWrapper")];
[assembly:AssemblyDescriptionAttribute("")]; [assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")]; [assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("Microsoft")]; [assembly:AssemblyCompanyAttribute("Microsoft")];

View File

@ -1,56 +0,0 @@
#ifndef CLISTANDALONESERVER_CPP_Standalone_CLI_H
#define CLISTANDALONESERVER_CPP_Standalone_CLI_H
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include "..\Game\GameServer\GameServerAPI.h"
enum DanBiasServerReturn
{
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
DanBiasServerReturn_GameNotCreated,
};
public value struct ServerInitDesc
{
System::String^ serverName;
int listenPort;
bool broadcast; //Not fully implemented!
};
public value struct GameServerInfo
{
unsigned int listenPort; // If set to 0, the default port 15151 will be used
System::String^ serverIp; // This cant be mofidfied..
};
public ref class CppStandaloneCLI
{
public:
CppStandaloneCLI();
~CppStandaloneCLI();
DanBiasServerReturn ServerInitiate(ServerInitDesc desc);
void ServerStart();
void ServerStop();
void ServerUpdate();
GameServerInfo ServerGetInfo();
bool ServerIsRunning();
void GameSetMapId(const int val);
void GameSetMaxClients(const int val);
void GameSetGameMode(const int val);
void GameSetGameTime(const int val);
int GameGetMapId();
int GameGetMaxClients();
int GameGetGameMode();
int GameGetGameTime();
System::String^ GameGetGameName();
bool GameStart();
};
#endif

View File

@ -139,14 +139,15 @@
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="C++StandaloneCLI.h" /> <ClInclude Include="StandaloneGameServerCLI.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="AssemblyInfo.cpp" /> <ClCompile Include="AssemblyInfo.cpp" />
<ClCompile Include="C++StandaloneCLI.cpp" /> <ClCompile Include="StandaloneGameServerCLI.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,17 +1,20 @@
#include "C++StandaloneCLI.h" #include "StandaloneGameServerCLI.h"
using namespace System; using namespace System;
using namespace System::Windows::Interop;
using namespace System::Windows;
using namespace System::Runtime::InteropServices; using namespace System::Runtime::InteropServices;
CppStandaloneCLI::CppStandaloneCLI() StandaloneGameServerCLI::StandaloneGameServerCLI()
{ {
} }
CppStandaloneCLI::~CppStandaloneCLI() StandaloneGameServerCLI::~StandaloneGameServerCLI()
{ {
} }
DanBiasServerReturn CppStandaloneCLI::ServerInitiate(ServerInitDesc desc) DanBiasServerReturn StandaloneGameServerCLI::ServerInitiate(ServerInitDesc desc)
{ {
DanBias::GameServerAPI::ServerInitDesc d; DanBias::GameServerAPI::ServerInitDesc d;
//Convert from String to char* //Convert from String to char*
@ -25,22 +28,22 @@ DanBiasServerReturn CppStandaloneCLI::ServerInitiate(ServerInitDesc desc)
return (DanBiasServerReturn)DanBias::GameServerAPI::ServerInitiate(d); return (DanBiasServerReturn)DanBias::GameServerAPI::ServerInitiate(d);
} }
void CppStandaloneCLI::ServerStart() void StandaloneGameServerCLI::ServerStart()
{ {
DanBias::GameServerAPI::ServerStart(); DanBias::GameServerAPI::ServerStart();
} }
void CppStandaloneCLI::ServerStop() void StandaloneGameServerCLI::ServerStop()
{ {
DanBias::GameServerAPI::ServerStop(); DanBias::GameServerAPI::ServerStop();
} }
void CppStandaloneCLI::ServerUpdate() void StandaloneGameServerCLI::ServerUpdate()
{ {
DanBias::GameServerAPI::ServerUpdate(); DanBias::GameServerAPI::ServerUpdate();
} }
GameServerInfo CppStandaloneCLI::ServerGetInfo() GameServerInfo StandaloneGameServerCLI::ServerGetInfo()
{ {
GameServerInfo info; GameServerInfo info;
@ -51,57 +54,57 @@ GameServerInfo CppStandaloneCLI::ServerGetInfo()
return info; return info;
} }
bool CppStandaloneCLI::ServerIsRunning() bool StandaloneGameServerCLI::ServerIsRunning()
{ {
return DanBias::GameServerAPI::ServerIsRunning(); return DanBias::GameServerAPI::ServerIsRunning();
} }
void CppStandaloneCLI::GameSetMapId(const int val) void StandaloneGameServerCLI::GameSetMapId(const int val)
{ {
DanBias::GameServerAPI::GameSetMapId(val); DanBias::GameServerAPI::GameSetMapId(val);
} }
void CppStandaloneCLI::GameSetMaxClients(const int val) void StandaloneGameServerCLI::GameSetMaxClients(const int val)
{ {
DanBias::GameServerAPI::GameSetMaxClients(val); DanBias::GameServerAPI::GameSetMaxClients(val);
} }
void CppStandaloneCLI::GameSetGameMode(const int val) void StandaloneGameServerCLI::GameSetGameMode(const int val)
{ {
DanBias::GameServerAPI::GameSetGameMode(val); DanBias::GameServerAPI::GameSetGameMode(val);
} }
void CppStandaloneCLI::GameSetGameTime(const int val) void StandaloneGameServerCLI::GameSetGameTime(const int val)
{ {
DanBias::GameServerAPI::GameSetGameTime(val); DanBias::GameServerAPI::GameSetGameTime(val);
} }
int CppStandaloneCLI::GameGetMapId() int StandaloneGameServerCLI::GameGetMapId()
{ {
return DanBias::GameServerAPI::GameGetMapId(); return DanBias::GameServerAPI::GameGetMapId();
} }
int CppStandaloneCLI::GameGetMaxClients() int StandaloneGameServerCLI::GameGetMaxClients()
{ {
return DanBias::GameServerAPI::GameGetMaxClients(); return DanBias::GameServerAPI::GameGetMaxClients();
} }
int CppStandaloneCLI::GameGetGameMode() int StandaloneGameServerCLI::GameGetGameMode()
{ {
return DanBias::GameServerAPI::GameGetGameMode(); return DanBias::GameServerAPI::GameGetGameMode();
} }
int CppStandaloneCLI::GameGetGameTime() int StandaloneGameServerCLI::GameGetGameTime()
{ {
return DanBias::GameServerAPI::GameGetGameTime(); return DanBias::GameServerAPI::GameGetGameTime();
} }
String^ CppStandaloneCLI::GameGetGameName() String^ StandaloneGameServerCLI::GameGetGameName()
{ {
return gcnew String(DanBias::GameServerAPI::GameGetGameName()); return gcnew String(DanBias::GameServerAPI::GameGetGameName());
} }
bool CppStandaloneCLI::GameStart() bool StandaloneGameServerCLI::GameStart()
{ {
return DanBias::GameServerAPI::GameStart(); return DanBias::GameServerAPI::GameStart();
} }

View File

@ -0,0 +1,58 @@
#ifndef CLISTANDALONESERVER_CPP_Standalone_CLI_H
#define CLISTANDALONESERVER_CPP_Standalone_CLI_H
#include <windows.h>
#include "..\Game\GameServer\GameServerAPI.h"
namespace System { namespace Windows { namespace Interop
{
public enum class DanBiasServerReturn
{
DanBiasServerReturn_Error,
DanBiasServerReturn_Sucess,
DanBiasServerReturn_GameNotCreated,
};
public value struct ServerInitDesc
{
System::String^ serverName;
int listenPort;
bool broadcast; //Not fully implemented!
};
public value struct GameServerInfo
{
unsigned int listenPort; // If set to 0, the default port 15151 will be used
System::String^ serverIp; // This cant be mofidfied..
};
public ref class StandaloneGameServerCLI
{
public:
StandaloneGameServerCLI();
~StandaloneGameServerCLI();
DanBiasServerReturn ServerInitiate(ServerInitDesc desc);
void ServerStart();
void ServerStop();
void ServerUpdate();
GameServerInfo ServerGetInfo();
bool ServerIsRunning();
void GameSetMapId(const int val);
void GameSetMaxClients(const int val);
void GameSetGameMode(const int val);
void GameSetGameTime(const int val);
int GameGetMapId();
int GameGetMaxClients();
int GameGetGameMode();
int GameGetGameTime();
System::String^ GameGetGameName();
bool GameStart();
};
} } }
#endif

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>false</ShowAllFiles> <ShowAllFiles>true</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -67,22 +67,16 @@ bool MainState::Init( NetworkClient* nwClient )
return true; return true;
} }
float mouseX, mouseY; // debug test
GameClientState::ClientState MainState::Update(float deltaTime, InputClass* KeyInput) GameClientState::ClientState MainState::Update(float deltaTime, InputClass* KeyInput)
{ {
MouseInput mouseState; MouseInput mouseState;
{ {
mouseState.x = KeyInput->GetPitch(); KeyInput->GetMousePos( mouseState.x, mouseState.y );
mouseState.y = KeyInput->GetYaw();
mouseState.mouseButtonPressed = KeyInput->IsMousePressed(); mouseState.mouseButtonPressed = KeyInput->IsMousePressed();
} }
EventHandler::Instance().Update( mouseState ); EventHandler::Instance().Update( mouseState );
mouseX = mouseState.x; // debug test
mouseY = mouseState.y; // debug test
return this->privData->nextState; return this->privData->nextState;
} }
@ -91,15 +85,12 @@ bool MainState::Render()
Graphics::API::NewFrame(); Graphics::API::NewFrame();
Graphics::API::StartGuiRender(); Graphics::API::StartGuiRender();
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) );
this->privData->guiElements.RenderTexture(); this->privData->guiElements.RenderTexture();
Graphics::API::StartTextRender(); Graphics::API::StartTextRender();
this->privData->guiElements.RenderText(); this->privData->guiElements.RenderText();
Graphics::API::RenderText( ::std::to_wstring(mouseX), Float2(0.2f, 0.5f), Float2(0.2f, 0.05f) ); // debug test
Graphics::API::RenderText( ::std::to_wstring(mouseY), Float2(0.5f, 0.5f), Float2(0.2f, 0.05f) ); // debug test
Graphics::API::EndFrame(); Graphics::API::EndFrame();
return true; return true;
} }
@ -108,7 +99,7 @@ bool MainState::Release()
{ {
if( this->privData ) if( this->privData )
{ {
Graphics::API::DeleteTexture( this->privData->background ); // TODO: @todo bug caught when exiting by X Graphics::API::DeleteTexture( this->privData->background );
EventHandler::Instance().ReleaseCollection( &this->privData->guiElements ); EventHandler::Instance().ReleaseCollection( &this->privData->guiElements );
this->privData = NULL; this->privData = NULL;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>false</ShowAllFiles> <ShowAllFiles>true</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ShowAllFiles>false</ShowAllFiles> <ShowAllFiles>true</ShowAllFiles>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory> <LocalDebuggerWorkingDirectory>$(OutDir)</LocalDebuggerWorkingDirectory>

View File

@ -207,7 +207,8 @@ namespace DanBias
{ {
if(this->clients[i]) if(this->clients[i])
{ {
Protocol_ObjectCreate oc(this->clients[i]->GetPlayer()->GetOrientation(), this->clients[i]->GetPlayer()->GetID(), "char_white.dan"); IPlayerData* p = this->clients[i]->GetPlayer();
Protocol_ObjectCreate oc(p->GetPosition(), p->GetRotation(), p->GetScale(), p->GetID(), "char_white.dan");
this->clients[i]->GetClient()->Send(oc); this->clients[i]->GetClient()->Send(oc);
} }
} }

View File

@ -5,6 +5,8 @@ InputClass::InputClass()
m_directInput = NULL; m_directInput = NULL;
m_keyboard = NULL; m_keyboard = NULL;
m_mouse = NULL; m_mouse = NULL;
mousePosX = 0.0f;
mousePosY = 0.0f;
} }
InputClass::~InputClass() InputClass::~InputClass()
@ -128,6 +130,13 @@ bool InputClass::Update()
return true; return true;
} }
bool InputClass::Update( float mousePosX, float mousePosY )
{
this->mousePosX = mousePosX;
this->mousePosY = mousePosY;
return this->Update();
}
bool InputClass::ReadKeyboard() bool InputClass::ReadKeyboard()
{ {
HRESULT result; HRESULT result;
@ -198,3 +207,15 @@ bool InputClass::IsKeyPressed(int key)
return false; return false;
} }
void InputClass::SetMousePos( float x, float y )
{
this->mousePosX = y;
this->mousePosY = x;
}
void InputClass::GetMousePos( float &x, float &y )
{
x = this->mousePosX;
y = this->mousePosY;
}

View File

@ -14,8 +14,6 @@
#include <dinput.h> #include <dinput.h>
class InputClass class InputClass
{ {
private: private:
@ -26,6 +24,8 @@ private:
unsigned char m_keyboardState[256]; unsigned char m_keyboardState[256];
DIMOUSESTATE m_mouseState; DIMOUSESTATE m_mouseState;
float mousePosX, mousePosY;
bool ReadKeyboard(); bool ReadKeyboard();
bool ReadMouse(); bool ReadMouse();
@ -40,6 +40,7 @@ public:
//read the mouse and keyboard and send back //read the mouse and keyboard and send back
// delta mouse pos and if any button is pressed // delta mouse pos and if any button is pressed
bool Update(); bool Update();
bool Update( float mousePosX, float mousePosY );
bool IsKeyPressed(int key); bool IsKeyPressed(int key);
bool IsMousePressed(); bool IsMousePressed();
@ -48,6 +49,8 @@ public:
float GetYaw(); float GetYaw();
float GetPitch(); float GetPitch();
void SetMousePos( float x, float y );
void GetMousePos( float &x, float &y );
}; };
#endif #endif

View File

@ -3,4 +3,9 @@
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup> </startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="..\..\Bin\DLL\" />
</assemblyBinding>
</runtime>
</configuration> </configuration>

View File

@ -28,20 +28,154 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.serverToggle = new System.Windows.Forms.Button();
this.lanBroadcast = new System.Windows.Forms.CheckBox();
this.serverName = new System.Windows.Forms.TextBox();
this.label_serverName = new System.Windows.Forms.Label();
this.listenPort = new System.Windows.Forms.NumericUpDown();
this.label_listenPort = new System.Windows.Forms.Label();
this.panel_serverOptions = new System.Windows.Forms.Panel();
this.panel_commands = new System.Windows.Forms.Panel();
this.panel_clientArea = new System.Windows.Forms.Panel();
this.clientInfoBox = new System.Windows.Forms.ListBox();
((System.ComponentModel.ISupportInitialize)(this.listenPort)).BeginInit();
this.panel_serverOptions.SuspendLayout();
this.panel_clientArea.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// serverToggle
//
this.serverToggle.Location = new System.Drawing.Point(90, 81);
this.serverToggle.Name = "serverToggle";
this.serverToggle.Size = new System.Drawing.Size(75, 23);
this.serverToggle.TabIndex = 0;
this.serverToggle.Text = "Start server";
this.serverToggle.UseVisualStyleBackColor = true;
this.serverToggle.Click += new System.EventHandler(this.button1_serverToggle_Click);
//
// lanBroadcast
//
this.lanBroadcast.AutoSize = true;
this.lanBroadcast.Location = new System.Drawing.Point(81, 58);
this.lanBroadcast.Name = "lanBroadcast";
this.lanBroadcast.Size = new System.Drawing.Size(95, 17);
this.lanBroadcast.TabIndex = 1;
this.lanBroadcast.Text = "Lan Broadcast";
this.lanBroadcast.UseVisualStyleBackColor = true;
//
// serverName
//
this.serverName.Location = new System.Drawing.Point(81, 3);
this.serverName.Name = "serverName";
this.serverName.Size = new System.Drawing.Size(95, 20);
this.serverName.TabIndex = 3;
//
// label_serverName
//
this.label_serverName.AutoSize = true;
this.label_serverName.Location = new System.Drawing.Point(6, 6);
this.label_serverName.Name = "label_serverName";
this.label_serverName.Size = new System.Drawing.Size(69, 13);
this.label_serverName.TabIndex = 4;
this.label_serverName.Text = "Server Name";
//
// listenPort
//
this.listenPort.Location = new System.Drawing.Point(81, 29);
this.listenPort.Maximum = new decimal(new int[] {
65000,
0,
0,
0});
this.listenPort.Minimum = new decimal(new int[] {
2048,
0,
0,
0});
this.listenPort.Name = "listenPort";
this.listenPort.Size = new System.Drawing.Size(95, 20);
this.listenPort.TabIndex = 5;
this.listenPort.Value = new decimal(new int[] {
2048,
0,
0,
0});
//
// label_listenPort
//
this.label_listenPort.AutoSize = true;
this.label_listenPort.Location = new System.Drawing.Point(6, 31);
this.label_listenPort.Name = "label_listenPort";
this.label_listenPort.Size = new System.Drawing.Size(56, 13);
this.label_listenPort.TabIndex = 4;
this.label_listenPort.Text = "Listen port";
//
// panel_serverOptions
//
this.panel_serverOptions.Controls.Add(this.serverName);
this.panel_serverOptions.Controls.Add(this.listenPort);
this.panel_serverOptions.Controls.Add(this.serverToggle);
this.panel_serverOptions.Controls.Add(this.label_listenPort);
this.panel_serverOptions.Controls.Add(this.lanBroadcast);
this.panel_serverOptions.Controls.Add(this.label_serverName);
this.panel_serverOptions.Location = new System.Drawing.Point(12, 12);
this.panel_serverOptions.Name = "panel_serverOptions";
this.panel_serverOptions.Size = new System.Drawing.Size(183, 112);
this.panel_serverOptions.TabIndex = 6;
//
// panel_commands
//
this.panel_commands.Location = new System.Drawing.Point(12, 130);
this.panel_commands.Name = "panel_commands";
this.panel_commands.Size = new System.Drawing.Size(183, 231);
this.panel_commands.TabIndex = 7;
//
// panel_clientArea
//
this.panel_clientArea.Controls.Add(this.clientInfoBox);
this.panel_clientArea.Location = new System.Drawing.Point(202, 12);
this.panel_clientArea.Name = "panel_clientArea";
this.panel_clientArea.Size = new System.Drawing.Size(303, 349);
this.panel_clientArea.TabIndex = 8;
//
// clientInfoBox
//
this.clientInfoBox.FormattingEnabled = true;
this.clientInfoBox.Location = new System.Drawing.Point(3, 6);
this.clientInfoBox.Name = "clientInfoBox";
this.clientInfoBox.Size = new System.Drawing.Size(297, 342);
this.clientInfoBox.TabIndex = 0;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(791, 318); this.ClientSize = new System.Drawing.Size(517, 373);
this.Controls.Add(this.panel_clientArea);
this.Controls.Add(this.panel_commands);
this.Controls.Add(this.panel_serverOptions);
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Form1"; this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.listenPort)).EndInit();
this.panel_serverOptions.ResumeLayout(false);
this.panel_serverOptions.PerformLayout();
this.panel_clientArea.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private System.Windows.Forms.Button serverToggle;
private System.Windows.Forms.CheckBox lanBroadcast;
private System.Windows.Forms.TextBox serverName;
private System.Windows.Forms.Label label_serverName;
private System.Windows.Forms.NumericUpDown listenPort;
private System.Windows.Forms.Label label_listenPort;
private System.Windows.Forms.Panel panel_serverOptions;
private System.Windows.Forms.Panel panel_commands;
private System.Windows.Forms.Panel panel_clientArea;
private System.Windows.Forms.ListBox clientInfoBox;
} }
} }

View File

@ -7,14 +7,69 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Interop;
using System.Runtime.InteropServices;
namespace StandAloneLauncher namespace StandAloneLauncher
{ {
public partial class Form1 : Form public partial class Form1 : Form
{ {
System.Windows.Interop.StandaloneGameServerCLI gameServer;
bool serverIsRunning = false;
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
}
public bool Initiate()
{
this.gameServer = new StandaloneGameServerCLI();
return true;
}
public void Run()
{
while (this.Created)
{
Application.DoEvents();
//Do some stuff
this.gameServer.ServerUpdate();
}
}
private void button1_serverToggle_Click(object sender, EventArgs e)
{
if (this.serverIsRunning)
{
this.serverIsRunning = false;
this.gameServer.ServerStop();
this.listenPort.Enabled = true;
this.serverName.Enabled = true;
this.lanBroadcast.Enabled = true;
this.serverToggle.Text = "Start server";
}
else
{
this.serverIsRunning = true;
ServerInitDesc desc = new ServerInitDesc();
desc.broadcast = this.lanBroadcast.Checked;
desc.listenPort = (int)this.listenPort.Value;
desc.serverName = this.serverName.Text;
if (this.gameServer.ServerInitiate(desc) == DanBiasServerReturn.DanBiasServerReturn_Sucess)
{
this.listenPort.Enabled = false;
this.serverName.Enabled = false;
this.lanBroadcast.Enabled = false;
this.serverToggle.Text = "Stop server";
this.gameServer.ServerStart();
this.clientInfoBox.Items.Add((Object)"Server initiated!");
}
}
} }
} }
} }

View File

@ -16,7 +16,13 @@ namespace StandAloneLauncher
{ {
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); //Application.Run(new Form1());
Form1 myf = new Form1();
myf.Show();
myf.Initiate();
myf.Run();
} }
} }
} }

View File

@ -17,32 +17,35 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>..\..\Bin\DLL\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>..\..\Bin\DLL\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath> <OutputPath>..\..\Bin\DLL\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath> <OutputPath>..\..\Bin\DLL\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@ -50,19 +53,21 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath> <OutputPath>..\..\Bin\DLL\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath> <OutputPath>..\..\Bin\DLL\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@ -70,6 +75,7 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit> <Prefer32Bit>true</Prefer32Bit>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System" /> <Reference Include="System" />
@ -121,8 +127,12 @@
<ProjectReference Include="..\CLIStandaloneServer\CLIStandaloneServer.vcxproj"> <ProjectReference Include="..\CLIStandaloneServer\CLIStandaloneServer.vcxproj">
<Project>{c8cba520-5d7d-4d61-a8da-6e05fd132bcb}</Project> <Project>{c8cba520-5d7d-4d61-a8da-6e05fd132bcb}</Project>
<Name>CLIStandaloneServer</Name> <Name>CLIStandaloneServer</Name>
<Private>False</Private>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
</PropertyGroup>
<PropertyGroup>
<ReferencePath>C:\Users\Dennis\Desktop\Skola\DV1477 - Stort spelutvecklingsprojekt\DanBias\Code\StandAloneLauncher\..\..\Bin\Dll\;C:\Users\Dennis\Desktop\Skola\DV1477 - Stort spelutvecklingsprojekt\DanBias\Bin\DLL\</ReferencePath>
</PropertyGroup>
</Project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>