UTMenu
Class InGameObjectives

source: e:\games\UnrealTournament\UTMenu\Classes\InGameObjectives.uc
Core.Object
   |
   +--UWindow.UWindowBase
      |
      +--UWindow.UWindowWindow
         |
         +--UTMenu.NotifyWindow
            |
            +--UTMenu.InGameObjectives
Direct Known Subclasses:None

class InGameObjectives
extends UTMenu.NotifyWindow


Variables
 AssaultInfo AI
 Texture BG1[4]
 Texture BG2[4]
 Texture BG3[4]
 string BGName1[4]
 string BGName2[4]
 string BGName3[4]
 NotifyButton BackButton
 string BrowserName
 NotifyButton Descscrolldown
 NotifyButton Descscrollup
 string EmptyText
 bool Initialized
 Texture MapShot
 StaticArea MapStatic
 LadderButton Names[8]
 NotifyButton NextButton
 SelectedO, NumNames
 UTFadeTextArea ObjDescArea
 string ObjectiveString
 string OrdersTransmissionText
 string StandByText
 float StaticScale
 Texture StaticTex
 NotifyButton Title1
 bool bMapStatic


Function Summary
 void AddObjDesc()
 void BeforePaint(Canvas C, float X, float Y)
 void Close(optional bool)
 void Created()
 void HideWindow()
 void NameSelected(int i)
 void Notify(UWindowWindow B, byte E)
 void Paint(Canvas C, float X, float Y)
 void SetMapShot(Texture NewShot)
 void Tick(float Delta)



Source Code


00001	class InGameObjectives extends NotifyWindow;
00002	
00003	// Background
00004	var texture BG1[4];
00005	var texture BG2[4];
00006	var texture BG3[4];
00007	var string BGName1[4];
00008	var string BGName2[4];
00009	var string BGName3[4];
00010	
00011	// Title
00012	var NotifyButton Title1;
00013	var localized string BrowserName;
00014	
00015	var NotifyButton BackButton;
00016	var NotifyButton NextButton;
00017	
00018	var UTFadeTextArea ObjDescArea;
00019	var NotifyButton Descscrollup;
00020	var NotifyButton Descscrolldown;
00021	
00022	// Names
00023	var LadderButton Names[8];
00024	var localized string ObjectiveString;
00025	var string EmptyText;
00026	var int SelectedO, NumNames;
00027	
00028	var bool Initialized;
00029	
00030	// Map Screen Shot
00031	var float StaticScale;
00032	var texture MapShot;
00033	var StaticArea MapStatic;
00034	var bool bMapStatic;
00035	var texture StaticTex;
00036	
00037	var localized string StandByText;
00038	var localized string OrdersTransmissionText;
00039	
00040	var AssaultInfo AI;
00041	
00042	function Created()
00043	{
00044		local class<Bot> InitialMate;
00045		local int i;
00046		local int W, H;
00047		local float XWidth, YHeight, XMod, YMod, XPos, YPos, YOffset;
00048		local color TextColor;
00049		local AssaultInfo AIS;
00050	
00051		Super.Created();
00052	
00053		GetPlayerOwner().ViewRotation.Pitch = 0;
00054		GetPlayerOwner().ViewRotation.Roll = 0;
00055	
00056		foreach GetPlayerOwner().AllActors(class'AssaultInfo', AIS)
00057		{
00058			AI = AIS;
00059		}
00060	
00061		/*
00062		 * Setup window parameters.
00063		 */
00064	
00065		bLeaveOnScreen = True;
00066		bAlwaysOnTop = True;
00067		class'UTLadderStub'.Static.GetStubClass().Static.SetupWinParams(Self, Root, W, H);
00068	
00069		XMod = 4*W;
00070		YMod = 3*H;
00071	
00072		/*
00073		 * Load the background.
00074		 */
00075	
00076		BG1[0] = Texture(DynamicLoadObject(BGName1[0], Class'Texture'));
00077		BG1[1] = Texture(DynamicLoadObject(BGName1[1], Class'Texture'));
00078		BG1[2] = Texture(DynamicLoadObject(BGName1[2], Class'Texture'));
00079		BG1[3] = Texture(DynamicLoadObject(BGName1[3], Class'Texture'));
00080		BG2[0] = Texture(DynamicLoadObject(BGName2[0], Class'Texture'));
00081		BG2[1] = Texture(DynamicLoadObject(BGName2[1], Class'Texture'));
00082		BG2[2] = Texture(DynamicLoadObject(BGName2[2], Class'Texture'));
00083		BG2[3] = Texture(DynamicLoadObject(BGName2[3], Class'Texture'));
00084		BG3[0] = Texture(DynamicLoadObject(BGName3[0], Class'Texture'));
00085		BG3[1] = Texture(DynamicLoadObject(BGName3[1], Class'Texture'));
00086		BG3[2] = Texture(DynamicLoadObject(BGName3[2], Class'Texture'));
00087		BG3[3] = Texture(DynamicLoadObject(BGName3[3], Class'Texture'));
00088	
00089		/*
00090		 * Create components.
00091		 */
00092	
00093		// Title
00094		XPos = 74.0/1024 * XMod;
00095		YPos = 69.0/768 * YMod;
00096		XWidth = 352.0/1024 * XMod;
00097		YHeight = 41.0/768 * YMod;
00098		Title1 = NotifyButton(CreateWindow(class'NotifyButton', XPos, YPos, XWidth, YHeight));
00099		Title1.Text = BrowserName;
00100		TextColor.R = 255;
00101		TextColor.G = 255;
00102		TextColor.B = 0;
00103		Title1.NotifyWindow = Self;
00104		Title1.SetTextColor(TextColor);
00105		Title1.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetHugeFont(Root);
00106		Title1.bStretched = True;
00107		Title1.bDisabled = True;
00108	
00109		// Names
00110		TextColor.R = 0;
00111		TextColor.G = 128;
00112		TextColor.B = 255;
00113		XPos = 168.0/1024 * XMod;
00114		YPos = 255.0/768 * YMod;
00115		XWidth = 256.0/1024 * XMod;
00116		YHeight = 64.0/768 * YMod;
00117		YOffset = 48.0/768 * YMod;
00118		NumNames = AI.NumObjShots;
00119		for (i=0; i<NumNames; i++)
00120		{
00121			Names[i] = LadderButton(CreateWindow(class'LadderButton', XPos, YPos + i*YOffset, XWidth, YHeight));
00122			Names[i].MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00123			Names[i].NotifyWindow = Self;
00124			Names[i].SetTextColor(TextColor);
00125			Names[i].bStretched = True;
00126			Names[i].bDontSetLabel = True;
00127			Names[i].LabelWidth = 178.0/1024 * XMod;
00128			Names[i].LabelHeight = 49.0/768 * YMod;
00129			Names[i].OverSound = sound'LadderSounds.lcursorMove';
00130			Names[i].DownSound = sound'SpeechWindowClick';
00131			Names[i].Text = ObjectiveString@i+1;
00132		}
00133		Names[0].bBottom = True;
00134		Names[NumNames-1].bTop = True;
00135	
00136		// Back Button
00137		XPos = 192.0/1024 * XMod;
00138		YPos = 701.0/768 * YMod;
00139		XWidth = 64.0/1024 * XMod;
00140		YHeight = 64.0/768 * YMod;
00141		BackButton = NotifyButton(CreateWindow(class'NotifyButton', XPos, YPos, XWidth, YHeight));
00142		BackButton.DisabledTexture = Texture(DynamicLoadObject("UTMenu.LeftUp", Class'Texture'));
00143		BackButton.UpTexture = Texture(DynamicLoadObject("UTMenu.LeftUp", Class'Texture'));
00144		BackButton.DownTexture = Texture(DynamicLoadObject("UTMenu.LeftDown", Class'Texture'));
00145		BackButton.OverTexture = Texture(DynamicLoadObject("UTMenu.LeftOver", Class'Texture'));
00146		BackButton.NotifyWindow = Self;
00147		BackButton.Text = "";
00148		TextColor.R = 255;
00149		TextColor.G = 255;
00150		TextColor.B = 0;
00151		BackButton.SetTextColor(TextColor);
00152		BackButton.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00153		BackButton.bStretched = True;
00154		BackButton.OverSound = sound'LadderSounds.lcursorMove';
00155		BackButton.DownSound = sound'LadderSounds.ladvance';
00156	
00157		// Next Button
00158		XPos = 256.0/1024 * XMod;
00159		YPos = 701.0/768 * YMod;
00160		XWidth = 64.0/1024 * XMod;
00161		YHeight = 64.0/768 * YMod;
00162		NextButton = NotifyButton(CreateWindow(class'NotifyButton', XPos, YPos, XWidth, YHeight));
00163		NextButton.DisabledTexture = Texture(DynamicLoadObject("UTMenu.RightUp", Class'Texture'));
00164		NextButton.UpTexture = Texture(DynamicLoadObject("UTMenu.RightUp", Class'Texture'));
00165		NextButton.DownTexture = Texture(DynamicLoadObject("UTMenu.RightDown", Class'Texture'));
00166		NextButton.OverTexture = Texture(DynamicLoadObject("UTMenu.RightOver", Class'Texture'));
00167		NextButton.NotifyWindow = Self;
00168		NextButton.Text = "";
00169		TextColor.R = 255;
00170		TextColor.G = 255;
00171		TextColor.B = 0;
00172		NextButton.SetTextColor(TextColor);
00173		NextButton.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00174		NextButton.bStretched = True;
00175		NextButton.OverSound = sound'LadderSounds.lcursorMove';
00176		NextButton.DownSound = sound'LadderSounds.ladvance';
00177	
00178		// Obj Desc
00179		XPos = 529.0/1024 * XMod;
00180		YPos = 586.0/768 * YMod;
00181		XWidth = 385.0/1024 * XMod;
00182		YHeight = 113.0/768 * YMod;
00183		ObjDescArea = UTFadeTextArea(CreateWindow(Class<UWindowWindow>(DynamicLoadObject("UTMenu.UTFadeTextArea", Class'Class')), XPos, YPos, XWidth, YHeight));
00184		ObjDescArea.TextColor.R = 255;
00185		ObjDescArea.TextColor.G = 255;
00186		ObjDescArea.TextColor.B = 0;
00187		ObjDescArea.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetSmallFont(Root);
00188		ObjDescArea.bAlwaysOnTop = True;
00189		ObjDescArea.bAutoScrolling = True;
00190	
00191		// DescScrollup
00192		XPos = 923.0/1024 * XMod;
00193		YPos = 590.0/768 * YMod;
00194		XWidth = 32.0/1024 * XMod;
00195		YHeight = 16.0/768 * YMod;
00196		DescScrollup = NotifyButton(CreateWindow(class'NotifyButton', XPos, YPos, XWidth, YHeight));
00197		DescScrollup.NotifyWindow = Self;
00198		DescScrollup.Text = "";
00199		DescScrollup.bStretched = True;
00200		DescScrollup.UpTexture = Texture(DynamicLoadObject("UTMenu.AroUup", Class'Texture'));
00201		DescScrollup.OverTexture = Texture(DynamicLoadObject("UTMenu.AroUovr", Class'Texture'));
00202		DescScrollup.DownTexture = Texture(DynamicLoadObject("UTMenu.AroUdwn", Class'Texture'));
00203		DescScrollup.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetSmallFont(Root);
00204		DescScrollup.bAlwaysOnTop = True;
00205	
00206		// DescScrolldown
00207		XPos = 923.0/1024 * XMod;
00208		YPos = 683.0/768 * YMod;
00209		XWidth = 32.0/1024 * XMod;
00210		YHeight = 16.0/768 * YMod;
00211		DescScrolldown = NotifyButton(CreateWindow(class'NotifyButton', XPos, YPos, XWidth, YHeight));
00212		DescScrolldown.NotifyWindow = Self;
00213		DescScrolldown.Text = "";
00214		DescScrolldown.bStretched = True;
00215		DescScrolldown.UpTexture = Texture(DynamicLoadObject("UTMenu.AroDup", Class'Texture'));
00216		DescScrolldown.OverTexture = Texture(DynamicLoadObject("UTMenu.AroDovr", Class'Texture'));
00217		DescScrolldown.DownTexture = Texture(DynamicLoadObject("UTMenu.AroDdwn", Class'Texture'));
00218		DescScrolldown.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetSmallFont(Root);
00219		DescScrolldown.bAlwaysOnTop = True;
00220	
00221		// StaticArea
00222		XPos = 608.0/1024 * XMod;
00223		YPos = 90.0/768 * YMod;
00224		XWidth = 320.0/1024 * XMod;
00225		YHeight = 319.0/768 * YMod;
00226		MapStatic = StaticArea(CreateWindow(class'StaticArea', XPos, YPos, XWidth, YHeight));
00227		MapStatic.VStaticScale = 300.0;
00228	
00229		Initialized = True;
00230		Root.Console.bBlackout = True;
00231	
00232		SelectedO = 0;
00233		SetMapShot(AI.ObjShots[0]);
00234		AddObjDesc();
00235		StaticScale = 1.0;
00236	}
00237	
00238	function BeforePaint(Canvas C, float X, float Y)
00239	{
00240		local int i;
00241		local int W, H;
00242		local float XWidth, YHeight, XMod, YMod, XPos, YPos, YOffset;
00243	
00244		Super.BeforePaint(C, X, Y);
00245	
00246		class'UTLadderStub'.Static.GetStubClass().Static.SetupWinParams(Self, Root, W, H);
00247	
00248		XMod = 4*W;
00249		YMod = 3*H;
00250	
00251		// Title
00252		XPos = 74.0/1024 * XMod;
00253		YPos = 69.0/768 * YMod;
00254		XWidth = 352.0/1024 * XMod;
00255		YHeight = 41.0/768 * YMod;
00256		Title1.WinLeft = XPos;
00257		Title1.WinTop = YPos;
00258		Title1.SetSize(XWidth, YHeight);
00259		Title1.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetHugeFont(Root);
00260	
00261		// Names
00262		XPos = 168.0/1024 * XMod;
00263		YPos = 595.0/768 * YMod;
00264		XWidth = 256.0/1024 * XMod;
00265		YHeight = 64.0/768 * YMod;
00266		YOffset = 47.0/768 * YMod;
00267		for (i=0; i<NumNames; i++)
00268		{
00269			Names[i].MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00270			Names[i].WinLeft = XPos;
00271			Names[i].WinTop = YPos - (i * YOffset);
00272			Names[i].SetSize(XWidth, YHeight);
00273			Names[i].LabelWidth = 178/1024 * XMod;
00274			Names[i].LabelHeight = 49/768 * YMod;
00275			if (i == SelectedO)
00276				Names[i].bSelected = True;
00277			else
00278				Names[i].bSelected = False;
00279		}
00280	
00281		// Back Button
00282		XPos = 192.0/1024 * XMod;
00283		YPos = 701.0/768 * YMod;
00284		XWidth = 64.0/1024 * XMod;
00285		YHeight = 64.0/768 * YMod;
00286		BackButton.SetSize(XWidth, YHeight);
00287		BackButton.WinLeft = XPos;
00288		BackButton.WinTop = YPos;
00289	
00290		// Next Button
00291		XPos = 256.0/1024 * XMod;
00292		YPos = 701.0/768 * YMod;
00293		XWidth = 64.0/1024 * XMod;
00294		YHeight = 64.0/768 * YMod;
00295		NextButton.SetSize(XWidth, YHeight);
00296		NextButton.WinLeft = XPos;
00297		NextButton.WinTop = YPos;
00298	
00299		// Obj Desc
00300		XPos = 529.0/1024 * XMod;
00301		YPos = 586.0/768 * YMod;
00302		XWidth = 385.0/1024 * XMod;
00303		YHeight = 113.0/768 * YMod;
00304		ObjDescArea.SetSize(XWidth, YHeight);
00305		ObjDescArea.WinLeft = XPos;
00306		ObjDescArea.WinTop = YPos;
00307		ObjDescArea.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetSmallFont(Root);
00308	
00309		// DescScrollup
00310		XPos = 923.0/1024 * XMod;
00311		YPos = 590.0/768 * YMod;
00312		XWidth = 32.0/1024 * XMod;
00313		YHeight = 16.0/768 * YMod;
00314		DescScrollup.WinLeft = XPos;
00315		DescScrollup.WinTop = YPos;
00316		DescScrollup.SetSize(XWidth, YHeight);
00317	
00318		// DescScrolldown
00319		XPos = 923.0/1024 * XMod;
00320		YPos = 683.0/768 * YMod;
00321		XWidth = 32.0/1024 * XMod;
00322		YHeight = 16.0/768 * YMod;
00323		DescScrolldown.WinLeft = XPos;
00324		DescScrolldown.WinTop = YPos;
00325		DescScrolldown.SetSize(XWidth, YHeight);
00326	
00327		// StaticArea
00328		XPos = 608.0/1024 * XMod;
00329		YPos = 90.0/768 * YMod;
00330		XWidth = 320.0/1024 * XMod;
00331		YHeight = 319.0/768 * YMod;
00332		MapStatic.WinLeft = XPos;
00333		MapStatic.WinTop = YPos;
00334		MapStatic.SetSize(XWidth, YHeight);
00335	}
00336	
00337	function Paint(Canvas C, float X, float Y)
00338	{
00339		local int XOffset, YOffset;
00340		local int W, H;
00341		local float XWidth, YHeight, XMod, YMod, XPos, YPos;
00342		local bool bOldSmooth;
00343	
00344		class'UTLadderStub'.Static.GetStubClass().Static.SetupWinParams(Self, Root, W, H);
00345	
00346		XMod = 4*W;
00347		YMod = 3*H;
00348	
00349		// Background
00350		DrawStretchedTexture(C, XOffset + (0 * W), YOffset + (0 * H), W+1, H+1, BG1[0]);
00351		DrawStretchedTexture(C, XOffset + (1 * W), YOffset + (0 * H), W+1, H+1, BG1[1]);
00352		DrawStretchedTexture(C, XOffset + (2 * W), YOffset + (0 * H), W+1, H+1, BG1[2]);
00353		DrawStretchedTexture(C, XOffset + (3 * W), YOffset + (0 * H), W+1, H+1, BG1[3]);
00354	
00355		DrawStretchedTexture(C, XOffset + (0 * W), YOffset + (1 * H), W+1, H+1, BG2[0]);
00356		DrawStretchedTexture(C, XOffset + (1 * W), YOffset + (1 * H), W+1, H+1, BG2[1]);
00357		DrawStretchedTexture(C, XOffset + (2 * W), YOffset + (1 * H), W+1, H+1, BG2[2]);
00358		DrawStretchedTexture(C, XOffset + (3 * W), YOffset + (1 * H), W+1, H+1, BG2[3]);
00359	
00360		DrawStretchedTexture(C, XOffset + (0 * W), YOffset + (2 * H), W+1, H+1, BG3[0]);
00361		DrawStretchedTexture(C, XOffset + (1 * W), YOffset + (2 * H), W+1, H+1, BG3[1]);
00362		DrawStretchedTexture(C, XOffset + (2 * W), YOffset + (2 * H), W+1, H+1, BG3[2]);
00363		DrawStretchedTexture(C, XOffset + (3 * W), YOffset + (2 * H), W+1, H+1, BG3[3]);
00364	
00365		// MapShot
00366		bOldSmooth = C.bNoSmooth;
00367		C.bNoSmooth = False;
00368		XPos = 608.0/1024 * XMod;
00369		YPos = 90.0/768 * YMod;
00370		XWidth = 320.0/1024 * XMod;
00371		YHeight = 319.0/768 * YMod;
00372	 	DrawStretchedTexture(C, XPos, YPos, XWidth, YHeight, MapShot);
00373		C.bNoSmooth = bOldSmooth;
00374	
00375		// Static
00376		XPos = 608.0/1024 * XMod;
00377		YPos = 90.0/768 * YMod;
00378		XWidth = 320.0/1024 * XMod;
00379		YHeight = 319.0/768 * YMod;
00380		C.DrawColor.R = 255 * StaticScale;
00381		C.DrawColor.G = 255 * StaticScale;
00382		C.DrawColor.B = 255 * StaticScale;
00383		C.Style = GetPlayerOwner().ERenderStyle.STY_Translucent;
00384	 	DrawStretchedTexture(C, XPos, YPos, XWidth, YHeight, StaticTex);
00385		C.Style = GetPlayerOwner().ERenderStyle.STY_Normal;
00386		C.DrawColor.R = 255;
00387		C.DrawColor.G = 255;
00388		C.DrawColor.B = 255;
00389	}
00390	
00391	function Notify(UWindowWindow B, byte E)
00392	{
00393		local int i;
00394	
00395		switch (E)
00396		{
00397			case DE_Click:
00398				for (i=0; i<8; i++)
00399				{
00400					if (B == Names[i])
00401					{
00402						if (!Names[i].bDisabled)
00403							NameSelected(i);
00404						return;
00405					}
00406				}
00407				switch (B)
00408				{
00409					case NextButton:
00410						Close();
00411						break;
00412					case BackButton:
00413						Close();
00414						break;
00415					case DescScrollup:
00416						ObjDescArea.ScrollingOffset--;
00417						if (ObjDescArea.ScrollingOffset < 0)
00418							ObjDescArea.ScrollingOffset = 0;
00419						break;
00420					case DescScrolldown:
00421						ObjDescArea.ScrollingOffset++;
00422						if (ObjDescArea.ScrollingOffset > 10)
00423							ObjDescArea.ScrollingOffset = 10;
00424						break;
00425				}
00426				break;
00427		}
00428	}
00429	
00430	function NameSelected(int i)
00431	{
00432		SelectedO = i;
00433		SetMapShot(AI.ObjShots[SelectedO]);
00434		AddObjDesc();
00435	}
00436	
00437	function Close(optional bool bByParent)
00438	{
00439		HideWindow();
00440		Root.Console.bNoDrawWorld = Root.Console.ShowDesktop;
00441		Root.Console.bLocked = False;
00442		UMenuRootWindow(Root).MenuBar.ShowWindow();
00443		Root.Console.CloseUWindow();
00444	
00445		Super.Close(bByParent);
00446	}
00447	
00448	function HideWindow()
00449	{
00450		Root.Console.bBlackOut = False;
00451	
00452		Super.HideWindow();
00453	}
00454	
00455	function AddObjDesc()
00456	{
00457		ObjDescArea.Clear();
00458		ObjDescArea.AddText(OrdersTransmissionText);
00459		ObjDescArea.AddText("---");
00460		ObjDescArea.AddText(AI.ObjDesc[SelectedO]);
00461	}
00462	
00463	function Tick(float Delta)
00464	{
00465		if (StaticScale > 0)
00466			StaticScale -= Delta;
00467		if (StaticScale < 0)
00468		{
00469			if (bMapStatic)
00470			{
00471				MapStatic.bVPanStatic = True;
00472				bMapStatic = False;
00473			}
00474			StaticScale = 0.0;
00475		}
00476	}
00477	
00478	function SetMapShot(texture NewShot)
00479	{
00480		StaticScale = 1.0;
00481		MapShot = NewShot;
00482		bMapStatic = True;
00483	}
00484	
00485	defaultproperties
00486	{
00487	     BGName1(0)="UTMenu.Ladr11"
00488	     BGName1(1)="UTMenu.Ladr12"
00489	     BGName1(2)="UTMenu.Ladr13"
00490	     BGName1(3)="UTMenu.Ladr14"
00491	     BGName2(0)="UTMenu.Ladr21"
00492	     BGName2(1)="UTMenu.Ladr22"
00493	     BGName2(2)="UTMenu.Ladr23"
00494	     BGName2(3)="UTMenu.Ladr24"
00495	     BGName3(0)="UTMenu.Ladr31"
00496	     BGName3(1)="UTMenu.Ladr32"
00497	     BGName3(2)="UTMenu.Ladr33"
00498	     BGName3(3)="UTMenu.Ladr34"
00499	     BrowserName="Mission Objectives"
00500	     ObjectiveString="Objective"
00501	     StaticTex=Texture'Botpack.LadrStatic.Static.Static_A00'
00502	     OrdersTransmissionText="Orders Transmission Follows"
00503	}

End Source Code