XIDInterf
Class XIIIMenuLiveJoinMsgBox

source: C:\XIII\XIDInterf\Classes\XIIIMenuLiveJoinMsgBox.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
               |
               +--XIDInterf.XIIIWindow
                  |
                  +--XIDInterf.XIIILiveWindow
                     |
                     +--XIDInterf.XIIILiveMsgBox
                        |
                        +--XIDInterf.XIIIMenuLiveJoinMsgBox
Direct Known Subclasses:None

class XIIIMenuLiveJoinMsgBox
extends XIDInterf.XIIILiveMsgBox

// ==================================================================== // (c) 2003 Ubi Soft. All Rights Reserved // ====================================================================
Variables
 ConnectingMsgBoxMenuTitle, ConnectingText
 float DelayToWait
 int MsgBoxStatus
 int ResultCode
 int ServerID
 string URL
 XboxLiveManager xboxlive

States
STA_JoinServer

Function Summary
 void InitComponent(GUIController pMyController, GUIComponent MyOwner)
 bool InternalOnKeyEvent(out byte, out byte, float delta)


State STA_JoinServer Function Summary



Source Code


00001	// ====================================================================
00002	//  (c) 2003 Ubi Soft.  All Rights Reserved
00003	// ====================================================================
00004	
00005	class XIIIMenuLiveJoinMsgBox extends XIIILiveMsgBox;
00006	
00007	
00008	var localized string ConnectingMsgBoxMenuTitle, ConnectingText;
00009	var int MsgBoxStatus;
00010	var float DelayToWait;
00011	
00012	var int ServerID;
00013	//var int GameServerPort;
00014	
00015	var XboxLiveManager xboxlive;
00016	var int ResultCode;
00017	
00018	var string URL;
00019	
00020	function InitComponent(GUIController pMyController, GUIComponent MyOwner)
00021	{
00022	    Super.InitComponent(pMyController, MyOwner);
00023	    if (xboxlive == none)
00024	      xboxlive=New Class'XboxLiveManager';
00025	}
00026	
00027	event HandleParameters(string Param1, string Param2)
00028	{
00029	    ServerID = int(Param1);
00030	    //log("Server ID = "$ServerID);
00031	}
00032	
00033	
00034	Delegate OnButtonClick(byte bButton)
00035	{
00036	    // cancel the pending level (cmd "CANCEL" to UGameEngine);
00037		GetPlayerOwner().ConsoleCommand("CANCEL");
00038	    if ((MsgBoxStatus == 0) || (MsgBoxStatus == 102) || (MsgBoxStatus == 103))
00039	    {
00040	        //myMMManager.LeaveGameServer();
00041	        //xboxlive.Reset
00042	        xboxlive.ResetVoiceNet();
00043	        xboxlive.SessionReset();
00044	    }
00045	}
00046	
00047	
00048	function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
00049	{
00050		local int index;
00051		local bool bLeft, bRight, bUp, bDown;
00052		
00053		if (State==1)// IST_Press // to avoid auto-repeat
00054	    {
00055	        //if ((Key==0x0D/*IK_Enter*/) || (Key==0x01)/*IK_LeftMouse*/)
00056		    //{
00057			//	return InternalOnClick(FocusedControl);
00058		    //}
00059		    /*else*/ if ((Key==0x08/*IK_Backspace*/)|| (Key==0x1B) /*IK_Escape*/)
00060		    {
00061		        myRoot.CloseMenu(true);
00062	    	    return true;
00063		    }
00064	    }
00065	    return super.InternalOnKeyEvent(Key, state, delta);
00066	}
00067	
00068	
00069	Delegate OnTick(float deltatime)
00070	{
00071	    local string ErrorMsg;
00072		local int i;
00073		local string MyClass, SkinCode;
00074	
00075	    if (MsgBoxStatus == 0)
00076	    {
00077	        // poll the connection status
00078	        MsgBoxStatus = MyRoot.GetConnectionStatus(ErrorMsg);
00079	        if (MsgBoxStatus != 0)
00080	        {
00081	            log("Error Msg = "$ErrorMsg);
00082	            UpdateTextDisplayed(ErrorMsg);
00083	            ShowWorking = false;
00084	            //myMMManager.LeaveGameServer();
00085	            xboxlive.ResetVoiceNet();
00086	            xboxlive.SessionReset();
00087	            MsgBoxStatus = 99;
00088	        }
00089	    }
00090	    else if (MsgBoxStatus == 99)
00091	    {
00092	        // nothing, just wait the user to cancel
00093	    }
00094	    else if (MsgBoxStatus == 100)
00095	    {
00096	        SetupQuestion(ConnectingText, QBTN_Cancel, QBTN_Cancel, "");//AJConnectingMsgBoxMenuTitle);
00097	        //myMMManager = new(none) class'MatchMakingManager';
00098	        MsgBoxStatus = 101;
00099	    }
00100	    else if (MsgBoxStatus == 101)
00101	    {
00102	        DelayToWait += deltatime;
00103	        if (DelayToWait > 1.0)
00104	        {
00105	            //GetPlayerOwner().ConsoleCommand("start"@GameServers[IndexOfServerToJoin].IpAddr$"?LAN");
00106	            GotoState('STA_JoinServer');
00107	            MsgBoxStatus = 102;
00108	        }
00109	    }
00110	    else if (MsgBoxStatus == 102)
00111	    {
00112	        // wait until GS grant join server
00113	    }
00114	    else if (MsgBoxStatus == 103)
00115	    {
00116	        //GetPlayerOwner().ConsoleCommand("start"@GameServerIP$":"$GameServerPort);
00117			// skin
00118			MyClass = GetPlayerOwner().GetDefaultURL("MySkin");
00119			SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[0].SkinCode;
00120			for (i=0;i<class'MeshSkinList'.default.MeshSkinListInfo.Length;i++)
00121			{
00122	  			if ( MyClass == class'MeshSkinList'.default.MeshSkinListInfo[i].SkinName )
00123	  			{
00124	  				SkinCode = class'MeshSkinList'.default.MeshSkinListInfo[i].SkinCode;
00125	  				break;
00126	  			}
00127			}
00128	
00129	        myRoot.bXboxStartup = true;
00130			 GetPlayerOwner().ConsoleCommand("start"@URL$"?SK="$SkinCode$"?GAMERTAG="$xboxlive.ConvertString(xboxlive.GetCurrentUser()));
00131	
00132	        MsgBoxStatus = 0;
00133	    }
00134	}
00135	
00136	Delegate OnClose(optional Bool bCanceled)
00137	{
00138	    if (MsgBoxStatus == 0)
00139	    {
00140	        // Connection is ok, the engine wants to close the menus before loading the map
00141	        myRoot.bProfileMenu = true;
00142	        myRoot.GotoState('');
00143	        // No need for myRoot.CloseAll() here because if this function is called, it is because the CloseAll() was called from the engine.
00144	        GetPlayerOwner().AttribPadToViewport();
00145	        Super.OnClose(bCanceled);
00146	    }
00147	    // in any other case, it is simply that the user wants to come back to close the messagebox by himself
00148	}
00149	
00150	
00151	
00152	State STA_JoinServer
00153	{
00154	
00155	Begin:
00156	  //myMMManager.JoinGameServer(ServerID, ""/*Password*/);
00157		//while ( !myMMManager.IsJoinGameServerAcknowledged(ResultCode, GameServerIP, GameServerAltIP, GameServerPort) )
00158		//{
00159		//	Sleep(0.1);
00160		//}
00161	
00162		//if (ResultCode != 0)
00163		//{
00164	  //      UpdateTextDisplayed(myMMManager.FailureMessages[ResultCode]);
00165	  //      ShowWorking = false;
00166	  //      MsgBoxStatus = 99;
00167		//}
00168	
00169	    MsgBoxStatus = 103;
00170	    GotoState('');
00171	}
00172	
00173	
00174	
00175	
00176	
00177	
00178	
00179	

End Source Code