-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnalytics.cpp
102 lines (79 loc) · 2.14 KB
/
Analytics.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// Fabric.cpp
// Maw Kit
//
// Created by Lluís Ulzurrun de Asanza Sàez on 18/02/16.
//
//
#include "Analytics.hpp"
#include "_Analytics.hpp"
#include "cocos2d.h"
#include "Features.hpp"
#include "Random.hpp"
namespace MK {
namespace Analytics {
/**
* Logs frames per second.
*
* @param isIntensive Whether this log is due to intensive performance
* information report or a regular performance information
* report. Defaults to false.
*/
void logPerformance( const bool isIntensive );
void logEvent( const std::string &event )
{
if ( !enabled() ) return;
_logEvent( event );
}
void logEvent( const std::string &event, const std::map<std::string, std::string> &attr )
{
if ( !enabled() ) return;
_logEvent( event, attr );
}
void logEvent( const std::string &event, const std::map<std::string, double> &attr )
{
if ( !enabled() ) return;
_logEvent( event, attr );
}
void logLevelStart( const std::string &levelName )
{
std::map<std::string, double> emptyMap;
logLevelStart( levelName, emptyMap );
}
void logLevelStart( const std::string &levelName,
const std::map<std::string, std::string> &attributes )
{
if ( !enabled() ) return;
_logLevelStart( levelName, attributes );
}
void logLevelStart( const std::string &levelName, const std::map<std::string, double> &attributes )
{
if ( !enabled() ) return;
_logLevelStart( levelName, attributes );
}
void logLevelEnd( const std::string &levelName,
const long long score,
const bool succeeded,
const std::map<std::string, std::string> &attr )
{
if ( !enabled() ) return;
_logLevelEnd( levelName, score, succeeded, attr );
}
void logLevelEnd( const std::string &levelName,
const long long score,
const bool succeeded,
const std::map<std::string, double> &attr )
{
if ( !enabled() ) return;
_logLevelEnd( levelName, score, succeeded, attr );
}
void logNonReadyVideoRewardDisplay()
{
logEvent( "Non ready video reward shown" );
}
const bool enabled()
{
return Features::Analytics;
}
}; // namespace Analytics
}; // namespace MK