ExportedFields.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using System.Diagnostics.CodeAnalysis;
  3. #pragma warning disable CS0169
  4. #pragma warning disable CS0414
  5. namespace Godot.SourceGenerators.Sample
  6. {
  7. [SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
  8. [SuppressMessage("ReSharper", "RedundantNameQualifier")]
  9. [SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
  10. [SuppressMessage("ReSharper", "InconsistentNaming")]
  11. public partial class ExportedFields : Godot.Object
  12. {
  13. [Export] private Boolean field_Boolean = true;
  14. [Export] private Char field_Char = 'f';
  15. [Export] private SByte field_SByte = 10;
  16. [Export] private Int16 field_Int16 = 10;
  17. [Export] private Int32 field_Int32 = 10;
  18. [Export] private Int64 field_Int64 = 10;
  19. [Export] private Byte field_Byte = 10;
  20. [Export] private UInt16 field_UInt16 = 10;
  21. [Export] private UInt32 field_UInt32 = 10;
  22. [Export] private UInt64 field_UInt64 = 10;
  23. [Export] private Single field_Single = 10;
  24. [Export] private Double field_Double = 10;
  25. [Export] private String field_String = "foo";
  26. // Godot structs
  27. [Export] private Vector2 field_Vector2 = new(10f, 10f);
  28. [Export] private Vector2i field_Vector2i = Vector2i.Up;
  29. [Export] private Rect2 field_Rect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
  30. [Export] private Rect2i field_Rect2i = new(new Vector2i(10, 10), new Vector2i(10, 10));
  31. [Export] private Transform2D field_Transform2D = Transform2D.Identity;
  32. [Export] private Vector3 field_Vector3 = new(10f, 10f, 10f);
  33. [Export] private Vector3i field_Vector3i = Vector3i.Back;
  34. [Export] private Basis field_Basis = new Basis(Quaternion.Identity);
  35. [Export] private Quaternion field_Quaternion = new Quaternion(Basis.Identity);
  36. [Export] private Transform3D field_Transform3D = Transform3D.Identity;
  37. [Export] private Vector4 field_Vector4 = new(10f, 10f, 10f, 10f);
  38. [Export] private Vector4i field_Vector4i = Vector4i.One;
  39. [Export] private Projection field_Projection = Projection.Identity;
  40. [Export] private AABB field_AABB = new AABB(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
  41. [Export] private Color field_Color = Colors.Aquamarine;
  42. [Export] private Plane field_Plane = Plane.PlaneXZ;
  43. [Export] private Callable field_Callable = new Callable(Engine.GetMainLoop(), "_process");
  44. [Export] private SignalInfo field_SignalInfo = new SignalInfo(Engine.GetMainLoop(), "property_list_changed");
  45. // Enums
  46. [SuppressMessage("ReSharper", "UnusedMember.Local")]
  47. enum MyEnum
  48. {
  49. A,
  50. B,
  51. C
  52. }
  53. [Export] private MyEnum field_Enum = MyEnum.C;
  54. [Flags]
  55. [SuppressMessage("ReSharper", "UnusedMember.Local")]
  56. enum MyFlagsEnum
  57. {
  58. A,
  59. B,
  60. C
  61. }
  62. [Export] private MyFlagsEnum field_FlagsEnum = MyFlagsEnum.C;
  63. // Arrays
  64. [Export] private Byte[] field_ByteArray = { 0, 1, 2, 3, 4, 5, 6 };
  65. [Export] private Int32[] field_Int32Array = { 0, 1, 2, 3, 4, 5, 6 };
  66. [Export] private Int64[] field_Int64Array = { 0, 1, 2, 3, 4, 5, 6 };
  67. [Export] private Single[] field_SingleArray = { 0f, 1f, 2f, 3f, 4f, 5f, 6f };
  68. [Export] private Double[] field_DoubleArray = { 0d, 1d, 2d, 3d, 4d, 5d, 6d };
  69. [Export] private String[] field_StringArray = { "foo", "bar" };
  70. [Export(PropertyHint.Enum, "A,B,C")] private String[] field_StringArrayEnum = { "foo", "bar" };
  71. [Export] private Vector2[] field_Vector2Array = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
  72. [Export] private Vector3[] field_Vector3Array = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
  73. [Export] private Color[] field_ColorArray = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
  74. [Export] private Godot.Object[] field_GodotObjectOrDerivedArray = { null };
  75. [Export] private object[] field_SystemObjectArray = { 0, 1f, 2d, "foo", Vector3i.Up };
  76. // Generics
  77. [Export] private Godot.Collections.Dictionary<string, string> field_GodotGenericDictionary =
  78. new Godot.Collections.Dictionary<string, string> { { "key1", "value1" }, { "key2", "value2" } };
  79. [Export] private Godot.Collections.Array<string> field_GodotGenericArray =
  80. new Godot.Collections.Array<string> { "elem1", "elem2", "elem3" };
  81. [Export] private System.Collections.Generic.Dictionary<string, string> field_SystemGenericDictionary =
  82. new System.Collections.Generic.Dictionary<string, string> { { "key1", "value1" }, { "key2", "value2" } };
  83. [Export] private System.Collections.Generic.List<string> field_SystemGenericList =
  84. new System.Collections.Generic.List<string> { "elem1", "elem2", "elem3" };
  85. [Export] private System.Collections.Generic.IDictionary<string, string> field_GenericIDictionary =
  86. new System.Collections.Generic.Dictionary<string, string> { { "key1", "value1" }, { "key2", "value2" } };
  87. [Export] private System.Collections.Generic.ICollection<string> field_GenericICollection =
  88. new System.Collections.Generic.List<string> { "elem1", "elem2", "elem3" };
  89. [Export] private System.Collections.Generic.IEnumerable<string> field_GenericIEnumerable =
  90. new System.Collections.Generic.List<string> { "elem1", "elem2", "elem3" };
  91. // Variant
  92. [Export] private object field_SystemObject = "foo";
  93. // Classes
  94. [Export] private Godot.Object field_GodotObjectOrDerived;
  95. [Export] private Godot.Texture field_GodotResourceTexture;
  96. [Export] private StringName field_StringName = new StringName("foo");
  97. [Export] private NodePath field_NodePath = new NodePath("foo");
  98. [Export] private RID field_RID;
  99. [Export] private Godot.Collections.Dictionary field_GodotDictionary =
  100. new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } };
  101. [Export] private Godot.Collections.Array field_GodotArray =
  102. new() { "foo", 10, Vector2.Up, Colors.Chocolate };
  103. [Export] private System.Collections.IDictionary field_IDictionary =
  104. new System.Collections.Generic.Dictionary<object, object>
  105. { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } };
  106. [Export] private System.Collections.ICollection field_ICollection =
  107. new System.Collections.Generic.List<object> { "foo", 10, Vector2.Up, Colors.Chocolate };
  108. [Export] private System.Collections.IEnumerable field_IEnumerable =
  109. new System.Collections.Generic.List<object> { "foo", 10, Vector2.Up, Colors.Chocolate };
  110. }
  111. }