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

TribesGUI.HUDDeployableReticule


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
//
// class: HUDDeployableReticule
//
// Reticule that indicates whether a deployable can be placed or not.
//
class HUDDeployableReticule extends HUDReticule;

import enum eDeployableInfo from Gameplay.Deployable;

var localized string textTooFar;
var localized string textBadSurface;
var localized string textBlocked;
var localized string textSameTypeTooNear;
var localized string textInvalidTargetObject;

var LabelElement	infoLabel;
var float			lastUseTime;
var float			labelHideTime;

function InitElement()
{
	super.InitElement();

	infoLabel = LabelElement(AddElement("TribesGUI.LabelElement", "default_deployable_reticuleInfoLabel"));
}

function UpdateReticule(ClientSideCharacter c)
{
	if (!c.bDeployableActive || c.deployable == None || c.bZoomed)
	{
		bVisible = false;
		return;
	}

	bVisible = true;

	if (c.deployableState == DeployableInfo_Ok)
	{
		reticuleMaterial.material = c.deployable.default.hudReticuleOk;
		retWidth = c.deployable.default.hudReticuleOkWidth;
		retHeight = c.deployable.default.hudReticuleOkHeight;
		hotspotX = c.deployable.default.hudReticuleOkCenterX;
		hotspotY = c.deployable.default.hudReticuleOkCenterY;
	}
	else
	{
		reticuleMaterial.material = c.deployable.default.hudReticuleBad;
		retWidth = c.deployable.default.hudReticuleBadWidth;
		retHeight = c.deployable.default.hudReticuleBadHeight;
		hotspotX = c.deployable.default.hudReticuleBadCenterX;
		hotspotY = c.deployable.default.hudReticuleBadCenterY;
	}

	if (lastUseTime != c.deployableUseTime)
	{
		lastUseTime = c.deployableUseTime;
		labelHideTime = c.levelTimeSeconds + 3;
		switch (c.deployableState)
		{
		case DeployableInfo_Ok:
			infoLabel.SetText("");
			break;
		case DeployableInfo_TooFar:
			infoLabel.SetText(textTooFar);
			break;
		case DeployableInfo_NoSurface:
			infoLabel.SetText(textBadSurface);
			break;
		case DeployableInfo_SameTypeTooNear:
			infoLabel.SetText(textSameTypeTooNear);
			break;
		case DeployableInfo_InvalidTargetObject:
			infoLabel.SetText(textInvalidTargetObject);
			break;
		default:
			infoLabel.SetText(textBlocked);
		}
	}

	infoLabel.bVisible = c.levelTimeSeconds < labelHideTime;
}

defaultproperties
{
	textTooFar = "The deployment point is too far away."
	textBadSurface = "You must deploy this item on a flat surface."
	textBlocked = "The deployment point is blocked."
	textSameTypeTooNear = "The deployment point is too close to another deployable of the same type."
	textInvalidTargetObject = "You cannot deploy on that object."
}

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:44.249 - Created with UnCodeX