## XIDInterf
Class XIIIMenuProfileClient

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

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

Direct Known Subclasses:None

class XIIIMenuProfileClient
extends XIDInterf.XIIIWindow

    //===========================================================================
    // Player Configuration in multiplayer mode (both online and splited)
    //===========================================================================

Variables
`int` | `ControlOffset`
`string` | `GameType`
`MaxSkin,` | `OnTeam`
`XIIIButton` | `OptionsButton`
`TeamText,` | `OptionsText`
`color` | `PadColor`
`string` | `PlayerBaseClass`
`ClassCombo,` | `TeamCombo`
`bool` | `bOnline`
`Initialized,` | `bTeamGame`
`string` | `sBackground[4]`
`string` | `sHighlight`
`Texture` | `tBackGround[4]`
`Texture` | `tHighlight`

Function Summary
`void` | `Created()`
`void` | `InitComponent(GUIController pMyController, GUIComponent MyOwner)`
`bool` | `InternalOnKeyEvent(out byte, out byte, float delta)`
`void` | `LoadClasses()`
`void` | `MsgBoxBtnClicked(byte bButton)`
`void` | `NameChanged()`
    /*
`void` | `Paint(Canvas C, float X, float Y)`
`void` | `PaintGfxBackground(Canvas C, float X, float Y)`
`void` | `SaveConfigs()`
`void` | `ShowWindow()`
`void` | `StartPressed()`
`void` | `UseSelected()`
    {
         local string N;
         if (Initialized)
         {
              Initialized = False;
              N = NameEdit.GetValue();
              ReplaceText(N, " ", "_");
              NameEdit.SetValue(N);
              Initialized = True;

              GetPlayerOwner().ChangeName(NameEdit.GetValue());
              GetPlayerOwner().UpdateURL("Name", NameEdit.GetValue(), True);
         }
    }*/

Source Code

    00001	//===========================================================================
    00002	// Player Configuration in multiplayer mode (both online and splited)
    00003	//===========================================================================
    00004	class XIIIMenuProfileClient extends XIIIWindow;
    00005
    00006	// Game Information
    00007	var config string GameType;
    00008
    00009	// Player Name
    00010	//var UWindowEditControl NameEdit;
    00011	//var localized string NameText;
    00012
    00013	// Skin & Team
    00014	var XIIIComboControl ClassCombo, TeamCombo;
    00015
    00016	var XIIIButton OptionsButton;
    00017	var localized string ClassText, TeamText, OptionsText;
    00018	var string PlayerBaseClass;
    00019
    00020	var int ControlOffset;
    00021	var bool Initialized, bTeamGame;
    00022
    00023	var int OnSkin, MaxSkin, OnTeam;
    00024
    00025	var texture tHighlight;
    00026	var string sHighlight;
    00027
    00028	var color PadColor;
    00029
    00030	var texture tBackGround[4];
    00031	var string sBackground[4];
    00032
    00033	//var XIIIMenuSplitSetupClient PWin;
    00034	var bool bOnline;
    00035
    00036	function MsgBoxBtnClicked(byte bButton)
    00037	{
    00038	  switch (bButton)
    00039	  {
    00040	    case QBTN_Ok:
    00041	      //log("[XIIIMsgBox] Ok pressed");
    00042	      //xboxlive.ShutdownAndCleanup();
    00043	      //Controller.ReplaceMenu("XIDInterf.XIIIMenuLiveAccountWindow");
    00044	    break;
    00045	  }
    00046	  //log("msgbox clicked: "$bButton);
    00047	}
    00048
    00049	function InitComponent(GUIController pMyController, GUIComponent MyOwner)
    00050	{
    00051	  local int i;
    00052
    00053		Super.Initcomponent(pMyController, MyOwner);
    00054	  for (i=0; i<4; i++)
    00055	    tBackGround[i] = texture(DynamicLoadObject(sBackGround[i], class'Texture'));
    00056
    00057	  // Why do I have to set these? They are 0 at the moment. Only valid inside the render or what?
    00058	  fRatioX = 1.0;
    00059	  fRatioY = 1.0;
    00060	}
    00061
    00062	function Created()
    00063	{
    00064	     local float A;
    00065	     Super.Created();
    00066
    00067	     tHighlight = texture(DynamicLoadObject(sHighlight, class'Texture'));
    00068
    00069	     // Player Name
    00070	     ControlOffset += 50;
    00071	/*     NameEdit = UWindowEditControl(CreateControl(class'UWindowEditControl', CenterPos, ControlOffset, CenterWidth, 1));
    00072	     NameEdit.SetText(NameText);
    00073	     NameEdit.SetFont(F_Normal);
    00074	     NameEdit.SetNumericOnly(False);
    00075	     NameEdit.SetMaxLength(20);
    00076	     NameEdit.SetDelayedNotify(True);
    00077	     NameEdit.SetValue(GetPlayerOwner().PlayerReplicationInfo.PlayerName);
    00078	*/
    00079	     ControlOffset += 60;
    00080	     // Game Type
    00081	     ClassCombo = XIIIComboControl(CreateControl(class'XIIIComboControl', 70, ControlOffset, 500, 40));
    00082	     ClassCombo.Text = ClassText;
    00083	     ClassCombo.bArrows = true;
    00084	     LoadClasses();
    00085
    00086	     ControlOffset += 60;
    00087	     TeamCombo = XIIIComboControl(CreateControl(class'XIIIComboControl', 70, ControlOffset, 500, 40));
    00088	     TeamCombo.Text = TeamText;
    00089	     TeamCombo.bArrows = true;
    00090	     TeamCombo.AddItem("Red Team");//, String(0));
    00091	     TeamCombo.AddItem("Blue Team");//, String(1));
    00092	     TeamCombo.SetSelectedIndex(Max(GetPlayerOwner().PlayerReplicationInfo.Team.TeamIndex, 0));
    00093
    00094	     ControlOffset += 60;
    00095	     OptionsButton = XIIIbutton(CreateControl(class'XIIIbutton', 70, ControlOffset, 220, 40));
    00096	     OptionsButton.Text = OptionsText;
    00097	     OptionsButton.bUseBorder = true;
    00098
    00099	     Initialized = True;
    00100
    00101	     Controls[0] = ClassCombo; Controls[1] = TeamCombo; Controls[2] = OptionsButton;
    00102
    00103	     switch(int(right(string(GetPlayerOwner()), 1))%4)
    00104	     {
    00105	        case 1 : A = PadColor.R; PadColor.R = PadColor.G; PadColor.G = A; break;
    00106	        case 2 : A = PadColor.G; PadColor.G = PadColor.B; PadColor.B = A; break;
    00107	        case 3 : A = PadColor.R; PadColor.R = PadColor.B; PadColor.B = A; break;
    00108	     }
    00109	}
    00110
    00111
    00112	function LoadClasses()
    00113	{
    00114	    local int NumPlayerClasses;
    00115	    local string NextPlayer, NextDesc;
    00116	    local int SortWeight;
    00117
    00118	    GetPlayerOwner().GetNextIntDesc(PlayerBaseClass, 0, NextPlayer, NextDesc);
    00119	    while( (NextPlayer != "") && (NumPlayerClasses < 64) )
    00120	    {
    00121	        log("Loading..."$NextDesc$"  "$NextPlayer);
    00122	        ClassCombo.AddItem(NextDesc, NextPlayer);//, SortWeight);
    00123	        NumPlayerClasses++;
    00124	        GetPlayerOwner().GetNextIntDesc(PlayerBaseClass, NumPlayerClasses, NextPlayer, NextDesc);
    00125	    }
    00126	//    ClassCombo.Sort();
    00127	    MaxSkin = NumPlayerClasses;
    00128	//    log("CURRENT MESH: "$GetPlayerOwner().PawnClass);
    00129	    ClassCombo.SetSelectedIndex(ClassCombo.FindItemIndex(string(GetPlayerOwner().PawnClass), true));
    00130	}
    00131
    00132
    00133	function ShowWindow()
    00134	{
    00135	     Super.ShowWindow();
    00136	     bShowRUN = true;
    00137	     bTeamGame = myRoot.GetLevel().Game.bTeamGame;
    00138	     if (!bTeamGame) TeamCombo.bNeverFocus = true;
    00139	     GetPlayerOwner().MyHud.bHideHud = true;
    00140	}
    00141
    00142	function PaintGfxBackground(Canvas C, float X, float Y)
    00143	{
    00144	  local float W, H;
    00145	  local float MarginWidth, MarginHeight;
    00146
    00147	  W = WinWidth;
    00148	  H = WinHeight;
    00149
    00150	  if (W <= 1) W = W*640*fRatioX;
    00151	  if (H <= 1) H = H*480*fRatioY;
    00152
    00153	  C.DrawColor = WhiteColor;
    00154	  C.Style = 5;
    00155	  MarginWidth = 0;
    00156	  MarginHeight = 0;
    00157	  C.SetPos(MarginWidth/2, MarginHeight/2);
    00158	  C.DrawTileClipped( tBackGround[2], W-MarginWidth, H/2-MarginHeight/2, 0, 0, tBackGround[2].USize, tBackGround[2].VSize);
    00159	  C.SetPos(MarginWidth/2, H/2);
    00160	  C.DrawTileClipped( tBackGround[3], W-MarginWidth, H/2-MarginHeight/2, 0, 0, tBackGround[3].USize, tBackGround[3].VSize);
    00161	  C.bUseBorder = false;
    00162	  C.DrawColor = BlackColor;
    00163	}
    00164
    00165	function Paint(Canvas C, float X, float Y)
    00166	{
    00167	    super.Paint(C, X, Y);
    00168
    00169	    C.Style = 1;
    00170	    C.DrawColor = PadColor;
    00171	    DrawStretchedTexture(C, 0, 0, WinWidth*C.ClipX, WinHeight*C.ClipY, myRoot.FondMenu);
    00172	    PaintGfxBackground(C, X ,Y);
    00173	    C.DrawColor = WhiteColor;
    00174	    OnMenu = FindComponentIndex(FocusedControl);
    00175	    C.Style = 5;  C.DrawColor.A = 180;
    00176	    DrawStretchedTexture(C, 60*fRatioX, (145+OnMenu*60)*fRatioY, 515*fRatioX, 65*fRatioY, tHighlight);
    00177	    C.DrawColor.A = 255; C.Style = 1;
    00178	}
    00179
    00180
    00181	/*
    00182	function NameChanged()
    00183	{
    00184	     local string N;
    00185	     if (Initialized)
    00186	     {
    00187	          Initialized = False;
    00188	          N = NameEdit.GetValue();
    00189	          ReplaceText(N, " ", "_");
    00190	          NameEdit.SetValue(N);
    00191	          Initialized = True;
    00192
    00193	          GetPlayerOwner().ChangeName(NameEdit.GetValue());
    00194	          GetPlayerOwner().UpdateURL("Name", NameEdit.GetValue(), True);
    00195	     }
    00196	}*/
    00197
    00198
    00199	function UseSelected()
    00200	{
    00201	    local int NewTeam;
    00202
    00203	     if (Initialized)
    00204	     {
    00205	          //GetPlayerOwner().UpdateURL("Class", ClassCombo.GetValue2(), True);
    00206	          GetPlayerOwner().PawnClass = class<Pawn>(DynamicLoadObject(ClassCombo.GetValue2(), class'Class'));
    00207	          //if (xboxlive.IsLoggedIn(xboxlive.GetCurrentUser()))
    00208	          //  myRoot.GetLevel().Game.ChangeName(GetPlayerOwner(), xboxlive.GetCurrentUser(), false);
    00209	          //else
    00210	          myRoot.GetLevel().Game.ChangeName(GetPlayerOwner(), GetPlayerOwner().PawnClass.default.PawnName, false);
    00211	          log("ACt TEAM: "$GetPlayerOwner().PlayerReplicationInfo.Team.TeamIndex$" Wanted Team: "$TeamCombo.GetSelectedIndex());
    00212	//          GetPlayerOwner().UpdateURL("Team", string(TeamCombo.GetSelectedIndex()), True);
    00213	          NewTeam = TeamCombo.GetSelectedIndex();
    00214	//        if( GetPlayerOwner().PlayerReplicationInfo.Team.TeamIndex != NewTeam )
    00215	            GetPlayerOwner().ChangeTeam(NewTeam);
    00216	          log("Current Team: "$GetPlayerOwner().PlayerReplicationInfo.Team.TeamIndex);
    00217	     }
    00218	}
    00219
    00220
    00221	function StartPressed()
    00222	{
    00223	     local string URL, Checksum;
    00224
    00225	     UseSelected();
    00226
    00227	//     myRoot.b = true;
    00228	     myRoot.CloseAll(true);
    00229	     myRoot.GotoState('');
    00230	}
    00231
    00232
    00233	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
    00234	{
    00235	    if (State==1)// IST_Press // to avoid auto-repeat
    00236	    {
    00237	        if (Key==0x0D/*IK_Enter*/)
    00238		    {
    00239	            if (FocusedControl == OptionsButton)
    00240	            {
    00241	                myRoot.OpenMenu("XIDInterf.XIIIMultiControlsWindow");
    00242	            }
    00243	            else {
    00244	                UseSelected();
    00245
myRoot.bProfileMenu = false; 00246 myRoot.CloseAll(true); 00247 GetPlayerOwner().MyHud.bHideHud = false; 00248 myRoot.GotoState(''); 00249 } 00250 // Controller.FocusedControl.OnClick(Self); 00251 return true; 00252 } 00253 if (Key==0x08) // BackSpace 00254 { 00255 myRoot.bProfileMenu = false; 00256 myRoot.CloseAll(true); 00257 myRoot.GotoState(''); 00258 GetPlayerOwner().ClientTravel("MapMenu", TRAVEL_Absolute, false); 00259 myRoot.Master.GlobalInteractions[0].ViewportOwner.Actor.ConsoleCommand("SetViewPortNumberForNextMap 1"); 00260 return true; 00261 } 00262 if (Key==0x26/*IK_Up*/) 00263 { 00264 PrevControl(FocusedControl); 00265 return true; 00266 } 00267 if (Key==0x28/*IK_Down*/) 00268 { 00269 NextControl(FocusedControl); 00270 return true; 00271 } 00272 if ((Key==0x25/*IK_Left*/) || (Key==0x27/*IK_Right*/)) 00273 { 00274 if (FocusedControl == Controls[0]) 00275 { 00276 if (Key==0x25) OnSkin--; 00277 if (Key==0x27) OnSkin++; 00278 if (OnSkin < 0) OnSkin = 0; 00279 if (OnSkin > MaxSkin - 1) OnSkin = MaxSkin - 1; 00280 classCombo.SetSelectedIndex(OnSkin); 00281 } 00282 if (FocusedControl == Controls[1]) 00283 { 00284 if (Key==0x25) OnTeam--; 00285 if (Key==0x27) OnTeam++; 00286 OnTeam = abs(OnTeam%2); 00287 TeamCombo.SetSelectedIndex(OnTeam); 00288 } 00289 return true; 00290 } 00291 } 00292 return super.InternalOnKeyEvent(Key, state, delta); 00293 // return false; 00294 } 00295 00296 00297 function SaveConfigs() 00298 { 00299 // Super.SaveConfigs(); 00300 GetPlayerOwner().SaveConfig(); 00301 GetPlayerOwner().PlayerReplicationInfo.SaveConfig(); 00302 } 00303 00304 00305 00306 00307 00308 defaultproperties 00309 { 00310 ClassText="Player Class" 00311 TeamText="Team" 00312 OptionsText="OPTIONS" 00313 PlayerBaseClass="XIIIMP.XIIIMPPlayerPawn" 00314 controloffset=50 00315 sHighlight="XIIIMenuStart.barreselectmenuoptadv" 00316 PadColor=(B=143,G=120,R=93) 00317 bForceHelp=True 00318 Background=None 00319 bCheckResolution=True 00320 bRequire640x480=False 00321 bAllowedAsLast=True 00322 }

End Source Code