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

Engine.GameplayEventsHandler


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
/**
 * Copyright 1998-2011 Epic Games, Inc. All Rights Reserved.
 *
 * Interface for processing events as they are read out of the game stats stream
 */
class GameplayEventsHandler extends Object
	abstract
	config(Game)
	native;

cpptext
{
	/** The function that does the actual handling of data (override with particular implementation) */
	virtual void HandleEvent(struct FGameEventHeader& GameEvent, class IGameEvent* GameEventData);

	/** Handlers for parsing the game stats stream */

	// Game Event Handling
	virtual void HandleGameStringEvent(struct FGameEventHeader& GameEvent, struct FGameStringEvent* GameEventData) {}
	virtual void HandleGameIntEvent(struct FGameEventHeader& GameEvent, struct FGameIntEvent* GameEventData) {}
	virtual void HandleGameFloatEvent(struct FGameEventHeader& GameEvent, struct FGameFloatEvent* GameEventData) {}
	virtual void HandleGamePositionEvent(struct FGameEventHeader& GameEvent, struct FGamePositionEvent* GameEventData) {}

	// Team Event Handling
	virtual void HandleTeamStringEvent(struct FGameEventHeader& GameEvent, struct FTeamStringEvent* GameEventData) {}
	virtual void HandleTeamIntEvent(struct FGameEventHeader& GameEvent, struct FTeamIntEvent* GameEventData) {}
	virtual void HandleTeamFloatEvent(struct FGameEventHeader& GameEvent, struct FTeamFloatEvent* GameEventData) {}

	// Player Event Handling
	virtual void HandlePlayerIntEvent(struct FGameEventHeader& GameEvent, struct FPlayerIntEvent* GameEventData) {}
	virtual void HandlePlayerFloatEvent(struct FGameEventHeader& GameEvent, struct FPlayerFloatEvent* GameEventData) {}
	virtual void HandlePlayerStringEvent(struct FGameEventHeader& GameEvent, struct FPlayerStringEvent* GameEventData) {}
	virtual void HandlePlayerSpawnEvent(struct FGameEventHeader& GameEvent, struct FPlayerSpawnEvent* GameEventData) {}
	virtual void HandlePlayerLoginEvent(struct FGameEventHeader& GameEvent, struct FPlayerLoginEvent* GameEventData) {}
	virtual void HandlePlayerKillDeathEvent(struct FGameEventHeader& GameEvent, struct FPlayerKillDeathEvent* GameEventData) {}
	virtual void HandlePlayerPlayerEvent(struct FGameEventHeader& GameEvent, struct FPlayerPlayerEvent* GameEventData) {}
	virtual void HandlePlayerLocationsEvent(struct FGameEventHeader& GameEvent, struct FPlayerLocationsEvent* GameEventData) {}
	virtual void HandleWeaponIntEvent(struct FGameEventHeader& GameEvent, struct FWeaponIntEvent* GameEventData) {}
	virtual void HandleDamageIntEvent(struct FGameEventHeader& GameEvent, struct FDamageIntEvent* GameEventData) {}
	virtual void HandleProjectileIntEvent(struct FGameEventHeader& GameEvent, struct FProjectileIntEvent* GameEventData) {}

	/** Access the current session info */
	const FGameSessionInformation& GetSessionInfo() const
	{
		check(Reader);
		return Reader->CurrentSessionInfo;
	}

	/** Returns the metadata associated with the given index */
	virtual const FGameplayEventMetaData& GetEventMetaData(INT EventID) const
	{
		check(Reader);
		return Reader->GetEventMetaData(EventID);
	}

	/** Returns the metadata associated with the given index */
	const FTeamInformation& GetTeamMetaData(INT TeamIndex) const
	{
		check(Reader);
		return Reader->GetTeamMetaData(TeamIndex);
	}

	/** Returns the metadata associated with the given index */
	const FPlayerInformationNew& GetPlayerMetaData(INT PlayerIndex) const
	{
		check(Reader);
		return Reader->GetPlayerMetaData(PlayerIndex);
	}

	/** Returns the metadata associated with the given index */
	const FPawnClassEventData& GetPawnMetaData(INT PawnClassIndex) const
	{
		check(Reader);
		return Reader->GetPawnMetaData(PawnClassIndex);
	}

	/** Returns the metadata associated with the given index */
	const FWeaponClassEventData& GetWeaponMetaData(INT WeaponClassIndex) const
	{
		check(Reader);
		return Reader->GetWeaponMetaData(WeaponClassIndex);
	}

	/** Returns the metadata associated with the given index */
	const FDamageClassEventData& GetDamageMetaData(INT DamageClassIndex) const
	{
		check(Reader);
		return Reader->GetDamageMetaData(DamageClassIndex);
	}

	/** Returns the metadata associated with the given index */
	const FProjectileClassEventData& GetProjectileMetaData(INT ProjectileClassIndex) const
	{
		check(Reader);
		return Reader->GetProjectileMetaData(ProjectileClassIndex);
	}

	/**
	 * Returns the metadata associated with the given index
	 * @param ActorIndex the index of the actor being looked up
	 * @return the name of the actor at that index
	 */
	const FString& GetActorMetaData(INT ActorIndex) const
	{
		check(Reader);
		return Reader->GetActorMetaData(ActorIndex);
	}

	/**
	 * Returns the metadata associated with the given index
	 * @param SoundIndex the index of the soundcue being looked up
	 * @return the name of the actor at that index
	 */
	const FString& GetSoundMetaData(INT SoundIndex) const
	{
		check(Reader);
		return Reader->GetSoundMetaData(SoundIndex);
	}

	/** Returns whether or not this processor handles this event */
	inline UBOOL IsEventFiltered(int EventID) const
	{
		return (EventIDFilter.FindItemIndex(EventID) != INDEX_NONE);
	}
}

/** Array of event types that will be ignored */
var config array<int> EventIDFilter;

/** Array of groups to filter, expands out into EventIDFilter above */
var config array<GameStatGroup> GroupFilter;

/** Reference to the reader for access to metadata, etc */
var transient private{protected} GameplayEventsReader Reader;

/** Set the reader on this handler */
function SetReader(GameplayEventsReader NewReader)
{
	Reader = NewReader;
}

/** A chance to do something before the stream starts */
native event PreProcessStream();

/** A chance to do something after the stream ends */
event PostProcessStream();

/** Iterate over all events, checking to see if they should be filtered out by their group */
event ResolveGroupFilters()
{
	local int EventIdx, FilterIdx;

	for (EventIdx=0; EventIdx<Reader.SupportedEvents.length; EventIdx++)
	{
		// Are we filtering this stats group at all?
		FilterIdx = GroupFilter.Find('Group', Reader.SupportedEvents[EventIdx].StatGroup.Group);
		if (FilterIdx != INDEX_NONE)
		{
			// Stats filter above the indicated level
			if (Reader.SupportedEvents[EventIdx].StatGroup.Level > GroupFilter[FilterIdx].Level)
			{
				AddFilter(Reader.SupportedEvents[EventIdx].EventID);
			}
		}
	}
}

/** Add an event id to ignore while processing */
function AddFilter(int EventID)
{
	if (EventIDFilter.Find(EventID) == INDEX_NONE)
	{
		EventIDFilter.AddItem(EventID);
	}
}

/** Remove an event id to ignore while processing */
function RemoveFilter(int EventID)
{
	EventIDFilter.RemoveItem(EventID);
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: må 7-2-2011 21:08:06.000 - Creation time: ti 22-3-2011 19:57:06.079 - Created with UnCodeX