UTMenu
Class PhysicalChildWindow

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

class PhysicalChildWindow
extends UTMenu.SpeechWindow


Variables
 int MinOptions
 int OptionOffset
 string PhysicalTaunts[30]
 string TauntCommand[30]


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



Source Code


00001	class PhysicalChildWindow expands SpeechWindow;
00002	
00003	var int OptionOffset;
00004	var int MinOptions;
00005	
00006	var string TauntCommand[30];
00007	var localized string PhysicalTaunts[30];
00008	
00009	function Created()
00010	{
00011		local int i;
00012		local int W, H;
00013		local float XMod, YMod;
00014	
00015		W = Root.WinWidth / 4;
00016		H = W;
00017	
00018		if(W > 256 || H > 256)
00019		{
00020			W = 256;
00021			H = 256;
00022		}
00023	
00024		XMod = 4*W;
00025		YMod = 3*H;
00026	
00027		CurrentType = SpeechWindow(ParentWindow).CurrentType;
00028	
00029		NumOptions = 4;
00030	
00031		Super.Created();
00032	
00033		for (i=0; i<NumOptions; i++)
00034		{
00035			OptionButtons[i].Text = PhysicalTaunts[i];
00036		}
00037	
00038		TopButton.OverTexture = texture'OrdersTopArrow';
00039		TopButton.UpTexture = texture'OrdersTopArrow';
00040		TopButton.DownTexture = texture'OrdersTopArrow';
00041		TopButton.WinLeft = 0;
00042		BottomButton.OverTexture = texture'OrdersBtmArrow';
00043		BottomButton.UpTexture = texture'OrdersBtmArrow';
00044		BottomButton.DownTexture = texture'OrdersBtmArrow';
00045		BottomButton.WinLeft = 0;
00046	
00047		MinOptions = Min(8,NumOptions);
00048	
00049		WinTop = (196.0/768.0 * YMod) + (32.0/768.0 * YMod)*(CurrentType-1);
00050		WinLeft = 256.0/1024.0 * XMod;
00051		WinWidth = 256.0/1024.0 * XMod;
00052		WinHeight = (32.0/768.0 * YMod)*(MinOptions+2);
00053	
00054		SetButtonTextures(0, True, False);
00055	}
00056	
00057	function BeforePaint(Canvas C, float X, float Y)
00058	{
00059		local int W, H;
00060		local float XWidth, YHeight, XMod, YMod, XPos, YPos, YOffset, BottomTop, XL, YL;
00061		local color TextColor;
00062		local int i;
00063	
00064		Super(NotifyWindow).BeforePaint(C, X, Y);
00065	
00066		W = Root.WinWidth / 4;
00067		H = W;
00068	
00069		if(W > 256 || H > 256)
00070		{
00071			W = 256;
00072			H = 256;
00073		}
00074	
00075		XMod = 4*W;
00076		YMod = 3*H;
00077	
00078		XWidth = 256.0/1024.0 * XMod;
00079		YHeight = 32.0/768.0 * YMod;
00080	
00081		TopButton.SetSize(XWidth, YHeight);
00082		TopButton.WinTop = 0;
00083		TopButton.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00084		if (OptionOffset > 0)
00085			TopButton.bDisabled = False;
00086		else
00087			TopButton.bDisabled = True;
00088	
00089		for(i=0; i<OptionOffset; i++)
00090		{
00091			OptionButtons[i].HideWindow();
00092		}
00093		for(i=OptionOffset; i<MinOptions+OptionOffset; i++)
00094		{
00095			OptionButtons[i].ShowWindow();
00096			OptionButtons[i].SetSize(XWidth, YHeight);
00097			OptionButtons[i].WinLeft = 0;
00098			OptionButtons[i].WinTop = (32.0/768.0*YMod)*(i+1-OptionOffset);
00099		}
00100		for(i=MinOptions+OptionOffset; i<NumOptions; i++)
00101		{
00102			OptionButtons[i].HideWindow();
00103		}
00104	
00105		BottomButton.SetSize(XWidth, YHeight);
00106		BottomButton.WinTop = (32.0/768.0*YMod)*(MinOptions+1);
00107		BottomButton.MyFont = class'UTLadderStub'.Static.GetStubClass().Static.GetBigFont(Root);
00108		if (NumOptions > MinOptions+OptionOffset)
00109			BottomButton.bDisabled = False;
00110		else
00111			BottomButton.bDisabled = True;
00112	}
00113	
00114	function Paint(Canvas C, float X, float Y)
00115	{
00116		local int i;
00117	
00118		Super.Paint(C, X, Y);
00119	
00120		// Text
00121		for(i=0; i<NumOptions; i++)
00122		{
00123			OptionButtons[i].FadeFactor = FadeFactor/100;
00124		}
00125	}
00126	
00127	function Notify(UWindowWindow B, byte E)
00128	{
00129		local int i;
00130	
00131		switch (E)
00132		{
00133			case DE_DoubleClick:
00134			case DE_Click:
00135				GetPlayerOwner().PlaySound(sound'SpeechWindowClick', SLOT_Interact);
00136				for (i=0; i<NumOptions; i++)
00137				{
00138					if (B == OptionButtons[i])
00139						GetPlayerOwner().ConsoleCommand(TauntCommand[i]);
00140				}
00141				if (B == TopButton)
00142				{
00143					if (NumOptions > 8)
00144					{
00145						if (OptionOffset > 0)
00146							OptionOffset--;
00147					}
00148				}
00149				if (B == BottomButton)
00150				{
00151					if (NumOptions > 8)
00152					{
00153						if (NumOptions - OptionOffset > 8)
00154							OptionOffset++;
00155					}
00156				}
00157				break;
00158		}
00159	}
00160	
00161	defaultproperties
00162	{
00163	     TauntCommand(0)="taunt victory1"
00164	     TauntCommand(1)="taunt thrust"
00165	     TauntCommand(2)="taunt taunt1"
00166	     TauntCommand(3)="taunt wave"
00167	     PhysicalTaunts(0)="Basic Taunt"
00168	     PhysicalTaunts(1)="Pelvic Thrust"
00169	     PhysicalTaunts(2)="Victory Dance"
00170	     PhysicalTaunts(3)="Wave"
00171	     TopTexture=Texture'UTMenu.Skins.OrdersTop2'
00172	     WindowTitle=""
00173	}

End Source Code