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

GUI2K4.UT2K4Tab_MidGameHelp


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
// ====================================================================
// Tab for login/midgame menu that shows game description and helpful hints
//
// Written by Matt Oelfke
// (C) 2003, Epic Games, Inc. All Rights Reserved
// ====================================================================

class UT2K4Tab_MidGameHelp extends MidGamePanel;

var bool bReceivedGameClass;

var automated GUISectionBackground sb_GameDesc, sb_Hints;

var automated GUIScrollTextBox GameDescriptionBox, HintsBox;
var automated GUILabel HintCountLabel;
var automated GUIButton PrevHintButton, NextHintButton;
var class<GameInfo> GameClass;
var array<string> AllGameHints;
var int CurrentHintIndex;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
	Super.Initcomponent(MyController, MyOwner);
	sb_GameDesc.ManageComponent(GameDescriptionBox);
	sb_Hints.ManageComponent(HintsBox);

	PrevHintButton.bBoundToParent=false;  PrevHintButton.bScaleToParent=false;
	NextHintButton.bBoundToParent=false;  NextHintButton.bScaleToParent=false;
	HintCountLabel.bBoundToParent=false;  HintCountLabel.bScaleToParent=false;

}

function ShowPanel(bool bShow)
{
	Super.ShowPanel(bShow);

	if (bShow && !bReceivedGameClass)
	{
		SetTimer(1.0, true);
		Timer();
	}
}

function Timer()
{
	local PlayerController PC;
	local int i;

	PC = PlayerOwner();
	if (PC != None && PC.GameReplicationInfo != None && PC.GameReplicationInfo.GameClass != "")
	{
		GameClass = class<GameInfo>(DynamicLoadObject(PC.GameReplicationInfo.GameClass, class'Class'));
		if (GameClass != None)
		{
			//get game description and hints from game class
			GameDescriptionBox.SetContent(GameClass.default.Description);
			AllGameHints = GameClass.static.GetAllLoadHints();
			if (AllGameHints.length > 0)
			{
				for (i = 0; i < AllGameHints.length; i++)
				{
					AllGameHints[i] = GameClass.static.ParseLoadingHint(AllGameHints[i], PC, HintsBox.Style.FontColors[HintsBox.MenuState]);
					if (AllGameHints[i] == "")
					{
						AllGameHints.Remove(i, 1);
						i--;
					}
				}
				HintsBox.SetContent(AllGameHints[CurrentHintIndex]);
				HintCountLabel.Caption = string(CurrentHintIndex + 1) @ "/" @ string(AllGameHints.length);
				EnableComponent(PrevHintButton);
				EnableComponent(NextHintButton);
			}

			KillTimer();
			bReceivedGameClass = true;
		}
	}
}

function bool ButtonClicked(GUIComponent Sender)
{
	if (Sender == PrevHintButton)
	{
		CurrentHintIndex--;
		if (CurrentHintIndex < 0)
			CurrentHintIndex = AllGameHints.length - 1;
	}
	else if (Sender == NextHintButton)
	{
		CurrentHintIndex++;
		if (CurrentHintIndex >= AllGameHints.length)
			CurrentHintIndex = 0;
	}

	HintsBox.SetContent(AllGameHints[CurrentHintIndex]);
	HintCountLabel.Caption = string(CurrentHintIndex + 1) @ "/" @ string(AllGameHints.length);

	return true;
}

function bool FixUp(Canvas C)
{
	local float t,h,l,w,xl;

    h = 20;
    t = sb_Hints.ActualTop() + sb_Hints.ActualHeight() -  27;

	PrevHintButton.WinLeft = sb_Hints.ActualLeft() + 40;
	PrevHintButton.WinTop = t;
	PrevHintButton.WinHeight=h;

	NextHintButton.WinLeft = sb_Hints.ActualLeft() + sb_Hints.ActualWidth() - 40 - NextHintButton.ActualWidth();
	NextHintButton.WinTop = t;
	NextHintButton.WinHeight=h;

	l = PrevHintButton.ActualLeft() + PrevHintButton.ActualWidth();
	w = NextHintButton.ActualLeft() - L;

	XL = HintCountLabel.ActualWidth();
	l = l + (w/2) - (xl/2);
	HintCountLabel.WinLeft=l;
	HintCountLabel.WinTop=t;
	HintCountLabel.WinWidth = xl;
	HintCountLabel.WinHeight=h;

	return false;
}

defaultproperties
{
	OnPreDraw=Fixup;

	Begin Object class=AltSectionBackground name=sbGameDesc
		WinWidth=0.944875
		WinHeight=0.455783
		WinLeft=0.023625
		WinTop=0.020438
		bBoundToParent=true
		bScaleToParent=true
		bFillClient=true
		Caption="Game Description"
	End Object
	sb_GameDesc=sbGameDesc;

	Begin Object Class=GUIScrollTextBox Name=InfoText
		WinWidth=1.000000
		WinHeight=0.316016
		WinLeft=0.000000
		WinTop=0.143750
		CharDelay=0.0025
		EOLDelay=0
		StyleName="NoBackground"
		bNoTeletype=true
		bNeverFocus=true
		TextAlign=TXTA_Center
		bBoundToParent=true
		bScaleToParent=true
	End Object
	GameDescriptionBox=InfoText


	Begin Object class=AltSectionBackground name=sbHints
		WinWidth=0.881875
		WinHeight=0.436125
		WinLeft=0.055125
		WinTop=0.482921
		bBoundToParent=true
		bScaleToParent=true
		bFillClient=true
		Caption="Helpful Hints"
	End Object
	sb_Hints=sbHints;

	Begin Object Class=GUIScrollTextBox Name=HintText
		WinWidth=1.000000
		WinHeight=0.266016
		WinLeft=0.000000
		WinTop=0.593750
		CharDelay=0.0025
		EOLDelay=0
		StyleName="NoBackground"
		bNoTeletype=true
		bNeverFocus=true
		TextAlign=TXTA_Center
		bBoundToParent=true
		bScaleToParent=true
	End Object
	HintsBox=HintText

	Begin Object Class=GUIButton Name=PrevHint
		Caption="Previous Hint"
		StyleName="SquareButton"
		OnClick=ButtonClicked
		WinWidth=0.226801
		WinHeight=0.042125
		WinLeft=0.131500
		WinTop=0.900000
		bAutoSize=True
		TabOrder=0
		MenuState=MSAT_Disabled
	End Object
	PrevHintButton=PrevHint

	Begin Object Class=GUIButton Name=NextHint
		Caption="Next Hint"
		StyleName="SquareButton"
		OnClick=ButtonClicked
		WinWidth=0.159469
		WinHeight=0.042125
		WinLeft=0.698425
		WinTop=0.900000
		bAutoSize=True
		TabOrder=1
		MenuState=MSAT_Disabled
	End Object
	NextHintButton=NextHint

	Begin Object class=GUILabel Name=HintCount
		TextALign=TXTA_Center
		TextColor=(R=255,G=255,B=255,A=255)
		WinWidth=0.400000
		WinHeight=32.000000
		WinLeft=0.300000
		WinTop=0.900000
	End Object
	HintCountLabel=HintCount
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Di 5.9.2006 22:28:52.000 - Creation time: Do 14.8.2014 09:58:54.346 - Created with UnCodeX