Esempio n. 1
0
 /// <summary>
 /// Tick the input service
 /// </summary>
 /// <param name="deltaTime"></param>
 public void Tick(float deltaTime)
 {
     if (inputEnabled)
     {
         //Check button down
         foreach (KeyValuePair <object, List <Func <bool> > > kv in buttonDownHandlers)
         {
             if (GetButtonDown(kv.Key))
             {
                 _eventService.Publish(new Events.ButtonDownEvent()
                 {
                     button = kv.Key
                 });
             }
         }
         //Check button up
         foreach (KeyValuePair <object, List <Func <bool> > > kv in buttonUpHandlers)
         {
             if (GetButtonUp(kv.Key))
             {
                 _eventService.Publish(new Events.ButtonUpEvent()
                 {
                     button = kv.Key
                 });
             }
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Sets the string.
        /// </summary>
        /// <param name="key">Key.</param>
        /// <param name="value">Value.</param>
        /// <param name="userID">User I.</param>
        public void SetString(string key, string value, string userID = default(string))
        {
            //Store data via backend service
            System.Collections.Generic.Dictionary <string, string> data = new System.Collections.Generic.Dictionary <string, string>();
            data.Add(key, value);

            Service.Backend.Commands.UpdateUserDataCommand cmd = new Service.Backend.Commands.UpdateUserDataCommand();
            cmd.Data   = data;
            cmd.UserID = userID;
            _eventService.Publish(cmd);
        }
Esempio n. 3
0
 void OnApplicationFocus(bool hasFocus)
 {
     if (eventService != null)
     {
         if (hasFocus)
         {
             eventService.Publish(new Events.OnApplicationFocus());
         }
         else
         {
             eventService.Publish(new Events.OnApplicationLostFocus());
         }
     }
 }
Esempio n. 4
0
 void Start()
 {
     //Resolve disposableManager
     dManager = Container.Resolve <DisposableManager>();
     //Let the program know, that Kernel has finished loading
     eventService = Container.Resolve <Service.Events.IEventsService>();
     eventService.Publish(new Events.KernelReadyEvent());
 }
Esempio n. 5
0
        void Initialize(
            [Inject] DisposableManager dManager,
            [Inject] Service.Events.IEventsService eventService
            )
        {
            _dManager     = dManager;
            _eventService = eventService;

            _dManager.Add(this);

            //Fire events on button up/down
            disposables.Add(Observable.EveryUpdate().Subscribe(e => {
                if (inputEnabled)
                {
                    //Check button down
                    foreach (KeyValuePair <object, List <Func <bool> > > kv in buttonDownHandlers)
                    {
                        if (GetButtonDown(kv.Key))
                        {
                            _eventService.Publish(new Events.ButtonDownEvent()
                            {
                                button = kv.Key
                            });
                        }
                    }
                    //Check button up
                    foreach (KeyValuePair <object, List <Func <bool> > > kv in buttonUpHandlers)
                    {
                        if (GetButtonUp(kv.Key))
                        {
                            _eventService.Publish(new Events.ButtonUpEvent()
                            {
                                button = kv.Key
                            });
                        }
                    }
                }
            }));
        }
Esempio n. 6
0
        /// <summary>
        /// Shows an interstitial ad
        /// </summary>
        public void Show()
        {
#if UNITY_ADS
            if (!UnityEngine.Advertisements.Advertisement.IsReady(videoZoneID))
            {
                Debug.Log("Ads not ready for " + videoZoneID);
                _eventService.Publish(new Events.ShownEvent()
                {
                    result = Events.AdvertisementResultEnum.NotReady
                });
                return;
            }

            UnityEngine.Advertisements.ShowOptions options = new UnityEngine.Advertisements.ShowOptions();
            options.resultCallback = HandleAdShown;
            UnityEngine.Advertisements.Advertisement.Show(videoZoneID, options);
#endif
        }
Esempio n. 7
0
 /// <summary>
 /// Publish the specified global event.
 /// </summary>
 /// <param name="evt">Evt.</param>
 protected void Publish(object evt)
 {
     eventService.Publish(evt);
 }
Esempio n. 8
0
 /// <summary>
 /// Publish the specified global event.
 /// </summary>
 /// <param name="evt">Evt.</param>
 public void Publish(object evt)
 {
     _eventService.Publish(evt);
 }