Exemplo n.º 1
0
        override internal EventAction RecordEvent <T>(T gameEvent)
        {
            if (!started)
            {
                throw new Exception("You must first start the SDK via the StartSDK method");
            }
            else if (whitelistEvents.Count != 0 && !whitelistEvents.Contains(gameEvent.Name))
            {
                Logger.LogDebug("Event " + gameEvent.Name + " is not whitelisted, ignoring");
                return(EventAction.CreateEmpty(gameEvent as GameEvent));
            }

            gameEvent.AddParam("platform", Platform);
            gameEvent.AddParam("sdkVersion", Settings.SDK_VERSION);

            var eventSchema = gameEvent.AsDictionary();

            eventSchema["userID"]    = this.UserID;
            eventSchema["sessionID"] = this.SessionID;
            eventSchema["eventUUID"] = Guid.NewGuid().ToString();

            string currentTimestmp = GetCurrentTimestamp();

            if (currentTimestmp != null)
            {
                eventSchema["eventTimestamp"] = GetCurrentTimestamp();
            }

            try {
                string json = MiniJSON.Json.Serialize(eventSchema);
                if (!this.eventStore.Push(json))
                {
                    Logger.LogWarning("Event store full, dropping '" + gameEvent.Name + "' event.");
                }
            } catch (Exception ex) {
                Logger.LogWarning("Unable to generate JSON for '" + gameEvent.Name + "' event. " + ex.Message);
            }

            return(new EventAction(
                       gameEvent as GameEvent,
                       eventTriggers.ContainsKey(gameEvent.Name)
                    ? eventTriggers[gameEvent.Name]
                    : EventAction.EMPTY_TRIGGERS,
                       actionStore));
        }
Exemplo n.º 2
0
 override internal EventAction RecordEvent <T>(T gameEvent)
 {
     return(EventAction.CreateEmpty(gameEvent as GameEvent));
 }
Exemplo n.º 3
0
        public void EmptyEventActionsRunWithoutError()
        {
            var e = new GameEvent("event");

            EventAction.CreateEmpty(e).Run();
        }