gg.easy.airship 0.1.2003 → 0.1.2005
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Runtime/Code/Health/AirshipProfileExporter.cs +24 -21
- package/Runtime/Code/LuauAPI/Bridge.cs +41 -17
- package/Runtime/Code/TSCodeGen/TypeGenerator.cs +0 -1
- package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
- package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
- package/package.json +1 -1
- package/Runtime/Code/LuauAPI/RenderUtils.cs +0 -21
- package/Runtime/Code/LuauAPI/RenderUtils.cs.meta +0 -2
|
@@ -13,6 +13,8 @@ using UnityEngine.Profiling;
|
|
|
13
13
|
struct SignedUrlRequest {
|
|
14
14
|
public string type;
|
|
15
15
|
public string name;
|
|
16
|
+
[CanBeNull]
|
|
17
|
+
public string note;
|
|
16
18
|
public string contentType;
|
|
17
19
|
public long contentLength;
|
|
18
20
|
}
|
|
@@ -37,6 +39,7 @@ namespace Code.Health
|
|
|
37
39
|
public struct ClientProfileUploadRequest : NetworkMessage
|
|
38
40
|
{
|
|
39
41
|
public string logLocation;
|
|
42
|
+
public string fileName;
|
|
40
43
|
public float duration;
|
|
41
44
|
public long contentSize;
|
|
42
45
|
}
|
|
@@ -46,7 +49,6 @@ namespace Code.Health
|
|
|
46
49
|
public string logLocation;
|
|
47
50
|
public string id;
|
|
48
51
|
public string url;
|
|
49
|
-
public float duration;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
public struct StartServerProfileMessage : NetworkMessage {
|
|
@@ -113,11 +115,10 @@ namespace Code.Health
|
|
|
113
115
|
|
|
114
116
|
public async void OnClientUploadRequest(NetworkConnectionToClient sender, ClientProfileUploadRequest msg)
|
|
115
117
|
{
|
|
116
|
-
var urlData = await this.GetSignedUrl(msg.duration, msg.contentSize);
|
|
118
|
+
var urlData = await this.GetSignedUrl(msg.fileName, msg.duration, msg.contentSize);
|
|
117
119
|
sender.Send(new ClientProfileUploadResponse
|
|
118
120
|
{
|
|
119
121
|
logLocation = msg.logLocation,
|
|
120
|
-
duration = msg.duration,
|
|
121
122
|
url = urlData.url,
|
|
122
123
|
id = urlData.id
|
|
123
124
|
});
|
|
@@ -129,7 +130,7 @@ namespace Code.Health
|
|
|
129
130
|
{
|
|
130
131
|
id = msg.id,
|
|
131
132
|
url = msg.url
|
|
132
|
-
}, msg.logLocation,
|
|
133
|
+
}, msg.logLocation, null);
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
public void OnStartProfilingMessage(NetworkConnectionToClient sender, StartServerProfileMessage msg) {
|
|
@@ -144,13 +145,13 @@ namespace Code.Health
|
|
|
144
145
|
$"{AirshipPlatformUrl.contentService}/artifacts/artifact-id/{msg.artifactId}");
|
|
145
146
|
if (!downloadUrl.success)
|
|
146
147
|
{
|
|
147
|
-
Debug.Log($"Profile Uploaded
|
|
148
|
+
Debug.Log($"Profile Uploaded:\n<a href=\"https://create.airship.gg/dashboard/organization/game/artifacts?activeGame={msg.gameId}\">https://create.airship.gg/dashboard/organization/game/artifacts?activeGame={msg.gameId}</a>\n(copied to your clipboard)");
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
152
|
var data = JsonUtility.FromJson<ArtifactDownloadResponse>(downloadUrl.data);
|
|
152
153
|
|
|
153
|
-
Debug.Log($"Profile uploaded
|
|
154
|
+
Debug.Log($"Profile uploaded:\n<a href=\"{data.url}\">{data.url}</a>\n(copied to your clipboard)");
|
|
154
155
|
GUIUtility.systemCopyBuffer = data.url;
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -162,7 +163,8 @@ namespace Code.Health
|
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
var date = DateTime.Now.ToString("MM-dd-yyyy h.mm.ss");
|
|
165
|
-
var
|
|
166
|
+
var fileName = RunCore.IsClient() ? $"Client-Profile-{date}.raw" : $"Server-Profile-{date}.raw";
|
|
167
|
+
var logPath = Path.Combine(Application.persistentDataPath, fileName);
|
|
166
168
|
if (File.Exists(logPath)) File.WriteAllText(logPath, "");
|
|
167
169
|
|
|
168
170
|
Profiler.logFile = logPath;
|
|
@@ -170,10 +172,10 @@ namespace Code.Health
|
|
|
170
172
|
|
|
171
173
|
Debug.Log($"Starting profiler for {durationSecs} seconds.");
|
|
172
174
|
Profiler.enabled = true;
|
|
173
|
-
StopProfilingAfterDelay(logPath, durationSecs, profileInitiator);
|
|
175
|
+
StopProfilingAfterDelay(logPath, fileName, durationSecs, profileInitiator);
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
private async void StopProfilingAfterDelay(string logPath, float durationSecs, [CanBeNull] NetworkConnectionToClient profileInitiator) {
|
|
178
|
+
private async void StopProfilingAfterDelay(string logPath, string fileName, float durationSecs, [CanBeNull] NetworkConnectionToClient profileInitiator) {
|
|
177
179
|
await Task.Delay((int)(durationSecs * 1000));
|
|
178
180
|
Profiler.enabled = false;
|
|
179
181
|
var info = new FileInfo(logPath);
|
|
@@ -184,22 +186,23 @@ namespace Code.Health
|
|
|
184
186
|
NetworkClient.Send(new ClientProfileUploadRequest
|
|
185
187
|
{
|
|
186
188
|
contentSize = info.Length,
|
|
187
|
-
logLocation = logPath
|
|
189
|
+
logLocation = logPath,
|
|
190
|
+
fileName = fileName
|
|
188
191
|
});
|
|
189
192
|
}
|
|
190
193
|
else
|
|
191
194
|
{
|
|
192
|
-
var urlData = await this.GetSignedUrl(durationSecs, info.Length);
|
|
193
|
-
Upload(urlData, logPath,
|
|
195
|
+
var urlData = await this.GetSignedUrl(fileName, durationSecs, info.Length);
|
|
196
|
+
Upload(urlData, logPath, profileInitiator);
|
|
194
197
|
}
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
private async Task<SignedUrlResponse> GetSignedUrl(float duration, long length)
|
|
200
|
+
private async Task<SignedUrlResponse> GetSignedUrl(string fileName, float duration, long length)
|
|
198
201
|
{
|
|
199
202
|
var body = new SignedUrlRequest()
|
|
200
203
|
{
|
|
201
204
|
type = "MICRO_PROFILE",
|
|
202
|
-
name =
|
|
205
|
+
name = fileName,
|
|
203
206
|
contentType = "application/octet-stream",
|
|
204
207
|
contentLength = length
|
|
205
208
|
};
|
|
@@ -208,30 +211,30 @@ namespace Code.Health
|
|
|
208
211
|
{
|
|
209
212
|
throw new Exception("Unable to get upload URL for profile.");
|
|
210
213
|
}
|
|
211
|
-
|
|
212
|
-
return JsonUtility.FromJson<SignedUrlResponse>(response.data);
|
|
214
|
+
return JsonUtility.FromJson<SignedUrlResponse>(response.data);
|
|
213
215
|
}
|
|
214
216
|
|
|
215
|
-
private async void Upload(SignedUrlResponse urlData, string logPath,
|
|
217
|
+
private async void Upload(SignedUrlResponse urlData, string logPath, [CanBeNull] NetworkConnectionToClient profileInitiator)
|
|
216
218
|
{
|
|
217
219
|
Debug.Log("Uploading profile to backend...");
|
|
218
220
|
var uploadFilePath = logPath;
|
|
219
221
|
var fileData = await File.ReadAllBytesAsync(uploadFilePath);
|
|
220
222
|
File.Delete(uploadFilePath);
|
|
221
223
|
|
|
222
|
-
var
|
|
223
|
-
form.AddBinaryData("file", fileData, Path.GetFileName(uploadFilePath));
|
|
224
|
-
using var www = UnityWebRequest.Post(urlData.url, form);
|
|
224
|
+
using var www = UnityWebRequest.Put(urlData.url, fileData);
|
|
225
225
|
MonitorUploadProgress(www);
|
|
226
226
|
await UnityWebRequestProxyHelper.ApplyProxySettings(www).SendWebRequest();
|
|
227
227
|
|
|
228
|
+
Debug.Log($"Upload response: {www.downloadHandler.text}");
|
|
229
|
+
|
|
228
230
|
if (profileInitiator != null && profileInitiator.isReady) {
|
|
229
231
|
profileInitiator.Send(new ServerProfileCompleteMessage { artifactId = urlData.id });
|
|
230
232
|
}
|
|
231
233
|
Debug.Log($"Profile uploaded.");
|
|
232
234
|
}
|
|
233
235
|
|
|
234
|
-
private async
|
|
236
|
+
private async Task MonitorUploadProgress(UnityWebRequest req) {
|
|
237
|
+
Debug.Log("Starting upload...");
|
|
235
238
|
var elapsed = 0.0d;
|
|
236
239
|
var timeSinceLastLog = 0.0d;
|
|
237
240
|
try {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
using System;
|
|
2
1
|
using System.Collections;
|
|
3
2
|
using System.Collections.Generic;
|
|
4
3
|
using System.Threading.Tasks;
|
|
@@ -15,26 +14,59 @@ using UnityEngine.UI;
|
|
|
15
14
|
using SceneManager = UnityEngine.SceneManagement.SceneManager;
|
|
16
15
|
|
|
17
16
|
[LuauAPI][Preserve]
|
|
18
|
-
public static class Bridge
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
public static class Bridge {
|
|
18
|
+
|
|
19
|
+
#region CREATION
|
|
20
|
+
//RENDER TEXTURES
|
|
21
|
+
public static RenderTexture MakeDefaultRenderTexture(int width, int height){
|
|
22
|
+
RenderTextureDescriptor descriptor = new RenderTextureDescriptor(width, height, RenderTextureFormat.ARGB32, 8, 0) {
|
|
23
|
+
sRGB = false,
|
|
24
|
+
autoGenerateMips = false,
|
|
25
|
+
useMipMap = false
|
|
26
|
+
};
|
|
27
|
+
return new RenderTexture(descriptor);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
return
|
|
30
|
+
//TEXTURES
|
|
31
|
+
public static Texture2D MakeDefaultTexture2D(int width, int height){
|
|
32
|
+
return new Texture2D(width, height);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static Texture2D MakeTexture2D(int width, int height, TextureFormat format, bool mipChain, bool linear){
|
|
36
|
+
return new Texture2D(width, height, format, mipChain, linear);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//SPRITES
|
|
40
|
+
public static Sprite MakeDefaultSprite(Texture2D texture){
|
|
41
|
+
return Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height),
|
|
28
42
|
new Vector2(0.5f, 0.5f), 100.0f);
|
|
29
43
|
}
|
|
30
44
|
|
|
45
|
+
public static Sprite MakeSprite(Texture2D texture, Rect rect, Vector2 pivot, float pixelsPerUnit){
|
|
46
|
+
return Sprite.Create(texture, rect, pivot, pixelsPerUnit);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//RENDERERS
|
|
50
|
+
public static void ClearMaterial(Renderer ren, int materialI){
|
|
51
|
+
ren.materials[materialI] = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public static void ClearAllMaterials(Renderer ren){
|
|
55
|
+
for(int i=0; i<ren.materials.Length; i++){
|
|
56
|
+
ren.materials[i] = null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// MATERIAL PROPERTY BLOCK
|
|
31
61
|
public static MaterialPropertyBlock MakeMaterialPropertyBlock() {
|
|
32
62
|
return new MaterialPropertyBlock();
|
|
33
63
|
}
|
|
34
64
|
|
|
65
|
+
//MESH
|
|
35
66
|
public static Mesh MakeMesh() {
|
|
36
67
|
return new Mesh();
|
|
37
68
|
}
|
|
69
|
+
#endregion
|
|
38
70
|
|
|
39
71
|
public static float GetAverageFPS()
|
|
40
72
|
{
|
|
@@ -46,14 +78,6 @@ public static class Bridge
|
|
|
46
78
|
return GraphyManager.Instance.CurrentFPS;
|
|
47
79
|
}
|
|
48
80
|
|
|
49
|
-
public static Vector3 Lerp(Vector3 start, Vector3 goal, float alpha) {
|
|
50
|
-
return Vector3.Lerp(start, goal, alpha);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public static Vector3 Slerp(Vector3 start, Vector3 goal, float alpha) {
|
|
54
|
-
return Vector3.Slerp(start, goal, alpha);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
81
|
public static float GetMonoRam() {
|
|
58
82
|
return GraphyManager.Instance.MonoRam;
|
|
59
83
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
using UnityEngine;
|
|
2
|
-
|
|
3
|
-
[LuauAPI]
|
|
4
|
-
public static class RenderUtils{
|
|
5
|
-
public static RenderTexture CreateDefaultRenderTexture(int width, int height){
|
|
6
|
-
RenderTextureDescriptor descriptor = new RenderTextureDescriptor(width, height, RenderTextureFormat.ARGB32, 8, 0) {
|
|
7
|
-
sRGB = false,
|
|
8
|
-
autoGenerateMips = false,
|
|
9
|
-
useMipMap = false
|
|
10
|
-
};
|
|
11
|
-
return new RenderTexture(descriptor);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
public static Texture2D CreateDefaultTexture2D(int width, int height){
|
|
15
|
-
return new Texture2D(width, height);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static Texture2D CreateTexture2D(int width, int height, TextureFormat format, bool mipChain, bool linear){
|
|
19
|
-
return new Texture2D(width, height, format, mipChain, linear);
|
|
20
|
-
}
|
|
21
|
-
}
|