|
@@ -5,6 +5,7 @@
|
|
#include <Base64.h>
|
|
#include <Base64.h>
|
|
#include <Bild.h>
|
|
#include <Bild.h>
|
|
#include <Datei.h>
|
|
#include <Datei.h>
|
|
|
|
+#include <DateiSystem.h>
|
|
#include <JSON.h>
|
|
#include <JSON.h>
|
|
#include <Knopf.h>
|
|
#include <Knopf.h>
|
|
#include <Schrift.h>
|
|
#include <Schrift.h>
|
|
@@ -31,11 +32,8 @@ ServerStatus::ServerStatus(Framework::Text name,
|
|
statusId(0),
|
|
statusId(0),
|
|
requestId(0),
|
|
requestId(0),
|
|
secrets(secrets),
|
|
secrets(secrets),
|
|
- closeAF(new AlphaFeld()),
|
|
|
|
join(initKnopf(0, 0, 55, 20, Knopf::Style::Normal, "join"))
|
|
join(initKnopf(0, 0, 55, 20, Knopf::Style::Normal, "join"))
|
|
{
|
|
{
|
|
- closeAF->setSize(20, 20);
|
|
|
|
- closeAF->setFarbe(0x00FF0000);
|
|
|
|
setMausEreignis(_ret1ME);
|
|
setMausEreignis(_ret1ME);
|
|
setStyle(Style::Erlaubt | Style::Sichtbar | Style::Rahmen);
|
|
setStyle(Style::Erlaubt | Style::Sichtbar | Style::Rahmen);
|
|
setRahmenBreite(1);
|
|
setRahmenBreite(1);
|
|
@@ -96,12 +94,39 @@ ServerStatus::ServerStatus(Framework::Text name,
|
|
}
|
|
}
|
|
return 1;
|
|
return 1;
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ LTDBDatei iconsDat;
|
|
|
|
+ iconsDat.setDatei(new Text("data/bilder/gui_icons.ltdb"));
|
|
|
|
+ iconsDat.leseDaten(0);
|
|
|
|
+
|
|
|
|
+ removeButton = initKnopf(0,
|
|
|
|
+ 0,
|
|
|
|
+ 20,
|
|
|
|
+ 20,
|
|
|
|
+ Framework::Knopf::Style::HBild | Framework::Knopf::Style::HAlpha
|
|
|
|
+ | Framework::Knopf::Style::Hintergrund,
|
|
|
|
+ "");
|
|
|
|
+ removeButton->setRahmenFarbe(0xFF9C0A0A);
|
|
|
|
+ removeButton->setAlphaFeldFarbe(0x5F9C0A0A);
|
|
|
|
+ removeButton->setToolTipText("Remove player from list of ignored players",
|
|
|
|
+ uiFactory.initParam.bildschirm,
|
|
|
|
+ uiFactory.initParam.schrift);
|
|
|
|
+ removeButton->setHintergrundBildZ(
|
|
|
|
+ dynamic_cast<Bild*>(iconsDat.laden(0, new Text("trash.png"))));
|
|
|
|
+ removeButton->setMausEreignis([this](void* p, void* o, MausEreignis me) {
|
|
|
|
+ if (me.id == ME_RLinks)
|
|
|
|
+ {
|
|
|
|
+ ((ServerSelectionMenu*)(Menu*)menuRegister->get("serverSelection"))
|
|
|
|
+ ->removeServer(this->name);
|
|
|
|
+ }
|
|
|
|
+ return 1;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
|
|
ServerStatus::~ServerStatus()
|
|
ServerStatus::~ServerStatus()
|
|
{
|
|
{
|
|
secrets->release();
|
|
secrets->release();
|
|
- closeAF->release();
|
|
|
|
|
|
+ removeButton->release();
|
|
join->release();
|
|
join->release();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -141,8 +166,7 @@ void ServerStatus::updatePlayerName(Framework::Text playerName)
|
|
if (statusId == 403)
|
|
if (statusId == 403)
|
|
{
|
|
{
|
|
int secondStatus = client->status(tmp->playerName, "");
|
|
int secondStatus = client->status(tmp->playerName, "");
|
|
- if (secondStatus == 200)
|
|
|
|
- statusId = 203;
|
|
|
|
|
|
+ if (secondStatus == 200) statusId = 203;
|
|
}
|
|
}
|
|
if (secret.istGleich("") && statusId == 200)
|
|
if (secret.istGleich("") && statusId == 200)
|
|
{
|
|
{
|
|
@@ -155,8 +179,7 @@ void ServerStatus::updatePlayerName(Framework::Text playerName)
|
|
tmp->statusId = statusId;
|
|
tmp->statusId = statusId;
|
|
if (tmp->statusId == 200)
|
|
if (tmp->statusId == 200)
|
|
tmp->status = "The Server is reachable";
|
|
tmp->status = "The Server is reachable";
|
|
- if (statusId == 203)
|
|
|
|
- tmp->status = "Create a new player";
|
|
|
|
|
|
+ if (statusId == 203) tmp->status = "Create a new player";
|
|
if (tmp->statusId == 403)
|
|
if (tmp->statusId == 403)
|
|
tmp->status = "The name is already in use";
|
|
tmp->status = "The name is already in use";
|
|
tmp->rend = 1;
|
|
tmp->rend = 1;
|
|
@@ -171,48 +194,16 @@ void ServerStatus::updatePlayerName(Framework::Text playerName)
|
|
|
|
|
|
void ServerStatus::doMausEreignis(Framework::MausEreignis& me, bool userRet)
|
|
void ServerStatus::doMausEreignis(Framework::MausEreignis& me, bool userRet)
|
|
{
|
|
{
|
|
- if (me.id == ME_Leaves)
|
|
|
|
- {
|
|
|
|
- closeAF->setStrength(0);
|
|
|
|
- closeAF->setFarbe(0x00FF0000);
|
|
|
|
- }
|
|
|
|
- else if (me.id == ME_Bewegung)
|
|
|
|
- {
|
|
|
|
- if (me.mx >= gr.x - 20 && me.mx < gr.x && me.my >= 0 && me.my <= 20)
|
|
|
|
- {
|
|
|
|
- if (closeAF->getStrength() == 0)
|
|
|
|
- {
|
|
|
|
- closeAF->setStrength(-5);
|
|
|
|
- closeAF->setFarbe(0x30FF0000);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- if (closeAF->getStrength() != 0)
|
|
|
|
- {
|
|
|
|
- closeAF->setStrength(0);
|
|
|
|
- closeAF->setFarbe(0x00FF0000);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (me.id == ME_RLinks)
|
|
|
|
- {
|
|
|
|
- if (me.mx >= gr.x - 20 && me.mx < gr.x && me.my >= 0 && me.my <= 20)
|
|
|
|
- {
|
|
|
|
- ((ServerSelectionMenu*)(Menu*)menuRegister->get("serverSelection"))
|
|
|
|
- ->removeServer(name);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ removeButton->doPublicMausEreignis(me);
|
|
if (canConnect()) join->doPublicMausEreignis(me);
|
|
if (canConnect()) join->doPublicMausEreignis(me);
|
|
}
|
|
}
|
|
|
|
|
|
bool ServerStatus::tick(double time)
|
|
bool ServerStatus::tick(double time)
|
|
{
|
|
{
|
|
join->setPosition(gr.x - 60, gr.y - 25);
|
|
join->setPosition(gr.x - 60, gr.y - 25);
|
|
- closeAF->setPosition(gr.x - 20, 0);
|
|
|
|
|
|
+ removeButton->setPosition(gr.x - 20, 0);
|
|
return ZeichnungHintergrund::tick(time) || join->tick(time)
|
|
return ZeichnungHintergrund::tick(time) || join->tick(time)
|
|
- || closeAF->tick(time);
|
|
|
|
|
|
+ || removeButton->tick(time);
|
|
}
|
|
}
|
|
|
|
|
|
void ServerStatus::render(Framework::Bild& rObj)
|
|
void ServerStatus::render(Framework::Bild& rObj)
|
|
@@ -243,9 +234,7 @@ void ServerStatus::render(Framework::Bild& rObj)
|
|
if (statusId == 403 || statusId == 201 || statusId == 203)
|
|
if (statusId == 403 || statusId == 201 || statusId == 203)
|
|
tr.renderText(5, 45, status, rObj, 0xFFFFA500);
|
|
tr.renderText(5, 45, status, rObj, 0xFFFFA500);
|
|
if (statusId == 200) tr.renderText(5, 45, status, rObj, 0xFF00FF00);
|
|
if (statusId == 200) tr.renderText(5, 45, status, rObj, 0xFF00FF00);
|
|
- closeAF->render(rObj);
|
|
|
|
- rObj.drawLinie(Punkt(gr.x - 20, 0), Punkt(gr.x, 20), 0xFFFF0000);
|
|
|
|
- rObj.drawLinie(Punkt(gr.x - 20, 20), Punkt(gr.x, 0), 0xFFFF0000);
|
|
|
|
|
|
+ removeButton->render(rObj);
|
|
if (canConnect()) join->render(rObj);
|
|
if (canConnect()) join->render(rObj);
|
|
rObj.releaseDrawOptions();
|
|
rObj.releaseDrawOptions();
|
|
}
|
|
}
|
|
@@ -279,7 +268,7 @@ ServerStatus::zSecrets() const
|
|
|
|
|
|
bool ServerStatus::canConnect() const
|
|
bool ServerStatus::canConnect() const
|
|
{
|
|
{
|
|
- return statusId == 200 || statusId == 201 ||statusId == 203;
|
|
|
|
|
|
+ return statusId == 200 || statusId == 201 || statusId == 203;
|
|
}
|
|
}
|
|
|
|
|
|
ServerSelectionMenu::ServerSelectionMenu(Bildschirm* zScreen)
|
|
ServerSelectionMenu::ServerSelectionMenu(Bildschirm* zScreen)
|