Debian Codegraph @

modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Sample/ExportedFields.cs

raw symbols SCIP
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics.CodeAnalysis;
4
5 #pragma warning disable CS0169
6 #pragma warning disable CS0414
7
8 namespace Godot.SourceGenerators.Sample
9 {
10 [SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
11 [SuppressMessage("ReSharper", "RedundantNameQualifier")]
12 [SuppressMessage("ReSharper", "ArrangeObjectCreationWhenTypeEvident")]
13 [SuppressMessage("ReSharper", "InconsistentNaming")]
14 public partial class ExportedFields : GodotObject
15 {
16 [Export] private Boolean _fieldBoolean = true;
17 [Export] private Char _fieldChar = 'f';
18 [Export] private SByte _fieldSByte = 10;
19 [Export] private Int16 _fieldInt16 = 10;
20 [Export] private Int32 _fieldInt32 = 10;
21 [Export] private Int64 _fieldInt64 = 10;
22 [Export] private Byte _fieldByte = 10;
23 [Export] private UInt16 _fieldUInt16 = 10;
24 [Export] private UInt32 _fieldUInt32 = 10;
25 [Export] private UInt64 _fieldUInt64 = 10;
26 [Export] private Single _fieldSingle = 10;
27 [Export] private Double _fieldDouble = 10;
28 [Export] private String _fieldString = "foo";
29
30 // Godot structs
31 [Export] private Vector2 _fieldVector2 = new(10f, 10f);
32 [Export] private Vector2I _fieldVector2I = Vector2I.Up;
33 [Export] private Rect2 _fieldRect2 = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
34 [Export] private Rect2I _fieldRect2I = new(new Vector2I(10, 10), new Vector2I(10, 10));
35 [Export] private Transform2D _fieldTransform2D = Transform2D.Identity;
36 [Export] private Vector3 _fieldVector3 = new(10f, 10f, 10f);
37 [Export] private Vector3I _fieldVector3I = Vector3I.Back;
38 [Export] private Basis _fieldBasis = new Basis(Quaternion.Identity);
39 [Export] private Quaternion _fieldQuaternion = new Quaternion(Basis.Identity);
40 [Export] private Transform3D _fieldTransform3D = Transform3D.Identity;
41 [Export] private Vector4 _fieldVector4 = new(10f, 10f, 10f, 10f);
42 [Export] private Vector4I _fieldVector4I = Vector4I.One;
43 [Export] private Projection _fieldProjection = Projection.Identity;
44 [Export] private Aabb _fieldAabb = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
45 [Export] private Color _fieldColor = Colors.Aquamarine;
46 [Export] private Plane _fieldPlane = Plane.PlaneXZ;
47 [Export] private Callable _fieldCallable = new Callable(Engine.GetMainLoop(), "_process");
48 [Export] private Signal _fieldSignal = new Signal(Engine.GetMainLoop(), "property_list_changed");
49
50 // Enums
51 [SuppressMessage("ReSharper", "UnusedMember.Local")]
52 public enum MyEnum
53 {
54 A,
55 B,
56 C
57 }
58
59 [Export] private MyEnum _fieldEnum = MyEnum.C;
60
61 [Flags]
62 [SuppressMessage("ReSharper", "UnusedMember.Local")]
63 public enum MyFlagsEnum
64 {
65 A,
66 B,
67 C
68 }
69
70 [Export] private MyFlagsEnum _fieldFlagsEnum = MyFlagsEnum.C;
71
72 // Arrays
73 [Export] private Byte[] _fieldByteArray = { 0, 1, 2, 3, 4, 5, 6 };
74 [Export] private Int32[] _fieldInt32Array = { 0, 1, 2, 3, 4, 5, 6 };
75 [Export] private Int64[] _fieldInt64Array = { 0, 1, 2, 3, 4, 5, 6 };
76 [Export] private Single[] _fieldSingleArray = { 0f, 1f, 2f, 3f, 4f, 5f, 6f };
77 [Export] private Double[] _fieldDoubleArray = { 0d, 1d, 2d, 3d, 4d, 5d, 6d };
78 [Export] private String[] _fieldStringArray = { "foo", "bar" };
79 [Export(PropertyHint.Enum, "A,B,C")] private String[] _fieldStringArrayEnum = { "foo", "bar" };
80 [Export] private Vector2[] _fieldVector2Array = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
81 [Export] private Vector3[] _fieldVector3Array = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
82 [Export] private Color[] _fieldColorArray = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
83 [Export] private GodotObject[] _fieldGodotObjectOrDerivedArray = { null };
84 [Export] private StringName[] _fieldStringNameArray = { "foo", "bar" };
85 [Export] private NodePath[] _fieldNodePathArray = { "foo", "bar" };
86 [Export] private Rid[] _fieldRidArray = { default, default, default };
87 // Note we use Array and not System.Array. This tests the generated namespace qualification.
88 [Export] private Int32[] _fieldEmptyInt32Array = Array.Empty<Int32>();
89 // Note we use List and not System.Collections.Generic.
90 [Export] private int[] _fieldArrayFromList = new List<int>(Array.Empty<int>()).ToArray();
91
92 // Variant
93 [Export] private Variant _fieldVariant = "foo";
94
95 // Classes
96 [Export] private GodotObject _fieldGodotObjectOrDerived;
97 [Export] private Godot.Texture _fieldGodotResourceTexture;
98 [Export] private StringName _fieldStringName = new StringName("foo");
99 [Export] private NodePath _fieldNodePath = new NodePath("foo");
100 [Export] private Rid _fieldRid;
101
102 [Export]
103 private Godot.Collections.Dictionary _fieldGodotDictionary =
104 new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } };
105
106 [Export]
107 private Godot.Collections.Array _fieldGodotArray =
108 new() { "foo", 10, Vector2.Up, Colors.Chocolate };
109
110 [Export]
111 private Godot.Collections.Dictionary<string, bool> _fieldGodotGenericDictionary =
112 new() { { "foo", true }, { "bar", false } };
113
114 [Export]
115 private Godot.Collections.Array<int> _fieldGodotGenericArray =
116 new() { 0, 1, 2, 3, 4, 5, 6 };
117 }
118 }