Merge pull request #8808 from deniz1a/leavemap-cleanup
Removes unnecessary code from IngameChatLogic.cs.
This commit is contained in:
@@ -37,7 +37,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
bool disableTeamChat;
|
bool disableTeamChat;
|
||||||
bool teamChat;
|
bool teamChat;
|
||||||
bool inDialog;
|
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, Ruleset modRules)
|
public IngameChatLogic(Widget widget, OrderManager orderManager, World world, Ruleset modRules)
|
||||||
@@ -55,14 +54,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
tabCompletion.Names = orderManager.LobbyInfo.Clients.Select(c => c.Name).Distinct().ToList();
|
tabCompletion.Names = orderManager.LobbyInfo.Clients.Select(c => c.Name).Distinct().ToList();
|
||||||
|
|
||||||
var chatPanel = (ContainerWidget)widget;
|
var chatPanel = (ContainerWidget)widget;
|
||||||
chatOverlay = chatPanel.GetOrNull<ContainerWidget>("CHAT_OVERLAY");
|
chatOverlay = chatPanel.Get<ContainerWidget>("CHAT_OVERLAY");
|
||||||
if (chatOverlay != null)
|
|
||||||
{
|
|
||||||
chatOverlayDisplay = chatOverlay.Get<ChatDisplayWidget>("CHAT_DISPLAY");
|
chatOverlayDisplay = chatOverlay.Get<ChatDisplayWidget>("CHAT_DISPLAY");
|
||||||
chatOverlay.Visible = false;
|
chatOverlay.Visible = false;
|
||||||
}
|
|
||||||
else
|
|
||||||
inDialog = true;
|
|
||||||
|
|
||||||
chatChrome = chatPanel.Get<ContainerWidget>("CHAT_CHROME");
|
chatChrome = chatPanel.Get<ContainerWidget>("CHAT_CHROME");
|
||||||
chatChrome.Visible = true;
|
chatChrome.Visible = true;
|
||||||
@@ -91,6 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
CloseChat();
|
CloseChat();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
chatText.OnTabKey = () =>
|
chatText.OnTabKey = () =>
|
||||||
{
|
{
|
||||||
var previousText = chatText.Text;
|
var previousText = chatText.Text;
|
||||||
@@ -102,10 +97,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
chatText.OnEscKey = () => { CloseChat(); return true; };
|
chatText.OnEscKey = () => { CloseChat(); return true; };
|
||||||
|
|
||||||
if (!inDialog)
|
|
||||||
{
|
|
||||||
var chatClose = chatChrome.Get<ButtonWidget>("CHAT_CLOSE");
|
var chatClose = chatChrome.Get<ButtonWidget>("CHAT_CLOSE");
|
||||||
chatClose.OnClick += CloseChat;
|
chatClose.OnClick += CloseChat;
|
||||||
|
|
||||||
@@ -122,7 +116,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
chatScrollPanel = chatChrome.Get<ScrollPanelWidget>("CHAT_SCROLLPANEL");
|
chatScrollPanel = chatChrome.Get<ScrollPanelWidget>("CHAT_SCROLLPANEL");
|
||||||
chatTemplate = chatScrollPanel.Get<ContainerWidget>("CHAT_TEMPLATE");
|
chatTemplate = chatScrollPanel.Get<ContainerWidget>("CHAT_TEMPLATE");
|
||||||
@@ -157,14 +150,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
chatChrome.Visible = true;
|
chatChrome.Visible = true;
|
||||||
chatScrollPanel.ScrollToBottom();
|
chatScrollPanel.ScrollToBottom();
|
||||||
chatText.TakeKeyboardFocus();
|
chatText.TakeKeyboardFocus();
|
||||||
if (!inDialog)
|
|
||||||
chatOverlay.Visible = false;
|
chatOverlay.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseChat()
|
public void CloseChat()
|
||||||
{
|
{
|
||||||
if (inDialog)
|
|
||||||
return;
|
|
||||||
chatChrome.Visible = false;
|
chatChrome.Visible = false;
|
||||||
chatText.YieldKeyboardFocus();
|
chatText.YieldKeyboardFocus();
|
||||||
chatOverlay.Visible = true;
|
chatOverlay.Visible = true;
|
||||||
@@ -177,7 +167,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
void AddChatLine(Color c, string from, string text, bool replayCache)
|
void AddChatLine(Color c, string from, string text, bool replayCache)
|
||||||
{
|
{
|
||||||
if (!(inDialog || replayCache))
|
if (!replayCache)
|
||||||
chatOverlayDisplay.AddLine(c, from, text);
|
chatOverlayDisplay.AddLine(c, from, text);
|
||||||
|
|
||||||
var template = chatTemplate.Clone();
|
var template = chatTemplate.Clone();
|
||||||
|
|||||||
Reference in New Issue
Block a user