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

GUI2K4.UT2K4SP_Injury


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
//==============================================================================
// Notification of a team mate injury
//
// Written by Michiel Hendriks
// (c) 2003, 2004, Epic Games, Inc.  All Rights Reserved
//==============================================================================

class UT2K4SP_Injury extends LargeWindow;

var automated GUIImage	imgPictureBg, imgPicture;
var automated GUIButton btnCancel, btnTreat;
var automated GUILabel lblTitle, lblMessage;

var UT2K4GameProfile GP;
/** price to heal the injured player */
var int TreatmentCost;
/** the offset in the GameProfile's botstats array, set in HandleParameters */
var int InjuredPlayer;

event HandleParameters(string Param1, string Param2)
{
	local XUtil.PlayerRecord PR;
	InjuredPlayer = int(Param1);
	GP = UT2K4GameProfile(PlayerOwner().Level.Game.CurrentGameProfile);
	if ((GP == none) || (InjuredPlayer < 0) || (InjuredPlayer >= GP.BotStats.length))
	{
		Warn("Invalid injury menu request:"@(GP == none)@(InjuredPlayer < 0)@(InjuredPlayer >= GP.BotStats.length));
		Controller.CloseMenu(true);
		return;
	}
	if (GP.BotStats[InjuredPlayer].Health >= 100)
	{
		Controller.CloseMenu(true);
		return;
	}
	lblMessage.Caption = repl(lblMessage.Caption, "%player%", GP.BotStats[InjuredPlayer].Name);
	lblMessage.Caption = repl(lblMessage.Caption, "%health%", GP.BotStats[InjuredPlayer].Health);
	TreatmentCost = round((100-GP.BotStats[InjuredPlayer].Health)*GP.BotStats[InjuredPlayer].Price/100*GP.InjuryTreatment);
	lblMessage.Caption = repl(lblMessage.Caption, "%treatment%", GP.MoneyToString(TreatmentCost));
	lblMessage.Caption = repl(lblMessage.Caption, "%balance%", GP.MoneyToString(GP.Balance));
	PR = class'xGame.xUtil'.static.FindPlayerRecord(GP.BotStats[InjuredPlayer].Name);
	imgPicture.Image = PR.Portrait;
	if (TreatmentCost > GP.Balance-GP.MinBalance) btnTreat.DisableMe(); // cant afford it, but still report
}

function bool btnCancelOnClick(GUIComponent Sender)
{
	Controller.CloseMenu(true);
	return true;
}

function bool btnTreatOnClick(GUIComponent Sender)
{
	GP.BotStats[InjuredPlayer].Health = 100;
	GP.Balance -= TreatmentCost;
	Controller.CloseMenu(false);
	return true;
}

defaultproperties
{
	Begin Object Class=GUIButton Name=SPMbtnCancel
		Caption="CANCEL"
		WinWidth=0.200000
		WinHeight=0.040000
		WinLeft=0.051563
		WinTop=0.857292
		OnClick=btnCancelOnClick
		FontScale=FNS_Small
		bBoundToParent=true
	End Object
	btnCancel=SPMbtnCancel

	Begin Object Class=GUIButton Name=SPMbtnTreat
		Caption="TREAT NOW"
		WinWidth=0.200000
		WinHeight=0.040000
		WinLeft=0.664063
		WinTop=0.857292
		OnClick=btnTreatOnClick
		FontScale=FNS_Small
		bBoundToParent=true
	End Object
	btnTreat=SPMbtnTreat

	Begin Object class=GUIImage name=SPMimgPicture
		WinWidth=0.174500
		WinHeight=0.452000
		WinLeft=0.059000
		WinTop=0.146500
		Image=Material'2K4Menus.Controls.thinpipe_b'
		ImageColor=(R=255,G=255,B=255,A=255);
		ImageRenderStyle=MSTY_Normal
		ImageStyle=ISTY_Scaled
		RenderWeight=0.3
		bBoundToParent=true
	End Object
	imgPicture=SPMimgPicture

	Begin Object class=GUIImage name=SPMimgPictureBg
		WinWidth=0.177000
		WinHeight=0.464500
		WinLeft=0.057750
		WinTop=0.136499
		ImageRenderStyle=MSTY_Normal
		Image=Material'2K4Menus.Controls.sectionback'
		ImageStyle=ISTY_Scaled
		RenderWeight=0.2
		bBoundToParent=true
	End Object
	imgPictureBg=SPMimgPictureBg

	Begin Object Class=GUILabel Name=SPLlblTitle
		WinWidth=0.661250
		WinHeight=0.072500
		WinLeft=0.028750
		WinTop=0.051667
		Caption="Injury"
		StyleName="TextLabel"
		FontScale=FNS_Large
		TextAlign=TXTA_Center
		RenderWeight=0.4
		bBoundToParent=true
	End Object
	lblTitle=SPLlblTitle

	Begin Object Class=GUILabel Name=SPLlblMessage
		WinWidth=0.373749
		WinHeight=0.391250
		WinLeft=0.372500
		WinTop=0.176667
		Caption="%player% got injured in the last match.|%player%'s health is down to %health%%, treatment of the injuries costs %treatment%.|Balance: %balance%."
		StyleName="TextLabel"
		RenderWeight=0.4
		bMultiline=true
		bBoundToParent=true
	End Object
	lblMessage=SPLlblMessage

	DefaultWidth=0.7
	DefaultHeight=0.7
	DefaultLeft=0.15
	DefaultTop=0.15

	WinWidth=0.7
	WinHeight=0.7
	WinLeft=0.15
	WinTop=0.15
}

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.048 - Created with UnCodeX