User Manual

Class uiink::Listener

Listeners are used to watch for changes made on Data, typically from user input.

Examples

var listener = new Listener(Listener.Flags.ALL_CHANGES);
var main = ink.Source("main");
var d = main.Append("entries");
d.AddListener(listener);
d.SetString("label", "Hello World!");

ink.Step(0.016f);
var ev = listener.Poll();
AssertEquals(ev.eventType, DataEvent.EventType.Change);

Inner Classes

Methods

Listener(int flags)
void MakeGlobal(Ink ink)

Causes this listener to watch for changes on all Data.

Listeners can be attached to individual data using Data.AddListener.

Examples

var ink = new Ink(0);
ink.LoadGuiBin("gui.bin");
var listener = new Listener(Listener.Flags.ALL_CHANGES);
listener.MakeGlobal(ink);

var main = ink.Source("main");
var d = main.Append("entries");
d.SetString("label", "Hello World!");

ink.Step(0.016f);
AssertEquals(listener.Poll().eventType, DataEvent.EventType.NewSource);
AssertEquals(listener.Poll().eventType, DataEvent.EventType.Append);
AssertEquals(listener.Poll().eventType, DataEvent.EventType.Change);

DataEvent Poll()

Fetches the next unhandled data event.

If there are no new data events since the last call to Poll() or Wait(), null will be returned.

DataEvent Wait()

Returns the next DataEvent in the queue or waits for for a new event if the queue is empty.