Beispiel #1
0
	void notify(void* data)
	{
		if(data == _net)
		{
			if(_net->getPacket()->packet_type == PacketTypes::REGISTER_SUCCES) 
				_allowNextScene = true;
			else if(_net->getPacket()->packet_type == PacketTypes::REGISTER_FAIL)  {
				_interface->addMessageBox(L"Confirmation failed.", L"That name is already in use, choose a different name.", true, 1, 0);
				_sceneRequest = false;
			}
		}
	}
Beispiel #2
0
	void requestNextScene()
	{
		size_t i;
		char tempdata[25];
		wcstombs_s(&i, tempdata, _interface->getElementWithId(GUI_ID_EDIT_NAME)->getText(), 24);
		std::string name = tempdata;

		_net->setUserName(name);
		_net->sendPacketType(PacketTypes::REQUEST_REGISTER_PLAYER, PROTOCOL_TCP);

		_sceneRequest = true;
		startTime = clock();
	}
Beispiel #3
0
	MainMenu(Core* core, Interface* ui, NetworkHandler* net) : Scene("MainMenu"), _core(core), _interface(ui), _net(net)
	{
		context.core = _core;
		context.currentScene = this;

		_net->attachScene(this);
	}
Beispiel #4
0
	NameSelection(Core* core, Interface* ui, NetworkHandler* net) : Scene("NameSelection"), _core(core), _interface(ui), _net(net)
	{
		context.core = _core;
		context.currentScene = this;

		_net->attachScene(this);
		_sceneRequest = _allowNextScene = false;
	}
Beispiel #5
0
	void requestNextScene()
	{
		if(context.createNew == true) {
			_net->sendPacketType(PacketTypes::REQUEST_NEW_LOBBY);
			printf("New lobby\n");
		}
		else {
			_core->setActiveScene(new LobbyListMenu(_core, _interface, _net));
		}
	}
Beispiel #6
0
	~NameSelection()
	{
		_net->detachScene(this);
		_net = NULL;

		_core->resetReceiver();
		_core = NULL;

		_interface->resetInterface();
		_interface = NULL;
	}
Beispiel #7
0
	~MainMenu()
	{
		_net->detachScene(this);
		_net = NULL;

		_core->resetReceiver();
		_core = NULL;

		_interface->resetInterface();
		_interface = NULL;
	}