public void Register(String name, Type eventType)
        {
            lock (this)
            {
                if (!name.EndsWith("()"))
                    throw new GossipScriptException("Events must end with ()");

                string key = name;
                if (!m_BindingByKey.ContainsKey(key))
                {
                    m_NextActionId++;
                    var binding = new EventBinding(m_NextActionId, name, eventType);
                    m_BindingById.Add(m_NextActionId, binding);

                    m_BindingByKey.Add(key, binding);
                }
                m_NextActionId++;
            }
        }
Exemple #2
0
        public bool HasEvent(EventBinding binding)
        {
            foreach (ScriptEvent scriptletEvent in OnCustomEvents)
            {
                if (scriptletEvent.CustomEventId == binding.Id)
                    return true;
            }

            return false;
        }
Exemple #3
0
 public void RaiseEvent(EventBinding binding, ScriptExecutionContext context)
 {
     foreach (ScriptEvent scriptEvent in OnCustomEvents)
     {
         if (scriptEvent.CustomEventId == binding.Id)
         {
             scriptEvent.Run(context);
             return;
         }
     }
 }
        public void RaiseEvent(EventBinding binding, Object eventParameter = null)
        {
            if (ActiveNodes.Count == 0)
                return;

            foreach (ScriptNode scriptlet in ActiveNodes)
            {
                if (scriptlet.HasEvent(binding))
                {
                    m_Context.CurrentScriptEvent.EventParameter = eventParameter;
                    scriptlet.RaiseEvent(binding, m_Context);
                    break;
                }
            }
        }