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

TribesGUI.TribesMissionLoadingMenu


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
// ====================================================================
//  Class:  TribesGui.TribesMissionLoadingMenu
//
//  Menu to load map from entry screen.
// ====================================================================

class TribesMissionLoadingMenu extends TribesGUIPage
     native;

var(TribesGui) private EditInline Config GUILabel	descriptionLabel	"Used for map description in SP, game type description in MP.";
var(TribesGui) private EditInline Config GUILabel	titleLabel			"Used to display the map title in SP, map title and game type in MP.";
var(TribesGui) private EditInline Config GUIImage	screenshotImage		"Used to display a screenshot of the map, stored in LevelSummary.";
var(TribesGUI) private EditInline Config Material	defaultImage;
var(TribesGUI) private EditInline Config Material	defaultFrameImage;
var(TribesGUI) private EditInline Config GUIImage	frameImage;
var(TribesGui) private EditInline Config GUILabel	hintLabel			"Used to display hints in MP.";
var(TribesGui) private EditInline Config GUIProgressBar MissionLoadingProgressBar;

var() color HintColor;
var() color BindColor;

var localized string connectingText;
var string defaultLabel;
var string defaultTitle;

function InitComponent(GUIComponent MyOwner)
{
	Super.InitComponent(MyOwner);

	OnKeyEvent = InternalOnKey;

	defaultLabel = "";
	defaultTitle = "";
	defaultImage = screenshotImage.Image;
}

function bool InternalOnKey(out byte Key, out byte State, float delta)
{
	if (key==EInputKey.IK_Escape)
	{
		Controller.ConsoleCommand("ABORTCONNECT");
	}

	return true;
}

function InternalOnShow()
{
	local LevelSummary L;
	local String URL;
	local class<GameInfo> G;
	local String gameClassStr;
	local int gStart;
	local int gEnd;

	L = GC.CurrentLevelSummary;
	hintLabel.Caption = "";

	if (L == None)
	{
		Log("The map doesn't have a LevelSummary");
		
		descriptionLabel.Caption = defaultLabel;
		titleLabel.Caption = defaultTitle;
		screenshotImage.Image = defaultImage;
	}
	else
	{
		descriptionLabel.Caption = L.Description;
		titleLabel.Caption = L.Title;

		if (L.Screenshot != None)
			screenshotImage.Image = L.Screenshot;
	}

	URL = Caps(GC.CurrentURL);

	// check if description must be obtained from gametype (in mp game)
	gStart = InStr(URL, "GAME=");
	frameImage.Image = None;
	if (gStart != -1)
	{
		gameClassStr = Mid(URL, gStart + 5);
		gEnd = InStr(gameClassStr, "?");
		if (gEnd != -1)
			gameClassStr = Left(gameClassStr, gEnd);

		LOG("Retrieving info for game type"@gameClassStr);
		G = class<GameInfo>(DynamicLoadObject(gameClassStr, class'Class'));
		if (G != None && class<MultiplayerGameInfo>(G) != None)
		{
			titleLabel.Caption @= "-"@G.default.GameName;
			descriptionLabel.Caption = G.default.GameDescription;
			hintLabel.Caption = class<MultiplayerGameInfo>(G).static.GetLoadingHint(PlayerOwner(), HintColor, BindColor);
			frameImage.Image = defaultFrameImage;
		}
	}
}

event HandleParameters( string Param1, string Param2, optional int param3)
{
	// multiplayer connection
	if (Param1 != "")
	{
		titleLabel.Caption = "";
		descriptionLabel.Caption = replaceStr(connectingText, Param1);
		screenshotImage.Image = defaultImage;
		hintLabel.Caption = "";

		MissionLoadingProgressBar.bCanBeShown = false;
		MissionLoadingProgressBar.Hide();
	}
	else
	{
		MissionLoadingProgressBar.bCanBeShown = true;
		MissionLoadingProgressBar.Show();
	}
}

function OnProgress(string Str1, string Str2)
{
	MissionLoadingProgressBar.Value = float(Str1);
	if (Controller != None)
		Controller.PaintProgress();
}

defaultproperties
{
	OnShow=InternalOnShow
	connectingText="Connecting to %1... (Press ESC to cancel)";
	bHideMouseCursor=true
	HintColor	= (R=255,G=255,B=255)
	BindColor	= (R=255,G=255,B=255)
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: st 16.4.2014 10:20:44.000 - Creation time: st 23.5.2018 00:10:48.545 - Created with UnCodeX