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

GUI2K4.UT2K4OnslaughtPowerLinkDesigner


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
// ====================================================================
// Onslaught PowerLink Designer - page for creating custom powercore link setups
//
// Written by Matt Oelfke
// (C) 2003, Epic Games, Inc. All Rights Reserved
// ====================================================================

class UT2K4OnslaughtPowerLinkDesigner extends LargeWindow;

var automated GUIImage          i_Map;
var automated moComboBox        co_SetupName;
var automated GUIButton         b_DeleteSetup, b_SaveSetup, b_lClose, b_Clear, b_Export;

var float OnslaughtMapCenterX, OnslaughtMapCenterY, OnslaughtMapRadius;
var ONSPlayerReplicationInfo PRI;
var ONSPowerCore SelectedCore;
var string SetupName; //name of setup we're currently editing

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
	Super.InitComponent(MyController, MyOwner);

	//fill setup name combobox
	PRI = ONSPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo);
	if (PRI != None)
	{
		PRI.UpdateGUIMapLists = UpdateGUIMapLists;
		PRI.ProcessSetupName = AddSetupName;
		PRI.RemoveSetupName = RemoveSetupName;
		PRI.SetCurrentSetup = SetCurrentSetup;
		PRI.ServerSendSetupNames();
	}

	co_SetupName.MyComboBox.List.OnClick = InternalListClick;
	b_Export.ToolTip.ExpirationSeconds = 10.0;
}

function bool ShouldAnimate(GUIComponent C, optional bool bSetup)
{
	return false;
}

function AddSetupName(string SetupName)
{
	if (SetupName == "")
	{
		if (co_SetupName.ItemCount() == 0)
			co_SetupName.AddItem("Custom");
	}
	else
	{
		co_SetupName.AddItem(SetupName);
		co_SetupName.OnChange(co_SetupName);
	}

	EnableComponent(b_SaveSetup);
	EnableComponent(co_SetupName);
}

function RemoveSetupName(string SetupName)
{
	co_SetupName.RemoveItem(co_SetupName.FindIndex(SetupName, true));
}

function UpdateGUIMapLists()
{
	local UT2K4GamePageBase Page;

	Page = UT2K4GamePageBase(Controller.FindPersistentMenuByClass(class'UT2K4GamePageBase'));
	if ( Page != None && Page.p_Main != None )
		Page.p_Main.InitMaps();
}

function SetCurrentSetup(string SetupName)
{
	co_SetupName.Find(SetupName, true);
}

function SetDefaultPosition()
{
	Super.SetDefaultPosition();

	ResolutionChanged(0, 0);
}

function ResolutionChanged( int NewResX, int NewResY )
{
	OnslaughtMapCenterX = ActualLeft() + default.OnslaughtMapCenterX * ActualWidth();
	OnslaughtMapCenterY = ActualTop() + default.OnslaughtMapCenterY * ActualHeight();
	OnslaughtMapRadius = default.OnslaughtMapRadius * ActualWidth();

	Super.ResolutionChanged(NewResX,NewResY);
}

function bool DrawMap(Canvas Canvas)
{
	local ONSHUDOnslaught ONSHUD;

	ONSHUD = ONSHudOnslaught(PlayerOwner().myHUD);
	if ( ONSHUD == None )
		return True;

	ONSHUD.DrawRadarMap(Canvas, OnslaughtMapCenterX, OnslaughtMapCenterY, OnslaughtMapRadius, true);
	if ( SelectedCore != None )
		ONSHUD.DrawSpawnIcon(Canvas, SelectedCore.HUDLocation, false, ONSHUD.IconScale, ONSHUD.HUDScale);

	Canvas.SetPos(OnslaughtMapCenterX - OnslaughtMapRadius, OnslaughtMapCenterY - OnslaughtMapRadius);
	Canvas.DrawBox( Canvas, OnslaughtMapRadius * 2, OnslaughtMapRadius * 2);

	return true;
}

function bool InternalOnClick(GUIComponent Sender)
{
	if (PRI == None)
		return true;

	if ( Sender == b_SaveSetup )
	{
		if ( co_SetupName.GetText() != "" )
			PRI.ServerSavePowerLinkSetup(co_SetupName.GetText());
	}
	else if (Sender == b_DeleteSetup)
	{
		PRI.ServerDeletePowerLinkSetup(co_SetupName.GetText());
	}
	else if (Sender == b_lClose)
		Controller.CloseMenu(false);
	else if (Sender == b_Clear)
		PRI.ServerClearPowerLinks();
	else if (Sender == b_Export)
		PlayerOwner().ConsoleCommand("CopyLinkSetup");

	return true;
}

function InternalOnChange(GUIComponent Sender)
{
	if (Sender == co_SetupName)
	{
		if (co_SetupName.FindIndex(co_SetupName.GetText(), true) != -1)
			EnableComponent(b_DeleteSetup);
		else
			DisableComponent(b_DeleteSetup);
	}
}

function bool InternalListClick(GUIComponent Sender)
{
	co_SetupName.MyComboBox.InternalListClick(Sender);
	if (!co_SetupName.MyComboBox.List.bVisible && ONSPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo) != None)
	{
		ONSPlayerReplicationInfo(PlayerOwner().PlayerReplicationInfo).ServerSetPowerLinkSetup(co_SetupName.GetText());
		ONSHudOnslaught(PlayerOwner().myHUD).RequestPowerLinks();
	}

	return true;
}

function InternalOnMouseReleased( GUIComponent Sender )
{
	local ONSPowerCore Core;
	local ONSHudOnslaught ONSHUD;

	if ( Sender == Self )
	{
		ONSHUD = ONSHudOnslaught(PlayerOwner().myHUD);
		Core = ONSHUD.LocatePowerCore(Controller.MouseX - OnslaughtMapCenterX, Controller.MouseY - OnslaughtMapCenterY, OnslaughtMapRadius);
		if (Core != None)
		{
			if (SelectedCore == None)
				SelectedCore = Core;
			else
			{
				if ( ONSHUD.HasLink(Core, SelectedCore) )
					PRI.ServerRemovePowerLink(SelectedCore, Core);
				else
					PRI.ServerReceivePowerLink(SelectedCore, Core);

				SelectedCore = None;
			}
		}
	}
}

function Free()
{
	if (PRI != None)
	{
		PRI.UpdateGUIMapLists = None;
		PRI.ProcessSetupName = None;
		PRI.SetCurrentSetup = None;
	}

	PRI = None;
	SelectedCore = None;
	super.Free();
}

defaultproperties
{
	OnslaughtMapCenterX=0.5
	OnslaughtMapCenterY=0.475
	OnslaughtMapRadius=0.30

	Begin Object Class=GUIToolTip Name=MapToolTip
		ExpirationSeconds=5.0
	End Object
	ToolTip=MapToolTip
	Hint="Click on any PowerCore or PowerNode to select it, then click on another PowerCore or PowerNode to create a link between the two."

	Begin Object Class=GUIImage Name=LinkDesignerMap
		Image=Material'MenuWhite'
		ImageRenderStyle=MSTY_Normal
		OnDraw=DrawMap
		Hint="Click on any PowerCore or PowerNode to select it, then click on another PowerCore or PowerNode to create a link between the two."
	End Object
	i_Map=LinkDesignerMap

	Begin Object Class=moComboBox Name=SetupNameBox
		WinWidth=0.400000
		WinHeight=0.030000
		WinLeft=0.300000
		WinTop=0.094531
		CaptionWidth=0.25
		Caption="Name"
		Hint="The name of this Link Setup. Type a name and click Save to create a new link setup."
		OnChange=InternalOnChange
		MenuState=MSAT_Disabled
	End Object
	co_SetupName=SetupNameBox

	Begin Object Class=GUIButton Name=DeleteSetupButton
		WinTop=0.155
		WinLeft=0.3
		WinWidth=0.15
		WinHeight=0.05
		Caption="Delete"
		Hint="Delete the currently selected Link Setup."
		OnClick=InternalOnClick
		MenuState=MSAT_Disabled
	End Object
	b_DeleteSetup=DeleteSetupButton

	Begin Object Class=GUIButton Name=SaveSetupButton
		WinTop=0.155
		WinLeft=0.55
		WinWidth=0.15
		WinHeight=0.05
		Caption="Save"
		Hint="Save the current Link Setup."
		OnClick=InternalOnClick
		MenuState=MSAT_Disabled
	End Object
	b_SaveSetup=SaveSetupButton

	Begin Object Class=GUIButton Name=CloseButton
		WinWidth=0.150000
		WinHeight=0.050000
		WinLeft=0.425000
		WinTop=0.861979
		Caption="Close"
		OnClick=InternalOnClick
	End Object
	b_lClose=CloseButton

	Begin Object Class=GUIButton Name=ClearButton
		WinWidth=0.200000
		WinHeight=0.050000
		WinLeft=0.400000
		WinTop=0.731979
		Caption="Clear Links"
		Hint="Clear all links on the map."
		OnClick=InternalOnClick
	End Object
	b_Clear=ClearButton

	Begin Object Class=GUIButton Name=ExportButton
		WinWidth=0.200000
		WinHeight=0.050000
		WinLeft=0.400000
		WinTop=0.791979
		Caption="Export to UnrealEd"
		Hint="LEVEL DESIGNERS ONLY: Export the current Link Setup to the clipboard. You can then open the map in UnrealEd and use Paste to create an Official Link Setup actor, making this Link Setup an Official Link Setup for your map."
		OnClick=InternalOnClick
	End Object
	b_Export=ExportButton

	OnMouseRelease=InternalOnMouseReleased

	WinLeft=0.2
	WinWidth=0.6
	WinTop=0.05
	WinHeight=0.9

	bAllowedAsLast=true
	bRenderWorld=true
}

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:53.671 - Created with UnCodeX