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
// ====================================================================
// 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
{
     Begin Object Class=AltSectionBackground Name=sbGameDesc
         bFillClient=True
         Caption="Game Description"
         WinTop=0.020438
         WinLeft=0.023625
         WinWidth=0.944875
         WinHeight=0.455783
         bBoundToParent=True
         bScaleToParent=True
         OnPreDraw=sbGameDesc.InternalPreDraw
     End Object
     sb_GameDesc=AltSectionBackground'GUI2K4.UT2K4Tab_MidGameHelp.sbGameDesc'

     Begin Object Class=AltSectionBackground Name=sbHints
         bFillClient=True
         Caption="Helpful Hints"
         WinTop=0.482921
         WinLeft=0.055125
         WinWidth=0.881875
         WinHeight=0.436125
         bBoundToParent=True
         bScaleToParent=True
         OnPreDraw=sbHints.InternalPreDraw
     End Object
     sb_Hints=AltSectionBackground'GUI2K4.UT2K4Tab_MidGameHelp.sbHints'

     Begin Object Class=GUIScrollTextBox Name=InfoText
         bNoTeletype=True
         CharDelay=0.002500
         EOLDelay=0.000000
         TextAlign=TXTA_Center
         OnCreateComponent=InfoText.InternalOnCreateComponent
         WinTop=0.143750
         WinHeight=0.316016
         bBoundToParent=True
         bScaleToParent=True
         bNeverFocus=True
     End Object
     GameDescriptionBox=GUIScrollTextBox'GUI2K4.UT2K4Tab_MidGameHelp.InfoText'

     Begin Object Class=GUIScrollTextBox Name=HintText
         bNoTeletype=True
         CharDelay=0.002500
         EOLDelay=0.000000
         TextAlign=TXTA_Center
         OnCreateComponent=HintText.InternalOnCreateComponent
         WinTop=0.593750
         WinHeight=0.266016
         bBoundToParent=True
         bScaleToParent=True
         bNeverFocus=True
     End Object
     HintsBox=GUIScrollTextBox'GUI2K4.UT2K4Tab_MidGameHelp.HintText'

     Begin Object Class=GUILabel Name=HintCount
         TextAlign=TXTA_Center
         TextColor=(B=255,G=255,R=255)
         WinTop=0.900000
         WinLeft=0.300000
         WinWidth=0.400000
         WinHeight=32.000000
     End Object
     HintCountLabel=GUILabel'GUI2K4.UT2K4Tab_MidGameHelp.HintCount'

     Begin Object Class=GUIButton Name=PrevHint
         Caption="Previous Hint"
         bAutoSize=True
         WinTop=0.900000
         WinLeft=0.131500
         WinWidth=0.226801
         WinHeight=0.042125
         TabOrder=0
         OnClick=UT2K4Tab_MidGameHelp.ButtonClicked
         OnKeyEvent=PrevHint.InternalOnKeyEvent
     End Object
     PrevHintButton=GUIButton'GUI2K4.UT2K4Tab_MidGameHelp.PrevHint'

     Begin Object Class=GUIButton Name=NextHint
         Caption="Next Hint"
         bAutoSize=True
         WinTop=0.900000
         WinLeft=0.698425
         WinWidth=0.159469
         WinHeight=0.042125
         TabOrder=1
         OnClick=UT2K4Tab_MidGameHelp.ButtonClicked
         OnKeyEvent=NextHint.InternalOnKeyEvent
     End Object
     NextHintButton=GUIButton'GUI2K4.UT2K4Tab_MidGameHelp.NextHint'

     OnPreDraw=UT2K4Tab_MidGameHelp.FixUp
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: pr 5-2-2018 12:35:54.000 - Creation time: sk 18-3-2018 09:50:24.556 - Created with UnCodeX