コード例 #1
0
        /// <summary>
        /// Sends events to server.
        /// </summary>
        public void Send()
        {
            if ((PlayFabClientAPI.IsClientLoggedIn()) && (isSending == false))
            {
                isSending = true;

                EventsModels.WriteEventsRequest request = new EventsModels.WriteEventsRequest();
                request.Events = new List <EventsModels.EventContents>();

                while ((eventsRequests.Count > 0) && (request.Events.Count < maxBatchSizeInEvents))
                {
                    EventsModels.EventContents eventInfo = eventsRequests.Dequeue();
                    request.Events.Add(eventInfo);
                }

                if (request.Events.Count > 0)
                {
                    PlayFabEventsAPI.WriteEvents(request, EventSentSuccessfulCallback, EventSentErrorCallback);
                }

                isSending = false;
            }
        }
コード例 #2
0
        public override void Tick(UUnitTestContext testContext)
        {
            if (pubSub != null && pubSub.State == PersistentSocketState.Opened && DateTime.Now > nextWrite)
            {
                UpdateNextWriteTime();
                EventsModels.WriteEventsRequest req = new EventsModels.WriteEventsRequest();

                EventsModels.EventContents ec = new EventsModels.EventContents();

                ec.Entity      = new EventsModels.EntityKey();
                ec.Entity.Id   = _MyEntityKey.Id;
                ec.Entity.Type = _MyEntityKey.Type;
                ec.Name        = testName;

                ec.EventNamespace = ns;
                ec.PayloadJSON    = $"{{\"CurrentTime\" : \"{DateTime.Now}\"}}";

                req.Events = new List <EventsModels.EventContents>();
                req.Events.Add(ec);

                PlayFabEventsAPI.WriteEvents(req, null, null);
            }
        }