ScriptObject.cs 928 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Runtime.InteropServices;
  4. namespace AtomicEngine
  5. {
  6. public class ScriptObject : AObject
  7. {
  8. public ScriptObject ()
  9. {
  10. nativeInstance = NativeCore.RegisterNative (csb_Atomic_CSScriptObject_Constructor(), this);
  11. }
  12. public void SendEvent(string eventType, Dictionary<string, object> eventData = null)
  13. {
  14. EventCore.SendEvent (this, eventType);
  15. }
  16. public void SubscribeToEvent(AObject sender, string eventType, AtomicEventDelegate function)
  17. {
  18. EventCore.SubscribeToEvent (this, sender, eventType, function);
  19. }
  20. public void SubscribeToEvent(string eventType, AtomicEventDelegate function)
  21. {
  22. EventCore.SubscribeToEvent (this, null, eventType, function);
  23. }
  24. [DllImport (Constants.LIBNAME, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
  25. private static extern IntPtr csb_Atomic_CSScriptObject_Constructor();
  26. }
  27. }