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

GUI2K4.TeamSymbolConfig


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
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
//==============================================================================
//	Created on: 09/15/2003
//	Configure the avatars for each team's banner
//
//	Written by Ron Prestenback
//	© 2003, Epic Games, Inc.  All Rights Reserved
//==============================================================================
class TeamSymbolConfig extends LockedFloatingWindow;

var automated GUIImage i_RedPreview, i_BluePreview;

var automated GUISectionBackground sb_Bk2;
var automated AltSectionBackground sb_Bk3;

var automated GUIVertImageListBox lb_Symbols;
var automated GUIHorzScrollButton b_AddRed, b_AddBlue;

var GUIVertImageList li_Sym;
var Material InitialRed, InitialBlue;
var localized string ResetString, RedString;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
	local array<string> TeamSymbols;
	local Material m;
	local int i;

	Super.InitComponent(MyController, MyOwner);

	Controller.GetTeamSymbolList( TeamSymbols, false );
	li_Sym = lb_Symbols.List;
	li_Sym.bDropSource=True;
	li_Sym.OnEndDrag=EndSymbolDrag;

	for ( i = 0; i < TeamSymbols.Length; i++ )
	{
		m = Material(DynamicLoadObject( TeamSymbols[i], Class'Material' ));
		if ( m != None )
		{
			lb_Symbols.AddImage(m);
		}
	}

	b_Ok.SetPosition(0.789829,0.880000,0.159649,0.050000);
	b_Cancel.SetPosition(0.599011,0.880000,0.159649,0.050000);

	sb_Main.SetPosition(0.651078,0.050317,0.264769,0.313203);


	sb_Main.ManageComponent(i_RedPreview);
	sb_Main.Caption = RedString;
	sb_Main.bFillClient=true;


	sb_Bk2.ManageComponent(i_BluePreview);
	sb_Bk3.ManageComponent(lb_Symbols);

	b_Cancel.Caption = ResetString;
	b_Cancel.OnClick=ResetClick;

}

function HandleParameters( string RedSymbol, string BlueSymbol )
{
	local int i;
	local Material M;
	local bool GotRed, GotBlue;

	if ( RedSymbol == "" )
		GotRed = true;

	if ( BlueSymbol == "" )
		GotBlue = true;

	while ( i < li_Sym.ItemCount && !(GotRed && GotBlue) )
	{
		M = li_Sym.GetImageAtIndex(i);
		if ( !GotRed && string(M) ~= RedSymbol )
		{
			InitialRed = M;
			GotRed = true;
			if ( SetRedImage(M) )
				continue;
		}

		if ( !GotBlue && string(M) ~= BlueSymbol )
		{
			InitialBlue = M;
			GotBlue = true;
			if ( SetBlueImage(M) )
				continue;
		}

		i++;
	}
}

function bool ResetClick(GUIComponent Sender)
{
	if ( Sender == b_Cancel )
	{
		SetRedImage(InitialRed);
		SetBlueImage(InitialBlue);
	}

	return true;
}

function EndSymbolDrag(GUIComponent Accepting, bool bAccepted)
{
	local int i;
	local array<ImageListElem> Pending;

	if (bAccepted && Accepting != None)
	{
		Pending = li_sym.GetPendingElements();

		for (i = 0; i < Pending.Length; i++)
		{
			if ( Accepting == i_RedPreview )
				SetRedImage(Pending[i].Image);
			else if ( Accepting == i_BluePreview )
				SetBlueImage( Pending[i].Image );
		}

		li_Sym.bRepeatClick = False;
	}

	if (Accepting == None)
		li_Sym.bRepeatClick = True;

	li_Sym.SetOutlineAlpha(255);
	if ( li_Sym.bNotify )
		li_Sym.CheckLinkedObjects(li_Sym);
}

function bool DragDropped(GUIComponent Sender)
{
	local Material Mat;

	Mat = li_Sym.Get();
	return Mat != None && Mat != GUIImage(Sender).Image;
}

// Returns true if successfully removed image from main list
function bool SetRedImage(Material Mat)
{
	local int i;
	local bool bResult;

	if ( Mat == None )
	{
		if ( i_RedPreview.Image != None )
		{
			i = li_Sym.FindImage(i_RedPreview.Image);
			if ( i == -1 )
				li_Sym.Add( i_RedPreview.Image );
		}

		i_RedPreview.Image = None;
		return false;
	}

	// The image must exist in our list for us to add it
	// Otherwise, we could end up with both teams having the same image, which causes problems
	// when you try to change one of those images, as you then end up with two copies of the same image in the list
	i = li_Sym.FindImage( Mat );
	if ( i != -1 )
	{
		if ( i_RedPreview.Image != None && i_RedPreview.Image != Mat )
			li_Sym.Replace( i, i_RedPreview.Image );

		else
		{
			li_Sym.Remove(i);
			bResult = true;
		}
		i_RedPreview.Image = Mat;
	}

	return bResult;
}

// Returns true if successfully removed image from main list
function bool SetBlueImage(Material Mat)
{
	local int i;
	local bool bResult;

	if ( Mat == None )
	{
		if ( i_BluePreview.Image != None )
		{
			i = li_Sym.FindImage(i_BluePreview.Image);
			if ( i == -1 )
				li_Sym.Add( i_BluePreview.Image );
		}

		i_BluePreview.Image = None;
		return false;
	}
	// The image must exist in our list for us to add it
	// Otherwise, we could end up with both teams having the same image, which causes problems
	// when you try to change one of those images, as you then end up with two copies of the same image in the list
	i = li_Sym.FindImage( Mat );
	if ( i != -1 )
	{
		if ( i_BluePreview.Image != None && i_BluePreview.Image != Mat )
			li_Sym.Replace( i, i_BluePreview.Image );

		else
		{
			li_Sym.Remove(i);
			bResult = True;
		}
		i_BluePreview.Image = Mat;
	}

	return bResult;
}

function bool AddOnPredraw(Canvas C)
{
	b_AddRed.WinLeft = sb_Main.WinLeft - b_AddRed.WinWidth;
	b_AddRed.WinLeft = sb_Bk2.WinLeft - b_AddRed.WinWidth;
	return false;
}

function bool butClick(GUIComponent Sender)
{
	local material m;

	m = li_Sym.Get();
	if (m!=None)
	{
		if (Sender==b_AddRed)
			SetRedImage(M);
		else if (Sender==b_AddBlue)
			SetBlueImage(M);
	}

	return true;
}


DefaultProperties
{
	Begin Object Class=GUIImage Name=RedPreview
		ImageRenderStyle=IMGA_Alpha
		ImageStyle=ISTY_Scaled
        ImageColor=(R=245,G=0,B=0,A=255)
        DropShadow=Material'2K4Menus.Controls.shadow'
        DropShadowX=0
        DropShadowY=-1
		WinWidth=0.240119
		WinHeight=0.407497
		WinLeft=0.105502
		WinTop=0.148005
        bDropTarget=True
        OnDragDrop=DragDropped
        bAcceptsInput=True
		bScaleToParent=True
		bBoundToParent=True
	End Object
	i_RedPreview=RedPreview

	Begin Object Class=GUIImage Name=BluePreview
		ImageRenderStyle=IMGA_Alpha
		ImageStyle=ISTY_Scaled
        ImageColor=(R=0,G=0,B=245,A=255)
        DropShadow=Material'2K4Menus.Controls.shadow'
        DropShadowX=0
        DropShadowY=-1
		WinWidth=0.240119
		WinHeight=0.400195
		WinLeft=0.653149
		WinTop=0.152873
        bDropTarget=True
        OnDragDrop=DragDropped
        bAcceptsInput=True
		bScaleToParent=True
		bBoundToParent=True
	End Object
	i_BluePreview=BluePreview

	Begin Object class=GUISectionBackground name=back2
		WinWidth=0.264769
		WinHeight=0.313203
		WinLeft=0.651078
		WinTop=0.472192
		bFillClient=true
		Caption="Blue Team"
	End Object
	sb_Bk2=Back2

	Begin Object class=AltSectionBackground name=back3
		WinWidth=0.494261
		WinHeight=0.698945
		WinLeft=0.030960
		WinTop=0.050317
		LeftPadding=0
		RightPadding=0
		Caption="Available Team Symbols"
		bFillClient=true
	End Object
	sb_Bk3=Back3

	Begin Object class=GUIVertImageListBox name=SymbList
		WinWidth=0.264769
		WinHeight=0.313203
		WinLeft=0.651078
		WinTop=0.472192
		CellStyle=CELL_FixedCount
		NoVisibleRows=5
		NoVisibleCols=5
	End Object
	lb_Symbols=SymbList

    Begin Object class=GUIHorzScrollButton name=bAddRed
		WinWidth=0.033984
		WinHeight=0.043750
		WinLeft=0.619922
		WinTop=0.200000
		OnPreDraw=AddOnPredraw
		OnClick=Butclick
		bIncreaseButton=true
		StyleName="AltComboButton""
	End Object
	b_AddRed=bAddRed

    Begin Object class=GUIHorzScrollButton name=bAddBlue
		WinWidth=0.033984
		WinHeight=0.043750
		WinLeft=0.615039
		WinTop=0.634896
		OnClick=Butclick
		bIncreaseButton=true
		StyleName="AltComboButton""
	End Object
	b_AddBlue=bAddBlue

	WinWidth=0.885742
	WinHeight=0.802344
	WinLeft=0.055664
	WinTop=0.091927

    RedString="Red Team"
	ResetString="Reset"
	WindowName="Configure Team Symbols"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:28:52.000 - Creation time: Do 14.8.2014 09:58:52.067 - Created with UnCodeX