Core.Object | +--UWindow.UWindowBase | +--UWindow.UWindowWindow | +--UTMenu.NotifyWindow | +--UTMenu.SpeechWindow | +--UTMenu.OrdersChildWindow
int
MinOptions
OptionOffset
OtherOffset[32]
PlayerReplicationInfo
TargetPRI
void
BeforePaint(Canvas C, float X, float Y)
Created()
FadeOut()
HideWindow()
Notify(UWindowWindow B, byte E)
Paint(Canvas C, float X, float Y)
00001 class OrdersChildWindow expands SpeechWindow; 00002 00003 var int OptionOffset; 00004 var int MinOptions; 00005 00006 var int OtherOffset[32]; 00007 00008 var PlayerReplicationInfo TargetPRI; 00009 00010 function Created() 00011 { 00012 local int i, j; 00013 local int W, H; 00014 local float XMod, YMod; 00015 local color TextColor; 00016 local class<ChallengeVoicePack> V; 00017 00018 V = class<ChallengeVoicePack>(GetPlayerOwner().PlayerReplicationInfo.VoiceType); 00019 00020 W = Root.WinWidth / 4; 00021 H = W; 00022 00023 if(W > 256 || H > 256) 00024 { 00025 W = 256; 00026 H = 256; 00027 } 00028 00029 XMod = 4*W; 00030 YMod = 3*H; 00031 00032 CurrentType = SpeechWindow(ParentWindow).CurrentType; 00033 00034 j = 0; 00035 for (i=0; i<9; i++) 00036 { 00037 if (V.Static.GetOrderString(i, GetPlayerOwner().GameReplicationInfo.GameName) != "") 00038 OtherOffset[j++] = i; 00039 } 00040 NumOptions = j; 00041 00042 Super.Created(); 00043 00044 for (i=0; i<NumOptions; i++) 00045 OptionButtons[i].Text = V.Static.GetOrderString(OtherOffset[i], GetPlayerOwner().GameReplicationInfo.GameName); 00046 00047 TopButton.OverTexture = texture'OrdersTopArrow'; 00048 TopButton.UpTexture = texture'OrdersTopArrow'; 00049 TopButton.DownTexture = texture'OrdersTopArrow'; 00050 TopButton.WinLeft = 0; 00051 BottomButton.OverTexture = texture'OrdersBtmArrow'; 00052 BottomButton.UpTexture = texture'OrdersBtmArrow'; 00053 BottomButton.DownTexture = texture'OrdersBtmArrow'; 00054 BottomButton.WinLeft = 0; 00055 00056 MinOptions = Min(8,NumOptions); 00057 00058 WinTop = (196.0/768.0 * YMod) + (32.0/768.0 * YMod)*(CurrentType-1); 00059 WinLeft = 256.0/1024.0 * XMod; 00060 WinWidth = 256.0/1024.0 * XMod; 00061 WinHeight = (32.0/768.0 * YMod)*(MinOptions+2); 00062 00063 SetButtonTextures(0, True, False); 00064 } 00065 00066 function BeforePaint(Canvas C, float X, float Y) 00067 { 00068 local int W, H; 00069 local float XWidth, YHeight, XMod, YMod, XPos, YPos, YOffset, BottomTop, XL, YL; 00070 local color TextColor; 00071 local int i; 00072 00073 Super(NotifyWindow).BeforePaint(C, X, Y); 00074 00075 W = Root.WinWidth / 4; 00076 H = W; 00077 00078 if(W > 256 || H > 256) 00079 { 00080 W = 256; 00081 H = 256; 00082 } 00083 00084 XMod = 4*W; 00085 YMod = 3*H; 00086 00087 XWidth = 256.0/1024.0 * XMod; 00088 YHeight = 32.0/768.0 * YMod; 00089 00090 TopButton.SetSize(XWidth, YHeight); 00091 TopButton.WinTop = 0; 00092 TopButton.MyFont = class'UTLadderStub'.Static.GetBigFont(Root); 00093 if (OptionOffset > 0) 00094 TopButton.bDisabled = False; 00095 else 00096 TopButton.bDisabled = True; 00097 00098 for(i=0; i<OptionOffset; i++) 00099 { 00100 OptionButtons[i].HideWindow(); 00101 } 00102 for(i=OptionOffset; i<MinOptions+OptionOffset; i++) 00103 { 00104 OptionButtons[i].ShowWindow(); 00105 OptionButtons[i].SetSize(XWidth, YHeight); 00106 OptionButtons[i].WinLeft = 0; 00107 OptionButtons[i].WinTop = (32.0/768.0*YMod)*(i+1-OptionOffset); 00108 } 00109 for(i=MinOptions+OptionOffset; i<NumOptions; i++) 00110 { 00111 OptionButtons[i].HideWindow(); 00112 } 00113 00114 BottomButton.SetSize(XWidth, YHeight); 00115 BottomButton.WinTop = (32.0/768.0*YMod)*(MinOptions+1); 00116 BottomButton.MyFont = class'UTLadderStub'.Static.GetBigFont(Root); 00117 if (NumOptions > MinOptions+OptionOffset) 00118 BottomButton.bDisabled = False; 00119 else 00120 BottomButton.bDisabled = True; 00121 } 00122 00123 function Paint(Canvas C, float X, float Y) 00124 { 00125 local int i; 00126 00127 Super.Paint(C, X, Y); 00128 00129 // Text 00130 for(i=0; i<NumOptions; i++) 00131 { 00132 OptionButtons[i].FadeFactor = FadeFactor/100; 00133 } 00134 } 00135 00136 function FadeOut() 00137 { 00138 FadeFactor = 100; 00139 bFadeOut = True; 00140 if (SpeechChild != None) 00141 SpeechChild.FadeOut(); 00142 SpeechChild = None; 00143 CurrentKey = -1; 00144 } 00145 00146 event bool KeyEvent( byte Key, byte Action, FLOAT Delta ) 00147 { 00148 local byte B; 00149 00150 if ( CurrentKey == Key ) 00151 { 00152 if ( Action == 3 ) // IST_Release 00153 CurrentKey = -1; 00154 return false; 00155 } 00156 00157 if ( SpeechChild != None ) 00158 return SpeechChild.KeyEvent(Key, Action, Delta); 00159 00160 if ( Key == 38 ) 00161 { 00162 CurrentKey = Key; 00163 Notify( TopButton, DE_Click ); 00164 return true; 00165 } 00166 00167 if ( Key == 40 ) 00168 { 00169 CurrentKey = Key; 00170 Notify( BottomButton, DE_Click ); 00171 return true; 00172 } 00173 00174 B = Key - 48; 00175 if ( B == 0 ) 00176 B = 9; 00177 else 00178 B -= 1; 00179 if ( (B>=0) && (B<10) ) 00180 { 00181 CurrentKey = Key; 00182 Notify( OptionButtons[B + OptionOffset], DE_Click ); 00183 return true; 00184 } 00185 00186 return false; 00187 } 00188 00189 function Notify(UWindowWindow B, byte E) 00190 { 00191 local int i; 00192 00193 switch (E) 00194 { 00195 case DE_DoubleClick: 00196 case DE_Click: 00197 GetPlayerOwner().PlaySound(sound'SpeechWindowClick', SLOT_Interact); 00198 for (i=0; i<NumOptions; i++) 00199 { 00200 if (B == OptionButtons[i]) 00201 { 00202 if (!GetPlayerOwner().GameReplicationInfo.bTeamGame) 00203 { 00204 Root.GetPlayerOwner().Speech(2, OtherOffset[i], 0); 00205 return; 00206 } else if ((TargetPRI != None) && (CurrentType == 6)) { 00207 Root.GetPlayerOwner().Speech(2, OtherOffset[i], TargetPRI.TeamID); 00208 return; 00209 } else { 00210 if (i == 0) 00211 SetButtonTextures(0, True, True); 00212 else { 00213 SetButtonTextures(0, True, False); 00214 SetButtonTextures(i, False, True, True); 00215 } 00216 HideChildren(); 00217 SpeechChild = SpeechWindow(ParentWindow.CreateWindow(class'TargetChildWindow', 100, 100, 100, 100)); 00218 SpeechChild.CurrentType = i+2; 00219 TargetChildWindow(SpeechChild).Message = OtherOffset[i]; 00220 SpeechChild.FadeIn(); 00221 } 00222 } 00223 } 00224 if (B == TopButton) 00225 { 00226 if (NumOptions > 8) 00227 { 00228 if (OptionOffset > 0) 00229 OptionOffset--; 00230 } 00231 } 00232 if (B == BottomButton) 00233 { 00234 if (NumOptions > 8) 00235 { 00236 if (NumOptions - OptionOffset > 8) 00237 OptionOffset++; 00238 } 00239 } 00240 break; 00241 } 00242 } 00243 00244 function HideWindow() 00245 { 00246 Super.HideWindow(); 00247 00248 if (SpeechChild != None) 00249 SpeechChild.HideWindow(); 00250 } 00251 00252 defaultproperties 00253 { 00254 TopTexture=Texture'UTMenu.Skins.OrdersTop2' 00255 WindowTitle="" 00256 }