// This class handles game design events, such as kills, deaths, high scores, etc.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using GameAnalyticsSDK.Wrapper;
namespace GameAnalyticsSDK.Events
{
public static class GA_Design
{
#region public methods
///
/// Creates a new event
///
///
/// A event string you define
///
///
/// A value of the event
///
/// Custom fields.
public static void NewEvent(string eventName, float eventValue, IDictionary fields, bool mergeFields)
{
CreateNewEvent(eventName, eventValue, fields, mergeFields);
}
///
/// Creates a new event
///
///
/// A event string you define
///
/// Custom fields.
public static void NewEvent(string eventName, IDictionary fields, bool mergeFields)
{
CreateNewEvent(eventName, null, fields, mergeFields);
}
#endregion
#region private methods
///
/// Adds a custom event to the submit queue (see GA_Queue)
///
///
/// Identifies the event so this should be as descriptive as possible. PickedUpAmmo might be a good event name. EventTwo is a bad event name!
///
///
/// A value relevant to the event. F.x. if the player picks up some shotgun ammo the eventName could be "PickedUpAmmo" and this value could be "Shotgun". This can be null
///
/// Custom fields.
private static void CreateNewEvent(string eventName, float? eventValue, IDictionary fields, bool mergeFields)
{
if(eventValue.HasValue)
{
GA_Wrapper.AddDesignEvent(eventName, eventValue.Value, fields, mergeFields);
}
else
{
GA_Wrapper.AddDesignEvent(eventName, fields, mergeFields);
}
}
#endregion
}
}