XIDInterf
Class XIIIMenuMultiBase

source: C:\XIII\XIDInterf\Classes\XIIIMenuMultiBase.uc
Core.Object
   |
   +--GUI.GUI
      |
      +--GUI.GUIComponent
         |
         +--GUI.GUIMultiComponent
            |
            +--GUI.GUIPage
               |
               +--XIDInterf.XIIIWindow
                  |
                  +--XIDInterf.XIIIWindowMainMenu
                     |
                     +--XIDInterf.XIIIMenuMultiBase
Direct Known Subclasses:XIIIMenuBotsSetupClient, XIIIMenuMultiGSBase, XIIIMenuMultiLANHost, XIIIMenuMultiLANJoin, XIIIMenuMultiProfile, XIIIMenuPlayersSetupClient, XIIIMenuSplitSetupClient, XIIIMenuBotChallengeSetupClient

class XIIIMenuMultiBase
extends XIDInterf.XIIIWindowMainMenu

//============================================================================ // UbiSoft's Game Service menu. // //============================================================================
Variables
 ARRAY DMOnly
 MapsList, DescList
 string GameTypeText[NbGameType]
 MaxAllMaps, MaxMaps
 PrefixText[NbGameType], MutatorText[NbGameType]
 GameMapsIndex, NbPlayers
 DefaultGameTypeValue[NbGameType], PointsLimitFactor[NbGameType]
 BOOL bUseDefaultBackground
 tBackground03, tBackground04


Function Summary
 bool CanBePlayedOnThisPlateform(int AbsoluteMapIndex)
 void Created()
     
{
	LOCAL int LBracketIndex, RBracketIndex;
	LBracketIndex = InStr( strVar, "[" );
	RBracketIndex = InStr( strVar, "[" );
	if ( LBracketIndex==0 && RBracketIndex!=-1 )
		return Mid( strVar, RBracketIndex+1 );
	else
		return strVar;
}
*/
 int GetDefaultGameTypeValue(int AllowedIndex)
 string GetGameInfoText(int AllowedIndex)
 string GetGameTypeText(int AllowedIndex)
 string GetMutatorText(int AllowedIndex)
 int GetPointsLimitFactor(int AllowedIndex)
 string GetPrefixText(int AllowedIndex)
 bool HasFriendlyFire(int AllowedIndex)
 bool HasTimeAndFragLimits(int AllowedIndex)
 bool IsDeathMatch(int AllowedIndex)
 bool IsTeamDeathMatch(int AllowedIndex)
 bool MapPrefixMatch(int AbsoluteMapIndex, string Prefix)
 void Paint(Canvas C, float X, float Y)
     
//============================================================================
 string SkipSquareBrackets(string strVar)
     
/*
 string Spaces2Underscores(string strVar)
 string Underscores2Spaces(string strVar)



Source Code


00001	//============================================================================
00002	// UbiSoft's Game Service menu.
00003	//
00004	//============================================================================
00005	class XIIIMenuMultiBase extends XIIIWindowMainMenu;
00006	
00007	VAR texture tBackground01, tBackground02, tBackground03, tBackground04;
00008	CONST NbGameType=6;
00009	VAR BOOL bUseDefaultBackground;
00010	VAR localized string GameTypeText[NbGameType];
00011	VAR string GameInfoText[NbGameType], PrefixText[NbGameType], MutatorText[NbGameType];
00012	VAR int DefaultGameTypeValue[NbGameType], PointsLimitFactor[NbGameType];
00013	VAR ARRAY<int> AllowedGameTypeIndex, GameMapsIndex, NbPlayers;
00014	VAR int MaxAllMaps, MaxMaps;
00015	VAR Array<string> MapsList, DescList;
00016	VAR ARRAY<byte> DMOnly;
00017	
00018	CONST DeathmatchIndex = 0;
00019	CONST TeamDeathmatchIndex = 1;
00020	CONST CaptureTheFlagIndex = 2;
00021	CONST TheHuntIndex = 3;
00022	CONST SabotageIndex = 4;
00023	CONST PowerUpIndex = 5;
00024	
00025	//============================================================================
00026	
00027	FUNCTION Paint(Canvas C, float X, float Y)
00028	{
00029		Super.Paint(C,X,Y);
00030	
00031		if ( bUseDefaultBackground )
00032		{
00033			DrawStretchedTexture(C, 28*fRatioX, 28*fScaleTo*fRatioY, 584*fRatioX, 406*fRatioY*fScaleTo, myRoot.tFondNoir);
00034	
00035			DrawStretchedTexture(C,  30*fRatioX,  30*fScaleTo*fRatioY, 290*fRatioX, 201*fScaleTo*fRatioY, tBackGround01);
00036			DrawStretchedTexture(C, 320*fRatioX,  30*fScaleTo*fRatioY, 290*fRatioX, 201*fScaleTo*fRatioY, tBackGround02);
00037			DrawStretchedTexture(C,  30*fRatioX, 231*fScaleTo*fRatioY, 290*fRatioX, 201*fScaleTo*fRatioY, tBackGround03);
00038			DrawStretchedTexture(C, 320*fRatioX, 231*fScaleTo*fRatioY, 290*fRatioX, 201*fScaleTo*fRatioY, tBackGround04);
00039		}
00040	}
00041	
00042	FUNCTION string GetGameTypeText( int AllowedIndex )
00043	{
00044		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00045			return GameTypeText[ AllowedGameTypeIndex[ AllowedIndex ] ] ;
00046		else
00047			return "Invalid GameType" ;
00048	}
00049	
00050	FUNCTION string GetGameInfoText( int AllowedIndex )
00051	{
00052		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00053			return GameInfoText[ AllowedGameTypeIndex[ AllowedIndex ] ] ;
00054		else
00055			return "" ;
00056	}
00057	
00058	FUNCTION string GetPrefixText( int AllowedIndex )
00059	{
00060		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00061			return PrefixText[ AllowedGameTypeIndex[ AllowedIndex ] ] ;
00062		else
00063			return "" ;
00064	}
00065	
00066	FUNCTION string GetMutatorText( int AllowedIndex )
00067	{
00068		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00069			return MutatorText[ AllowedGameTypeIndex[ AllowedIndex ] ] ;
00070		else
00071			return "" ;
00072	}
00073	
00074	FUNCTION bool IsDeathMatch( int AllowedIndex )
00075	{
00076		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00077			return ( AllowedGameTypeIndex[ AllowedIndex ] == DeathmatchIndex ) ;
00078		else
00079			return false ;
00080	}
00081	
00082	FUNCTION bool IsTeamDeathMatch( int AllowedIndex )
00083	{
00084		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00085			return ( AllowedGameTypeIndex[ AllowedIndex ] == TeamDeathmatchIndex ) ;
00086		else
00087			return false ;
00088	}
00089	
00090	FUNCTION bool HasFriendlyFire( int AllowedIndex )
00091	{
00092		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00093			return ( AllowedGameTypeIndex[ AllowedIndex ] == TeamDeathmatchIndex )
00094				|| ( AllowedGameTypeIndex[ AllowedIndex ] == CaptureTheFlagIndex )
00095				|| ( AllowedGameTypeIndex[ AllowedIndex ] == SabotageIndex );
00096		else
00097			return false ;
00098	}
00099	
00100	FUNCTION bool HasTimeAndFragLimits( int AllowedIndex )
00101	{
00102		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00103			return ( AllowedGameTypeIndex[ AllowedIndex ] != SabotageIndex );
00104		else
00105			return false ;
00106	}
00107	
00108	FUNCTION string Underscores2Spaces( string strVar )
00109	{
00110		LOCAL string strResult, strCar;
00111		LOCAL int i;
00112	
00113		for ( i = 0; i < len( strVar ); i++ )
00114		{
00115			strCar = Mid( strVar, i, 1 );
00116			if ( strCar=="_" )
00117				strResult = strResult $ " ";
00118			else
00119				strResult = strResult $ strCar;
00120				
00121		}
00122		return strResult;
00123	}
00124	
00125	FUNCTION string Spaces2Underscores( string strVar )
00126	{
00127		LOCAL string strResult, strCar;
00128		LOCAL int i;
00129	
00130		for ( i = 0; i < len( strVar ); i++ )
00131		{
00132			strCar = Mid( strVar, i, 1 );
00133			if ( strCar==" " )
00134				strResult = strResult $ "_";
00135			else
00136				strResult = strResult $ strCar;
00137				
00138		}
00139		return strResult;
00140	}
00141	/*
00142	FUNCTION string SkipSquareBrackets( string strVar )
00143	{
00144		LOCAL int LBracketIndex, RBracketIndex;
00145		LBracketIndex = InStr( strVar, "[" );
00146		RBracketIndex = InStr( strVar, "[" );
00147		if ( LBracketIndex==0 && RBracketIndex!=-1 )
00148			return Mid( strVar, RBracketIndex+1 );
00149		else
00150			return strVar;
00151	}
00152	*/
00153	FUNCTION Created()
00154	{
00155		LOCAL int i;
00156	
00157		SUPER.Created();
00158	
00159		// real names of maps
00160		MaxAllMaps = class'MapList'.default.MapListInfo.Length;
00161	
00162		if ( MaxAllMaps > 0 )
00163		{
00164			for (i=0; i<MaxAllMaps; i++)
00165			{
00166				if	( CanBePlayedOnThisPlateform(i) )
00167				{
00168					if ( myRoot.CurrentPF == 0 )
00169					{
00170						DescList[DescList.Length] = class'MapList'.default.MapListInfo[i].MapReadableName;
00171					}
00172					else
00173					{
00174						if (( myRoot.CurrentPF == 1 ) && ( class'MapList'.default.MapListInfo[i].NbPlayers > 6 ))
00175							DescList[DescList.Length] = "[6] "$class'MapList'.default.MapListInfo[i].MapReadableName;
00176						else
00177							DescList[DescList.Length] = "["$class'MapList'.default.MapListInfo[i].NbPlayers$"] "$class'MapList'.default.MapListInfo[i].MapReadableName;
00178					}
00179					MapsList[MapsList.Length] = class'MapList'.default.MapListInfo[i].MapUnrName;
00180					NbPlayers[NbPlayers.Length] = class'MapList'.default.MapListInfo[i].NbPlayers;
00181					if ( class'MapList'.default.MapListInfo[i].bDeathMatchOnly )
00182						DMOnly[DMOnly.Length]=1;
00183					else
00184						DMOnly[DMOnly.Length]=0;
00185				}
00186			}
00187		}
00188	
00189		MaxAllMaps = MapsList.Length;
00190	}
00191	
00192	FUNCTION bool CanBePlayedOnThisPlateform( int AbsoluteMapIndex )
00193	{
00194		return 
00195			( myRoot.CurrentPF == 0 && class'MapList'.default.MapListInfo[AbsoluteMapIndex].bOnPC ) 
00196		||	( myRoot.CurrentPF == 1 && class'MapList'.default.MapListInfo[AbsoluteMapIndex].bOnPS2 )
00197		||	( myRoot.CurrentPF == 2 && class'MapList'.default.MapListInfo[AbsoluteMapIndex].bOnXBOX )
00198		||	( myRoot.CurrentPF == 3 && class'MapList'.default.MapListInfo[AbsoluteMapIndex].bOnCube );
00199	}
00200	
00201	FUNCTION bool MapPrefixMatch( int AbsoluteMapIndex, string Prefix )
00202	{
00203		return Left(MapsList[AbsoluteMapIndex],2) ~= Prefix;
00204	}
00205	
00206	
00207	FUNCTION GetMapArray( int AllowedIndex, out ARRAY<STRING> MapDescArray, out ARRAY<STRING> MapUNRArray )
00208	{
00209		LOCAL int i;
00210	
00211		MapDescArray.Length = 0;
00212		MapUNRArray.Length = 0;
00213		GameMapsIndex.Length = 0;
00214	
00215		for ( i=0; i<MaxAllMaps; i++ )
00216		{
00217			// if we are in deathmatch mode, deathmatch specific maps can be used
00218			// if we are in team deathmatch mode, CTF maps can be used
00219			if	(	AllowedIndex==-1 
00220					||	( IsDeathMatch( AllowedIndex ) && MapPrefixMatch( i,GetPrefixText(DeathMatchIndex) ) )
00221					||	( MapPrefixMatch(i,GetPrefixText(AllowedIndex) ) && ( DMOnly[i]==0 ) )
00222					||	( IsTeamDeathMatch( AllowedIndex ) && MapPrefixMatch( i,PrefixText[CaptureTheFlagIndex] ) )
00223				)
00224			{
00225				// Add the map.
00226				MapDescArray[MapDescArray.Length] = DescList[i];
00227				MapUNRArray[MapUNRArray.Length] = MapsList[i];
00228				GameMapsIndex[GameMapsIndex.Length] = i;
00229			}
00230		}
00231		MaxMaps=MapDescArray.Length;
00232	}
00233	
00234	
00235	FUNCTION int GetDefaultGameTypeValue( int AllowedIndex )
00236	{
00237		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00238			return DefaultGameTypeValue[ AllowedGameTypeIndex[ AllowedIndex ] ] ;
00239		else
00240			return 0 ;
00241	}
00242	
00243	
00244	FUNCTION int GetPointsLimitFactor( int AllowedIndex )
00245	{
00246		if ( AllowedIndex>=0 && AllowedIndex<AllowedGameTypeIndex.Length )
00247			return PointsLimitFactor[ AllowedGameTypeIndex[ AllowedIndex ] ] ;
00248		else
00249			return 0 ;
00250	}
00251	
00252	
00253	
00254	defaultproperties
00255	{
00256	     tBackground01=Texture'XIIIMenuStart.Multi_rules.multilive01'
00257	     tBackground02=Texture'XIIIMenuStart.Multi_rules.multilive02'
00258	     tBackground03=Texture'XIIIMenuStart.Multi_rules.multilive03'
00259	     tBackground04=Texture'XIIIMenuStart.Multi_rules.multilive04'
00260	     bUseDefaultBackground=True
00261	     GameTypeText(0)="Deathmatch"
00262	     GameTypeText(1)="Team Deathmatch"
00263	     GameTypeText(2)="Capture The Flag"
00264	     GameTypeText(3)="The Hunt"
00265	     GameTypeText(4)="Sabotage"
00266	     GameTypeText(5)="Power Up"
00267	     GameInfoText(0)="XIIIMP.XIIIMPGameInfo"
00268	     GameInfoText(1)="XIIIMP.XIIIMPTeamGameInfo"
00269	     GameInfoText(2)="XIIIMP.XIIIMPCTFGameInfo"
00270	     GameInfoText(3)="XIIIMP.XIIIMPDuckGameInfo"
00271	     GameInfoText(4)="XIIIMP.XIIIMPBombGame"
00272	     GameInfoText(5)="XIIIMP.XIIIMPGameInfo"
00273	     PrefixText(0)="DM"
00274	     PrefixText(1)="DM"
00275	     PrefixText(2)="CT"
00276	     PrefixText(3)="DM"
00277	     PrefixText(4)="SB"
00278	     PrefixText(5)="DM"
00279	     MutatorText(5)="XIIIMP.MarioMutator"
00280	     DefaultGameTypeValue(0)=10
00281	     DefaultGameTypeValue(1)=10
00282	     DefaultGameTypeValue(2)=5
00283	     DefaultGameTypeValue(3)=100
00284	     DefaultGameTypeValue(5)=10
00285	     PointsLimitFactor(0)=10
00286	     PointsLimitFactor(1)=10
00287	     PointsLimitFactor(2)=1
00288	     PointsLimitFactor(3)=50
00289	     PointsLimitFactor(5)=10
00290	}

End Source Code