Connection.pkg 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. $#include "Connection.h"
  2. struct RemoteEvent
  3. {
  4. unsigned senderID_ @ senderID;
  5. StringHash eventType_ @ eventType;
  6. VariantMap eventData_ @ eventData;
  7. bool inOrder_ @ inOrder;
  8. };
  9. class Connection : public Object
  10. {
  11. void SendMessage(int msgID, bool reliable, bool inOrder, const VectorBuffer& msg, unsigned contentID = 0);
  12. void SendMessage(int msgID, bool reliable, bool inOrder, const unsigned char* data, unsigned numBytes, unsigned contentID = 0);
  13. void SendRemoteEvent(StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
  14. void SendRemoteEvent(const String eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
  15. void SendRemoteEvent(Node* node, StringHash eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
  16. void SendRemoteEvent(Node* node, const String eventType, bool inOrder, const VariantMap& eventData = Variant::emptyVariantMap);
  17. void SetScene(Scene* newScene);
  18. void SetIdentity(const VariantMap& identity);
  19. void SetControls(const Controls& newControls);
  20. void SetPosition(const Vector3& position);
  21. void SetConnectPending(bool connectPending);
  22. void SetLogStatistics(bool enable);
  23. void Disconnect(int waitMSec = 0);
  24. void SendServerUpdate();
  25. void SendClientUpdate();
  26. void SendRemoteEvents();
  27. void SendPackages();
  28. void ProcessPendingLatestData();
  29. bool ProcessMessage(int msgID, MemoryBuffer& msg);
  30. const VariantMap& GetIdentity() const;
  31. Scene* GetScene() const;
  32. const Controls& GetControls() const;
  33. const Vector3& GetPosition() const;
  34. bool IsClient() const;
  35. bool IsConnected() const;
  36. bool IsConnectPending() const;
  37. bool IsSceneLoaded() const;
  38. bool GetLogStatistics() const;
  39. String GetAddress() const;
  40. unsigned short GetPort() const;
  41. String ToString() const;
  42. unsigned GetNumDownloads() const;
  43. const String& GetDownloadName() const;
  44. float GetDownloadProgress() const;
  45. tolua_property__get_set VariantMap& identity;
  46. tolua_property__get_set Scene* scene;
  47. tolua_property__get_set Controls& controls;
  48. tolua_property__get_set Vector3& position;
  49. tolua_readonly tolua_property__is_set bool client;
  50. tolua_readonly tolua_property__is_set bool connected;
  51. tolua_property__is_set bool connectPending;
  52. tolua_readonly tolua_property__is_set bool sceneLoaded;
  53. tolua_property__get_set bool logStatistics;
  54. tolua_readonly tolua_property__get_set String address;
  55. tolua_readonly tolua_property__get_set unsigned short port;
  56. tolua_readonly tolua_property__get_set unsigned numDownloads;
  57. tolua_readonly tolua_property__get_set String& downloadName;
  58. tolua_readonly tolua_property__get_set float downloadProgress;
  59. };