## XIDInterf
Class XIIIMenuSkill

source: C:\XIII\XIDInterf\Classes\XIIIMenuSkill.uc

    Core.Object
       |
       +--GUI.GUI
          |
          +--GUI.GUIComponent
             |
             +--GUI.GUIMultiComponent
                |
                +--GUI.GUIPage
                   |
                   +--XIDInterf.XIIIWindow
                      |
                      +--XIDInterf.XIIIMenuSkill

Direct Known Subclasses:None

class XIIIMenuSkill
extends XIDInterf.XIIIWindow

    //============================================================================
    // Save Game menu.
    //
    //============================================================================

Variables
`string` | `Description`
`Doc11Button,` | `Doc12Button`
`Doc11Label,` | `Doc12Label`
`Doc11Text,` | `Doc12Text,ServiceText`
`Doc7LabText,` | `Doc8LabText`
`int` | `IsEmpty`
`int` | `MaxSlots`
`sBackPlane[4],` | `MessageText`
`Hour,` | `Min`
`int` | `MyLastSlot`
`int` | `MyLastTime`
`int` | `NbMap`
`int` | `ReturnCode`
`int` | `Time`
`int` | `Year`
`int` | `i`
`tHighlight[20],` | `tBackPlane[4]`

Function Summary
`void` | `AfterPaint(Canvas C, float X, float Y)`
    //============================================================================
`void` | `Created()`
    //============================================================================
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
    //============================================================================
`void` | `Paint(Canvas C, float X, float Y)`
    //============================================================================
`void` | `ShowWindow()`
    //============================================================================

Source Code

    00001	//============================================================================
    00002	// Save Game menu.
    00003	//
    00004	//============================================================================
    00005	class XIIIMenuSkill extends XIIIWindow;
    00006
    00007
    00008	var XIIIButton Doc1Button, Doc2Button, Doc3Button, Doc4Button, Doc5Button, Doc6Button, Doc7Button, Doc8Button, Doc9Button, Doc10Button, Doc11Button, Doc12Button;
    00009	var XIIILabel Doc1Label, Doc2Label, Doc3Label, Doc4Label, Doc5Label, Doc6Label, Doc7Label, Doc8Label, Doc9Label, Doc10Label, Doc11Label, Doc12Label;
    00010	var  localized string TitleText, Doc1Text, Doc2Text, Doc3Text, Doc4Text, Doc5Text, Doc6Text, Doc7Text, Doc8Text, Doc9Text, Doc10Text, Doc11Text, Doc12Text,ServiceText;
    00011	var  localized string Doc1LabText, Doc2LabText, Doc3LabText, Doc4LabText, Doc5LabText, Doc6LabText, Doc7LabText, Doc8LabText;
    00012
    00013	var texture tBackGround[20], tHighlight[20], tBackPlane[4];
    00014	var string sBackGround[20], sHighlight[20], sBackPlane[4], MessageText;
    00015
    00016	var int MaxSlots;
    00017	var int ReturnCode;
    00018	var int IsEmpty;
    00019	var int i;
    00020	var int Year;
    00021	var byte Month, Day, Hour, Min;
    00022
    00023	var string Description;
    00024
    00025	var int Time;
    00026	var int MyLastTime;
    00027	var int MyLastSlot;
    00028	var int NbMap;
    00029
    00030
    00031	//============================================================================
    00032	function Created()
    00033	{
    00034	    local int i;
    00035
    00036	    Super.Created();
    00037
    00038	    for (i=0; i<4; i++)
    00039	    {
    00040	        tBackPlane[i] = texture(DynamicLoadObject(sBackPlane[i], class'Texture'));
    00041	    }
    00042
    00043	    for (i=0; i<20; i++)
    00044	    {
    00045	        tHighlight[i] = texture(DynamicLoadObject(sHighlight[i], class'Texture'));
    00046	        //tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00047	    }
    00048
    00049
    00050	    Doc1Button = XIIIButton(CreateControl(class'XIIIButton', 35, 125*fScaleTo, 140, 22*fScaleTo));
    00051	    Doc1Button.Text = Doc1Text;
    00052	    Doc1Button.bUseBorder=false;
    00053
    00054	    Doc2Button = XIIIButton(CreateControl(class'XIIIButton', 35, 150*fScaleTo, 140, 22*fScaleTo));
    00055	    Doc2Button.Text = Doc2Text;
    00056	    Doc2Button.bUseBorder=false;
    00057
    00058	    Doc3Button = XIIIButton(CreateControl(class'XIIIButton', 35, 175*fScaleTo, 140, 22*fScaleTo));
    00059	    Doc3Button.Text = Doc3Text;
    00060	    Doc3Button.bUseBorder=false;
    00061
    00062	    Doc4Button = XIIIButton(CreateControl(class'XIIIButton', 35, 200*fScaleTo, 140, 22*fScaleTo));
    00063	    Doc4Button.Text = Doc4Text;
    00064	    Doc4Button.bUseBorder=false;
    00065
    00066	    Doc5Button = XIIIButton(CreateControl(class'XIIIButton', 35, 225*fScaleTo, 140, 22*fScaleTo));
    00067	    Doc5Button.Text = Doc5Text;
    00068	    Doc5Button.bUseBorder=false;
    00069
    00070	    Doc6Button = XIIIButton(CreateControl(class'XIIIButton', 35, 250*fScaleTo, 140, 22*fScaleTo));
    00071	    Doc6Button.Text = Doc6Text;
    00072	    Doc6Button.bUseBorder=false;
    00073
    00074	    Doc7Button = XIIIButton(CreateControl(class'XIIIButton', 35, 275*fScaleTo, 140, 22*fScaleTo));
    00075	    Doc7Button.Text = Doc7Text;
    00076	    Doc7Button.bUseBorder=false;
    00077
    00078	    Doc8Button = XIIIButton(CreateControl(class'XIIIButton', 35, 300*fScaleTo, 140, 22*fScaleTo));
    00079	    Doc8Button.Text = Doc8Text;
    00080	    Doc8Button.bUseBorder=false;
    00081
    00082
    00083	    Controls[0]=Doc1Button;
    00084	    Controls[1]=Doc2Button;
    00085	    Controls[2]=Doc3Button;
    00086	    Controls[3]=Doc4Button;
    00087	    Controls[4]=Doc5Button;
    00088	    Controls[5]=Doc6Button;
    00089	    Controls[6]=Doc7Button;
    00090	    Controls[7]=Doc8Button;
    00091
    00092	    InitLabel(Doc1Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc1LabText);
    00093	    InitLabel(Doc2Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc2LabText);
    00094	    InitLabel(Doc3Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc3LabText);
    00095	    InitLabel(Doc4Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc4LabText);
    00096	    InitLabel(Doc5Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc5LabText);
    00097	    InitLabel(Doc6Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc6LabText);
    00098	    InitLabel(Doc7Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc7LabText);
    00099	    InitLabel(Doc8Label, 30, 350*fScaleTo, 580, 80*fScaleTo, Doc8LabText);
    00100
    00101	sBackGround[0]=Doc1LabText;
    00102	sBackGround[1]=Doc2LabText;
    00103	sBackGround[2]=Doc3LabText;
    00104	sBackGround[3]=Doc4LabText;
    00105	sBackGround[4]=Doc5LabText;
    00106	sBackGround[5]=Doc6LabText;
    00107	sBackGround[6]=Doc7LabText;
    00108	sBackGround[7]=Doc8LabText;
    00109
    00110	}
    00111
    00112
    00113	//============================================================================
    00114	function ShowWindow()
    00115	{
    00116	    Super.ShowWindow();
    00117	    bShowBCK = true;
    00118	    //bShowSEL = true;
    00119	}
    00120
    00121
    00122	//============================================================================
    00123	function Paint(Canvas C, float X, float Y)
    00124	{
    00125		local float fScale, fHeight, W, H;
    00126		local int i, j, k;
    00127
    00128
    00129		local array<string> MsgArray;
    00130		local int v;
    00131		local int Length;
    00132		local int TextWith;
    00133
    00134
    00135	        super.paint(C,X,Y);
    00136
    00137		// big black border behind documents
    00138		 C.bUseBorder = true;
    00139		 DrawStretchedTexture(C, 30*fRatioX, 350*fRatioY*fscaleto, 580*fRatioX, 80*fRatioY*fscaleto, myRoot.FondMenu);
    00140
    00141		 DrawStretchedTexture(C, 30*fRatioX, 120*fRatioY*fscaleto, 150*fRatioX, 220*fRatioY*fscaleto, myRoot.FondMenu);
    00142
    00143		 //thin line under service record
    00144		 DrawStretchedTexture(C, 200*fRatioX, 172*fRatioY, 410*fRatioX, 1*fRatioY, myRoot.FondMenu);
    00145
    00146
    00147		// image backrgound
    00148		 C.bUseBorder = false;
    00149		 DrawStretchedTexture(C, 200*fRatioX, 35*fRatioY, 130*fRatioX, 130*fRatioY, tBackPlane[0]);
    00150		 DrawStretchedTexture(C, 200*fRatioX, 180*fRatioY, 260*fRatioX, 140*fRatioY, tBackPlane[1]);
    00151		 DrawStretchedTexture(C, 470*fRatioX, 180*fRatioY, 140*fRatioX, 140*fRatioY, tBackPlane[2]);
    00152
    00153		 C.bUseBorder = false;
    00154		 //DrawStretchedTexture(C, 400*fRatioX, 140*fRatioY, 140*fRatioX, 32*fRatioY, myRoot.FondMenu);
    00155		 C.TextSize(Caps(ServiceText), W, H);
    00156		 C.DrawColor = BlackColor;
    00157		 C.SetPos((400 + (140-W)/2)*fRatioX, (140+(32-H)/2)*fRatioY); C.DrawText(Caps(ServiceText), false);
    00158		 C.bUseBorder = false;
    00159		 C.DrawColor = WhiteColor;
    00160
    00161		// image behind title
    00162		//DrawStretchedTexture(C, 40*fRatioX, 36*fRatioY, 180*fRatioX, 100*fRatioY, tBackGround[0]);
    00163
    00164		for (j=0; j<4; j++)
    00165	        {
    00166			for (i=0; i<5; i++)
    00167	    		{
    00168		 		if (tBackGround[k] != none)
    00169					DrawStretchedTexture(C, (i*77+128)*fRatioX, (j*100+44)*fRatioY, 63*fRatioX, 64*fRatioY, tBackGround[k]);
    00170				k++;
    00171			}
    00172			i=0;
    00173		}
    00174
    00175		 // Title
    00176		 C.bUseBorder = true;
    00177		 DrawStretchedTexture(C, 30*fRatioX, 40*fRatioY*fScaleTo, 140*fRatioX, 32*fRatioY*fScaleTo, myRoot.FondMenu);
    00178		 C.TextSize(TitleText, W, H);
    00179		 C.DrawColor = BlackColor;
    00180		 C.SetPos((30*fRatioX + (140*fRatioX-W)/2), (40*fRatioY+(32*fRatioY-H)/2)*fscaleto); C.DrawText(TitleText, false);
    00181		 C.bUseBorder = false;
    00182		 C.DrawColor = WhiteColor;
    00183
    00184
    00185
    00186
    00187
    00188
    00189		// only selected control has a border
    00190	    for (i=0; i<8; i++)
    00191	        XIIIButton(Controls[i]).bUseBorder = false;
    00192	    if (FindComponentIndex(FocusedControl)!= -1)
    00193	        XIIIButton(Controls[FindComponentIndex(FocusedControl)]).bUseBorder = true;
    00194
    00195		TextWith = 540*fRatioX;
    00196		C.DrawColor = BlackColor;
    00197		MessageText=sBackGround[FindComponentIndex(FocusedControl)];
    00198		C.WrapStringToArray(MessageText, MsgArray, TextWith, "|");
    00199		//log("messagetext = "$messagetext);
    00200		Length = MsgArray.Length;
    00201	 	if (Length > 1)
    00202		{
    00203			for(v=0;v<Length;v++)
    00204			{
    00205				C.TextSize(MsgArray[v], W, H);
    00206				C.SetPos(50*fRatioX, 360*fRatioY*fscaleto + (H*v*fRatioY)*fscaleto);
    00207				C.DrawText(MsgArray[v], false);
    00208			}
    00209		}
    00210		else
    00211		{
    00212			C.TextSize(MsgArray[v], W, H);
    00213			C.SetPos(50*fRatioX, 350*fRatioY*fscaleto + (H*fRatioY)*fscaleto);
    00214			C.DrawText(MsgArray[v], false);
    00215
    00216		}
    00217
    00218		 C.DrawColor = WhiteColor;
    00219
    00220
    00221	}
    00222	/*
    00223	//============================================================================
    00224	function AfterPaint(Canvas C, float X, float Y)
    00225	{
    00226	    local float zoom;
    00227	    local int index;
    00228
    00229	    Super.AfterPaint(C, X, Y);
    00230
    00231	    C.Style = 5;
    00232
    00233	    index = FindComponentIndex(FocusedControl);
    00234	    switch (index)
    00235		{
    00236		case 0 :
    00237	        	DrawLabel(C, Doc1Label);
    00238		break;
    00239		case 1 :
    00240	        	DrawLabel(C, Doc2Label);
    00241		break;
    00242		case 2 :
    00243	        	DrawLabel(C, Doc3Label);
    00244		break;
    00245
case 3 : 00246 DrawLabel(C, Doc4Label); 00247 break; 00248 case 4 : 00249 DrawLabel(C, Doc5Label); 00250 break; 00251 case 5 : 00252 DrawLabel(C, Doc6Label); 00253 break; 00254 case 6 : 00255 DrawLabel(C, Doc7Label); 00256 break; 00257 case 7 : 00258 DrawLabel(C, Doc8Label); 00259 break; 00260 } 00261 00262 C.Style = 1; 00263 }*/ 00264 //============================================================================ 00265 function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) 00266 { 00267 local int index; 00268 local bool bLeft, bRight, bUp, bDown; 00269 00270 if (State==1)// IST_Press // to avoid auto-repeat 00271 { 00272 if ((Key==0x08/*IK_Escape*/) || (Key==0x1B)) 00273 { 00274 myRoot.CloseMenu(true); 00275 return true; 00276 log("conspiracy closed"); 00277 } 00278 00279 bUp = (Key==0x26); 00280 bDown = (Key==0x28); 00281 bLeft = (Key==0x25); 00282 bRight = (Key==0x27); 00283 if ( bUp || bDown || bLeft || bRight ) 00284 { 00285 index = FindComponentIndex(FocusedControl); 00286 switch (index) 00287 { 00288 case 0 : 00289 if ( bDown) Controls[1].FocusFirst(Self,false); 00290 if ( bUp ) Controls[7].FocusFirst(Self,false); 00291 break; 00292 case 1 : 00293 if ( bDown ) Controls[2].FocusFirst(Self,false); 00294 if ( bUp ) Controls[0].FocusFirst(Self,false); 00295 break; 00296 case 2 : 00297 if ( bDown) Controls[3].FocusFirst(Self,false); 00298 if ( bUp ) Controls[1].FocusFirst(Self,false); 00299 break; 00300 case 3 : 00301 if ( bDown) Controls[4].FocusFirst(Self,false); 00302 if ( bUp ) Controls[2].FocusFirst(Self,false); 00303 break; 00304 case 4 : 00305 if ( bUp ) Controls[3].FocusFirst(Self,false); 00306 if ( bDown) Controls[5].FocusFirst(Self,false); 00307 break; 00308 case 5 : 00309 if ( bUp ) Controls[4].FocusFirst(Self,false); 00310 if ( bDown) Controls[6].FocusFirst(Self,false); 00311 break; 00312 case 6 : 00313 if ( bUp ) Controls[5].FocusFirst(Self,false); 00314 if ( bDown) Controls[7].FocusFirst(Self,false); 00315 break; 00316 case 7 : 00317 if ( bUp ) Controls[6].FocusFirst(Self,false); 00318 if ( bDown) Controls[0].FocusFirst(Self,false); 00319 break; 00320 } 00321 return true; 00322 } 00323 00324 } 00325 return super.InternalOnKeyEvent(Key, state, delta); 00326 } 00327 00328 00329 00330 event HandleParameters(string Param1, string Param2) 00331 { 00332 // interpret info at page load 00333 // how many maps have we been through 00334 Description = Param1; 00335 log("Param1="$Description); 00336 if (Description=="Brighton Beach 1") 00337 NbMap=0; 00338 if (Description=="Brighton Beach 2") 00339 NbMap=1; 00340 if (Description=="Winslow Bank") 00341 NbMap=2; 00342 if (Description=="FBI") 00343 NbMap=3; 00344 if (Description=="Major Jones") 00345 NbMap=4; 00346 if (Description=="Emerald Base bridge") 00347 NbMap=5; 00348 if (Description=="Emerald Base roof") 00349 NbMap=6; 00350 if (Description=="Carrington's cell") 00351 NbMap=7; 00352 if (Description=="Cable car station") 00353 NbMap=8; 00354 if (Description=="Cable car") 00355 NbMap=9; 00356 if (Description=="Kellownee Lake") 00357 NbMap=10; 00358 if (Description=="Kellownee hideout") 00359 NbMap=11; 00360 if (Description=="Plain Rock 1") 00361 NbMap=12; 00362 if (Description=="Doc Johansson") 00363 NbMap=13; 00364 if (Description=="Canyon 1") 00365 NbMap=14; 00366 if (Description=="Canyon 2") 00367 NbMap=15; 00368 if (Description=="Sewage") 00369 NbMap=16; 00370 if (Description=="SPADS camp 1") 00371 NbMap=17; 00372 if (Description=="McCall") 00373 NbMap=18; 00374 if (Description=="Submarine base") 00375 NbMap=19; 00376 if (Description=="Submarine 1") 00377 NbMap=20; 00378 if (Description=="Submarine 2") 00379 NbMap=21; 00380 if (Description=="Sabotage") 00381 NbMap=22; 00382 if (Description=="Quay 33") 00383 NbMap=23; 00384 if (Description=="Bristol Suites Hotel") 00385 NbMap=24; 00386 if (Description=="Sanctuary Garden") 00387 NbMap=25; 00388 if (Description=="Sanctuary hall") 00389 NbMap=26; 00390 if (Description=="Sanctuary crypt") 00391 NbMap=27; 00392 if (Description=="Sanctuary cliff") 00393 NbMap=28; 00394 if (Description=="SSH101a") 00395 NbMap=29; 00396 if (Description=="SSH101b") 00397 NbMap=30; 00398 if (Description=="SSH101c") 00399 NbMap=31; 00400 if (Description=="SSH102b") 00401 NbMap=32; 00402 if (Description=="Bateau01") 00403 NbMap=33; 00404 if (Description=="Bove President") 00405 NbMap=0; 00406 else 00407 NbMap=0; 00408 log("NbMap = "$NbMap); 00409 00410 00411 } 00412 00413 00414 00415 //============================================================================ 00416 00417 00418 defaultproperties 00419 { 00420 TitleText="Skills" 00421 Doc1Text="Stunning skill" 00422 Doc2Text="Sixth sense" 00423 Doc3Text="Silent walk" 00424 Doc4Text="Breathing skill" 00425 Doc5Text="First aid" 00426 Doc6Text="Dual weapon" 00427 Doc7Text="Lock pick" 00428 Doc8Text="Sniper skill" 00429 ServiceText="Service Record" 00430 Doc1LabText="I can use any object as a weapon to stun my enemies" 00431 Doc2LabText="I can see the danger surrounding me" 00432 Doc3LabText="I do not make any noise when I move slowly" 00433 Doc4LabText="I can hold my breath for a longer period of time" 00434 Doc5LabText="I get back more life when I cure myself" 00435 Doc6LabText="I can hold two handguns guns at once, either Beretta or Uzi" 00436 Doc7LabText="I can lock pick closed door, Sam Fisher style" 00437 Doc8LabText="My sniping hability is improved, my moves are more assured" 00438 sBackPlane(0)="XIIIMenuStart.conspi.skill.spadslogo" 00439 sBackPlane(1)="XIIIMenuStart.conspi.skill.Info" 00440 sBackPlane(2)="XIIIMenuStart.conspi.skill.xiiiphoto" 00441 sBackPlane(3)="XIIIMenuStart.conspi.galerieportraits4" 00442 }

End Source Code