Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# TribesGUI.HUDMessage

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

    class HUDMessage extends HUDContainer;

    // when marked as irrelevant, the message will fade out to
    // be invisible and eventually be removed from the list entirely
    var private bool bIrrelevant;

    var float AppearTime;		// Time at which the message appeared
    var float Lifetime;			// lifetime of the message, -1 for infinite
    var float TimeOfDeath;		// time the message became irrelevant
    var float FadeOutDuration;	// how long the message will take to fade away

    var int	firstVisibleLine;	// first visible line

    // Gets the text of the message, not necesarily valid
    function String GetText()
    {
    	return "";
    }

    // gets the number of lines in the message
    function int GetNumLines()
    {
    	return 1;
    }

    //
    // Only valid if all messages usethe same font.
    //
    // The only place this function is currently used is for the chat
    // window in the end game mp menu.
    //
    function int GetLineHeight(Canvas canvas)
    {
    	// just a default, subclasses will need to override
    	return 8;
    }

    // Sets the first visible line of the message
    function SetFirstVisibleLine(int newFirstVisibleLine)
    {
    	firstVisibleLine = newFirstVisibleLine;
    }

    function Reset()
    {
    	bVisible = true;
    	SetAlpha(1.0);
    	bIrrelevant = false;
    	timeOfDeath = 0;
    }

    // Marks the message as irrelvant and sets its time of death
    function MarkAsIrrelevant()
    {
    	bIrrelevant = true;
    	timeOfDeath = TimeSeconds;
    }

    //
    // Updates visibility of the message:
    // * Lifetimes are checked constantly until the message is marked irrelvant
    // * Irrelvant messages have their alpha reduced to 0 and are then marked invisible
    //
    function UpdateVisibility()
    {
    	// if already invisible or infinite lifetime, then return
    	if(! bVisible || Lifetime <= 0)
    		return;

    	if(Lifetime < (TimeSeconds - AppearTime) && ! bIrrelevant)
    		MarkAsIrrelevant();

    	// irrelevant message - fade it out
    	if(bIrrelevant)
    	{
    		// degrade the alpha value
    		SetAlpha(FClamp(1.0 - ((TimeSeconds - TimeOfDeath) / FadeOutDuration), 0.0, 1.0));

    		if(GetAlpha() == 0)
    			bVisible = false;
    	}
    }

    defaultproperties
    {

    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
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.363 - Created with UnCodeX