Debian Codegraph @

modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests/TestData/Sources/ExportedProperties.cs

raw symbols SCIP
1 using Godot;
2 using System;
3 using static Godot.Mathf;
4
5 public partial class ExportedProperties(string primaryCtorParameter) : GodotObject
6 {
7 // Do not generate default value
8 private String _notGeneratePropertyString = new string("not generate");
9 [Export]
10 public String NotGenerateComplexLamdaProperty
11 {
12 get => _notGeneratePropertyString + Convert.ToInt32("1");
13 set => _notGeneratePropertyString = value;
14 }
15
16 [Export]
17 public String NotGenerateLamdaNoFieldProperty
18 {
19 get => new string("not generate");
20 set => _notGeneratePropertyString = value;
21 }
22
23 [Export]
24 public String NotGenerateComplexReturnProperty
25 {
26 get
27 {
28 return _notGeneratePropertyString + Convert.ToInt32("1");
29 }
30 set
31 {
32 _notGeneratePropertyString = value;
33 }
34 }
35
36 private int _notGeneratePropertyInt = 1;
37 [Export]
38 public string NotGenerateReturnsProperty
39 {
40 get
41 {
42 if (_notGeneratePropertyInt == 1)
43 {
44 return "a";
45 }
46 else
47 {
48 return "b";
49 }
50 }
51 set
52 {
53 _notGeneratePropertyInt = value == "a" ? 1 : 2;
54 }
55 }
56
57 // Full Property
58 private String _fullPropertyString = "FullPropertyString";
59 [Export]
60 public String FullPropertyString
61 {
62 get
63 {
64 return _fullPropertyString;
65 }
66 set
67 {
68 _fullPropertyString = value;
69 }
70 }
71
72 private String _fullPropertyStringComplex = new string("FullPropertyString_Complex") + Convert.ToInt32("1");
73 [Export]
74 public String FullPropertyString_Complex
75 {
76 get
77 {
78 return _fullPropertyStringComplex;
79 }
80 set
81 {
82 _fullPropertyStringComplex = value;
83 }
84 }
85
86 private Single _fullPropertyStaticImport = Pi;
87 [Export]
88 public Single FullPropertyStaticImport
89 {
90 get
91 {
92 return _fullPropertyStaticImport;
93 }
94 set
95 {
96 _fullPropertyStaticImport = value;
97 }
98 }
99
100 // Lambda Property
101 private String _lamdaPropertyString = "LamdaPropertyString";
102 [Export]
103 public String LamdaPropertyString
104 {
105 get => _lamdaPropertyString;
106 set => _lamdaPropertyString = value;
107 }
108
109 private Single _lambdaPropertyStaticImport = Tau;
110 [Export]
111 public Single LambdaPropertyStaticImport
112 {
113 get => _lambdaPropertyStaticImport;
114 set => _lambdaPropertyStaticImport = value;
115 }
116
117 // Primary Constructor Parameter
118 [Export]
119 public String PrimaryCtorParameter { get; set; } = primaryCtorParameter;
120
121 // Constant Math Expression
122 [Export]
123 public Single ConstantMath { get; set; } = 2 * Mathf.Pi;
124
125 //Constant Math Expression With Static Import
126 [Export]
127 public Single ConstantMathStaticImport { get; set; } = RadToDeg(2 * Pi);
128
129 // Static Strings Addition
130 [Export]
131 public string StaticStringAddition { get; set; } = string.Empty + string.Empty;
132
133 // Auto Property
134 [Export] private Boolean PropertyBoolean { get; set; } = true;
135 [Export] private Char PropertyChar { get; set; } = 'f';
136 [Export] private SByte PropertySByte { get; set; } = 10;
137 [Export] private Int16 PropertyInt16 { get; set; } = 10;
138 [Export] private Int32 PropertyInt32 { get; set; } = 10;
139 [Export] private Int64 PropertyInt64 { get; set; } = -10_000;
140 [Export] private Byte PropertyByte { get; set; } = 10;
141 [Export] private UInt16 PropertyUInt16 { get; set; } = 10;
142 [Export] private UInt32 PropertyUInt32 { get; set; } = 10;
143 [Export] private UInt64 PropertyUInt64 { get; set; } = 10;
144 [Export] private Single PropertySingle { get; set; } = 10;
145 [Export] private Double PropertyDouble { get; set; } = 10;
146 [Export] private String PropertyString { get; set; } = "foo";
147
148 // Godot structs
149 [Export] private Vector2 PropertyVector2 { get; set; } = new(10f, 10f);
150 [Export] private Vector2I PropertyVector2I { get; set; } = Vector2I.Up;
151 [Export] private Rect2 PropertyRect2 { get; set; } = new(new Vector2(10f, 10f), new Vector2(10f, 10f));
152 [Export] private Rect2I PropertyRect2I { get; set; } = new(new Vector2I(10, 10), new Vector2I(10, 10));
153 [Export] private Transform2D PropertyTransform2D { get; set; } = Transform2D.Identity;
154 [Export] private Vector3 PropertyVector3 { get; set; } = new(10f, 10f, 10f);
155 [Export] private Vector3I PropertyVector3I { get; set; } = Vector3I.Back;
156 [Export] private Basis PropertyBasis { get; set; } = new Basis(Quaternion.Identity);
157 [Export] private Quaternion PropertyQuaternion { get; set; } = new Quaternion(Basis.Identity);
158 [Export] private Transform3D PropertyTransform3D { get; set; } = Transform3D.Identity;
159 [Export] private Vector4 PropertyVector4 { get; set; } = new(10f, 10f, 10f, 10f);
160 [Export] private Vector4I PropertyVector4I { get; set; } = Vector4I.One;
161 [Export] private Projection PropertyProjection { get; set; } = Projection.Identity;
162 [Export] private Aabb PropertyAabb { get; set; } = new Aabb(10f, 10f, 10f, new Vector3(1f, 1f, 1f));
163 [Export] private Color PropertyColor { get; set; } = Colors.Aquamarine;
164 [Export] private Plane PropertyPlane { get; set; } = Plane.PlaneXZ;
165 [Export] private Callable PropertyCallable { get; set; } = new Callable(Engine.GetMainLoop(), "_process");
166 [Export] private Signal PropertySignal { get; set; } = new Signal(Engine.GetMainLoop(), "Propertylist_changed");
167
168 // Enums
169 public enum MyEnum
170 {
171 A,
172 B,
173 C
174 }
175
176 [Export] private MyEnum PropertyEnum { get; set; } = MyEnum.C;
177
178 [Flags]
179 public enum MyFlagsEnum
180 {
181 A,
182 B,
183 C
184 }
185
186 [Export] private MyFlagsEnum PropertyFlagsEnum { get; set; } = MyFlagsEnum.C;
187
188 // Arrays
189 [Export] private Byte[] PropertyByteArray { get; set; } = { 0, 1, 2, 3, 4, 5, 6 };
190 [Export] private Int32[] PropertyInt32Array { get; set; } = { 0, 1, 2, 3, 4, 5, 6 };
191 [Export] private Int64[] PropertyInt64Array { get; set; } = { 0, 1, 2, 3, 4, 5, 6 };
192 [Export] private Single[] PropertySingleArray { get; set; } = { 0f, 1f, 2f, 3f, 4f, 5f, 6f };
193 [Export] private Double[] PropertyDoubleArray { get; set; } = { 0d, 1d, 2d, 3d, 4d, 5d, 6d };
194 [Export] private String[] PropertyStringArray { get; set; } = { "foo", "bar" };
195 [Export(PropertyHint.Enum, "A,B,C")] private String[] PropertyStringArrayEnum { get; set; } = { "foo", "bar" };
196 [Export] private Vector2[] PropertyVector2Array { get; set; } = { Vector2.Up, Vector2.Down, Vector2.Left, Vector2.Right };
197 [Export] private Vector3[] PropertyVector3Array { get; set; } = { Vector3.Up, Vector3.Down, Vector3.Left, Vector3.Right };
198 [Export] private Color[] PropertyColorArray { get; set; } = { Colors.Aqua, Colors.Aquamarine, Colors.Azure, Colors.Beige };
199 [Export] private GodotObject[] PropertyGodotObjectOrDerivedArray { get; set; } = { null };
200 [Export] private StringName[] field_StringNameArray { get; set; } = { "foo", "bar" };
201 [Export] private NodePath[] field_NodePathArray { get; set; } = { "foo", "bar" };
202 [Export] private Rid[] field_RidArray { get; set; } = { default, default, default };
203
204 // Variant
205 [Export] private Variant PropertyVariant { get; set; } = "foo";
206
207 // Classes
208 [Export] private GodotObject PropertyGodotObjectOrDerived { get; set; }
209 [Export] private Godot.Texture PropertyGodotResourceTexture { get; set; }
210 [Export] private Godot.Texture PropertyGodotResourceTextureWithInitializer { get; set; } = new() { ResourceName = "" };
211 [Export] private StringName PropertyStringName { get; set; } = new StringName("foo");
212 [Export] private NodePath PropertyNodePath { get; set; } = new NodePath("foo");
213 [Export] private Rid PropertyRid { get; set; }
214
215 [Export]
216 private Godot.Collections.Dictionary PropertyGodotDictionary { get; set; } = new() { { "foo", 10 }, { Vector2.Up, Colors.Chocolate } };
217
218 [Export]
219 private Godot.Collections.Array PropertyGodotArray { get; set; } = new() { "foo", 10, Vector2.Up, Colors.Chocolate };
220
221 [Export]
222 private Godot.Collections.Dictionary<string, bool> PropertyGodotGenericDictionary { get; set; } = new() { { "foo", true }, { "bar", false } };
223
224 [Export]
225 private Godot.Collections.Array<int> PropertyGodotGenericArray { get; set; } = new() { 0, 1, 2, 3, 4, 5, 6 };
226 }