Merge remote-tracking branch 'origin/GameServer' into GameLogic
This commit is contained in:
commit
695d6db7a9
|
@ -224,6 +224,7 @@
|
||||||
<ClCompile Include="GameClientState\MainState.cpp" />
|
<ClCompile Include="GameClientState\MainState.cpp" />
|
||||||
<ClCompile Include="GameClientState\NetLoadState.cpp" />
|
<ClCompile Include="GameClientState\NetLoadState.cpp" />
|
||||||
<ClCompile Include="GameClientState\RespawnUI.cpp" />
|
<ClCompile Include="GameClientState\RespawnUI.cpp" />
|
||||||
|
<ClCompile Include="GameClientState\StatsUI.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="GameClientState\Buttons\Plane_UI.h" />
|
<ClInclude Include="GameClientState\Buttons\Plane_UI.h" />
|
||||||
|
@ -251,6 +252,7 @@
|
||||||
<ClInclude Include="GameClientState\NetLoadState.h" />
|
<ClInclude Include="GameClientState\NetLoadState.h" />
|
||||||
<ClInclude Include="GameClientState\RespawnUI.h" />
|
<ClInclude Include="GameClientState\RespawnUI.h" />
|
||||||
<ClInclude Include="GameClientState\SharedStateContent.h" />
|
<ClInclude Include="GameClientState\SharedStateContent.h" />
|
||||||
|
<ClInclude Include="GameClientState\StatsUI.h" />
|
||||||
<ClInclude Include="Include\GameClient.h" />
|
<ClInclude Include="Include\GameClient.h" />
|
||||||
<ClInclude Include="GameClientState\LobbyState.h" />
|
<ClInclude Include="GameClientState\LobbyState.h" />
|
||||||
<ClInclude Include="GameClientState\C_Object.h" />
|
<ClInclude Include="GameClientState\C_Object.h" />
|
||||||
|
|
|
@ -21,6 +21,10 @@ namespace DanBias
|
||||||
: pos(pos), size(size), text(text), textColor(textColor)
|
: pos(pos), size(size), text(text), textColor(textColor)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void setText(std::wstring text)
|
||||||
|
{
|
||||||
|
this->text = text;
|
||||||
|
}
|
||||||
void RenderText() const
|
void RenderText() const
|
||||||
{
|
{
|
||||||
if(text.size() > 0)
|
if(text.size() > 0)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include "GamingUI.h"
|
#include "GamingUI.h"
|
||||||
#include "RespawnUI.h"
|
#include "RespawnUI.h"
|
||||||
|
#include "StatsUI.h"
|
||||||
|
|
||||||
using namespace ::DanBias::Client;
|
using namespace ::DanBias::Client;
|
||||||
using namespace ::Oyster;
|
using namespace ::Oyster;
|
||||||
|
@ -96,9 +97,11 @@ bool GameState::Init( SharedStateContent &shared )
|
||||||
// create UI states
|
// create UI states
|
||||||
this->gameUI = new GamingUI(this->privData->input, this->privData->nwClient, &this->privData->camera);
|
this->gameUI = new GamingUI(this->privData->input, this->privData->nwClient, &this->privData->camera);
|
||||||
this->respawnUI = new RespawnUI(this->privData->nwClient, 20);
|
this->respawnUI = new RespawnUI(this->privData->nwClient, 20);
|
||||||
|
this->statsUI = new StatsUI();
|
||||||
this->currGameUI = gameUI;
|
this->currGameUI = gameUI;
|
||||||
((GamingUI*)gameUI)->Init();
|
((GamingUI*)gameUI)->Init();
|
||||||
// TODO init respawn
|
((RespawnUI*)respawnUI)->Init();
|
||||||
|
((StatsUI*)statsUI)->Init();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -246,11 +249,23 @@ bool GameState::Render()
|
||||||
//!RB DEBUG
|
//!RB DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// render current UI state
|
Oyster::Graphics::API::StartGuiRender();
|
||||||
|
// render gui elemnts
|
||||||
if(currGameUI->HaveGUIRender())
|
if(currGameUI->HaveGUIRender())
|
||||||
currGameUI->RenderGUI();
|
currGameUI->RenderGUI();
|
||||||
|
if(renderStats)
|
||||||
|
{
|
||||||
|
if(statsUI->HaveGUIRender())
|
||||||
|
statsUI->RenderGUI();
|
||||||
|
}
|
||||||
|
Oyster::Graphics::API::StartTextRender();
|
||||||
if(currGameUI->HaveTextRender())
|
if(currGameUI->HaveTextRender())
|
||||||
currGameUI->RenderText();
|
currGameUI->RenderText();
|
||||||
|
if(renderStats)
|
||||||
|
{
|
||||||
|
if(statsUI->HaveTextRender())
|
||||||
|
statsUI->RenderText();
|
||||||
|
}
|
||||||
|
|
||||||
Oyster::Graphics::API::EndFrame();
|
Oyster::Graphics::API::EndFrame();
|
||||||
return true;
|
return true;
|
||||||
|
@ -298,6 +313,12 @@ bool GameState::Release()
|
||||||
delete gameUI;
|
delete gameUI;
|
||||||
gameUI = NULL;
|
gameUI = NULL;
|
||||||
}
|
}
|
||||||
|
if(statsUI)
|
||||||
|
{
|
||||||
|
statsUI->Release();
|
||||||
|
delete statsUI;
|
||||||
|
statsUI = NULL;
|
||||||
|
}
|
||||||
currGameUI = NULL;
|
currGameUI = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -332,10 +353,33 @@ void GameState::ReadKeyInput()
|
||||||
{
|
{
|
||||||
this->renderWhireframe = !this->renderWhireframe;
|
this->renderWhireframe = !this->renderWhireframe;
|
||||||
this->key_Wireframe_Toggle = true;
|
this->key_Wireframe_Toggle = true;
|
||||||
|
// DEBUG set you as dead when render wireframe
|
||||||
|
this->currGameUI = respawnUI;
|
||||||
|
// !DEBUG
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this->key_Wireframe_Toggle = false;
|
this->key_Wireframe_Toggle = false;
|
||||||
|
// DEBUG set you as dead when render wireframe
|
||||||
|
this->currGameUI = gameUI;
|
||||||
|
// !DEBUG
|
||||||
|
}
|
||||||
|
|
||||||
|
// toggle wire frame render
|
||||||
|
if( this->privData->input->IsKeyPressed(DIK_TAB) )
|
||||||
|
{
|
||||||
|
if( !this->key_showStats )
|
||||||
|
{
|
||||||
|
this->renderStats = true;
|
||||||
|
this->key_showStats = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->renderStats = false;
|
||||||
|
this->key_showStats = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState::NetEvent &message )
|
const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState::NetEvent &message )
|
||||||
{
|
{
|
||||||
|
@ -356,8 +400,22 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
switch(ID)
|
switch(ID)
|
||||||
{
|
{
|
||||||
case protocol_Gameplay_ObjectPickup: break; /** @todo TODO: implement */
|
case protocol_Gameplay_ObjectPickup: break; /** @todo TODO: implement */
|
||||||
case protocol_Gameplay_ObjectDamage: break; /** @todo TODO: implement */
|
case protocol_Gameplay_ObjectDamage:
|
||||||
case protocol_Gameplay_ObjectHealthStatus: break; /** @todo TODO: implement */
|
{
|
||||||
|
Protocol_ObjectDamage decoded(data);
|
||||||
|
if( this->privData->myId == decoded.object_ID )
|
||||||
|
{
|
||||||
|
if(currGameUI == gameUI)
|
||||||
|
{
|
||||||
|
((GamingUI*)currGameUI)->SetHPtext(std::to_wstring(decoded.healthLost));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GameClientState::event_processed;
|
||||||
|
case protocol_Gameplay_ObjectHealthStatus:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return GameClientState::event_processed;
|
||||||
case protocol_Gameplay_ObjectPosition:
|
case protocol_Gameplay_ObjectPosition:
|
||||||
{
|
{
|
||||||
Protocol_ObjectPosition decoded(data);
|
Protocol_ObjectPosition decoded(data);
|
||||||
|
@ -494,14 +552,36 @@ const GameClientState::NetEvent & GameState::DataRecieved( const GameClientState
|
||||||
case protocol_Gameplay_ObjectWeaponCooldown: break; /** @todo TODO: implement */
|
case protocol_Gameplay_ObjectWeaponCooldown: break; /** @todo TODO: implement */
|
||||||
case protocol_Gameplay_ObjectWeaponEnergy: break; /** @todo TODO: implement */
|
case protocol_Gameplay_ObjectWeaponEnergy: break; /** @todo TODO: implement */
|
||||||
case protocol_Gameplay_ObjectRespawn:
|
case protocol_Gameplay_ObjectRespawn:
|
||||||
|
{
|
||||||
|
// set player pos
|
||||||
|
Protocol_ObjectRespawn decoded(data);
|
||||||
|
// move player. Remember to change camera
|
||||||
|
this->privData->camera.SetPosition( decoded.position );
|
||||||
|
this->privData->player.setPos( decoded.position );
|
||||||
|
this->privData->player.updateWorld();
|
||||||
|
// RB DEBUG
|
||||||
|
this->privData->player.setRBPos ( decoded.position );
|
||||||
|
this->privData->player.updateRBWorld();
|
||||||
|
// !RB DEBUG
|
||||||
|
|
||||||
this->currGameUI = this->gameUI;
|
this->currGameUI = this->gameUI;
|
||||||
|
}
|
||||||
return GameClientState::event_processed;
|
return GameClientState::event_processed;
|
||||||
case protocol_Gameplay_ObjectDie:
|
case protocol_Gameplay_ObjectDie:
|
||||||
|
{
|
||||||
|
Protocol_ObjectDie decoded(data);
|
||||||
|
// if is this player. Remember to change camera
|
||||||
|
if( this->privData->myId == decoded.objectID )
|
||||||
|
{
|
||||||
this->currGameUI = this->respawnUI;
|
this->currGameUI = this->respawnUI;
|
||||||
// set countdown
|
// set countdown
|
||||||
|
((RespawnUI*)currGameUI)->SetCountdown( decoded.seconds );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return GameClientState::event_processed;
|
||||||
case protocol_Gameplay_ObjectDisconnectPlayer:
|
case protocol_Gameplay_ObjectDisconnectPlayer:
|
||||||
{
|
{
|
||||||
//Removes
|
//Remove the disconnected player
|
||||||
Protocol_ObjectDisconnectPlayer decoded(data);
|
Protocol_ObjectDisconnectPlayer decoded(data);
|
||||||
auto object = this->privData->dynamicObjects->find( decoded.objectID );
|
auto object = this->privData->dynamicObjects->find( decoded.objectID );
|
||||||
if( object != this->privData->dynamicObjects->end() )
|
if( object != this->privData->dynamicObjects->end() )
|
||||||
|
|
|
@ -32,13 +32,16 @@ namespace DanBias { namespace Client
|
||||||
private:
|
private:
|
||||||
struct MyData;
|
struct MyData;
|
||||||
::Utility::DynamicMemory::UniquePointer<MyData> privData;
|
::Utility::DynamicMemory::UniquePointer<MyData> privData;
|
||||||
GameStateUI *currGameUI, *gameUI, *respawnUI;
|
GameStateUI *currGameUI, *gameUI, *respawnUI, *statsUI;
|
||||||
|
|
||||||
// DEGUG KEYS
|
// DEGUG KEYS
|
||||||
bool key_Reload_Shaders;
|
bool key_Reload_Shaders;
|
||||||
bool key_Wireframe_Toggle;
|
bool key_Wireframe_Toggle;
|
||||||
bool renderWhireframe;
|
bool renderWhireframe;
|
||||||
|
bool key_showStats;
|
||||||
|
bool renderStats;
|
||||||
// !DEGUG KEYS
|
// !DEGUG KEYS
|
||||||
|
|
||||||
};
|
};
|
||||||
} }
|
} }
|
||||||
#endif
|
#endif
|
|
@ -30,6 +30,7 @@ GamingUI::GamingUI( InputClass *input, NetworkClient *connection, Camera_FPSV2 *
|
||||||
GamingUI::~GamingUI() { /* Do nothing */ }
|
GamingUI::~GamingUI() { /* Do nothing */ }
|
||||||
bool GamingUI::Init()
|
bool GamingUI::Init()
|
||||||
{
|
{
|
||||||
|
// z value should be between 0.5 - 0.9 so that it will be behind other states
|
||||||
// add textures and text
|
// add textures and text
|
||||||
this->plane = new Plane_UI(L"box_tex.png", Float3(0.5f, 0.0f, 0.5f), Float2(0.3f, 0.1f));
|
this->plane = new Plane_UI(L"box_tex.png", Float3(0.5f, 0.0f, 0.5f), Float2(0.3f, 0.1f));
|
||||||
this->text = new Text_UI(L"hej", Float3(0.5f,0.0f,0.1f), Float2(0.1f,0.1f));
|
this->text = new Text_UI(L"hej", Float3(0.5f,0.0f,0.1f), Float2(0.1f,0.1f));
|
||||||
|
@ -54,13 +55,11 @@ bool GamingUI::HaveTextRender() const
|
||||||
|
|
||||||
void GamingUI::RenderGUI() const
|
void GamingUI::RenderGUI() const
|
||||||
{
|
{
|
||||||
Oyster::Graphics::API::StartGuiRender();
|
|
||||||
this->plane->RenderTexture();
|
this->plane->RenderTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamingUI::RenderText() const
|
void GamingUI::RenderText() const
|
||||||
{
|
{
|
||||||
Oyster::Graphics::API::StartTextRender();
|
|
||||||
this->text->RenderText();
|
this->text->RenderText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +72,10 @@ bool GamingUI::Release()
|
||||||
delete this->text;
|
delete this->text;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
void GamingUI::SetHPtext( std::wstring hp )
|
||||||
|
{
|
||||||
|
this->text->setText(hp);
|
||||||
|
}
|
||||||
void GamingUI::ReadKeyInput()
|
void GamingUI::ReadKeyInput()
|
||||||
{
|
{
|
||||||
if( this->input->IsKeyPressed(DIK_W) )
|
if( this->input->IsKeyPressed(DIK_W) )
|
||||||
|
|
|
@ -22,11 +22,14 @@ namespace DanBias { namespace Client
|
||||||
void RenderGUI() const;
|
void RenderGUI() const;
|
||||||
void RenderText() const;
|
void RenderText() const;
|
||||||
bool Release();
|
bool Release();
|
||||||
|
void SetHPtext( std::wstring hp );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InputClass *input;
|
InputClass *input;
|
||||||
::Oyster::Network::NetworkClient *netClient;
|
::Oyster::Network::NetworkClient *netClient;
|
||||||
Camera_FPSV2 *camera;
|
Camera_FPSV2 *camera;
|
||||||
|
|
||||||
|
// TODO add multiple UI elements
|
||||||
Text_UI* text;
|
Text_UI* text;
|
||||||
Plane_UI* plane;
|
Plane_UI* plane;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
using namespace ::DanBias::Client;
|
using namespace ::DanBias::Client;
|
||||||
using namespace ::Oyster::Network;
|
using namespace ::Oyster::Network;
|
||||||
using namespace ::Utility::Value;
|
using namespace ::Utility::Value;
|
||||||
|
using namespace ::Oyster::Math;
|
||||||
|
|
||||||
RespawnUI::RespawnUI() :
|
RespawnUI::RespawnUI() :
|
||||||
GameStateUI()
|
GameStateUI()
|
||||||
|
@ -17,13 +18,23 @@ RespawnUI::RespawnUI( NetworkClient *connection, float delay ) :
|
||||||
{
|
{
|
||||||
this->netClient = connection;
|
this->netClient = connection;
|
||||||
this->countDown = delay;
|
this->countDown = delay;
|
||||||
|
this->text = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RespawnUI::~RespawnUI() { /* Do nothing */ }
|
RespawnUI::~RespawnUI() { /* Do nothing */ }
|
||||||
|
|
||||||
|
bool RespawnUI::Init()
|
||||||
|
{
|
||||||
|
// z value should be between 0.5 - 0.9 so that it will be behind other states
|
||||||
|
// add textures and text
|
||||||
|
this->text = new Text_UI(L"DEAD", Float3(0.5f,0.0f,0.5f), Float2(0.2f,0.2f));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
GameStateUI::UIState RespawnUI::Update( float deltaTime )
|
GameStateUI::UIState RespawnUI::Update( float deltaTime )
|
||||||
{
|
{
|
||||||
this->countDown = Max( this->countDown - deltaTime, 0.0f );
|
this->countDown = Max( this->countDown - deltaTime, 0.0f );
|
||||||
|
// countDown == 0
|
||||||
|
// return UIState_gaming state;
|
||||||
return this->nextState;
|
return this->nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,25 +45,32 @@ bool RespawnUI::HaveGUIRender() const
|
||||||
|
|
||||||
bool RespawnUI::HaveTextRender() const
|
bool RespawnUI::HaveTextRender() const
|
||||||
{
|
{
|
||||||
return false; // TODO: change to true when we want UI elements like a chat window
|
return true; // TODO: change to true when we want UI elements like a chat window
|
||||||
}
|
}
|
||||||
|
|
||||||
void RespawnUI::RenderGUI() const
|
void RespawnUI::RenderGUI() const
|
||||||
{
|
{
|
||||||
// TODO: We need?
|
// TODO:BLOODY SCREEN
|
||||||
}
|
}
|
||||||
|
|
||||||
void RespawnUI::RenderText() const
|
void RespawnUI::RenderText() const
|
||||||
{
|
{
|
||||||
|
this->text->RenderText();
|
||||||
// TODO: Text countdown somewhere on screen would be nice
|
// TODO: Text countdown somewhere on screen would be nice
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RespawnUI::Release()
|
bool RespawnUI::Release()
|
||||||
{
|
{
|
||||||
// TODO: Release UI components here.
|
// TODO: Release UI components here.
|
||||||
|
if(this->text)
|
||||||
|
delete this->text;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
void RespawnUI::SetCountdown( float cd )
|
||||||
|
{
|
||||||
|
this->countDown = cd;
|
||||||
|
// this text should be rendered
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define DANBIAS_CLIENT_RESPAWN_UI_H
|
#define DANBIAS_CLIENT_RESPAWN_UI_H
|
||||||
|
|
||||||
#include "GameStateUI.h"
|
#include "GameStateUI.h"
|
||||||
|
#include "Buttons\Text_UI.h"
|
||||||
|
#include "Buttons\Plane_UI.h"
|
||||||
|
|
||||||
namespace DanBias { namespace Client
|
namespace DanBias { namespace Client
|
||||||
{
|
{
|
||||||
|
@ -10,18 +12,23 @@ namespace DanBias { namespace Client
|
||||||
public:
|
public:
|
||||||
RespawnUI( ::Oyster::Network::NetworkClient *connection, float delay );
|
RespawnUI( ::Oyster::Network::NetworkClient *connection, float delay );
|
||||||
virtual ~RespawnUI();
|
virtual ~RespawnUI();
|
||||||
|
bool Init();
|
||||||
|
|
||||||
|
// TODO countdown
|
||||||
UIState Update( float deltaTime );
|
UIState Update( float deltaTime );
|
||||||
bool HaveGUIRender() const;
|
bool HaveGUIRender() const;
|
||||||
bool HaveTextRender() const;
|
bool HaveTextRender() const;
|
||||||
void RenderGUI() const;
|
void RenderGUI() const;
|
||||||
void RenderText() const;
|
void RenderText() const;
|
||||||
bool Release();
|
bool Release();
|
||||||
|
void SetCountdown( float cd );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
::Oyster::Network::NetworkClient *netClient;
|
::Oyster::Network::NetworkClient *netClient;
|
||||||
float countDown;
|
float countDown;
|
||||||
|
|
||||||
|
// TODO add multiple UI elements
|
||||||
|
Text_UI* text;
|
||||||
RespawnUI();
|
RespawnUI();
|
||||||
};
|
};
|
||||||
} }
|
} }
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
#include "StatsUI.h"
|
||||||
|
#include <Protocols.h>
|
||||||
|
#include "Utilities.h"
|
||||||
|
|
||||||
|
using namespace ::DanBias::Client;
|
||||||
|
using namespace ::GameLogic;
|
||||||
|
using namespace ::Utility::Value;
|
||||||
|
using namespace ::Oyster::Math;
|
||||||
|
|
||||||
|
StatsUI::StatsUI() :
|
||||||
|
GameStateUI()
|
||||||
|
{
|
||||||
|
/* Should never be called! */
|
||||||
|
this->plane = nullptr;
|
||||||
|
this->text = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
StatsUI::~StatsUI() { /* Do nothing */ }
|
||||||
|
bool StatsUI::Init()
|
||||||
|
{
|
||||||
|
// z value should be between 0.1 - 0.5 so that it will be in front of other states
|
||||||
|
// add textures and text for player stats
|
||||||
|
this->plane = new Plane_UI(L"box_tex.png", Float3(0.0f, 0.0f, 0.5f), Float2(0.3f, 0.1f));
|
||||||
|
this->text = new Text_UI(L"Stats", Float3(0.0f,0.0f,0.1f), Float2(0.1f,0.1f));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
GameStateUI::UIState StatsUI::Update( float deltaTime )
|
||||||
|
{
|
||||||
|
return this->nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StatsUI::HaveGUIRender() const
|
||||||
|
{
|
||||||
|
// Set true if UIstate have any plane to render
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StatsUI::HaveTextRender() const
|
||||||
|
{
|
||||||
|
// Set true if UIstate have any text to render
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatsUI::RenderGUI() const
|
||||||
|
{
|
||||||
|
// render all the planes
|
||||||
|
this->plane->RenderTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatsUI::RenderText() const
|
||||||
|
{
|
||||||
|
// render all the text
|
||||||
|
this->text->RenderText();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StatsUI::Release()
|
||||||
|
{
|
||||||
|
// TODO: Release UI components here.
|
||||||
|
if(this->plane)
|
||||||
|
delete this->plane;
|
||||||
|
if(this->text)
|
||||||
|
delete this->text;
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef DANBIAS_CLIENT_STATS_UI_H
|
||||||
|
#define DANBIAS_CLIENT_STATS_UI_H
|
||||||
|
|
||||||
|
#include "GameStateUI.h"
|
||||||
|
#include "Buttons\Text_UI.h"
|
||||||
|
#include "Buttons\Plane_UI.h"
|
||||||
|
|
||||||
|
namespace DanBias { namespace Client
|
||||||
|
{
|
||||||
|
class StatsUI : public GameStateUI
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
StatsUI();
|
||||||
|
virtual ~StatsUI();
|
||||||
|
bool Init();
|
||||||
|
|
||||||
|
UIState Update( float deltaTime );
|
||||||
|
bool HaveGUIRender() const;
|
||||||
|
bool HaveTextRender() const;
|
||||||
|
void RenderGUI() const;
|
||||||
|
void RenderText() const;
|
||||||
|
bool Release();
|
||||||
|
// TODO add function to add a new players statistics
|
||||||
|
// TODO add function to remove a players statistics
|
||||||
|
|
||||||
|
private:
|
||||||
|
// TODO add multiple UI elements
|
||||||
|
// one for each player ingame
|
||||||
|
Text_UI* text;
|
||||||
|
Plane_UI* plane;
|
||||||
|
};
|
||||||
|
} }
|
||||||
|
|
||||||
|
#endif
|
|
@ -78,6 +78,7 @@ using namespace DanBias;
|
||||||
{
|
{
|
||||||
if(this->gClients[temp]->IncrementFailedProtocol() >= 5/*client->threshold*/)
|
if(this->gClients[temp]->IncrementFailedProtocol() >= 5/*client->threshold*/)
|
||||||
{
|
{
|
||||||
|
printf("\t(%i : %s) - EventType_Disconnect\n", cl->GetClient()->GetID(), e.sender->GetIpAddress().c_str());
|
||||||
Protocol_ObjectDisconnectPlayer prot(this->gClients[temp]->GetPlayer()->GetID());
|
Protocol_ObjectDisconnectPlayer prot(this->gClients[temp]->GetPlayer()->GetID());
|
||||||
for (unsigned int i = 0; i < this->gClients.Size(); i++)
|
for (unsigned int i = 0; i < this->gClients.Size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,11 +217,18 @@ bool GameSession::Join(gClient gameClient)
|
||||||
if(this->gClients[i] && !this->gClients[i]->IsInvalid())
|
if(this->gClients[i] && !this->gClients[i]->IsInvalid())
|
||||||
{
|
{
|
||||||
IPlayerData* temp = this->gClients[i]->GetPlayer();
|
IPlayerData* temp = this->gClients[i]->GetPlayer();
|
||||||
Protocol_ObjectCreatePlayer oc( temp->GetPosition(), temp->GetRotation(), temp->GetScale(),
|
Protocol_ObjectCreatePlayer p1( temp->GetPosition(), temp->GetRotation(), temp->GetScale(),
|
||||||
temp->GetID(), false, temp->GetTeamID(),
|
temp->GetID(), false, temp->GetTeamID(),
|
||||||
Utility::String::WStringToString(this->gClients[i]->GetAlias(), std::string()),
|
Utility::String::WStringToString(this->gClients[i]->GetAlias(), std::string()),
|
||||||
Utility::String::WStringToString(this->gClients[i]->GetCharacter(), std::string()));
|
Utility::String::WStringToString(this->gClients[i]->GetCharacter(), std::string()));
|
||||||
nwClient->Send(oc);
|
nwClient->Send(p1);
|
||||||
|
|
||||||
|
temp = playerData;
|
||||||
|
Protocol_ObjectCreatePlayer p2( temp->GetPosition(), temp->GetRotation(), temp->GetScale(),
|
||||||
|
temp->GetID(), false, temp->GetTeamID(),
|
||||||
|
Utility::String::WStringToString(gameClient->GetAlias(), std::string()),
|
||||||
|
Utility::String::WStringToString(gameClient->GetCharacter(), std::string()));
|
||||||
|
this->gClients[i]->GetClient()->Send(p2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,7 +241,7 @@ bool GameSession::Join(gClient gameClient)
|
||||||
{
|
{
|
||||||
//Protocol_ObjectPosition p(movedObject->GetPosition(), id);
|
//Protocol_ObjectPosition p(movedObject->GetPosition(), id);
|
||||||
Protocol_ObjectPositionRotation p(objects[i]->GetPosition(), objects[i]->GetRotation(), objects[i]->GetID());
|
Protocol_ObjectPositionRotation p(objects[i]->GetPosition(), objects[i]->GetRotation(), objects[i]->GetID());
|
||||||
GameSession::gameSession->Send(p.GetProtocol());
|
nwClient->Send(p.GetProtocol());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,16 +22,16 @@ namespace Oyster
|
||||||
{
|
{
|
||||||
struct BroadcastOptions
|
struct BroadcastOptions
|
||||||
{
|
{
|
||||||
//bool broadcast;
|
bool broadcast;
|
||||||
//float broadcastInterval;
|
float broadcastInterval;
|
||||||
//std::wstring subnetToBroadcast;
|
std::wstring subnetToBroadcast;
|
||||||
//CustomNetProtocol broadcastMessage;
|
CustomNetProtocol broadcastMessage;
|
||||||
//BroadcastOptions()
|
BroadcastOptions()
|
||||||
//{
|
{
|
||||||
// broadcast = true;
|
broadcast = true;
|
||||||
// broadcastInterval = 1.0f;
|
broadcastInterval = 1.0f;
|
||||||
// subnetToBroadcast = L"192.168.0.1";
|
subnetToBroadcast = L"192.168.0.1";
|
||||||
//}
|
}
|
||||||
} broadcastOptions;
|
} broadcastOptions;
|
||||||
|
|
||||||
struct MainOptions
|
struct MainOptions
|
||||||
|
@ -117,6 +117,23 @@ namespace Oyster
|
||||||
*/
|
*/
|
||||||
int NetworkServer::GetPort();
|
int NetworkServer::GetPort();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************
|
||||||
|
Broadcast functions
|
||||||
|
***************************************/
|
||||||
|
//Set broadcast settings.
|
||||||
|
void SetBroadcast(CustomNetProtocol& broadcastMessage, float interval = 1.0f, bool enable = true);
|
||||||
|
|
||||||
|
//Set broadcast settings.
|
||||||
|
void SetBroadcastMessage(CustomNetProtocol& broadcastMessage);
|
||||||
|
|
||||||
|
//Enable/disable broadcast.
|
||||||
|
void SetBroadcast(bool enable);
|
||||||
|
|
||||||
|
//Set interval between each broadcast message in seconds.
|
||||||
|
void SetBroadcastInterval(float interval);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
PrivateData* privateData;
|
PrivateData* privateData;
|
||||||
|
|
Loading…
Reference in New Issue