UTMenu
Class TargetChildWindow

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

class TargetChildWindow
extends UTMenu.SpeechWindow


Variables
 string AllString
 int Message
 int MinOptions
 SpeechMiniDisplay MiniDisplay
 int OptionOffset
 int OptionTeamIDs[16]
 bool bSelectLast


Function Summary
 void BeforePaint(Canvas C, float X, float Y)
 void Created()
 void HideWindow()
 void Notify(UWindowWindow B, byte E)
 void Paint(Canvas C, float X, float Y)



Source Code


00001	class TargetChildWindow expands SpeechWindow;
00002	
00003	var int OptionOffset;
00004	var int MinOptions;
00005	
00006	var localized string AllString;
00007	var int Message;
00008	
00009	var SpeechMiniDisplay MiniDisplay;
00010	
00011	var bool bSelectLast;
00012	
00013	var int OptionTeamIDs[16];
00014	
00015	function Created()
00016	{
00017		local int i, j;
00018		local int W, H;
00019		local float XMod, YMod;
00020		local color TextColor;
00021		local PlayerReplicationInfo PRI;
00022		local string Names[32];
00023	
00024		W = Root.WinWidth / 4;
00025		H = W;
00026	
00027		if(W > 256 || H > 256)
00028		{
00029			W = 256;
00030			H = 256;
00031		}
00032	
00033		XMod = 4*W;
00034		YMod = 3*H;
00035	
00036		CurrentType = SpeechWindow(ParentWindow).CurrentType;
00037	
00038		NumOptions = 1;
00039		for (i=0; i<32; i++)
00040			Options[i] = "";
00041		for (i=0; i<32; i++)
00042		{
00043			PRI = GetPlayerOwner().GameReplicationInfo.PRIArray[i];
00044			if (PRI != None)
00045			{
00046				if ( (PRI.Team == GetPlayerOwner().PlayerReplicationInfo.Team) && (PRI != GetPlayerOwner().PlayerReplicationInfo) )
00047				{
00048					NumOptions++;
00049					Names[PRI.TeamID] = PRI.PlayerName;
00050				}
00051			}
00052		}
00053	
00054		Super.Created();
00055	
00056		OptionButtons[0].Text = AllString;
00057		j = 1;
00058		for (i=0; i<32; i++)
00059		{
00060			if (Names[i] != "")
00061			{
00062				OptionButtons[j].Text = Names[i];
00063				OptionTeamIDs[j] = i;
00064				j++;
00065			}
00066		}
00067	
00068		MiniDisplay = SpeechMiniDisplay(Root.CreateWindow(class'SpeechMiniDisplay', 100, 100, 100, 100));
00069		MiniDisplay.WinWidth = 256.0/1024.0 * XMod;
00070		MiniDisplay.WinHeight = 256.0/768.0 * YMod;
00071	
00072		TopButton.OverTexture = texture'OrdersTopArrow';
00073		TopButton.UpTexture = texture'OrdersTopArrow';
00074		TopButton.DownTexture = texture'OrdersTopArrow';
00075		TopButton.WinLeft = 0;
00076		BottomButton.OverTexture = texture'OrdersBtm';
00077		BottomButton.UpTexture = texture'OrdersBtm';
00078		BottomButton.DownTexture = texture'OrdersBtm';
00079		BottomButton.WinLeft = 0;
00080	
00081		MinOptions = Min(8,NumOptions);
00082	
00083		WinTop = (196.0/768.0 * YMod) + (32.0/768.0 * YMod)*(CurrentType-1);
00084		WinLeft = 512.0/1024.0 * XMod;
00085		WinWidth = 256.0/1024.0 * XMod;
00086		WinHeight = (32.0/768.0 * YMod)*(MinOptions+2);
00087	
00088		SetButtonTextures(0, True, False);
00089	}
00090	
00091	function BeforePaint(Canvas C, float X, float Y)
00092	{
00093		local int W, H;
00094		local float XWidth, YHeight, XMod, YMod, XPos, YPos, YOffset, BottomTop, XL, YL;
00095		local color TextColor;
00096		local int i;
00097	
00098		Super.BeforePaint(C, X, Y);
00099	
00100		W = Root.WinWidth / 4;
00101		H = W;
00102	
00103		if(W > 256 || H > 256)
00104		{
00105			W = 256;
00106			H = 256;
00107		}
00108	
00109		XMod = 4*W;
00110		YMod = 3*H;
00111	
00112		WinTop = (196.0/768.0 * YMod) + (32.0/768.0 * YMod)*(CurrentType-1);
00113		WinLeft = 512.0/1024.0 * XMod;
00114		WinWidth = 256.0/1024.0 * XMod;
00115		WinHeight = (32.0/768.0 * YMod)*(NumOptions+2);
00116	
00117		XWidth = 256.0/1024.0 * XMod;
00118		YHeight = 32.0/768.0 * YMod;
00119	
00120		TopButton.SetSize(XWidth, YHeight);
00121		TopButton.WinTop = 0;
00122		TopButton.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00123		if (OptionOffset > 0)
00124			TopButton.bDisabled = False;
00125		else
00126			TopButton.bDisabled = True;
00127	
00128		for(i=0; i<NumOptions; i++)
00129		{
00130			OptionButtons[i].SetSize(XWidth, YHeight);
00131			OptionButtons[i].WinLeft = 0;
00132			OptionButtons[i].WinTop = (32.0/768.0*YMod)*(i+1);
00133		}
00134	
00135		BottomButton.SetSize(XWidth, YHeight);
00136		BottomButton.WinTop = (32.0/768.0*YMod)*(NumOptions+1);
00137		BottomButton.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00138		BottomButton.bDisabled = True;
00139	}
00140	
00141	function Paint(Canvas C, float X, float Y)
00142	{
00143		local int i;
00144	
00145		Super.Paint(C, X, Y);
00146	
00147		// Text
00148		for(i=0; i<NumOptions; i++)
00149			OptionButtons[i].FadeFactor = FadeFactor/100;
00150	}
00151	
00152	function HideWindow()
00153	{
00154		Super.HideWindow();
00155	
00156		if (MiniDisplay != None)
00157			MiniDisplay.HideWindow();
00158	}
00159	
00160	function Notify(UWindowWindow B, byte E)
00161	{
00162		local int i;
00163	
00164		switch (E)
00165		{
00166			case DE_MouseEnter:
00167				for (i=0; i<NumOptions; i++)
00168				{
00169					if (B == OptionButtons[i])
00170					{
00171						MiniDisplay.WinTop = OptionButtons[i].WinTop + WinTop;
00172						MiniDisplay.WinLeft = WinLeft + WinWidth + WinWidth/10;
00173						MiniDisplay.Reset();
00174						if (i > 0)
00175							MiniDisplay.FillInfo(i, OptionButtons[i].Text);
00176					}
00177				}
00178				break;
00179			case DE_DoubleClick:
00180			case DE_Click:
00181				GetPlayerOwner().PlaySound(sound'SpeechWindowClick', SLOT_Interact);
00182				for (i=0; i<NumOptions; i++)
00183				{
00184					if ( B == OptionButtons[i] )
00185					{
00186						if ( i == 0 )
00187							Root.GetPlayerOwner().Speech(SpeechWindow(ParentWindow).CurrentType, Message, -1);
00188						else 
00189							Root.GetPlayerOwner().Speech(SpeechWindow(ParentWindow).CurrentType, Message, OptionTeamIDs[i]);
00190					}
00191				}
00192				break;
00193		}
00194	}
00195	
00196	defaultproperties
00197	{
00198	     AllString="All"
00199	     TopTexture=Texture'UTMenu.Skins.OrdersTop2'
00200	     WindowTitle=""
00201	}

End Source Code