Serializable.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Serializable.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// Base class for objects with automatic serialization through attributes.
  21. /// </summary>
  22. public unsafe partial class Serializable : UrhoObject
  23. {
  24. unsafe partial void OnSerializableCreated ();
  25. [Preserve]
  26. public Serializable (IntPtr handle) : base (handle)
  27. {
  28. OnSerializableCreated ();
  29. }
  30. [Preserve]
  31. protected Serializable (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnSerializableCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Serializable_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Serializable_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Serializable_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Serializable_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Serializable_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Serializable));
  54. return new StringHash (Serializable_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Serializable_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Serializable));
  61. return Marshal.PtrToStringAnsi (Serializable_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Serializable () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Serializable_Serializable (IntPtr context);
  69. [Preserve]
  70. public Serializable (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Serializable));
  73. handle = Serializable_Serializable ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnSerializableCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern bool Serializable_Load_File (IntPtr handle, IntPtr source, bool setInstanceDefault);
  79. /// <summary>
  80. /// Load from binary data. When setInstanceDefault is set to true, after setting the attribute value, store the value as instance's default value. Return true if successful.
  81. /// </summary>
  82. public virtual bool Load (File source, bool setInstanceDefault = false)
  83. {
  84. Runtime.ValidateRefCounted (this);
  85. return Serializable_Load_File (handle, (object)source == null ? IntPtr.Zero : source.Handle, setInstanceDefault);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern bool Serializable_Load_MemoryBuffer (IntPtr handle, IntPtr source, bool setInstanceDefault);
  89. /// <summary>
  90. /// Load from binary data. When setInstanceDefault is set to true, after setting the attribute value, store the value as instance's default value. Return true if successful.
  91. /// </summary>
  92. public virtual bool Load (MemoryBuffer source, bool setInstanceDefault = false)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return Serializable_Load_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle, setInstanceDefault);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern bool Serializable_Save_File (IntPtr handle, IntPtr dest);
  99. /// <summary>
  100. /// Save as binary data. Return true if successful.
  101. /// </summary>
  102. public virtual bool Save (File dest)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return Serializable_Save_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern bool Serializable_Save_MemoryBuffer (IntPtr handle, IntPtr dest);
  109. /// <summary>
  110. /// Save as binary data. Return true if successful.
  111. /// </summary>
  112. public virtual bool Save (MemoryBuffer dest)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return Serializable_Save_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern bool Serializable_LoadXML (IntPtr handle, IntPtr source, bool setInstanceDefault);
  119. /// <summary>
  120. /// Load from XML data. When setInstanceDefault is set to true, after setting the attribute value, store the value as instance's default value. Return true if successful.
  121. /// </summary>
  122. public virtual bool LoadXml (XmlElement source, bool setInstanceDefault = false)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return Serializable_LoadXML (handle, (object)source == null ? IntPtr.Zero : source.Handle, setInstanceDefault);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern bool Serializable_SaveXML (IntPtr handle, IntPtr dest);
  129. /// <summary>
  130. /// Save as XML data. Return true if successful.
  131. /// </summary>
  132. public virtual bool SaveXml (XmlElement dest)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return Serializable_SaveXML (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Serializable_ApplyAttributes (IntPtr handle);
  139. /// <summary>
  140. /// Apply attribute changes that can not be applied immediately. Called after scene load or a network update.
  141. /// </summary>
  142. public virtual void ApplyAttributes ()
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Serializable_ApplyAttributes (handle);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern bool Serializable_SaveDefaultAttributes (IntPtr handle);
  149. /// <summary>
  150. /// Return whether should save default-valued attributes into XML. Default false.
  151. /// </summary>
  152. public virtual bool SaveDefaultAttributes ()
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return Serializable_SaveDefaultAttributes (handle);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern void Serializable_MarkNetworkUpdate (IntPtr handle);
  159. /// <summary>
  160. /// Mark for attribute check on the next network update.
  161. /// </summary>
  162. public virtual void MarkNetworkUpdate ()
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. Serializable_MarkNetworkUpdate (handle);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern bool Serializable_SetAttribute_0 (IntPtr handle, uint index, ref Vector3 value);
  169. /// <summary>
  170. /// Set attribute by index. Return true if successfully set.
  171. /// </summary>
  172. public bool SetAttribute (uint index, Vector3 value)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return Serializable_SetAttribute_0 (handle, index, ref value);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern bool Serializable_SetAttribute_1 (IntPtr handle, uint index, ref IntRect value);
  179. /// <summary>
  180. /// Set attribute by index. Return true if successfully set.
  181. /// </summary>
  182. public bool SetAttribute (uint index, IntRect value)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return Serializable_SetAttribute_1 (handle, index, ref value);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern bool Serializable_SetAttribute_2 (IntPtr handle, uint index, ref Color value);
  189. /// <summary>
  190. /// Set attribute by index. Return true if successfully set.
  191. /// </summary>
  192. public bool SetAttribute (uint index, Color value)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return Serializable_SetAttribute_2 (handle, index, ref value);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern bool Serializable_SetAttribute_3 (IntPtr handle, uint index, ref Vector2 value);
  199. /// <summary>
  200. /// Set attribute by index. Return true if successfully set.
  201. /// </summary>
  202. public bool SetAttribute (uint index, Vector2 value)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return Serializable_SetAttribute_3 (handle, index, ref value);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern bool Serializable_SetAttribute_4 (IntPtr handle, uint index, ref Vector4 value);
  209. /// <summary>
  210. /// Set attribute by index. Return true if successfully set.
  211. /// </summary>
  212. public bool SetAttribute (uint index, Vector4 value)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return Serializable_SetAttribute_4 (handle, index, ref value);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern bool Serializable_SetAttribute_5 (IntPtr handle, uint index, ref IntVector2 value);
  219. /// <summary>
  220. /// Set attribute by index. Return true if successfully set.
  221. /// </summary>
  222. public bool SetAttribute (uint index, IntVector2 value)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return Serializable_SetAttribute_5 (handle, index, ref value);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern bool Serializable_SetAttribute_6 (IntPtr handle, uint index, ref Quaternion value);
  229. /// <summary>
  230. /// Set attribute by index. Return true if successfully set.
  231. /// </summary>
  232. public bool SetAttribute (uint index, Quaternion value)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return Serializable_SetAttribute_6 (handle, index, ref value);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern bool Serializable_SetAttribute_7 (IntPtr handle, uint index, ref Matrix4 value);
  239. /// <summary>
  240. /// Set attribute by index. Return true if successfully set.
  241. /// </summary>
  242. public bool SetAttribute (uint index, Matrix4 value)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return Serializable_SetAttribute_7 (handle, index, ref value);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern bool Serializable_SetAttribute_8 (IntPtr handle, uint index, ref Matrix3x4 value);
  249. /// <summary>
  250. /// Set attribute by index. Return true if successfully set.
  251. /// </summary>
  252. public bool SetAttribute (uint index, Matrix3x4 value)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return Serializable_SetAttribute_8 (handle, index, ref value);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern bool Serializable_SetAttribute_9 (IntPtr handle, uint index, int value);
  259. /// <summary>
  260. /// Set attribute by index. Return true if successfully set.
  261. /// </summary>
  262. public bool SetAttribute (uint index, int value)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return Serializable_SetAttribute_9 (handle, index, value);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern bool Serializable_SetAttribute_10 (IntPtr handle, uint index, float value);
  269. /// <summary>
  270. /// Set attribute by index. Return true if successfully set.
  271. /// </summary>
  272. public bool SetAttribute (uint index, float value)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. return Serializable_SetAttribute_10 (handle, index, value);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern bool Serializable_SetAttribute_11 (IntPtr handle, uint index, string value);
  279. /// <summary>
  280. /// Set attribute by index. Return true if successfully set.
  281. /// </summary>
  282. public bool SetAttribute (uint index, string value)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. return Serializable_SetAttribute_11 (handle, index, value);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern bool Serializable_SetAttribute_12 (IntPtr handle, uint index, bool value);
  289. /// <summary>
  290. /// Set attribute by index. Return true if successfully set.
  291. /// </summary>
  292. public bool SetAttribute (uint index, bool value)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. return Serializable_SetAttribute_12 (handle, index, value);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern bool Serializable_SetAttribute0_0 (IntPtr handle, string name, ref Vector3 value);
  299. /// <summary>
  300. /// Set attribute by name. Return true if successfully set.
  301. /// </summary>
  302. public bool SetAttribute (string name, Vector3 value)
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. return Serializable_SetAttribute0_0 (handle, name, ref value);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern bool Serializable_SetAttribute0_1 (IntPtr handle, string name, ref IntRect value);
  309. /// <summary>
  310. /// Set attribute by name. Return true if successfully set.
  311. /// </summary>
  312. public bool SetAttribute (string name, IntRect value)
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return Serializable_SetAttribute0_1 (handle, name, ref value);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern bool Serializable_SetAttribute0_2 (IntPtr handle, string name, ref Color value);
  319. /// <summary>
  320. /// Set attribute by name. Return true if successfully set.
  321. /// </summary>
  322. public bool SetAttribute (string name, Color value)
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. return Serializable_SetAttribute0_2 (handle, name, ref value);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern bool Serializable_SetAttribute0_3 (IntPtr handle, string name, ref Vector2 value);
  329. /// <summary>
  330. /// Set attribute by name. Return true if successfully set.
  331. /// </summary>
  332. public bool SetAttribute (string name, Vector2 value)
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. return Serializable_SetAttribute0_3 (handle, name, ref value);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern bool Serializable_SetAttribute0_4 (IntPtr handle, string name, ref Vector4 value);
  339. /// <summary>
  340. /// Set attribute by name. Return true if successfully set.
  341. /// </summary>
  342. public bool SetAttribute (string name, Vector4 value)
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return Serializable_SetAttribute0_4 (handle, name, ref value);
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern bool Serializable_SetAttribute0_5 (IntPtr handle, string name, ref IntVector2 value);
  349. /// <summary>
  350. /// Set attribute by name. Return true if successfully set.
  351. /// </summary>
  352. public bool SetAttribute (string name, IntVector2 value)
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return Serializable_SetAttribute0_5 (handle, name, ref value);
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern bool Serializable_SetAttribute0_6 (IntPtr handle, string name, ref Quaternion value);
  359. /// <summary>
  360. /// Set attribute by name. Return true if successfully set.
  361. /// </summary>
  362. public bool SetAttribute (string name, Quaternion value)
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return Serializable_SetAttribute0_6 (handle, name, ref value);
  366. }
  367. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  368. internal static extern bool Serializable_SetAttribute0_7 (IntPtr handle, string name, ref Matrix4 value);
  369. /// <summary>
  370. /// Set attribute by name. Return true if successfully set.
  371. /// </summary>
  372. public bool SetAttribute (string name, Matrix4 value)
  373. {
  374. Runtime.ValidateRefCounted (this);
  375. return Serializable_SetAttribute0_7 (handle, name, ref value);
  376. }
  377. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  378. internal static extern bool Serializable_SetAttribute0_8 (IntPtr handle, string name, ref Matrix3x4 value);
  379. /// <summary>
  380. /// Set attribute by name. Return true if successfully set.
  381. /// </summary>
  382. public bool SetAttribute (string name, Matrix3x4 value)
  383. {
  384. Runtime.ValidateRefCounted (this);
  385. return Serializable_SetAttribute0_8 (handle, name, ref value);
  386. }
  387. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  388. internal static extern bool Serializable_SetAttribute0_9 (IntPtr handle, string name, int value);
  389. /// <summary>
  390. /// Set attribute by name. Return true if successfully set.
  391. /// </summary>
  392. public bool SetAttribute (string name, int value)
  393. {
  394. Runtime.ValidateRefCounted (this);
  395. return Serializable_SetAttribute0_9 (handle, name, value);
  396. }
  397. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  398. internal static extern bool Serializable_SetAttribute0_10 (IntPtr handle, string name, float value);
  399. /// <summary>
  400. /// Set attribute by name. Return true if successfully set.
  401. /// </summary>
  402. public bool SetAttribute (string name, float value)
  403. {
  404. Runtime.ValidateRefCounted (this);
  405. return Serializable_SetAttribute0_10 (handle, name, value);
  406. }
  407. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  408. internal static extern bool Serializable_SetAttribute0_11 (IntPtr handle, string name, string value);
  409. /// <summary>
  410. /// Set attribute by name. Return true if successfully set.
  411. /// </summary>
  412. public bool SetAttribute (string name, string value)
  413. {
  414. Runtime.ValidateRefCounted (this);
  415. return Serializable_SetAttribute0_11 (handle, name, value);
  416. }
  417. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  418. internal static extern bool Serializable_SetAttribute0_12 (IntPtr handle, string name, bool value);
  419. /// <summary>
  420. /// Set attribute by name. Return true if successfully set.
  421. /// </summary>
  422. public bool SetAttribute (string name, bool value)
  423. {
  424. Runtime.ValidateRefCounted (this);
  425. return Serializable_SetAttribute0_12 (handle, name, value);
  426. }
  427. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  428. internal static extern void Serializable_ResetToDefault (IntPtr handle);
  429. /// <summary>
  430. /// Reset all editable attributes to their default values.
  431. /// </summary>
  432. public void ResetToDefault ()
  433. {
  434. Runtime.ValidateRefCounted (this);
  435. Serializable_ResetToDefault (handle);
  436. }
  437. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  438. internal static extern void Serializable_RemoveInstanceDefault (IntPtr handle);
  439. /// <summary>
  440. /// Remove instance's default values if they are set previously.
  441. /// </summary>
  442. public void RemoveInstanceDefault ()
  443. {
  444. Runtime.ValidateRefCounted (this);
  445. Serializable_RemoveInstanceDefault (handle);
  446. }
  447. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  448. internal static extern void Serializable_SetTemporary (IntPtr handle, bool enable);
  449. /// <summary>
  450. /// Set temporary flag. Temporary objects will not be saved.
  451. /// </summary>
  452. private void SetTemporary (bool enable)
  453. {
  454. Runtime.ValidateRefCounted (this);
  455. Serializable_SetTemporary (handle, enable);
  456. }
  457. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  458. internal static extern void Serializable_SetInterceptNetworkUpdate (IntPtr handle, string attributeName, bool enable);
  459. /// <summary>
  460. /// Enable interception of an attribute from network updates. Intercepted attributes are sent as events instead of applying directly. This can be used to implement client side prediction.
  461. /// </summary>
  462. public void SetInterceptNetworkUpdate (string attributeName, bool enable)
  463. {
  464. Runtime.ValidateRefCounted (this);
  465. Serializable_SetInterceptNetworkUpdate (handle, attributeName, enable);
  466. }
  467. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  468. internal static extern void Serializable_AllocateNetworkState (IntPtr handle);
  469. /// <summary>
  470. /// Allocate network attribute state.
  471. /// </summary>
  472. public void AllocateNetworkState ()
  473. {
  474. Runtime.ValidateRefCounted (this);
  475. Serializable_AllocateNetworkState (handle);
  476. }
  477. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  478. internal static extern void Serializable_WriteInitialDeltaUpdate_File (IntPtr handle, IntPtr dest, byte timeStamp);
  479. /// <summary>
  480. /// Write initial delta network update.
  481. /// </summary>
  482. public void WriteInitialDeltaUpdate (File dest, byte timeStamp)
  483. {
  484. Runtime.ValidateRefCounted (this);
  485. Serializable_WriteInitialDeltaUpdate_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle, timeStamp);
  486. }
  487. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  488. internal static extern void Serializable_WriteInitialDeltaUpdate_MemoryBuffer (IntPtr handle, IntPtr dest, byte timeStamp);
  489. /// <summary>
  490. /// Write initial delta network update.
  491. /// </summary>
  492. public void WriteInitialDeltaUpdate (MemoryBuffer dest, byte timeStamp)
  493. {
  494. Runtime.ValidateRefCounted (this);
  495. Serializable_WriteInitialDeltaUpdate_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle, timeStamp);
  496. }
  497. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  498. internal static extern void Serializable_WriteLatestDataUpdate_File (IntPtr handle, IntPtr dest, byte timeStamp);
  499. /// <summary>
  500. /// Write a latest data network update.
  501. /// </summary>
  502. public void WriteLatestDataUpdate (File dest, byte timeStamp)
  503. {
  504. Runtime.ValidateRefCounted (this);
  505. Serializable_WriteLatestDataUpdate_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle, timeStamp);
  506. }
  507. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  508. internal static extern void Serializable_WriteLatestDataUpdate_MemoryBuffer (IntPtr handle, IntPtr dest, byte timeStamp);
  509. /// <summary>
  510. /// Write a latest data network update.
  511. /// </summary>
  512. public void WriteLatestDataUpdate (MemoryBuffer dest, byte timeStamp)
  513. {
  514. Runtime.ValidateRefCounted (this);
  515. Serializable_WriteLatestDataUpdate_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle, timeStamp);
  516. }
  517. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  518. internal static extern bool Serializable_ReadDeltaUpdate_File (IntPtr handle, IntPtr source);
  519. /// <summary>
  520. /// Read and apply a network delta update. Return true if attributes were changed.
  521. /// </summary>
  522. public bool ReadDeltaUpdate (File source)
  523. {
  524. Runtime.ValidateRefCounted (this);
  525. return Serializable_ReadDeltaUpdate_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  526. }
  527. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  528. internal static extern bool Serializable_ReadDeltaUpdate_MemoryBuffer (IntPtr handle, IntPtr source);
  529. /// <summary>
  530. /// Read and apply a network delta update. Return true if attributes were changed.
  531. /// </summary>
  532. public bool ReadDeltaUpdate (MemoryBuffer source)
  533. {
  534. Runtime.ValidateRefCounted (this);
  535. return Serializable_ReadDeltaUpdate_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  536. }
  537. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  538. internal static extern bool Serializable_ReadLatestDataUpdate_File (IntPtr handle, IntPtr source);
  539. /// <summary>
  540. /// Read and apply a network latest data update. Return true if attributes were changed.
  541. /// </summary>
  542. public bool ReadLatestDataUpdate (File source)
  543. {
  544. Runtime.ValidateRefCounted (this);
  545. return Serializable_ReadLatestDataUpdate_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  546. }
  547. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  548. internal static extern bool Serializable_ReadLatestDataUpdate_MemoryBuffer (IntPtr handle, IntPtr source);
  549. /// <summary>
  550. /// Read and apply a network latest data update. Return true if attributes were changed.
  551. /// </summary>
  552. public bool ReadLatestDataUpdate (MemoryBuffer source)
  553. {
  554. Runtime.ValidateRefCounted (this);
  555. return Serializable_ReadLatestDataUpdate_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  556. }
  557. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  558. internal static extern Variant Serializable_GetAttribute (IntPtr handle, uint index);
  559. /// <summary>
  560. /// Return attribute value by index. Return empty if illegal index.
  561. /// </summary>
  562. public Variant GetAttribute (uint index)
  563. {
  564. Runtime.ValidateRefCounted (this);
  565. return Serializable_GetAttribute (handle, index);
  566. }
  567. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  568. internal static extern Variant Serializable_GetAttribute1 (IntPtr handle, string name);
  569. /// <summary>
  570. /// Return attribute value by name. Return empty if not found.
  571. /// </summary>
  572. public Variant GetAttribute (string name)
  573. {
  574. Runtime.ValidateRefCounted (this);
  575. return Serializable_GetAttribute1 (handle, name);
  576. }
  577. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  578. internal static extern Variant Serializable_GetAttributeDefault (IntPtr handle, uint index);
  579. /// <summary>
  580. /// Return attribute default value by index. Return empty if illegal index.
  581. /// </summary>
  582. public Variant GetAttributeDefault (uint index)
  583. {
  584. Runtime.ValidateRefCounted (this);
  585. return Serializable_GetAttributeDefault (handle, index);
  586. }
  587. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  588. internal static extern Variant Serializable_GetAttributeDefault2 (IntPtr handle, string name);
  589. /// <summary>
  590. /// Return attribute default value by name. Return empty if not found.
  591. /// </summary>
  592. public Variant GetAttributeDefault (string name)
  593. {
  594. Runtime.ValidateRefCounted (this);
  595. return Serializable_GetAttributeDefault2 (handle, name);
  596. }
  597. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  598. internal static extern uint Serializable_GetNumAttributes (IntPtr handle);
  599. /// <summary>
  600. /// Return number of attributes.
  601. /// </summary>
  602. private uint GetNumAttributes ()
  603. {
  604. Runtime.ValidateRefCounted (this);
  605. return Serializable_GetNumAttributes (handle);
  606. }
  607. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  608. internal static extern uint Serializable_GetNumNetworkAttributes (IntPtr handle);
  609. /// <summary>
  610. /// Return number of network replication attributes.
  611. /// </summary>
  612. private uint GetNumNetworkAttributes ()
  613. {
  614. Runtime.ValidateRefCounted (this);
  615. return Serializable_GetNumNetworkAttributes (handle);
  616. }
  617. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  618. internal static extern bool Serializable_IsTemporary (IntPtr handle);
  619. /// <summary>
  620. /// Return whether is temporary.
  621. /// </summary>
  622. private bool IsTemporary ()
  623. {
  624. Runtime.ValidateRefCounted (this);
  625. return Serializable_IsTemporary (handle);
  626. }
  627. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  628. internal static extern bool Serializable_GetInterceptNetworkUpdate (IntPtr handle, string attributeName);
  629. /// <summary>
  630. /// Return whether an attribute's network updates are being intercepted.
  631. /// </summary>
  632. public bool GetInterceptNetworkUpdate (string attributeName)
  633. {
  634. Runtime.ValidateRefCounted (this);
  635. return Serializable_GetInterceptNetworkUpdate (handle, attributeName);
  636. }
  637. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  638. internal static extern NetworkState* Serializable_GetNetworkState (IntPtr handle);
  639. /// <summary>
  640. /// Return the network attribute state, if allocated.
  641. /// </summary>
  642. private NetworkState* GetNetworkState ()
  643. {
  644. Runtime.ValidateRefCounted (this);
  645. return Serializable_GetNetworkState (handle);
  646. }
  647. public override StringHash Type {
  648. get {
  649. return UrhoGetType ();
  650. }
  651. }
  652. public override string TypeName {
  653. get {
  654. return GetTypeName ();
  655. }
  656. }
  657. [Preserve]
  658. public static StringHash TypeStatic {
  659. get {
  660. return GetTypeStatic ();
  661. }
  662. }
  663. public static string TypeNameStatic {
  664. get {
  665. return GetTypeNameStatic ();
  666. }
  667. }
  668. /// <summary>
  669. /// Return whether is temporary.
  670. /// Or
  671. /// Set temporary flag. Temporary objects will not be saved.
  672. /// </summary>
  673. public bool Temporary {
  674. get {
  675. return IsTemporary ();
  676. }
  677. set {
  678. SetTemporary (value);
  679. }
  680. }
  681. /// <summary>
  682. /// Return number of attributes.
  683. /// </summary>
  684. public uint NumAttributes {
  685. get {
  686. return GetNumAttributes ();
  687. }
  688. }
  689. /// <summary>
  690. /// Return number of network replication attributes.
  691. /// </summary>
  692. public uint NumNetworkAttributes {
  693. get {
  694. return GetNumNetworkAttributes ();
  695. }
  696. }
  697. /// <summary>
  698. /// Return the network attribute state, if allocated.
  699. /// </summary>
  700. public NetworkState* NetworkState {
  701. get {
  702. return GetNetworkState ();
  703. }
  704. }
  705. }
  706. }