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