Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.action.Entities.AI.Interaction.UI.BasicInteractionUI Class Reference
Inheritance diagram for essentials.action.Entities.AI.Interaction.UI.BasicInteractionUI:
essentials.action.Entities.AI.Interaction.UI.IInteractionUI

Public Member Functions

 BasicInteractionUI ()
 
void Display (InteractContract contract)
 
void Close ()
 

Events

Action< int > OnPressed
 

Constructor & Destructor Documentation

essentials.action.Entities.AI.Interaction.UI.BasicInteractionUI.BasicInteractionUI ( )
34  {
35  this.InjectDependencies();
36  _ui = _screen.AddControl(_resolver.Resolve("ui/interaction.xml"));
37  }
string Resolve(string resource)
Resolves the data.
IBuiControl AddControl(string filename)
Add a control by filename

Member Function Documentation

void essentials.action.Entities.AI.Interaction.UI.BasicInteractionUI.Close ( )
65  {
66  //Unbind
67  if (_current.Options != null)
68  {
69  _input.Dispose();
70  _input = null;
71  }
72 
73  _current = null;
74 
75  this._scheduler.ScheduleTask(ChainedTask.Create()
76  .Then( Tween.Linear(1f, 0f, 1f, x => _ui.Invoke("fade", x)) )
77  .Then( () => _ui.Invoke("close"))
78  );
79  }
void Invoke(string name, params object[] args)
Invoke the specified method name with optional arguments
ChainedTask Then(ITask task)
Add a task to run after the current set of tasks
Definition: ChainedTask.cs:48
List< InteractionOption > Options
Definition: InteractContract.cs:12
Definition: ChainedTask.cs:6
static ChainedTask Create()
Definition: ChainedTask.cs:39
IScheduledTask ScheduleTask(ITask task)
Schedules the task.
static ITask Linear(float fromVal, float toVal, double seconds, Action< float > invoke)
Definition: Tween.cs:10
Definition: Tween.cs:6
void essentials.action.Entities.AI.Interaction.UI.BasicInteractionUI.Display ( InteractContract  contract)

Implements essentials.action.Entities.AI.Interaction.UI.IInteractionUI.

42  {
43  _logger.LogInfo("Displaying interaction: {0}", contract.Text);
44 
45  _current = contract;
46  _ui.Invoke("display", contract);
47 
48  if (contract.Options == null || contract.Options.Count == 0)
49  {
50  _scheduler.ScheduleTask(this.Close, TimeSpan.FromSeconds(8));
51  }
52  else
53  {
54  _input = _inputManager.GetBinding(typeof(BasicInteractionUI));
55  for (int i=0; i<10; ++i)
56  {
57  var key = OpenTK.Input.Key.Number1 + i;
58  _input.Bind( string.Format("interaction-{0}", i), key, () => KeyCallback(key));
59  }
60  _input.StartListening();
61  }
62  }
void StartListening()
Start listening to bindings
void Invoke(string name, params object[] args)
Invoke the specified method name with optional arguments
List< InteractionOption > Options
Definition: InteractContract.cs:12
BasicInteractionUI()
Definition: BasicInteractionUI.cs:33
IScheduledTask ScheduleTask(ITask task)
Schedules the task.
void Bind(string bindName, Action action)
Do an action when the event attached to the bind occurs
void Close()
Definition: BasicInteractionUI.cs:64
void LogInfo(string msg, params object[] args)
IBoundInput GetBinding(string name)
Get or create a new binding class by name

Event Documentation

Action<int> essentials.action.Entities.AI.Interaction.UI.BasicInteractionUI.OnPressed

The documentation for this class was generated from the following file: