Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

xVoting.MapVoteFooter


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
//==============================================================================
//  Created on: 01/02/2004
//  Contains controls for participating in chat while mapvote menus are open
//
//  Written by Ron Prestenback
//  © 2003, Epic Games, Inc. All Rights Reserved
//==============================================================================

class MapVoteFooter extends GUIFooter;

var() noexport array<string> RecallQueue;
var() noexport int RecallIdx;
var() noexport int idxLastChatMsg;
var() noexport float LastMsgTime;

var automated GUISectionBackground sb_Background;
var automated GUIScrollTextBox lb_Chat;
var automated moEditBox        ed_Chat;
var automated GUIButton        b_Accept, b_Submit, b_Close;

delegate OnSubmit();
delegate OnAccept();
delegate bool OnSendChat( string Text )
{
	if ( Text != "" )
	{
		if ( RecallQueue.Length == 0 || RecallQueue[RecallQueue.Length - 1] != Text )
		{
			RecallIdx = RecallQueue.Length;
			RecallQueue[RecallIdx] = Text;
		}

		if ( Left(Text,4) ~= "cmd " )
			PlayerOwner().ConsoleCommand( Mid(Text, 4) );
		else
		{
			if ( Left(Text,1) == "." )
				PlayerOwner().TeamSay( Mid(Text,1) );
			else PlayerOwner().Say( Text );
		}
	}

	return true;
}

function InitComponent(GUIController InController, GUIComponent InOwner)
{
	local string str;
	local ExtendedConsole C;

	Super.InitComponent(InController, InOwner);

	lb_Chat.MyScrollText.SetContent("");
	lb_Chat.MyScrollText.FontScale=FNS_Small;

	C = ExtendedConsole(Controller.ViewportOwner.Console);
	if ( C != None )
	{
		C.OnChatMessage = ReceiveChat;
		if ( C.bTyping )
		{
			str = C.TypedStr;
			C.TypingClose();

			if ( Left(str,4) ~= "say " )
				str = Mid(str, 4);

			else if ( Left(str,8) ~= "teamsay " )
				str = Mid(str, 8);

			ed_Chat.SetText(str);
		}
	}

	sb_Background.Managecomponent(lb_Chat);


	OnDraw=MyOnDraw;

}

function bool MyOnDraw(canvas C)
{
	local float l,t,w,xl,yl;
	local eFontScale fs;
	// Reposition everything

	t = sb_Background.ActualTop() + sb_Background.ActualHeight();
	l = sb_Background.ActualLeft() + sb_Background.ActualWidth() - sb_Background.ImageOffset[3];

	b_Close.Style.TextSize(C,MSAT_Blurry,b_Close.Caption, XL,YL,FS);
	w = XL;
	b_Submit.Style.TextSize(C,MSAT_Blurry,b_Close.Caption, XL,YL,FS);
	if (XL>w)
		w = XL;
	b_Accept.Style.TextSize(C,MSAT_Blurry,b_Close.Caption, XL,YL,FS);
	if (XL>w)
		w = XL;

	w = w*3;
	w = ActualWidth(w);

	l -= w;
	b_Close.WinWidth = w;
	b_Close.WinTop = t;
	b_Close.WinLeft = l;

	l -= w;
	b_Submit.WinWidth = w;
	b_Submit.WinTop = t;
	b_Submit.WinLeft = l;

	l -= w;
	b_Accept.WinWidth = w;
	b_Accept.WinTop = t;
	b_Accept.WinLeft = l;


	ed_Chat.WinLeft   = sb_Background.ActualLeft() + sb_Background.ImageOffset[0];
	ed_Chat.WinWidth  = L - ed_Chat.WinLeft;
	ed_Chat.WinHeight = 25;
	ed_Chat.WinTop    = t;

 	return false;
}

function ReceiveChat(string Msg)
{
	lb_Chat.AddText(Msg);
	lb_Chat.MyScrollText.End();

	// remove top messages from list if there are more than 10
	if( lb_Chat.MyScrollText.ItemCount > 10 )
		lb_Chat.MyScrollText.Remove(0,lb_Chat.MyScrollText.ItemCount - 10);
}

function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
{
	if ( State == 3 && Key == 0x0D ) // enter
	{
		if ( OnSendChat(ed_Chat.GetText()) )
			ed_Chat.SetComponentValue("", True);

		return true;
	}

	else if ( State == 1 && RecallQueue.Length > 0 )
	{
		if ( Key == 0x26 ) // up
		{
			ed_Chat.SetText(RecallQueue[RecallIdx]);
			RecallIdx = Max(0, RecallIdx - 1);
			return true;
		}
		else if ( Key == 0x28 ) // down
		{
			ed_Chat.SetText(RecallQueue[RecallIdx]);
			RecallIdx = Min(RecallQueue.Length - 1, RecallIdx + 1);
			return true;
		}
	}

	return false;
}

function bool InternalOnClick(GUIComponent Sender)
{
	if (Sender == b_Close )
	{
		Controller.CloseMenu(true);
		return true;
	}

	if ( Sender == b_Submit )
	{
		OnSubmit();
		return true;
	}

	if ( Sender == b_Accept )
	{
		OnAccept();
		return true;
	}
}

defaultproperties
{
     Begin Object Class=AltSectionBackground Name=MapvoteFooterBackground
         bFillClient=True
         Caption="Chat"
         LeftPadding=0.010000
         RightPadding=0.010000
         WinHeight=0.820000
         bBoundToParent=True
         bScaleToParent=True
         OnPreDraw=MapvoteFooterBackground.InternalPreDraw
     End Object
     sb_Background=AltSectionBackground'xVoting.MapVoteFooter.MapvoteFooterBackground'

     Begin Object Class=GUIScrollTextBox Name=ChatScrollBox
         bNoTeletype=True
         CharDelay=0.002500
         EOLDelay=0.000000
         bVisibleWhenEmpty=True
         OnCreateComponent=ChatScrollBox.InternalOnCreateComponent
         StyleName="ServerBrowserGrid"
         WinTop=0.223580
         WinLeft=0.043845
         WinWidth=0.918970
         WinHeight=0.582534
         TabOrder=2
         bBoundToParent=True
         bScaleToParent=True
         bNeverFocus=True
     End Object
     lb_Chat=GUIScrollTextBox'xVoting.MapVoteFooter.ChatScrollBox'

     Begin Object Class=moEditBox Name=ChatEditbox
         CaptionWidth=0.150000
         Caption="Say"
         OnCreateComponent=ChatEditbox.InternalOnCreateComponent
         WinTop=0.868598
         WinLeft=0.007235
         WinWidth=0.700243
         WinHeight=0.106609
         TabOrder=0
         OnKeyEvent=MapVoteFooter.InternalOnKeyEvent
     End Object
     ed_Chat=moEditBox'xVoting.MapVoteFooter.ChatEditbox'

     Begin Object Class=GUIButton Name=AcceptButton
         Caption="Accept"
         Hint="Click once you are satisfied with all settings and wish to offer no further modifications"
         WinTop=0.906173
         WinLeft=0.562577
         WinWidth=0.191554
         WinHeight=0.071145
         TabOrder=1
         bVisible=False
         bStandardized=True
         OnClick=MapVoteFooter.InternalOnClick
         OnKeyEvent=AcceptButton.InternalOnKeyEvent
     End Object
     b_Accept=GUIButton'xVoting.MapVoteFooter.AcceptButton'

     Begin Object Class=GUIButton Name=SubmitButton
         Caption="Submit"
         WinTop=0.849625
         WinLeft=0.704931
         WinWidth=0.160075
         WinHeight=0.165403
         TabOrder=1
         bStandardized=True
         OnClick=MapVoteFooter.InternalOnClick
         OnKeyEvent=SubmitButton.InternalOnKeyEvent
     End Object
     b_Submit=GUIButton'xVoting.MapVoteFooter.SubmitButton'

     Begin Object Class=GUIButton Name=CloseButton
         Caption="Close"
         WinTop=0.849625
         WinLeft=0.861895
         WinWidth=0.137744
         WinHeight=0.165403
         TabOrder=1
         bStandardized=True
         OnClick=MapVoteFooter.InternalOnClick
         OnKeyEvent=CloseButton.InternalOnKeyEvent
     End Object
     b_Close=GUIButton'xVoting.MapVoteFooter.CloseButton'

     StyleName="BindBox"
     bNeverFocus=False
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:56.000 - Creation time: sk 18-3-2018 09:50:12.493 - Created with UnCodeX