chat in menu doesn't fade and 'M'-key to show more messages works in menu too
This commit is contained in:
parent
8d62198ca3
commit
74400f77fc
|
@ -40,10 +40,11 @@ ChatManager::ChatManager(){
|
|||
disableTeamMode = false;
|
||||
}
|
||||
|
||||
void ChatManager::init(Console* console, int thisTeamIndex){
|
||||
void ChatManager::init(Console* console, int thisTeamIndex, const bool inMenu){
|
||||
this->console= console;
|
||||
this->thisTeamIndex= thisTeamIndex;
|
||||
this->disableTeamMode= false;
|
||||
this->inMenu=inMenu;
|
||||
}
|
||||
|
||||
void ChatManager::keyUp(char key){
|
||||
|
@ -105,6 +106,7 @@ void ChatManager::keyDown(char key){
|
|||
console->addLine(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": " + text);
|
||||
gameNetworkInterface->sendTextMessage(Config::getInstance().getString("NetPlayerName",Socket::getHostName().c_str()) + ": "+
|
||||
text, teamMode? thisTeamIndex: -1);
|
||||
if(!inMenu) editEnabled= false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -35,10 +35,12 @@ private:
|
|||
Console* console;
|
||||
string text;
|
||||
int thisTeamIndex;
|
||||
bool inMenu;
|
||||
|
||||
|
||||
public:
|
||||
ChatManager();
|
||||
void init(Console* console, int thisTeamIndex);
|
||||
void init(Console* console, int thisTeamIndex, const bool inMenu=false );
|
||||
|
||||
void keyDown(char key);
|
||||
void keyUp(char key);
|
||||
|
|
|
@ -142,6 +142,7 @@ Renderer::Renderer(){
|
|||
FactoryRepository &fr= FactoryRepository::getInstance();
|
||||
Config &config= Config::getInstance();
|
||||
|
||||
maxConsoleLines= Config::getInstance().getInt("ConsoleMaxLines");
|
||||
gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
|
||||
GraphicsFactory *graphicsFactory= GraphicsInterface::getInstance().getFactory();
|
||||
|
||||
|
@ -709,7 +710,7 @@ void Renderer::renderTextureQuad(int x, int y, int w, int h, const Texture2D *te
|
|||
assertGl();
|
||||
}
|
||||
|
||||
void Renderer::renderConsole(const Console *console,const bool showFullConsole){
|
||||
void Renderer::renderConsole(const Console *console,const bool showFullConsole,const bool showMenuConsole){
|
||||
|
||||
if(console == NULL) {
|
||||
throw runtime_error("console == NULL");
|
||||
|
@ -737,6 +738,16 @@ void Renderer::renderConsole(const Console *console,const bool showFullConsole){
|
|||
}
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
else if(showMenuConsole){
|
||||
for(int i=0; i<console->getStoredLineCount() && i<maxConsoleLines; ++i){
|
||||
renderTextShadow(
|
||||
console->getStoredLine(i),
|
||||
CoreData::getInstance().getConsoleFont(),
|
||||
fontColor,
|
||||
20, i*20+20);
|
||||
}
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
else{
|
||||
for(int i=0; i<console->getLineCount(); ++i){
|
||||
renderTextShadow(
|
||||
|
|
|
@ -200,7 +200,7 @@ public:
|
|||
|
||||
//light
|
||||
static const float maxLightDist;
|
||||
|
||||
|
||||
public:
|
||||
enum Shadows{
|
||||
sDisabled,
|
||||
|
@ -220,6 +220,7 @@ private:
|
|||
bool focusArrows;
|
||||
bool textures3D;
|
||||
Shadows shadows;
|
||||
int maxConsoleLines;
|
||||
|
||||
//game
|
||||
const Game *game;
|
||||
|
@ -315,7 +316,7 @@ public:
|
|||
void renderMouse3d();
|
||||
void renderBackground(const Texture2D *texture);
|
||||
void renderTextureQuad(int x, int y, int w, int h, const Texture2D *texture, float alpha=1.f);
|
||||
void renderConsole(const Console *console, const bool showAll=false);
|
||||
void renderConsole(const Console *console, const bool showAll=false, const bool showMenuConsole=false);
|
||||
void renderChatManager(const ChatManager *chatManager);
|
||||
void renderResourceStatus();
|
||||
void renderSelectionQuad();
|
||||
|
|
|
@ -54,7 +54,7 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
|
|||
Config &config = Config::getInstance();
|
||||
needToSetChangedGameSettings = false;
|
||||
lastSetChangedGameSettings = time(NULL);
|
||||
|
||||
showFullConsole=false;
|
||||
|
||||
currentFactionName="";
|
||||
currentMap="";
|
||||
|
@ -166,7 +166,7 @@ SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE
|
|||
|
||||
//init controllers
|
||||
listBoxControls[0].setSelectedItemIndex(ctHuman);
|
||||
chatManager.init(&console, -1);
|
||||
chatManager.init(&console, -1,true);
|
||||
}
|
||||
|
||||
void MenuStateConnectedGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
|
@ -380,7 +380,7 @@ void MenuStateConnectedGame::render(){
|
|||
renderer.renderListBox(&listBoxTechTree);
|
||||
|
||||
renderer.renderChatManager(&chatManager);
|
||||
renderer.renderConsole(&console,true);
|
||||
renderer.renderConsole(&console,showFullConsole,true);
|
||||
}
|
||||
catch(const std::exception &ex) {
|
||||
char szBuf[1024]="";
|
||||
|
@ -755,6 +755,11 @@ void MenuStateConnectedGame::keyDown(char key)
|
|||
{
|
||||
//send key to the chat manager
|
||||
chatManager.keyDown(key);
|
||||
if(!chatManager.getEditEnabled()){
|
||||
if(key=='M'){
|
||||
showFullConsole= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateConnectedGame::keyPress(char c)
|
||||
|
@ -765,6 +770,13 @@ void MenuStateConnectedGame::keyPress(char c)
|
|||
void MenuStateConnectedGame::keyUp(char key)
|
||||
{
|
||||
chatManager.keyUp(key);
|
||||
if(chatManager.getEditEnabled()){
|
||||
//send key to the chat manager
|
||||
chatManager.keyUp(key);
|
||||
}
|
||||
else if(key== 'M'){
|
||||
showFullConsole= false;
|
||||
}
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
|
|
|
@ -65,6 +65,7 @@ private:
|
|||
|
||||
Console console;
|
||||
ChatManager chatManager;
|
||||
bool showFullConsole;
|
||||
|
||||
string currentFactionName;
|
||||
string currentMap;
|
||||
|
|
|
@ -55,6 +55,8 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
Lang &lang= Lang::getInstance();
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
Config &config = Config::getInstance();
|
||||
|
||||
showFullConsole=false;
|
||||
|
||||
//initialize network interface
|
||||
NetworkManager::getInstance().end();
|
||||
|
@ -286,7 +288,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu, b
|
|||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//chatManager.init(&console, world.getThisTeamIndex());
|
||||
chatManager.init(&console, -1);
|
||||
chatManager.init(&console, -1,true);
|
||||
|
||||
publishToMasterserverThread = new SimpleTaskThread(this,0,50);
|
||||
publishToMasterserverThread->start();
|
||||
|
@ -664,7 +666,7 @@ void MenuStateCustomGame::render(){
|
|||
renderer.renderListBox(&listBoxEnableObserverMode);
|
||||
|
||||
renderer.renderChatManager(&chatManager);
|
||||
renderer.renderConsole(&console,true);
|
||||
renderer.renderConsole(&console,showFullConsole,true);
|
||||
if(listBoxPublishServer.getEditable())
|
||||
{
|
||||
renderer.renderListBox(&listBoxPublishServer);
|
||||
|
@ -1497,6 +1499,11 @@ void MenuStateCustomGame::keyDown(char key)
|
|||
{
|
||||
//send key to the chat manager
|
||||
chatManager.keyDown(key);
|
||||
if(!chatManager.getEditEnabled()){
|
||||
if(key=='M'){
|
||||
showFullConsole= true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateCustomGame::keyPress(char c)
|
||||
|
@ -1507,6 +1514,13 @@ void MenuStateCustomGame::keyPress(char c)
|
|||
void MenuStateCustomGame::keyUp(char key)
|
||||
{
|
||||
chatManager.keyUp(key);
|
||||
if(chatManager.getEditEnabled()){
|
||||
//send key to the chat manager
|
||||
chatManager.keyUp(key);
|
||||
}
|
||||
else if(key== 'M'){
|
||||
showFullConsole= false;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateCustomGame::showMessageBox(const string &text, const string &header, bool toggle){
|
||||
|
|
|
@ -83,6 +83,7 @@ private:
|
|||
|
||||
Console console;
|
||||
ChatManager chatManager;
|
||||
bool showFullConsole;
|
||||
|
||||
public:
|
||||
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,bool openNetworkSlots= false, bool parentMenuIsMasterserver=false);
|
||||
|
|
Loading…
Reference in New Issue