Пример #1
0
 public void EventTriggerLogic()
 {
     if(Input.GetKeyDown(KeyCode.Alpha1))
     {
         CustomEvent tmp = new CustomEvent();
         InputManager.Dispatch<CustomEvent>(tmp);
     }
 }
Пример #2
0
    // ReSharper restore UnusedMember.Local
    // ReSharper disable UnusedMember.Local
    void OnMouseDown()
    {
        Debug.Log("EventDispatcherScript2: dispatching event");

        // custom event
        CustomEvent customEvent = new CustomEvent(OBJECT_CLICKED);
        customEvent.Position = transform.position;
        DispatchEvent(customEvent);
    }
Пример #3
0
    public void DeleteMethodHandler(CustomEvent customEvent)
    {
        int eventIndex = Events.GetEventIndex(customEvent.ID);

        if (eventIndex >= 0)
        {
            Events.RemoveAt(eventIndex);
        }
    }
Пример #4
0
    public static void TriggerEvent(EventType eventType, string message = null)
    {
        CustomEvent thisEvent = null;

        if (Instance.m_EventMap.TryGetValue(eventType, out thisEvent))
        {
            thisEvent.Invoke(message);
        }
    }
        private void CheckCustomEvent(JToken t, CustomEvent e, JToken userJson)
        {
            JObject o = t as JObject;

            Assert.Equal("custom", (string)o["kind"]);
            Assert.Equal(e.Key, (string)o["key"]);
            Assert.Equal(e.JsonData, o["data"]);
            CheckEventUserOrKey(o, e, userJson);
        }
Пример #6
0
    // Start is called before the first frame update

    public virtual void OnHitElement(Element element)
    {
        switch (element)
        {
        default:
            CustomEvent.Trigger(gameObject, "OnHitElement", element);
            break;
        }
    }
Пример #7
0
        public void AlertOn()
        {
            Timer         timerAlert    = new Timer();
            List <IEvent> events        = new List <IEvent>();
            var           exerciseEvent = new CustomEvent
            {
                StartDate          = Convert.ToDateTime("5/5/2017 12:00:00 AM"),
                EndDate            = Convert.ToDateTime("7/7/2017 12:00:00 AM"),
                RecurringFrequency = RecurringFrequencies.Daily,
                EventLengthInHours = 1,
                Alert     = 1,
                EventText = "test",
                EventFont = Global.CustomFont,
                Days      = new List <DayOfWeek>()
                {
                    DayOfWeek.Thursday, DayOfWeek.Sunday
                }
            };

            events.Add(exerciseEvent);

            bool play    = true;
            bool success = false;

            foreach (IEvent evt in events)
            {
                if (DateTime.Today.Date.DayOfYear >= evt.StartDate.DayOfYear && DateTime.Today.Date.DayOfYear <= evt.EndDate.DayOfYear)
                {
                    if (DateTime.Today.Year >= evt.StartDate.Year && DateTime.Today.Year <= evt.EndDate.Year)
                    {
                        if (evt.StartDate.ToShortTimeString() == "12:00 AM" && evt.Alert == 1)
                        {
                            foreach (DayOfWeek d in evt.Days)
                            {
                                if (DayOfWeek.Thursday == d)
                                {
                                    evt.Alert = 0;
                                    SoundPlayer s = new SoundPlayer(Properties.Resources.alert);
                                    if (play)
                                    {
                                        success = true;
                                        s.Play();
                                        if (MessageBox.Show("Your event: " + evt.EventText + " has been started !", "Reminder", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) == DialogResult.OK)
                                        {
                                            s.Stop();
                                        }
                                    }
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            Assert.AreEqual(true, success);
        }
Пример #8
0
 public void BroEventHandler(CustomEvent ce)
 {
     if ("Action".Equals(ce ["Type"]) && "Damage".Equals(ce ["Action"]))
     {
         if (id.Equals(ce ["TargetId"]))
         {
             damage((int)ce ["DamageValue"]);
         }
     }
 }
Пример #9
0
        public ActionResult DeleteCustomEvent(int cEventID)
        {
            CustomEvent deletedCustomEvent = customEventRepo.DeleteCustomEvent(cEventID);

            if (deletedCustomEvent != null)
            {
                TempData["message"] = "Delete success";
            }
            return(RedirectToAction("CustomEventManaging"));
        }
Пример #10
0
 public void publishCustomEvent(object message, string[] notifyList)
 {
     try {
         CustomEvent customEvent = new CustomEvent();
         customEvent.Info = new CustomEvent.EventInfo(message, notifyList);
         _outer.Publish(customEvent);
     } catch (Exception e) {
         JSEngineManager.Engine.Log(e.Message);
     }
 }
    /// <summary>
    /// Example using event system. Пример с передачей аргументов
    /// </summary>
    /// <param name="_event"></param>
    private void OnExampleHandler(CustomEvent _event)
    {
        //EventData может быть любым типом, главное - явное преобразование типов
        //в данном примере мы ожидаем, что EventData - целое число (н-р, количество полученных монет)
        //если событие не нуждается в аргументах - просто не используем EventData
        var arg = (int)_event.EventData;

        money += arg;
        UpdateMoneyUI();
    }
    public void UpdateMethodHandler(CustomEvent customEvent)
    {
        int eventIndex = Events.GetEventIndex(customEvent.Id);

        if (eventIndex >= 0)
        {
            Events.RemoveAt(eventIndex);
            Events.Insert(eventIndex, customEvent);
        }
    }
Пример #13
0
    public static void TriggerEvent(CustomEventData eventData)
    {
        CustomEvent thisEvent = null;

        DebugLog.WriteLog("Event Broadcasted: " + eventData.eventName);
        if (instance.eventDictionary.TryGetValue(eventData.eventName, out thisEvent))
        {
            thisEvent.Invoke(eventData);
        }
    }
Пример #14
0
// ReSharper disable UnusedMember.Local
    void OnMouseDown()
// ReSharper restore UnusedMember.Local
    {
        Debug.Log("EventDispatcherScript2: dispatching event");
        
        // custom event
        CustomEvent customEvent = new CustomEvent(OBJECT_CLICKED, (object)gameObject);
        customEvent.Position = transform.position;
        Dispatcher.DispatchEvent(customEvent);
    }
    // raise a specifitic custom event
    // METHODS
    public void Raise(CustomEvent e)
    {
        MyEventHandler handler = RaiseEventTest; // assign a delegate with the event

        if (handler != null)
        {
            Console.WriteLine("Publishing an event.");
            handler(this, e); // raise it
        }
    }
    public event MyEventHandler RaiseEventTest; // declare an event from the delegate

    // METHODS

    public void Raise(CustomEvent e)             // raise a specifitic custom event
    {
        MyEventHandler handler = RaiseEventTest; // assign a delegate with the event

        if (handler != null)
        {
            Console.WriteLine("Publishing an event.");
            handler(this, e); // raise it
        }
    }
Пример #17
0
    public static void TriggerEvent(string eventName, System.Object arg = null)
    {
        CustomEvent thisEvent = null;

        if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent))
        {
            Debug.Log(eventName + " triggered.");
            thisEvent.Invoke(arg);
        }
    }
Пример #18
0
        public void Fire()
        {
            GameObject smokeInsr      = PooledObjects.Instance.RequestGameObject(GameObjectPool.SmokeGrenade);
            Vector3    deployPosition = agent.transform.position;

            smokeInsr.transform.position = deployPosition;
            EventTrigger smokeBomb = new CustomEvent(deployPosition, EventSubject.SmokeBomb, GameConfig.smokeBombPriotity, GameConfig.smokeBombEnableTime, false);

            EventObserver.Subscribe(smokeBomb);
        }
Пример #19
0
 public void BroEventHandler(CustomEvent ce)
 {
     if ((string)ce ["Type"] == "Action" && (string)ce ["Action"] == "Damage")
     {
         if ((int)ce ["TargetId"] == id)
         {
             damage((int)ce ["DamageValue"]);
         }
     }
 }
Пример #20
0
    //Handles failure state
    public void ReceiveEvent(CustomEvent evt)
    {
        if(evt.GetEventName() == "Time Up")
        {
            //game over
            gameOver = 1;
            StartCoroutine(pause());

        }
    }
Пример #21
0
        /// <summary>
        /// Sends the complete list of games to one actor in the lobby.
        /// </summary>
        /// <param name="actor">
        /// The actor.
        /// </param>
        private void PublishGameList(Actor actor)
        {
            // Room list needs to be cloned because it is serialized in other thread and is changed at the same time
            var customEvent = new CustomEvent(actor.ActorNr, (byte)LiteLobbyEventCode.GameList,
                                              (Hashtable)this.roomList.Clone());

            this.PublishEvent(customEvent, actor, new SendParameters {
                Unreliable = true
            });
        }
 private void AssignProperties(CustomEvent customEvent, Event newEvent)
 {
     newEvent.Summary        = customEvent.SourceEvent.Summary;
     newEvent.Description    = customEvent.SourceEvent.Description;
     newEvent.Location       = customEvent.SourceEvent.Location;
     newEvent.Start          = customEvent.SourceEvent.Start;
     newEvent.Start.TimeZone = CalendarApiHelper.GetVTimeZone(timeZoneId);
     newEvent.End            = customEvent.SourceEvent.End;
     newEvent.End.TimeZone   = CalendarApiHelper.GetVTimeZone(timeZoneId);
 }
Пример #23
0
        public static void Main()
        {
            //No Scroll Bar
            Document.Body.Style.Overflow = Overflow.Hidden;

            //Adding Background
            Bridge.Console.Info("Loading Background");
            double imgPixels   = Math.Max(Window.Screen.Width, Window.Screen.Height);
            string imgSelector =
                imgPixels >= 1920 ? "../img/City_Wallpaper_orig_low.jpg" :
                imgPixels >= 1280 ? "../img/City_Wallpaper_1920X1080.jpg" :
                imgPixels >= 320 ? "../img/City_Wallpaper_1280X720.jpg" :
                "../img/City_Wallpaper_320X180";

            new HTMLBackground(imgSelector, 0.82);

            //Loading button list to display
            Bridge.Console.Info("Loading JSON file");
            string json = StaticTools.loadDoc("../data/box_list.json");

            List <StaticTools.pulsTimer> ptList  = new List <StaticTools.pulsTimer> ();
            List <StaticTools.urlBox>    urlList = new List <StaticTools.urlBox> ();

            //string json = "{\"box_list\":[{...}]}";
            ptList.AddRange((JSON.Parse(json) ["box_list"]) as IEnumerable <StaticTools.pulsTimer>);
            urlList.AddRange((JSON.Parse(json) ["box_urls"]) as IEnumerable <StaticTools.urlBox>);
            string arduino_URL = JSON.Parse(json) ["arduino_URL"] as string;

            Bridge.Console.Info("Loading boxStructure");
            HTMLBoxStructure boxStructure = new HTMLBoxStructure();


            //Adding all pulseTimer Events
            Bridge.Console.Info("Loading pulseTimer boxes");
            foreach (StaticTools.pulsTimer pt in ptList)
            {
                StaticTools.addArduinoLightBox(boxStructure, pt.name, arduino_URL, JSON.Stringify(pt));
            }

            //Adding an external link
            Bridge.Console.Info("Loading url boxes");
            foreach (StaticTools.urlBox ub in urlList)
            {
                boxStructure.addBox(new HTMLBox(ub.name, delegate {
                    Window.Open(ub.url, "_blank");
                }));
            }

            Window.SetTimeout(delegate {
                //toggle resize event manually
                CustomEvent ev = new CustomEvent("resize", new CustomEventInit());
                ev.InitCustomEvent("resize", true, false, new object());
                Window.DispatchEvent(ev);
            }, 10);
        }
 private static void BuyComplete(IAPOperationStatus status, string message, StoreProduct product)
 {
     if (status == IAPOperationStatus.Success)
     {
         CustomEvent.Trigger(buyEventTarget, "BuyComplete", true);
     }
     else
     {
         CustomEvent.Trigger(buyEventTarget, "BuyComplete", false);
     }
 }
Пример #25
0
        private void calendar1_Load(object sender, EventArgs e)
        {
            var exerciseEvent = new CustomEvent
            {
                Date = DateTime.Now,
                RecurringFrequency = RecurringFrequencies.Yearly,
                EventText          = "RJ BAYOT!"
            };

            calendar1.AddEvent(exerciseEvent);
        }
Пример #26
0
 private void OnLevelStarted(CustomEvent LevelStartedEvent)
 {
     waveNumber        = 0;
     currentWaveLength = 0;
     timeBetweenWaves  = 0;
     timeBetweenSpawns = 0;
     damageIncremental = 0;
     healthIncremental = 0;
     rewardIncremental = 0;
     isSpawning        = true;
 }
Пример #27
0
        public CustomEvent DeleteCustomEvent(int cEventID)
        {
            CustomEvent dbEntry = context.CustomEvents.Find(cEventID);

            if (dbEntry != null)
            {
                context.CustomEvents.Remove(dbEntry);
                context.SaveChanges();
            }
            return(dbEntry);
        }
Пример #28
0
// ReSharper disable UnusedMember.Local
    void OnMouseDown()
// ReSharper restore UnusedMember.Local
    {
        Debug.Log("EventDispatcherScript2: dispatching event");

        // custom event
        CustomEvent customEvent = new CustomEvent(OBJECT_CLICKED, (object)gameObject);

        customEvent.Position = transform.position;
        Dispatcher.DispatchEvent(customEvent);
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        CustomEvent s = (CustomEvent)target;

        if (GUILayout.Button("Play"))
        {
            s.Rise();
        }
    }
Пример #30
0
 public void LogEvent(string name, string category, string eventName, string eventData)
 {
     if (Enabled && _manager != null)
     {
         var loggingEvent = new CustomEvent(name);
         loggingEvent.AddAttribute(Constants.Tracking.Category, category);
         loggingEvent.AddAttribute(Constants.Tracking.EventName, eventName);
         loggingEvent.AddAttribute(Constants.Tracking.EventData, eventData);
         _manager.RecordEvent(loggingEvent);
     }
 }
Пример #31
0
        /// <summary>
        ///   Helper method of <see cref = "HandleRaiseEventOperation" />.
        ///   Stores an event for new actors.
        /// </summary>
        /// <param name = "actor">
        ///   The actor.
        /// </param>
        /// <param name = "raiseEventRequest">
        ///   The raise event request.
        /// </param>
        /// <param name="msg">
        ///   Contains an error message if the method returns false.
        /// </param>
        /// <returns>
        ///   True if <see cref = "RaiseEventRequest.Cache" /> is valid.
        /// </returns>
        protected bool UpdateEventCache(Actor actor, RaiseEventRequest raiseEventRequest, out string msg)
        {
            msg = null;
            CustomEvent customEvent;

            switch (raiseEventRequest.Cache)
            {
            case (byte)CacheOperation.DoNotCache:
                return(true);

            case (byte)CacheOperation.AddToRoomCache:
                customEvent = new CustomEvent(actor.ActorNr, raiseEventRequest.EvCode, raiseEventRequest.Data);
                this.eventCache.AddEvent(customEvent);
                return(true);

            case (byte)CacheOperation.AddToRoomCacheGlobal:
                customEvent = new CustomEvent(0, raiseEventRequest.EvCode, raiseEventRequest.Data);
                this.eventCache.AddEvent(customEvent);
                return(true);
            }

            // cache operations for the actor event cache currently only working with hashtable data
            Hashtable eventData;

            if (raiseEventRequest.Data == null || raiseEventRequest.Data is Hashtable)
            {
                eventData = (Hashtable)raiseEventRequest.Data;
            }
            else
            {
                msg = string.Format("Cache operation '{0}' requires a Hashtable as event data.", raiseEventRequest.Cache);
                return(false);
            }


            switch (raiseEventRequest.Cache)
            {
            case (byte)CacheOperation.MergeCache:
                this.actorEventCache.MergeEvent(actor.ActorNr, raiseEventRequest.EvCode, eventData);
                return(true);

            case (byte)CacheOperation.RemoveCache:
                this.actorEventCache.RemoveEvent(actor.ActorNr, raiseEventRequest.EvCode);
                return(true);

            case (byte)CacheOperation.ReplaceCache:
                this.actorEventCache.ReplaceEvent(actor.ActorNr, raiseEventRequest.EvCode, eventData);
                return(true);

            default:
                msg = string.Format("Unknown cache operation '{0}'.", raiseEventRequest.Cache);
                return(false);
            }
        }
Пример #32
0
 public void AddRandomEvent()
 {
     try
     {
         var eventDate   = new DateTime(2020, 10, _dayEventToStart);
         var customEvent = new CustomEvent(_dayEventToStart, "Nome evento", eventDate, eventDate, false);
         Events.Add(customEvent);
         _dayEventToStart++;
     }
     catch (Exception) { }
 }
Пример #33
0
 public void LogError(string name, string title, string message)
 {
     if (Enabled && _manager != null)
     {
         var loggingEvent = new CustomEvent(Constants.Tracking.UserError);
         loggingEvent.AddAttribute(Constants.Tracking.UserErrorView, name);
         loggingEvent.AddAttribute(Constants.Tracking.UserErrorTitle, title);
         loggingEvent.AddAttribute(Constants.Tracking.UserErrorMessage, message);
         _manager.RecordEvent(loggingEvent);
     }
 }
Пример #34
0
        public virtual void Submit(CustomEvent customEvent)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("CustomEvent: " + customEvent.eventName);
            foreach (var data in customEvent.eventData)
            {
                sb.AppendLine(data.Key + ": " + data.Value);
            }
            Log(sb.ToString());
        }
        private void OnGameplayCameraEnableHandler(CustomEvent _event)
        {
            var state = (bool)_event.EventData;

            if (state && camera == null)
            {
                camera = ComponentLocator.Resolve <GameplayCameraController>();
            }

            SetEnable(state);
        }
Пример #36
0
    // ReSharper restore UnusedMember.Local
    // ReSharper restore InconsistentNaming
    // ReSharper disable UnusedMember.Local
    void OnMouseDown()
    {
        Debug.Log("EventDispatcherScript: dispatching event");

        //Dispatcher.DispatchEvent(new Event(OBJECT_CLICKED, (object)gameObject)); // setting this.gameObject as Target

        // custom event
        CustomEvent customEvent = new CustomEvent(OBJECT_CLICKED, (object) gameObject);
        customEvent.Position = transform.position;
        Dispatcher.DispatchEvent(customEvent);
    }
        partial void UIButton4_TouchUpInside(UIButton sender)
        {
            // Custom Event Buttoon Handler
            CustomEvent customEvent = new CustomEvent("level_complete");

            customEvent.AddAttribute("LevelName", "Level5");
            customEvent.AddAttribute("Successful", "True");
            customEvent.AddMetric("Score", 12345);
            customEvent.AddMetric("TimeInLevel", 64);

            Manager.RecordEvent(customEvent);
        }
    public void RecordEvent(SinozeAnalyticsEvent e)
    {
        var c = new CustomEvent(e.Name);

        if(e._stringMetas != null)
            foreach(var a in e._stringMetas)
                c.AddAttribute(a.Key, a.Value);
        if(e._numberMetas != null)
            foreach(var m in e._numberMetas)
                c.AddMetric(m.Key, m.Value);

        analyticsManager.RecordEvent(c);
    }
Пример #39
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button customEventButton = FindViewById<Button>(Resource.Id.button_custom_event);
            Button monetizationEventButton = FindViewById<Button>(Resource.Id.button_monetization_event);


            customEventButton.Click += delegate
            {
                CustomEvent customEvent = new CustomEvent("level_complete");

                customEvent.AddAttribute("LevelName", "Level5");
                customEvent.AddAttribute("Successful", "True");
                customEvent.AddMetric("Score", 12345);
                customEvent.AddMetric("TimeInLevel", 64);

                _manager.RecordEvent(customEvent);
            };


            monetizationEventButton.Click += delegate
            {
                MonetizationEvent monetizationEvent = new MonetizationEvent();

                monetizationEvent.Quantity = 10.0;
                monetizationEvent.ItemPrice = 2.00;
                monetizationEvent.ProductId = "ProductId123";
                monetizationEvent.ItemPriceFormatted = "$2.00";
                monetizationEvent.Store = "Amazon";
                monetizationEvent.TransactionId = "TransactionId123";
                monetizationEvent.Currency = "USD";

                _manager.RecordEvent(monetizationEvent);
            };


            // customize your Mobile Analytics Manager Config
            MobileAnalyticsManagerConfig config = new MobileAnalyticsManagerConfig();
            config.AllowUseDataNetwork = true;

            _manager = MobileAnalyticsManager.GetOrCreateInstance(APP_ID, new CognitoAWSCredentials(COGNITO_POOL_ID, COGNITO_REGION), RegionEndpoint.USEast1, config);
        }
Пример #40
0
    public void RecieveEvent(CustomEvent evt)
    {
        if(evt.GetEventName() == "Sword Attack")
        {
            int evtX, evtY, x, y;
            evtX = evt.GetParam(0);
            evtY = evt.GetParam(1);
            x = (int)transform.position.x;
            y = (int)transform.position.y;

            float distance = Vector3.Distance(transform.position, new Vector3(evtX, evtY, 0.0f));

            if(distance < 120.0f)
            {
                this.takeDamage(1, evt.GetParam(2));
            }
        }
    }
        void OnGUI()
        {
            GUILayout.BeginArea(new Rect(0, 0, Screen.width * 0.5f, Screen.height));
            GUILayout.Label("Amazon Mobile Analytics Operations");

            // record custom event
            if (GUILayout.Button("Record Custom Event", GUILayout.MinHeight(Screen.height * 0.2f), GUILayout.Width(Screen.width * 0.4f)))
            {
                CustomEvent customEvent = new CustomEvent("level_complete");

                customEvent.AddAttribute("LevelName", "Level1");
                customEvent.AddAttribute("CharacterClass", "Warrior");
                customEvent.AddAttribute("Successful", "True");
                customEvent.AddMetric("Score", 12345);
                customEvent.AddMetric("TimeInLevel", 64);

                analyticsManager.RecordEvent(customEvent);
            }

            // record monetization event
            if (GUILayout.Button("Record Monetization Event", GUILayout.MinHeight(Screen.height * 0.2f), GUILayout.Width(Screen.width * 0.4f)))
            {
                MonetizationEvent monetizationEvent = new MonetizationEvent();

                monetizationEvent.Quantity = 3.0;
                monetizationEvent.ItemPrice = 1.99;
                monetizationEvent.ProductId = "ProductId123";
                monetizationEvent.ItemPriceFormatted = "$1.99";
                monetizationEvent.Store = "Apple";
                monetizationEvent.TransactionId = "TransactionId123";
                monetizationEvent.Currency = "USD";

                analyticsManager.RecordEvent(monetizationEvent);
            }


            GUILayout.EndArea();

        }
    private void RenameEvent(CustomEvent cEvent)
    {
        var match = _organizer.customEvents.FindAll(delegate(CustomEvent obj) {
            return obj.EventName == cEvent.ProspectiveName;
        });

        if (match.Count > 0) {
            DTGUIHelper.ShowAlert("You already have a Custom Event named '" + cEvent.ProspectiveName + "'. Please choose a different name.");
            return;
        }

        cEvent.EventName = cEvent.ProspectiveName;
    }
Пример #43
0
        private void ResumeSessionHelper()
        {
            DateTime currentTime = DateTime.UtcNow;

            // update session info
            PreStartTime = currentTime;

            // record session resume event
            CustomEvent resumeSessionEvent = new CustomEvent(Constants.SESSION_RESUME_EVENT_TYPE);
            resumeSessionEvent.StartTimestamp = StartTime;
            if (StopTime != null)
                resumeSessionEvent.StopTimestamp = StopTime;
            resumeSessionEvent.SessionId = SessionId;
            resumeSessionEvent.Duration = Duration;

            MobileAnalyticsManager.GetInstance(_appID).RecordEvent(resumeSessionEvent);
        }
Пример #44
0
 //add an event to the event queue
 public void PostEvent(CustomEvent evt)
 {
     mEventQueue.Enqueue(evt);
 }
	private static void SendData(CustomEvent e, Dictionary<string, object> eventData)
	{
		SendData(e.ToString(), eventData);
	}
Пример #46
0
        private void StopSessionHelper()
        {
            DateTime currentTime = DateTime.UtcNow;

            // update session info
            StopTime = currentTime;

            // record session stop event
            CustomEvent stopSessionEvent = new CustomEvent(Constants.SESSION_STOP_EVENT_TYPE);

            stopSessionEvent.StartTimestamp = StartTime;

            if (StopTime != null)
                stopSessionEvent.StopTimestamp = StopTime;
            stopSessionEvent.SessionId = SessionId;
            stopSessionEvent.Duration = Duration;

            MobileAnalyticsManager.GetInstance(_appID).RecordEvent(stopSessionEvent);
        }
Пример #47
0
        private void PauseSessionHelper()
        {
            DateTime currentTime = DateTime.UtcNow;

            // update session info
            StopTime = currentTime;
            Duration += Convert.ToInt64((currentTime - PreStartTime).TotalMilliseconds);

            // record session pause event
            CustomEvent pauseSessionEvent = new CustomEvent(Constants.SESSION_PAUSE_EVENT_TYPE);
            pauseSessionEvent.StartTimestamp = StartTime;

            if (StopTime != null)
                pauseSessionEvent.StopTimestamp = StopTime;
            pauseSessionEvent.SessionId = SessionId;
            pauseSessionEvent.Duration = Duration;
            MobileAnalyticsManager.GetInstance(_appID).RecordEvent(pauseSessionEvent);
        }
        /// <summary>
        /// Records the custom event to the local persistent storage. Background thread will deliver the event later.
        /// </summary>
        /// <param name="customEvent">The Mobile Analytics event.</param>
        public void RecordEvent(CustomEvent customEvent)
        {
            if (null == customEvent)
                throw new ArgumentNullException("customEvent");

            customEvent.Timestamp = DateTime.UtcNow;
            Amazon.MobileAnalytics.Model.Event modelEvent = customEvent.ConvertToMobileAnalyticsModelEvent(this.Session);

            BackgroundDeliveryClient.EnqueueEventsForDelivery(modelEvent);
        }
Пример #49
0
 private void StopSession()
 {
     DateTime currentTime = DateTime.UtcNow;
     
     // record session stop event
     CustomEvent managerEvent = new CustomEvent(SESSION_STOP_EVENT_TYPE);
     lock(_lock)
     {
         if(_stopTime != null)
             managerEvent.StopTimestamp = ((DateTime)_stopTime).ToString(AWSSDKUtils.ISO8601DateFormatNoMS);
         
         managerEvent.Duration = _duration;
     }
     MobileAnalyticsManager.GetInstance(_appid).RecordEvent(managerEvent);
 }
Пример #50
0
	// Dispatch an event
	public bool dispatchEvent(CustomEvent evt) {
		string eventType = evt.type;
		if (!checkForEvent(eventType)) {
			if (allowWarningOutputs) {
				Debug.LogWarning("Event Manager: Event \"" + eventType + "\" triggered has no listeners!");
			}
			return false;
		}
		
		ArrayList listenerList = _listeners[eventType] as ArrayList;
		if (allowDebugOutputs) {
			Debug.Log("Event Manager: Event " + eventType + " dispatched to " + listenerList.Count + ((listenerList.Count == 1) ? " listener." : " listeners."));
		}
		foreach (EventListener callback in listenerList) {
			if (callback.listener && callback.listener.activeSelf) {
				callback.listener.SendMessage(callback.function, evt, SendMessageOptions.DontRequireReceiver);
			}
		}
		return false;
	}
    private void CreateCustomEvent(string newEventName)
    {
        var match = _creator.customEventsToCreate.FindAll(delegate(CustomEvent custEvent) {
            return custEvent.EventName == newEventName;
        });

        if (match.Count > 0) {
            GUIHelper.ShowAlert("You already have a custom event named '" + newEventName + "' configured here. Please choose a different name.");
            return;
        }

        var newEvent = new CustomEvent(newEventName);

        _creator.customEventsToCreate.Add(newEvent);
    }
Пример #52
0
        private void NewSessionHelper()
        {

            StartTime = DateTime.UtcNow;
            PreStartTime = DateTime.UtcNow;
            StopTime = null;
            SessionId = Guid.NewGuid().ToString();
            Duration = 0;

            CustomEvent sessionStartEvent = new CustomEvent(Constants.SESSION_START_EVENT_TYPE);

            sessionStartEvent.StartTimestamp = StartTime;
            sessionStartEvent.SessionId = SessionId;

            MobileAnalyticsManager.GetInstance(_appID).RecordEvent(sessionStartEvent);
        }
    private void RenameEvent(CustomEvent cEvent)
    {
        var match = _creator.customEventsToCreate.FindAll(delegate(CustomEvent obj) {
            return obj.EventName == cEvent.ProspectiveName;
        });

        if (match.Count > 0) {
            GUIHelper.ShowAlert("You already have a custom event named '" + cEvent.ProspectiveName + "' configured here. Please choose a different name.");
            return;
        }

        cEvent.EventName = cEvent.ProspectiveName;
    }
Пример #54
0
    void RecieveEvent(CustomEvent evt)
    {
        if(evt.GetEventName() == "Sword Attack")
        {
            int evtX, evtY;
            evtX = evt.GetParam(0);
            evtY = evt.GetParam(1);

            float distance = Vector3.Distance(transform.position, new Vector3(evtX, evtY, 0.0f));

            if(distance < 40.0f)
            {
                this.takeDamage((int)ATTACK_TYPE.MELEE, evt.GetParam(2));
            }
        }
    }
Пример #55
0
 private void StopSession()
 {
     //DateTime currentTime = DateTime.UtcNow;
     
     // record session stop event
     CustomEvent managerEvent = new CustomEvent(SESSION_STOP_EVENT_TYPE);
     lock(_lock)
     {
         if (_stopTime != null) 
         { 
             managerEvent.StopTimestamp = ((DateTime)_stopTime).ToString(AWSSDKUtils.ISO8601DateFormat);
             managerEvent.Duration = Convert.ToInt64(((DateTime)_stopTime - _startTime).TotalMilliseconds);
         }
     }
     MobileAnalyticsManager.GetInstance(_appid).RecordEvent(managerEvent);
 }
        /// <summary>
        /// Records the custom event to the local persistent storage. Background thread will deliver the event later.
        /// </summary>
        /// <param name="customEvent">The event.</param>
        public void RecordEvent(CustomEvent customEvent)
        {
            customEvent.Timestamp = DateTime.UtcNow.ToString(AWSSDKUtils.ISO8601DateFormat);

            Amazon.MobileAnalytics.Model.Event modelEvent = customEvent.ConvertToMobileAnalyticsModelEvent(this.Session);
            BackgroundDeliveryClient.EnqueueEventsForDelivery(modelEvent);
        }
Пример #57
0
 private void PauseSession()
 {
     DateTime currentTime = DateTime.UtcNow;
    
     // update session info
     lock(_lock)
     {
         _stopTime = currentTime;
         _duration += Convert.ToInt64((currentTime-_preStartTime).TotalMilliseconds);
     }
     
     // record session pause event
     CustomEvent customEvent = new CustomEvent(SESSION_PAUSE_EVENT_TYPE);
     MobileAnalyticsManager.GetInstance(_appid).RecordEvent(customEvent);
 }
Пример #58
0
        private void NewSession()
        {
            lock(_lock)
            {
                _startTime = DateTime.UtcNow;
                _preStartTime = DateTime.UtcNow;
                _stopTime = null;
                _sessionId = Guid.NewGuid().ToString();
                _duration = 0;
            }

            CustomEvent customEvent = new CustomEvent(SESSION_START_EVENT_TYPE);
            MobileAnalyticsManager.GetInstance(_appid).RecordEvent(customEvent);
        }
Пример #59
0
        CustomEvent CreateEvent(object resourceId, string subject, int status, int label, DateTime date)
        {
            int id = (int)resourceId;

            CustomEvent customEvent = new CustomEvent();
            customEvent.Subject = subject;
            customEvent.OwnerId = resourceId;

            int rangeInHours = 1;
            customEvent.StartTime = date + TimeSpan.FromHours(rangeInHours*id);
            customEvent.EndTime = customEvent.StartTime + TimeSpan.FromHours(rangeInHours);
            customEvent.Status = status;
            customEvent.Label = label;
            customEvent.Id = "ev" + customEvent.GetHashCode();
            return customEvent;
        }
Пример #60
0
 private void ResumeSession()
 {
     DateTime currentTime = DateTime.UtcNow;
     
     // update session info
     lock(_lock)
     {
         _preStartTime = currentTime;
     }
     
     // record session resume event
     CustomEvent customEvent = new CustomEvent(SESSION_RESUME_EVENT_TYPE);
     lock(_lock)
     {
         if(_stopTime != null)
             customEvent.StopTimestamp = ((DateTime)_stopTime).ToString(AWSSDKUtils.ISO8601DateFormatNoMS);
             
         customEvent.Duration = _duration;
     }
     MobileAnalyticsManager.GetInstance(_appid).RecordEvent(customEvent);
 }