Hide chat
This commit is contained in:
@ -20,12 +20,31 @@ namespace CoopClient
|
|||||||
get { return CurrentFocused; }
|
get { return CurrentFocused; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (value && Hidden)
|
||||||
|
{
|
||||||
|
Hidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
MainScaleForm.CallFunction("SET_FOCUS", value ? 2 : 1, 2, "ALL");
|
MainScaleForm.CallFunction("SET_FOCUS", value ? 2 : 1, 2, "ALL");
|
||||||
|
|
||||||
CurrentFocused = value;
|
CurrentFocused = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTime LastMessageTime { get; set; }
|
||||||
|
|
||||||
|
private bool CurrentHidden { get; set; }
|
||||||
|
private bool Hidden
|
||||||
|
{
|
||||||
|
get { return CurrentHidden; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
MainScaleForm.CallFunction(value ? "hide" : "showFeed");
|
||||||
|
|
||||||
|
CurrentHidden = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Chat()
|
public Chat()
|
||||||
{
|
{
|
||||||
MainScaleForm = new Scaleform("multiplayer_chat");
|
MainScaleForm = new Scaleform("multiplayer_chat");
|
||||||
@ -43,8 +62,16 @@ namespace CoopClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Tick()
|
public void Tick()
|
||||||
|
{
|
||||||
|
if (LastMessageTime.AddSeconds(15) < DateTime.UtcNow && !Focused && !Hidden)
|
||||||
|
{
|
||||||
|
Hidden = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Hidden)
|
||||||
{
|
{
|
||||||
MainScaleForm.Render2D();
|
MainScaleForm.Render2D();
|
||||||
|
}
|
||||||
|
|
||||||
if (!CurrentFocused)
|
if (!CurrentFocused)
|
||||||
{
|
{
|
||||||
@ -57,6 +84,8 @@ namespace CoopClient
|
|||||||
public void AddMessage(string sender, string msg)
|
public void AddMessage(string sender, string msg)
|
||||||
{
|
{
|
||||||
MainScaleForm.CallFunction("ADD_MESSAGE", sender + ":", msg);
|
MainScaleForm.CallFunction("ADD_MESSAGE", sender + ":", msg);
|
||||||
|
LastMessageTime = DateTime.UtcNow;
|
||||||
|
Hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnKeyDown(Keys key)
|
public void OnKeyDown(Keys key)
|
||||||
@ -89,11 +118,8 @@ namespace CoopClient
|
|||||||
case (char)8:
|
case (char)8:
|
||||||
if (CurrentInput.Length > 0)
|
if (CurrentInput.Length > 0)
|
||||||
{
|
{
|
||||||
MainScaleForm.CallFunction("SET_FOCUS", 1, 2, "ALL");
|
CurrentInput = CurrentInput.Remove(CurrentInput.Length - 1);
|
||||||
MainScaleForm.CallFunction("SET_FOCUS", 2, 2, "ALL");
|
MainScaleForm.CallFunction("DELETE_TEXT");
|
||||||
|
|
||||||
CurrentInput = CurrentInput.Substring(0, CurrentInput.Length - 1);
|
|
||||||
MainScaleForm.CallFunction("ADD_TEXT", CurrentInput);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case (char)13:
|
case (char)13:
|
||||||
|
Reference in New Issue
Block a user