Skip to content

Commit 86cbb23

Browse files
committed
Add AltDriverUnity, AltDriver Unreal, AltObjectUnreal and base classes
1 parent 9835752 commit 86cbb23

29 files changed

+4072
-767
lines changed

Assets/AltTester/Runtime/AltDriver/AltDriver.cs

Lines changed: 13 additions & 561 deletions
Large diffs are not rendered by default.

Assets/AltTester/Runtime/AltDriver/AltDriverBase.cs

Lines changed: 648 additions & 0 deletions
Large diffs are not rendered by default.

Assets/AltTester/Runtime/AltDriver/AltDriverBase.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 342 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,342 @@
1+
/*
2+
Copyright(C) 2025 Altom Consulting
3+
4+
This program is free software: you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation, either version 3 of the License, or
7+
(at your option) any later version.
8+
9+
This program is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
GNU General Public License for more details.
13+
14+
You should have received a copy of the GNU General Public License
15+
along with this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
using System;
19+
using System.Collections.Generic;
20+
using AltTester.AltTesterUnitySDK.Driver.Commands;
21+
22+
namespace AltTester.AltTesterUnitySDK.Driver
23+
{
24+
public class AltDriverUnity : AltDriverBase
25+
{
26+
public AltDriverUnity(string host = "127.0.0.1", int port = 13000, string appName = "__default__", bool enableLogging = false, int connectTimeout = 60, string platform = "unknown", string platformVersion = "unknown", string deviceInstanceId = "unknown", string appId = "unknown", string driverType = "SDK")
27+
: base(host, port, appName, enableLogging, connectTimeout, platform, platformVersion, deviceInstanceId, appId, driverType)
28+
{
29+
}
30+
31+
public new void ResetInput()
32+
{
33+
base.ResetInput();
34+
}
35+
public new void LoadScene(string scene, bool loadSingle = true)
36+
{
37+
base.LoadScene(scene, loadSingle);
38+
}
39+
40+
public new void UnloadScene(string scene)
41+
{
42+
base.UnloadScene(scene);
43+
}
44+
45+
public new List<string> GetAllLoadedScenes()
46+
{
47+
return base.GetAllLoadedScenes();
48+
}
49+
50+
public new string GetCurrentScene()
51+
{
52+
return base.GetCurrentScene();
53+
}
54+
55+
public new void WaitForCurrentSceneToBe(string sceneName, double timeout = 10, double interval = 1)
56+
{
57+
base.WaitForCurrentSceneToBe(sceneName, timeout, interval);
58+
}
59+
60+
public new void SetTimeScale(float timeScale)
61+
{
62+
base.SetTimeScale(timeScale);
63+
}
64+
65+
public new float GetTimeScale()
66+
{
67+
return base.GetTimeScale();
68+
}
69+
70+
71+
public new void DeletePlayerPref()
72+
{
73+
base.DeletePlayerPref();
74+
}
75+
76+
public new void DeleteKeyPlayerPref(string keyName)
77+
{
78+
base.DeleteKeyPlayerPref(keyName);
79+
}
80+
81+
public new void SetKeyPlayerPref(string keyName, int valueName)
82+
{
83+
base.SetKeyPlayerPref(keyName, valueName);
84+
}
85+
86+
public new void SetKeyPlayerPref(string keyName, float valueName)
87+
{
88+
base.SetKeyPlayerPref(keyName, valueName);
89+
}
90+
91+
public new void SetKeyPlayerPref(string keyName, string valueName)
92+
{
93+
base.SetKeyPlayerPref(keyName, valueName);
94+
}
95+
96+
public new int GetIntKeyPlayerPref(string keyName)
97+
{
98+
return base.GetIntKeyPlayerPref(keyName);
99+
}
100+
101+
public new float GetFloatKeyPlayerPref(string keyName)
102+
{
103+
return base.GetFloatKeyPlayerPref(keyName);
104+
}
105+
106+
public new string GetStringKeyPlayerPref(string keyName)
107+
{
108+
return base.GetStringKeyPlayerPref(keyName);
109+
}
110+
111+
public new List<AltObject> FindObjects(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true)
112+
{
113+
return base.FindObjects(altBy, cameraAltBy, enabled);
114+
}
115+
116+
public new List<AltObject> FindObjectsWhichContain(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true)
117+
{
118+
return base.FindObjectsWhichContain(altBy, cameraAltBy, enabled);
119+
}
120+
121+
public new AltObject FindObject(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true)
122+
{
123+
return base.FindObject(altBy, cameraAltBy, enabled);
124+
}
125+
126+
public new AltObject FindObjectWhichContains(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true)
127+
{
128+
return base.FindObjectWhichContains(altBy, cameraAltBy, enabled);
129+
}
130+
131+
public new T CallStaticMethod<T>(string typeName, string methodName, string assemblyName,
132+
object[] parameters, string[] typeOfParameters = null)
133+
{
134+
return base.CallStaticMethod<T>(typeName, methodName, assemblyName, parameters, typeOfParameters);
135+
}
136+
137+
public new T GetStaticProperty<T>(string componentName, string propertyName, string assemblyName, int maxDepth = 2)
138+
{
139+
return base.GetStaticProperty<T>(componentName, propertyName, assemblyName, maxDepth);
140+
}
141+
142+
public new void SetStaticProperty(string componentName, string propertyName, string assemblyName, object updatedProperty)
143+
{
144+
base.SetStaticProperty(componentName, propertyName, assemblyName, updatedProperty);
145+
}
146+
147+
/// <summary>
148+
/// Simulates a swipe action between two points.
149+
/// </summary>
150+
/// <param name="start">Coordinates of the screen where the swipe begins</param>
151+
/// <param name="end">Coordinates of the screen where the swipe ends</param>
152+
/// <param name="duration">The time measured in seconds to move the mouse from start to end location. Defaults to <c>0.1</c>.</param>
153+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
154+
public new void Swipe(AltVector2 start, AltVector2 end, float duration = 0.1f, bool wait = true)
155+
{
156+
base.Swipe(start, end, duration, wait);
157+
}
158+
159+
/// <summary>
160+
/// Simulates a multipoint swipe action.
161+
/// </summary>
162+
/// <param name="positions">A list of positions on the screen where the swipe be made.</param>
163+
/// <param name="duration">The time measured in seconds to swipe from first position to the last position. Defaults to <code>0.1</code>.</param>
164+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
165+
public new void MultipointSwipe(AltVector2[] positions, float duration = 0.1f, bool wait = true)
166+
{
167+
base.MultipointSwipe(positions, duration, wait);
168+
}
169+
170+
/// <summary>
171+
/// Simulates holding left click button down for a specified amount of time at given coordinates.
172+
/// </summary>
173+
/// <param name="coordinates">The coordinates where the button is held down.</param>
174+
/// <param name="duration">The time measured in seconds to keep the button down.</param>
175+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
176+
public new void HoldButton(AltVector2 coordinates, float duration, bool wait = true)
177+
{
178+
base.HoldButton(coordinates, duration, wait);
179+
}
180+
181+
/// <summary>
182+
/// Simulates key press action in your app.
183+
/// </summary>
184+
/// <param name="keyCode">The key code of the key simulated to be pressed.</param>
185+
/// <param name="power" >A value between [-1,1] used for joysticks to indicate how hard the button was pressed. Defaults to <c>1</c>.</param>
186+
/// <param name="duration">The time measured in seconds from the key press to the key release. Defaults to <c>0.1</c></param>
187+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
188+
public new void PressKey(AltKeyCode keyCode, float power = 1, float duration = 0.1f, bool wait = true)
189+
{
190+
base.PressKey(keyCode, power, duration, wait);
191+
}
192+
193+
/// <summary>
194+
/// Simulates multiple keys pressed action in your app.
195+
/// </summary>
196+
/// <param name="keyCodes">The list of key codes of the keys simulated to be pressed.</param>
197+
/// <param name="power" >A value between [-1,1] used for joysticks to indicate how hard the button was pressed. Defaults to <c>1</c>.</param>
198+
/// <param name="duration">The time measured in seconds from the key press to the key release. Defaults to <c>0.1</c></param>
199+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
200+
public new void PressKeys(AltKeyCode[] keyCodes, float power = 1, float duration = 0.1f, bool wait = true)
201+
{
202+
base.PressKeys(keyCodes, power, duration, wait);
203+
}
204+
205+
public new void KeyDown(AltKeyCode keyCode, float power = 1)
206+
{
207+
base.KeyDown(keyCode, power);
208+
}
209+
210+
/// <summary>
211+
/// Simulates multiple keys down action in your app.
212+
/// </summary>
213+
/// <param name="keyCodes">The key codes of the keys simulated to be down.</param>
214+
/// <param name="power" >A value between [-1,1] used for joysticks to indicate how hard the button was pressed. Defaults to <c>1</c>.</param>
215+
public new void KeysDown(AltKeyCode[] keyCodes, float power = 1)
216+
{
217+
base.KeysDown(keyCodes, power);
218+
}
219+
220+
221+
/// <summary>
222+
/// Simulate mouse movement in your app.
223+
/// </summary>
224+
/// <param name="coordinates">The screen coordinates</param>
225+
/// <param name="duration">The time measured in seconds to move the mouse from the current mouse position to the set coordinates. Defaults to <c>0.1f</c></param>
226+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
227+
public new void MoveMouse(AltVector2 coordinates, float duration = 0.1f, bool wait = true)
228+
{
229+
base.MoveMouse(coordinates, duration, wait);
230+
}
231+
232+
/// <summary>
233+
/// Simulate scroll action in your app.
234+
/// </summary>
235+
/// <param name="speed">Set how fast to scroll. Positive values will scroll up and negative values will scroll down. Defaults to <code> 1 </code></param>
236+
/// <param name="duration">The duration of the scroll in seconds. Defaults to <code> 0.1 </code></param>
237+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
238+
public new void Scroll(float speed = 1, float duration = 0.1f, bool wait = true)
239+
{
240+
base.Scroll(speed, duration, wait);
241+
}
242+
243+
/// <summary>
244+
/// Simulate scroll action in your app.
245+
/// </summary>
246+
/// <param name="scrollValue">Set how fast to scroll. X is horizontal and Y is vertical. Defaults to <code> 1 </code></param>
247+
/// <param name="duration">The duration of the scroll in seconds. Defaults to <code> 0.1 </code></param>
248+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
249+
public new void Scroll(AltVector2 scrollValue, float duration = 0.1f, bool wait = true)
250+
{
251+
base.Scroll(scrollValue, duration, wait);
252+
}
253+
254+
/// <summary>
255+
/// Tap at screen coordinates
256+
/// </summary>
257+
/// <param name="coordinates">The screen coordinates</param>
258+
/// <param name="count">Number of taps</param>
259+
/// <param name="interval">Interval between taps in seconds</param>
260+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
261+
public new void Tap(AltVector2 coordinates, int count = 1, float interval = 0.1f, bool wait = true)
262+
{
263+
base.Tap(coordinates, count, interval, wait);
264+
}
265+
266+
/// <summary>
267+
/// Simulates device rotation action in your app.
268+
/// </summary>
269+
/// <param name="acceleration">The linear acceleration of a device.</param>
270+
/// <param name="duration">How long the rotation will take in seconds. Defaults to <code>0.1<code>.</param>
271+
/// <param name="wait">If set wait for command to finish. Defaults to <c>True</c>.</param>
272+
public new void Tilt(AltVector3 acceleration, float duration = 0.1f, bool wait = true)
273+
{
274+
base.Tilt(acceleration, duration, wait);
275+
}
276+
277+
public new List<AltObject> GetAllElements(AltBy cameraAltBy = null, bool enabled = true)
278+
{
279+
return base.GetAllElements(cameraAltBy, enabled);
280+
}
281+
282+
public new List<AltObjectLight> GetAllElementsLight(AltBy cameraAltBy = null, bool enabled = true)
283+
{
284+
return base.GetAllElementsLight(cameraAltBy, enabled);
285+
}
286+
287+
public new AltObject WaitForObject(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true, double timeout = 20, double interval = 0.5)
288+
{
289+
return base.WaitForObject(altBy, cameraAltBy, enabled, timeout, interval);
290+
}
291+
292+
public new void WaitForObjectNotBePresent(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true, double timeout = 20, double interval = 0.5)
293+
{
294+
base.WaitForObjectNotBePresent(altBy, cameraAltBy, enabled, timeout, interval);
295+
}
296+
297+
public new AltObject WaitForObjectWhichContains(AltBy altBy, AltBy cameraAltBy = null, bool enabled = true, double timeout = 20, double interval = 0.5)
298+
{
299+
return base.WaitForObjectWhichContains(altBy, cameraAltBy, enabled, timeout, interval);
300+
}
301+
302+
public new List<string> GetAllScenes()
303+
{
304+
return base.GetAllScenes();
305+
}
306+
307+
public new List<AltObject> GetAllCameras()
308+
{
309+
return base.GetAllCameras();
310+
}
311+
312+
public new List<AltObject> GetAllActiveCameras()
313+
{
314+
return base.GetAllActiveCameras();
315+
}
316+
public new AltVector2 GetApplicationScreenSize()
317+
{
318+
return base.GetApplicationScreenSize();
319+
}
320+
321+
322+
public new int BeginTouch(AltVector2 screenPosition)
323+
{
324+
return base.BeginTouch(screenPosition);
325+
}
326+
327+
public new void MoveTouch(int fingerId, AltVector2 screenPosition)
328+
{
329+
base.MoveTouch(fingerId, screenPosition);
330+
}
331+
332+
public new void EndTouch(int fingerId)
333+
{
334+
base.EndTouch(fingerId);
335+
}
336+
337+
public new AltObject FindObjectAtCoordinates(AltVector2 screenPosition)
338+
{
339+
return base.FindObjectAtCoordinates(screenPosition);
340+
}
341+
}
342+
}

Assets/AltTester/Runtime/AltDriver/AltDriverUnity.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)