예제 #1
0
파일: Galaga.cpp 프로젝트: jjiezheng/lfant
void Galaga::OnReceiveMessage(string sender, string msg)
{
	Log("Galaga::OnReceiveMessage: Touch.");
	CEGUI::Window* history = userInterface->rootWindow->getChild("Console")->getChild("History");
	if(history)
	{
		history->appendText(sender+": "+msg);
	}
}
예제 #2
0
/***********************************************************
display description
***********************************************************/
void JournalBox::DisplayDescription (const std::vector<CEGUI::String> & text, bool questdone)
{
	CEGUI::Window* descwin = NULL;
	if(questdone)
		descwin = CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questdonetab/Description");
	else
		descwin = CEGUI::WindowManager::getSingleton().getWindow("Root/JournalWin/tab/questtab/Description");

	bool firsttime = true;
	descwin->setText("");

	for(size_t i=0; i<text.size(); ++i)
	{
		if(firsttime)
		{
			firsttime = false;
			descwin->setText(text[i]);
		}
		else
			descwin->appendText(text[i]);
	}
}
예제 #3
0
InputContext* DynamicEditor::EditorFactoryType::createEditor(CEGUI::TabControl* _tab, std::string _factoryName, std::string _typeName, DynamicEditor* _editor)
{
    CEGUI::Window* page = CEGUI::WindowManager::getSingletonPtr()->loadWindowLayout("EntityInstanceTab.layout", _factoryName);

    FactoryParameters* params = new FactoryParameters(true);
    DynamicEditorMode* editorMode = modeFactory->createMode(page, params);

    CEGUI::Window* typeNameDisplay = page->getChild(_factoryName + "Tab/EntityTypeName");
    typeNameDisplay->appendText(_typeName);
    page->setProperty("Text",_factoryName);
    _tab->addTab(page);
    page->setUserData(editorMode);

    editorMode->initEditorMode(_factoryName, _editor);

    float uiElementTop = 0.0f;
    for (auto i = instanceVariableFactories.begin(); i != instanceVariableFactories.end(); i++)
    {
        DynamicEditorVariable* editorVar = (*i)->createVariable(editorMode->getWindow(),params->getTypeTable(), _factoryName, &uiElementTop);
        editorMode->addVariable((*i)->getName(), editorVar);
    }

    return editorMode;
}
예제 #4
0
파일: Galaga.cpp 프로젝트: jjiezheng/lfant
void Galaga::OnClickButton(CEGUI::Window* window)
{
	Log("Got btn click galaga");
	if(window->getName() == "Submit")
	{
		string msg = "";
		CEGUI::Window* input = userInterface->rootWindow->getChild("Console")->getChild("Input");
		CEGUI::Window* history = userInterface->rootWindow->getChild("Console")->getChild("History");
		if(history && input)
		{
			msg = input->getText();
			history->appendText(msg);
			input->setText("");
		}

		if(msg == "host" && !client)
		{
			Log("Hosting.");
			server = network->AddUser<ChatServer>();
			server->Host(22222);
		//	ConnectEvent(SENDER(server, Host), RECEIVER(this, OnHost));
			ConnectEvent(SENDER(server, ReceiveMessage), RECEIVER(this, OnReceiveMessage));
		}
		else if(msg == "connect" && !server)
		{
			Log("Connecting.");
			client = network->AddUser<ChatClient>();
			client->Connect("127.0.0.1", 22222);
		//	ConnectEvent(SENDER(client, Connect), RECEIVER(this, OnHost));
			ConnectEvent(SENDER(client, ReceiveMessage), RECEIVER(this, OnReceiveMessage));
		}
		else if(msg == "disconnect")
		{
			if(client)
			{
				// Client::Destroy calls Disconnect() for us, if a connection is currently established.
				client->SendMessage("[RemoveClient client]");
			//	client->Destroy();
			}
			else if(server)
			{
				// Close server?
				server->SendMessage("[RemoveAllClients]");
			//	server->Destroy();
			}
		}
		else if(msg == "destroy")
		{
			if(client)
			{
				client->Destroy();
			}
			else if(server)
			{
				// Close server?
				server->Destroy();
			}
		}
		else if(msg != "")
		{
			if(client)
			{
				client->SendMessage(msg);
			}
			else if(server)
			{
				server->SendMessage(msg);
			}
		}
	}
}