XIDInterf
Class XIIIConsole

source: C:\XIII\XIDInterf\Classes\XIIIConsole.uc
Core.Object
   |
   +--Engine.Interactions
      |
      +--Engine.Interaction
         |
         +--Engine.Console
            |
            +--XIDInterf.XIIIConsole
Direct Known Subclasses:None

class XIIIConsole
extends Engine.Console

//============================================================================ // The brain of the windowed system // Handles the opening/closing of UWindow, the input events, etc... //============================================================================
Variables
 Texture ConsoleBk
           MLK: True means no menu escape
 font ConsoleFont
           MLK: True means no menu escape
 BlackColor, DarkGoldColor
           MLK: True means no menu escape
 bool bMapMenu
           MLK: True means no menu escape
 XIIIQuickSLManager qsManager
           MLK: True means no menu escape

States
Typing

Function Summary
 void RestoreBriefing()
 void ShowBriefing()
     
//____________________________________________________________________
// MLK    Launch/Close the Briefing screen
 void ShowMainMenu(XIIIPlayerController myC)
     
// ========================
// To be deleted
// ========================
 void ShowTheMenu(XIIIPlayerController myC)
     
//____________________________________________________________________
// MLK    Launch/Close the Info Menu


State Typing Function Summary
 bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta)
 void PostRender(Canvas C)



Source Code


00001	//============================================================================
00002	// The brain of the windowed system
00003	// Handles the opening/closing of UWindow, the input events, etc...
00004	//============================================================================
00005	class XIIIConsole extends Console;
00006	
00007	var bool bMapMenu; // MLK: True means no menu escape
00008	
00009	var color GoldColor, BlackColor, DarkGoldColor;
00010	var font ConsoleFont;
00011	var texture ConsoleBk;
00012	VAR XIIIQuickSLManager qsManager;
00013	const ConsoleYOffset=4.0;
00014	
00015	
00016	//____________________________________________________________________
00017	// MLK    Launch/Close the Info Menu
00018	exec function ShowTheMenu(XIIIPlayerController myC)
00019	{
00020	     local XIIIRootWindow myRoot; // XIIIRootWindow
00021	     local controller P;
00022	     local int i, j;
00023	
00024	// DEBUG LOGGING
00025	     log("VPO: "$ViewportOwner);
00026	     log("myC: "$myC.Player);   // Replaces ViewportOwner in MP-Split games
00027	// END
00028	
00029	     myRoot = XIIIRootWindow(myC.Player.LocalInteractions[0]);
00030	     if (Left(ViewportOwner.Actor.Level.GetLocalURL(), 7) ~= "mapmenu")
00031	     {
00032	         bMapMenu = true;
00033	         myRoot.bIamInGame = false;
00034	         myRoot.bIamInMulti = false;
00035	        //ConsoleCommand("ExtendViewPortBeforeMenu");
00036			 if ( myRoot.IsInState( 'UWindows' ) )
00037				 myRoot.BeginState( );
00038			 else
00039		         myRoot.gotostate('UWindows');
00040	         return;
00041	     }
00042	     else
00043	     {
00044	         bMapMenu = false;
00045	         myRoot.gotostate('');
00046	         myRoot.bIamInGame = false;
00047	     }
00048	
00049	
00050	     if (!bMapMenu)
00051	     {
00052	          if (myC.Player.Actor.Level.bLonePlayer)
00053	          {
00054	               log("IN ShowInfo");
00055	               if (myRoot.bBriefing == false && XIIIGameInfo(myC.Player.Actor.Level.Game).MapInfo != none )
00056	               {
00057	                    log("NO BRIEFING");
00058	                    if (!myRoot.bIamInGame)//if (!myRoot.IsInState('UWindows'))
00059	                    {
00060	                        log("INGAME");
00061	                        myRoot.bIamInGame = true;
00062	                        myRoot.gotostate('UWindows');
00063	                    }
00064	                    else
00065	                    {
00066	                        myRoot.CloseAll(true);
00067	                        myRoot.gotostate('');
00068	                        myRoot.bIamInGame = false;
00069	                    }
00070	               }
00071	          }
00072	          else
00073	          {
00074	               if (!myRoot.IsInState('UWindows'))
00075	               {
00076	                    log("INMULTI");
00077	                    myRoot.bIamInMulti = true;
00078	                    if (XIIIRootWindow(ViewportOwner.LocalInteractions[0]).bProfileMenu)
00079	                        myRoot.bProfileMenu = true;
00080	//                ConsoleCommand("ExtendViewPortBeforeMenu");
00081	                    myRoot.gotostate('UWindows');
00082	               }
00083	               else
00084	               {
00085	                    if (!myRoot.bProfileMenu)
00086	                    {
00087	                        myRoot.CloseAll(true);
00088	                        myRoot.gotostate('');
00089	                        myRoot.bIamInMulti = false;
00090	                        for ( P=myRoot.GetLevel().ControllerList; P!=None; P=P.NextController )
00091	                        {
00092	                            if (XIIIRootWindow(PlayerController(P).Player.LocalInteractions[0]).bIamInMulti == true)
00093	                            myC.Player.Actor.SetPause( true );
00094	                        }
00095	//                 ConsoleCommand("RestoreViewPortAfterMenu");
00096	                   }
00097	               }
00098	          }
00099	     }
00100	}
00101	
00102	
00103	//____________________________________________________________________
00104	// MLK    Launch/Close the Briefing screen
00105	exec function ShowBriefing()
00106	{
00107	     local XIIIRootWindow myRoot;
00108	
00109	     myRoot = XIIIRootWindow(ViewportOwner.LocalInteractions[0]);
00110	     if (!myRoot.bBriefingDone)
00111	     {
00112	          myRoot.bBriefing = true;
00113	          myRoot.gotostate('UWindows');
00114	     }
00115	}
00116	
00117	exec function RestoreBriefing()
00118	{
00119	     local XIIIRootWindow myRoot;
00120	
00121	     myRoot = XIIIRootWindow(ViewportOwner.LocalInteractions[0]);
00122	     myRoot.bBriefingDone = false;
00123	}
00124	
00125	
00126	// ========================
00127	// To be deleted
00128	// ========================
00129	exec function ShowMainMenu(XIIIPlayerController myC)
00130	{
00131	     local XIIIRootWindow myRoot;
00132	
00133	     myRoot = XIIIRootWindow(myC.Player.LocalInteractions[0]);
00134	     if (Left(myRoot.GetLevel().GetLocalURL(), 7) != "mapmenu")
00135	     {
00136	     log("SHOWGAMEMENU");
00137	        myRoot.bIamInMulti = true;
00138	        myRoot.GotoState('UWindows');
00139	     }
00140	}
00141	
00142	state Typing
00143	{
00144	    function PostRender(Canvas C)
00145	    {
00146	      local float X,Y;
00147	      local string OutStr;
00148	
00149	      // Blank out a space
00150	
00151	      C.Font = ConsoleFont;
00152	      C.Style = 5; //ERenderStyle.STY_Alpha;
00153	      C.bCenter = true;
00154	      C.BorderColor = GoldColor;
00155	      C.BorderColor.A = 128;
00156	      C.bUseBorder = true;
00157	      OutStr = "[("@caps(TypedStr)$"_ )]";
00158	      C.Strlen(OutStr,X,Y);
00159	
00160	      C.SetPos( (C.ClipX-X)/2-4, C.ClipY - ConsoleYOffset - 4 - Y);
00161	      C.DrawColor = DarkGoldColor;
00162	      C.DrawColor.A = 180;
00163	      C.DrawTile( ConsoleBk, X+10, Y+4,0,0,ConsoleBk.USize,ConsoleBk.VSize);
00164	
00165	/*      C.SetPos(0,C.ClipY-8-yl);
00166	      C.SetDrawColor(0,255,0);
00167	      C.DrawTile( texture'ConsoleBdr', C.ClipX, 2,0,0,32,32); */
00168	
00169	//      C.SetPos( (C.ClipX-X)/2+2, C.ClipY - ConsoleYOffset - 3 - Y+2);
00170	      C.SetPos( 1, C.ClipY - ConsoleYOffset - 3 - Y+1);
00171	      C.DrawColor = BlackColor;
00172	      C.DrawText( OutStr, false );
00173	//      C.SetPos( (C.ClipX-X)/2, C.ClipY - ConsoleYOffset - 3 - Y);
00174	      C.SetPos( 0, C.ClipY - ConsoleYOffset - 3 - Y);
00175	      C.DrawColor = GoldColor;
00176	      C.DrawColor.A = 200;
00177	      C.DrawText( OutStr, false );
00178	      C.BorderColor = BlackColor;
00179	      C.bUseBorder = false;
00180	    }
00181	}
00182	
00183	function bool KeyEvent( EInputKey Key, EInputAction Action, FLOAT Delta )
00184	{
00185		if (Action==1)
00186		{
00187			if ( ViewportOwner.Actor.Level.bLonePlayer && !(ViewportOwner.Actor.Level.Title~="mapmenu") )
00188			{
00189				if ( Key==0x74/*IK_F5*/ )
00190				{
00191	                if ( ( qsManager==none || qsManager.bDeleteMe ) )
00192	                {
00193	                    qsManager = ViewportOwner.Actor.spawn( class'XIIIQuickSLManager', none );
00194	                    if ( qsManager != none )
00195	                    {
00196	                        ViewportOwner.Actor.ClientMessage(ViewportOwner.Actor.QuickSaveString);
00197							qsManager.MyConsole = self;
00198	                        qsManager.RequestQuickSave( );
00199	                    }
00200	                }
00201	 				return true;
00202				}
00203				else if (  Key==0x78/*IK_F9*/ && ( qsManager==none || qsManager.bDeleteMe ) )
00204				{
00205	                qsManager = ViewportOwner.Actor.spawn( class'XIIIQuickSLManager', none );
00206	                if ( qsManager != none )
00207					{
00208						qsManager.MyConsole = self;
00209	                    qsManager.RequestQuickLoad( );
00210					}
00211	 				return true;
00212				}
00213			}
00214		}
00215		return Super.KeyEvent( Key, Action, Delta );
00216	} 
00217	
00218	
00219	
00220	defaultproperties
00221	{
00222	     GoldColor=(B=200,G=255,R=255,A=255)
00223	     BlackColor=(A=255)
00224	     DarkGoldColor=(B=100,G=128,R=128,A=255)
00225	     ConsoleFont=Font'XIIIFonts.XIIIConsoleFont'
00226	     ConsoleBK=Texture'XIIIMenu.HUD.FondMsg'
00227	}

End Source Code