Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UTGame.UTEntryPlayerController


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
/**
 * UTEntryPlayerController
 *
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */

class UTEntryPlayerController extends UTPlayerController
	config(Game)
	native;
























































































































 



#linenumber 11

var PostProcessChain EntryPostProcessChain;
var array<PostProcessChain> OldPostProcessChain;
var LocalPlayer OldPlayer;

event InitInputSystem()
{
	// Need to bypass the UTPlayerController since it initializes voice and we do not want to do that in the menus.
	Super(GamePlayerController).InitInputSystem();

	AddOnlineDelegates(false);

	// we do this here so that we only bother to create it for local players
	CameraAnimPlayer = new(self) class'CameraAnimInst';

	if (EntryPostProcessChain != None)
	{
		// Store the old post process chains
		if(OldPostProcessChain.length==0)
		{
			OldPostProcessChain = LocalPlayer(Player).PlayerPostProcessChains;
			OldPlayer = LocalPlayer(Player);
		}

		// Remove all post processing chains for the player
		LocalPlayer(Player).RemoveAllPostProcessingChains();
		LocalPlayer(Player).InsertPostProcessingChain(EntryPostProcessChain, -1, FALSE);
	}
}

simulated function RestorePostProcessing()
{
	local int PPIdx;

	// Restore the old post process chain if we removed it
	if( (OldPlayer != None) && (EntryPostProcessChain != none) )
	{
		OldPlayer.RemoveAllPostProcessingChains();

		for(PPIdx=0; PPIdx<OldPostProcessChain.length; PPIdx++)
		{
			OldPlayer.InsertPostProcessingChain(OldPostProcessChain[PPIdx], -1, true);
		}
		OldPostProcessChain.length = 0;
		OldPlayer = None;
	}
}

/** Destroyed event for the PC, resets the post process chain to normal. */
simulated event Destroyed()
{
	RestorePostProcessing();

	Super.Destroyed();
}

/**
 * Attempts to pause/unpause the game when a controller becomes
 * disconnected/connected
 *
 * @param ControllerId the id of the controller that changed
 * @param bIsConnected whether the controller is connected or not
 */
function OnControllerChanged(int ControllerId,bool bIsConnected)
{
	local LocalPlayer LocPlayer;
	// Don't worry about remote players
	LocPlayer = LocalPlayer(Player);
	// If the controller that changed, is attached to the this playercontroller
	if (LocPlayer != None && LocPlayer.ControllerId == ControllerId)
	{
		bIsControllerConnected = bIsConnected;

		if(bIsConnected)
		{
			class'UTUIScene'.static.HideOnlineToast();
		}
		else
		{
			class'UTUIScene'.static.ShowOnlineToast(Localize("ToastMessages","ReconnectController","UTGameUI")$" ("$(ControllerId+1)$")", -1);	// Time of -1 to make the toast stay up until we hide it.
		}
	}
}

/** Callback for when a game invite has been received. */
function OnGameInviteReceived(byte LocalUserNum,string RequestingNick)
{
	local string FinalMsg;

	if(Len(RequestingNick) > 0)
	{
		FinalMsg = Repl(Localize("ToastMessages","ReceivedGameInviteSpecific","UTGameUI"), "`PlayerName`",RequestingNick, true);

		// Display toast
		class'UTUIScene'.static.ShowOnlineToast(FinalMsg);
	}
}


/** Callback for when a friend request has been received. */
function OnFriendInviteReceived(byte LocalUserNum,UniqueNetId RequestingPlayer,string RequestingNick,string Message)
{
	local string FinalMsg;

	if(Len(RequestingNick) > 0)
	{
		FinalMsg = Repl(Localize("ToastMessages","ReceivedFriendInviteSpecific","UTGameUI"), "`PlayerName`",RequestingNick, true);
	}
	else
	{
		FinalMsg = Localize("ToastMessages","ReceivedFriendInvite","UTGameUI");
	}

	// Display toast
	class'UTUIScene'.static.ShowOnlineToast(FinalMsg);
}

/**
 * Called when a friend invite arrives for a local player
 *
 * @param LocalUserNum the user that is receiving the invite
 * @param SendingPlayer the player sending the friend request
 * @param SendingNick the nick of the player sending the friend request
 * @param Message the message to display to the recipient
 *
 * @return true if successful, false otherwise
 */
function OnFriendMessageReceived(byte LocalUserNum,UniqueNetId SendingPlayer,string SendingNick,string Message)
{
	local string FinalMsg;

	if(Len(SendingNick) > 0)
	{
		FinalMsg = Repl(Localize("ToastMessages","ReceivedMessageSpecific","UTGameUI"), "`PlayerName`",SendingNick, true);
	}
	else
	{
		FinalMsg = Localize("ToastMessages","ReceivedMessage","UTGameUI");
	}

	// Display toast
	class'UTUIScene'.static.ShowOnlineToast(FinalMsg);
}

/**
 * Callback for when a character has been unlocked.
 */
event OnCharacterUnlocked()
{
	local string FinalMsg;

	FinalMsg = Localize("ToastMessages","CharacterUnlocked","UTGameUI");
	class'UTUIScene'.static.ShowOnlineToast(FinalMsg);
}







/**
 * Called when a system level connection change notification occurs. If we are
 * playing a match through the platform's online service, we may need to notify and
 * go back to the menu. Otherwise silently ignore this.
 *
 * @param ConnectionStatus the new connection status.
 */
exec function OnConnectionStatusChange(EOnlineServerConnectionStatus ConnectionStatus)
{
	local GameUISceneClient SceneClient;
	local bool bInvalidConnectionStatus;
	local string OutValue;

	// Only handle the error if we arent currently creating a profile.
	if(class'UIRoot'.static.GetDataStoreStringValue("<Registry:CreatingProfile>",OutValue)==false || OutValue!="1")
	{
		// Determine whether the connection status change requires us to drop and go to the menu
		switch (ConnectionStatus)
		{
		case OSCS_DuplicateLoginDetected:
			// Two people can't play or badness will happen
			LogInternal("Detected another user logging-in with this profile.");

			// now set an error message to be displayed to the user
			SetFrontEndErrorMessage("<Strings:UTGameUI.Errors.DuplicateLogin_Title>",
				"<Strings:UTGameUI.Errors.DuplicateLogin_Message>");

			bInvalidConnectionStatus = true;
			break;

		case OSCS_ConnectionDropped:
		case OSCS_NoNetworkConnection:
		case OSCS_UpdateRequired:
		case OSCS_ServersTooBusy:
			// set an error message to be displayed to the user
			SetFrontEndErrorMessage("<Strings:UTGameUI.Errors.ConnectionLost_Title>",
				"<Strings:UTGameUI.Errors.ConnectionLost_Message>");

			bInvalidConnectionStatus = true;
			break;

		case OSCS_ServiceUnavailable:
			SetFrontEndErrorMessage("<Strings:UTGameUI.Errors.ServiceUnavailable_Title>", "<Strings:UTGameUI.Errors.ServiceUnavailable_Message>");
			bInvalidConnectionStatus = true;
			break;
		}

		// notify the UI scene client, which will propagate the notification to all scenes.  Any scenes
		// which require a valid online service will close themselves.
		SceneClient = class'UIRoot'.static.GetSceneClient();
		if ( SceneClient != None )
		{
			SceneClient.NotifyOnlineServiceStatusChanged(ConnectionStatus);
		}

		LogInternal(Name$"::"$GetFuncName()@"ConnectionStatus:'"$GetEnum(Enum'EOnlineServerConnectionStatus',ConnectionStatus)$"'"@"bInvalidConnectionStatus:'"$bInvalidConnectionStatus$"'",'DevOnline');
		if ( bInvalidConnectionStatus )
		{
			// finalize
			QuitToMainMenu();
		}
	}
}

/**
 * Called when the platform's network link status changes.  If we are playing a match on a remote server, we need to go back
 * to the front end menus and notify the player.
 */
exec function OnLinkStatusChanged( bool bConnected )
{
	local GameUISceneClient SceneClient;
	local string ErrorDisplay;

	LogInternal(Name$"::"$GetFuncName()@"bConnected:'"$bConnected$"'",'DevNet');

	// notify the UI scene client, which will propagate the notification to all scenes.  Any scenes
	// which require a valid network connection will close themselves.
	SceneClient = class'UIRoot'.static.GetSceneClient();
	if ( SceneClient != None )
	{
		SceneClient.NotifyLinkStatusChanged(bConnected);
	}

	if ( !bConnected )
	{
		// if we're no longer connected to the network, check to see if another error message has been set
		// only display our message if none are currently set.
		if (!class'UIRoot'.static.GetDataStoreStringValue("<Registry:FrontEndError_Display>", ErrorDisplay)
		||	int(ErrorDisplay) == 0 )
		{
			SetFrontEndErrorMessage("<Strings:UTGameUI.Errors.Error_Title>", "<Strings:UTGameUI.Errors.NetworkLinkLost_Message>");
			QuitToMainMenu();
		}
	}
}

/** Called when returning to the main menu. */
function QuitToMainMenu()
{
	local GameUISceneClient SceneClient;
	local int SceneIdx;
	local UTUIFrontEnd Scene;

	LogInternal("UTEntryPlayerController::QuitToMainMenu() - Quitting to main menu.");

	if(GetURLMap()=="UTFrontEnd")
	{
		//Is an online session in progress?
		if (OnlineSub != None && OnlineSub.GameInterface != None && OnlineSub.GameInterface.GetOnlineGameState() != OGS_NoSession)
		{
			// Set the destroy delegate so we can know when that is complete
			OnlineSub.GameInterface.AddDestroyOnlineGameCompleteDelegate(OnDestroyOnlineGameComplete);

			// Now we can destroy the game, kill the pending connection
			LogInternal("UTEntryPlayerController::QuitToMainMenu() - Destroying Online Game, ControllerId: " $ LocalPlayer(Player).ControllerId);
			OnlineSub.GameInterface.DestroyOnlineGame();
		}

		SceneClient = class'UIRoot'.static.GetSceneClient();
		if ( SceneClient != None && SceneClient.IsUIActive(0x00000020) )
		{
			for ( SceneIdx = SceneClient.ActiveScenes.Length - 1; SceneIdx >= 0; SceneIdx-- )
			{
				Scene = UTUIFrontEnd(SceneClient.ActiveScenes[SceneIdx]);
				if ( Scene != None )
				{
					Scene.SetupButtonBar();
					Scene.CheckForFrontEndError();
					break;
				}
			}
		}
	}
	else
	{
		Super.QuitToMainMenu();
	}
}

/**
* Called when the destroy online game has completed. At this point it is safe
* to travel back to the menus
*
* @param bWasSuccessful whether it worked ok or not
*/
function OnDestroyOnlineGameComplete(bool bWasSuccessful)
{
	LogInternal("UTEntryPlayerController::OnDestroyOnlineGameComplete() - Finishing Quit to Main Menu, ControllerId: " $ LocalPlayer(Player).ControllerId);

	OnlineSub.GameInterface.ClearDestroyOnlineGameCompleteDelegate(OnDestroyOnlineGameComplete);

	// Clear out the gamesettings cache
	if (WorldInfo.Game != None)
		WorldInfo.Game.GameSettings = None;
}

function LoadCharacterFromProfile(UTProfileSettings Profile);	// Do nothing
function SetPawnConstructionScene(bool bShow);	// Do nothing
function UTUIScene_MidGameMenu ShowMidGameMenu(optional name TabTag,optional bool bEnableInput);
function ShowScoreboard();

exec function UnlockChapter(int ChapterIndex)
{
	local UTProfileSettings Profile;
	Profile = UTProfileSettings(OnlinePlayerData.ProfileProvider.Profile);
	if (Profile != none)
	{
		Profile.UnlockChapter(ChapterIndex);
	}
}

defaultproperties
{
   EntryPostProcessChain=PostProcessChain'FX_HitEffects.UTMenuPostProcess'
   bInitialProcessingComplete=True
   Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTPlayerController:CollisionCylinder'
      ObjectArchetype=CylinderComponent'UTGame.Default__UTPlayerController:CollisionCylinder'
   End Object
   CylinderComponent=CollisionCylinder
   Begin Object Class=SpriteComponent Name=Sprite ObjName=Sprite Archetype=SpriteComponent'UTGame.Default__UTPlayerController:Sprite'
      ObjectArchetype=SpriteComponent'UTGame.Default__UTPlayerController:Sprite'
   End Object
   Components(0)=Sprite
   Components(1)=CollisionCylinder
   CollisionComponent=CollisionCylinder
   Name="Default__UTEntryPlayerController"
   ObjectArchetype=UTPlayerController'UTGame.Default__UTPlayerController'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:20.000 - Creation time: sk 18-3-2018 10:01:20.747 - Created with UnCodeX