Skip to content

Instantly share code, notes, and snippets.

@Leopotam
Created January 15, 2018 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Leopotam/b2112ffcd2c82cd11f072b7ba6bc6b0f to your computer and use it in GitHub Desktop.
Save Leopotam/b2112ffcd2c82cd11f072b7ba6bc6b0f to your computer and use it in GitHub Desktop.
using LeopotamGroup.Ecs.Ui.Components;
using UnityEngine;
namespace LeopotamGroup.Ecs.Ui.Tests {
public class TestUiInputEventSystem : IEcsRunSystem {
[EcsWorld]
EcsWorld _world;
[EcsFilterInclude (typeof (EcsUiInputChangeEvent))]
EcsFilter _inputChangeEvents;
[EcsFilterInclude (typeof (EcsUiInputEndEvent))]
EcsFilter _inputEndEvents;
public EcsRunSystemType GetRunSystemType () {
return EcsRunSystemType.Update;
}
public void Run () {
foreach (var entity in _inputChangeEvents.Entities) {
var data = _world.GetComponent<EcsUiInputChangeEvent> (entity);
Debug.LogFormat (data.Sender, "Input changed: {0}", data.Value);
}
foreach (var entity in _inputEndEvents.Entities) {
var data = _world.GetComponent<EcsUiInputEndEvent> (entity);
Debug.LogFormat (data.Sender, "Input end: {0}", data.Value);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment