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

UTGame.UTUIFrontEnd_CustomScreen


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
/**
* Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
*
* Custom Scene for UT3, contains a description label and an automated way of providing descriptions for widgets.
*/
class UTUIFrontEnd_CustomScreen extends UTUIFrontEnd
	native(UIFrontEnd);

var transient UILabel	DescriptionLabel;

/** Target editbox for the onscreen keyboard, if any. */
var transient UIEditBox KeyboardTargetEditBox;

/** Whether or not the keyboard being displayed is a password keyboard. */
var transient bool bIsPasswordKeyboard;

/** Mapping of widget tag to field description. */
struct native DescriptionMapping
{
	var name WidgetTag;
	var string DataStoreMarkup;
};

var transient array<DescriptionMapping> DescriptionMap;

/** PostInitialize event - Sets delegates for the scene. */
event PostInitialize( )
{
	Super.PostInitialize();

	DescriptionLabel = UILabel(FindChild('lblDescription', true));
}


/** Callback for when the object's active state changes. */
function OnNotifyActiveStateChanged( UIScreenObject Sender, int PlayerIndex, UIState NewlyActiveState, optional UIState PreviouslyActiveState )
{
	local int MappingIdx;

	if(NewlyActiveState.Class == class'UIState_Focused'.default.Class)
	{
		// Loop through all description mappings and try to set a description based on the currently focused widget.
		for(MappingIdx=0; MappingIdx<DescriptionMap.length; MappingIdx++)
		{
			if(DescriptionMap[MappingIdx].WidgetTag==UIObject(Sender).WidgetTag)
			{
				DescriptionLabel.SetDataStoreBinding(DescriptionMap[MappingIdx].DataStoreMarkup);
				break;
			}
		}
	}
}

/** Shows the on screen keyboard. */
function ShowKeyboard(UIEditBox InTargetEditBox, string Title, optional string Message, optional bool bPassword, optional bool bShouldValidate, optional string DefaultText="", optional int MaxLength)
{
	local OnlinePlayerInterface PlayerInt;

	KeyboardTargetEditBox = InTargetEditBox;

	bIsPasswordKeyboard=bPassword;
	PlayerInt = GetPlayerInterface();
	PlayerInt.AddKeyboardInputDoneDelegate(OnKeyboardInputComplete);
	GetUTInteraction().BlockUIInput(true);	// block input
	if(PlayerInt.ShowKeyboardUI(GetPlayerIndex(), Title, Message, bPassword, bShouldValidate, DefaultText, MaxLength)==false)
	{
		OnKeyboardInputComplete(false);
	}
}

/**
 * Delegate used when the keyboard input request has completed
 *
 * @param bWasSuccessful true if the async action completed without error, false if there was an error
 */
function OnKeyboardInputComplete(bool bWasSuccessful)
{
	local OnlinePlayerInterface PlayerInt;
	local byte bWasCancelled;
	local string KeyboardResults;

	PlayerInt = GetPlayerInterface();

	if(PlayerInt != None)
	{
		GetUTInteraction().BlockUIInput(false);	// unblock input
		PlayerInt.ClearKeyboardInputDoneDelegate(OnKeyboardInputComplete);

		if(bWasSuccessful)
		{
			KeyboardResults = PlayerInt.GetKeyboardInputResults(bWasCancelled);

			if(bool(bWasCancelled)==false)
			{
				if(!bIsPasswordKeyboard)
				{
					KeyboardResults=TrimWhitespace(KeyboardResults);
				}

				KeyboardTargetEditBox.SetValue(KeyboardResults);
			}
		}
	}
}

/**
 * Strips any characters which are deemed invalid for profile names from the specified username.
 *
 * @param	Username	the username to strip invalid characters from.
 *
 * @return	the username with all invalid characters stripped.
 */
static function string StripInvalidUsernameCharacters( string Username )
{
	Username = TrimWhitespace(Username);

	// question marks break URL parsing, so strip those as well
	Username = Repl(Username, "?", "");

	//@todo - at this time, there is a bug on gamespy's end that prevents profiles which contain apostrophes from
	// logging in online successfully, so we'll need to strip apostrophes from the profile name until gamespy
	// fixes this bug on their end.
	Username = Repl(Username, "'", "");

	return Username;
}

defaultproperties
{
   Begin Object Class=UIComp_Event Name=SceneEventComponent ObjName=SceneEventComponent Archetype=UIComp_Event'UTGame.Default__UTUIFrontEnd:SceneEventComponent'
      ObjectArchetype=UIComp_Event'UTGame.Default__UTUIFrontEnd:SceneEventComponent'
   End Object
   EventProvider=SceneEventComponent
   Name="Default__UTUIFrontEnd_CustomScreen"
   ObjectArchetype=UTUIFrontEnd'UTGame.Default__UTUIFrontEnd'
}

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