Allow clearing the message log.
This commit is contained in:
parent
b10bc64e74
commit
2daf06d018
6 changed files with 84 additions and 5 deletions
|
|
@ -88,6 +88,20 @@ extend Class SWWMHandler
|
|||
bar.ntagtic = level.totaltime;
|
||||
bar.ntagcol = nametagcolor;
|
||||
}
|
||||
else if ( e.Name ~== "swwmrefreshmessagelog" )
|
||||
{
|
||||
let kbase = DemolitionistMenu(Menu.GetCurrentMenu());
|
||||
if ( !kbase ) return;
|
||||
foreach ( t:kbase.tabs )
|
||||
{
|
||||
if ( !(t is 'DemolitionistChatTab') ) continue;
|
||||
let ct = DemolitionistChatTab(t);
|
||||
if ( ct.msglist ) ct.msglist.Destroy();
|
||||
break;
|
||||
}
|
||||
kbase.tmsg = StringTable.Localize("$SWWM_CHATCLEARED");
|
||||
kbase.tmsgtic = Menu.MenuTime()+70;
|
||||
}
|
||||
}
|
||||
|
||||
override void NetworkProcess( ConsoleEvent e )
|
||||
|
|
@ -454,6 +468,12 @@ extend Class SWWMHandler
|
|||
if ( consoleplayer != e.Args[2] ) return;
|
||||
SWWMFullHistory.PushMessage(e.Name.Mid(17),e.Args[0],e.Args[1]);
|
||||
}
|
||||
else if ( e.Name ~== "swwmclearmessages" )
|
||||
{
|
||||
if ( consoleplayer != e.Args[0] ) return;
|
||||
SWWMFullHistory.ClearMessages();
|
||||
SendInterfaceEvent(consoleplayer,"swwmrefreshmessagelog");
|
||||
}
|
||||
else if ( e.Name.Left(16) ~== "swwmremoteliner." )
|
||||
{
|
||||
if ( consoleplayer == e.Args[0] ) return;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ Class DemolitionistChatTab : DemolitionistMenuTab
|
|||
double smofs;
|
||||
bool drag;
|
||||
bool justopened;
|
||||
bool bDel;
|
||||
SWWMFullHistory hist;
|
||||
|
||||
override DemolitionistMenuTab Init( DemolitionistMenu master )
|
||||
|
|
@ -116,6 +117,18 @@ Class DemolitionistChatTab : DemolitionistMenuTab
|
|||
case MK_UP:
|
||||
if ( Scroll(-16) ) master.MenuSound("menu/demoscroll");
|
||||
break;
|
||||
case MK_ENTER:
|
||||
if ( bDel )
|
||||
{
|
||||
master.MenuSound("menu/democlose");
|
||||
bDel = false;
|
||||
EventHandler.SendNetworkEvent("swwmclearmessages",consoleplayer);
|
||||
}
|
||||
break;
|
||||
case MK_BACK:
|
||||
bDel = !bDel;
|
||||
master.MenuSound(bDel?"menu/demosel":"menu/democlose");
|
||||
break;
|
||||
}
|
||||
}
|
||||
override void MouseInput( Vector2 pos, int btn )
|
||||
|
|
@ -131,6 +144,10 @@ Class DemolitionistChatTab : DemolitionistMenuTab
|
|||
master.MenuSound("menu/demoscroll");
|
||||
drag = true;
|
||||
}
|
||||
MenuInput(MK_ENTER);
|
||||
break;
|
||||
case MB_RIGHT:
|
||||
MenuInput(MK_BACK);
|
||||
break;
|
||||
case MB_WHEELUP:
|
||||
if ( Scroll(-8) ) master.MenuSound("menu/demoscroll");
|
||||
|
|
@ -148,7 +165,24 @@ Class DemolitionistChatTab : DemolitionistMenuTab
|
|||
}
|
||||
override void Drawer( double fractic )
|
||||
{
|
||||
if ( !hist || (msglist.items.Size() <= 0) )
|
||||
if ( bDel )
|
||||
{
|
||||
double fh = master.mSmallFont.GetHeight();
|
||||
double yy = int(master.ws.y-fh*4)/2;
|
||||
String str = StringTable.Localize("$SWWM_CLEARCHAT0");
|
||||
double xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2;
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_FIRE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
yy += fh*2;
|
||||
str = StringTable.Localize("$SWWM_CLEARCHAT1");
|
||||
xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2;
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
yy += fh;
|
||||
str = StringTable.Localize("$SWWM_CLEARCHAT2");
|
||||
xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2;
|
||||
Screen.DrawText(master.mSmallFont,Font.CR_WHITE,master.origin.x+xx,master.origin.y+yy,str,DTA_VirtualWidthF,master.ss.x,DTA_VirtualHeightF,master.ss.y,DTA_KeepRatio,true);
|
||||
return;
|
||||
}
|
||||
if ( !hist || !msglist || (msglist.items.Size() <= 0) )
|
||||
{
|
||||
String str = StringTable.Localize("$SWWM_NOCHAT");
|
||||
double xx = int(master.ws.x-master.mSmallFont.StringWidth(str))/2;
|
||||
|
|
|
|||
|
|
@ -53,6 +53,19 @@ Class SWWMFullHistory : SWWMStaticThinker
|
|||
m.rep = 1;
|
||||
fh.msg.Push(m);
|
||||
}
|
||||
|
||||
static play void ClearMessages()
|
||||
{
|
||||
let fh = SWWMFullHistory(ThinkerIterator.Create("SWWMFullHistory",STAT_STATIC).Next());
|
||||
if ( !fh )
|
||||
{
|
||||
fh = new("SWWMFullHistory");
|
||||
fh.ChangeStatNum(STAT_STATIC);
|
||||
return;
|
||||
}
|
||||
fh.lastmap = "";
|
||||
fh.msg.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// Dedicated mission log (for custom maps)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue