Skip to content

Commit 726e071

Browse files
committed
Added UGC Support and Made some bug fixes
1 parent 553c21c commit 726e071

File tree

61 files changed

+2466
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+2466
-137
lines changed

Assets/LootLocker/Admin/Editor/AdminServerAPI.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected override void RefreshTokenAndCompleteCall(ServerRequest cacheServerReq
4343
}
4444
else
4545
{
46-
Debug.LogError("Admin token refresh failed");
46+
LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed");
4747
LootLockerResponse res = new LootLockerResponse();
4848
res.statusCode = 401;
4949
res.Error = "Admin token Expired";
@@ -53,7 +53,7 @@ protected override void RefreshTokenAndCompleteCall(ServerRequest cacheServerReq
5353
}
5454
else
5555
{
56-
Debug.LogError("Admin token refresh failed");
56+
LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed",true);
5757
LootLockerResponse res = new LootLockerResponse();
5858
res.statusCode = 401;
5959
res.Error = "Admin token Expired";

Assets/LootLocker/Admin/Editor/AdminUserTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public void SetupTwoFactorAuthentication()
1313
{
1414
if (response.success)
1515
{
16-
Debug.LogError("Successful setup two factor authentication: " + response.text);
16+
LootLockerSDKAdminManager.DebugMessage("Successful setup two factor authentication: " + response.text);
1717
}
1818
else
1919
{
20-
Debug.LogError("failed to set two factor authentication: " + response.Error);
20+
LootLockerSDKAdminManager.DebugMessage("failed to set two factor authentication: " + response.Error, true);
2121
}
2222
});
2323
}

Assets/LootLocker/Admin/Editor/LootLockerSDKAdminManager.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static void Init()
2626

2727
static bool LoadConfig()
2828
{
29-
Debug.LogWarning("Loading admin config..");
29+
LootLockerSDKAdminManager.DebugMessage("Loading admin config..");
3030

3131
if (LootLockerAdminConfig.current == null)
3232
LootLockerAdminConfig.current = Resources.Load("Config/LootLockerAdminConfig") as LootLockerAdminConfig;
@@ -40,17 +40,21 @@ static bool LoadConfig()
4040

4141
}
4242

43-
public static void DebugMessage(string message)
43+
public static void DebugMessage(string message, bool IsError = false)
4444
{
45-
Debug.Log("Response: " + message);
45+
#if UNITY_EDITOR
46+
if (IsError)
47+
Debug.LogError(message);
48+
else
49+
Debug.Log(message);
50+
#endif
4651
}
4752

4853
public static bool CheckInitialized()
4954
{
5055
if (!initialized)
5156
{
5257
Init();
53-
//DebugMessage("Please initialize before calling sdk functions");
5458
return true;
5559
}
5660

@@ -61,7 +65,7 @@ public static bool CheckInitialized()
6165
catch (Exception ex)
6266
{
6367

64-
Debug.LogWarning("Couldn't change activeConfig on ServerAPI to Admin config. " + ex);
68+
LootLockerSDKAdminManager.DebugMessage("Couldn't change activeConfig on ServerAPI to Admin config. " + ex, true);
6569

6670
}
6771

Assets/LootLocker/Admin/Editor/Panel/Assets.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public partial class LootlockerAdminPanel : EditorWindow
2020

2121
void PopulateAssets(string search = null)
2222
{
23-
Debug.Log("Getting assets..");
23+
LootLockerSDKAdminManager.DebugMessage("Getting assets..");
2424

2525
currentView = View.Loading;
2626

@@ -32,23 +32,23 @@ void PopulateAssets(string search = null)
3232
{
3333
Contexts = contextResponse.Contexts;
3434
ContextNames = Contexts.Select(x => x.name).ToArray();
35-
Debug.Log("Successful got all contexts: " + contextResponse.text);
35+
LootLockerSDKAdminManager.DebugMessage("Successful got all contexts: " + contextResponse.text);
3636
}
3737
else
3838
{
39-
Debug.LogError("failed to get all contexts: " + contextResponse.Error);
39+
LootLockerSDKAdminManager.DebugMessage("failed to get all contexts: " + contextResponse.Error, true);
4040
}
4141

4242
if (response.success)
4343
{
4444
assetsResponse = response;
4545
currentView = View.Assets;
4646
Repaint();
47-
Debug.Log("Successful got all assets: " + response.text);
47+
LootLockerSDKAdminManager.DebugMessage("Successful got all assets: " + response.text);
4848
}
4949
else
5050
{
51-
Debug.LogError("failed to get all assets: " + response.Error);
51+
LootLockerSDKAdminManager.DebugMessage("failed to get all assets: " + response.Error, true);
5252
}
5353

5454
});

Assets/LootLocker/Admin/Editor/Panel/Files.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ void DrawCreateFileView()
270270
}
271271
else
272272
{
273-
274273
EditorGUILayout.LabelField("File name: " + Path.GetFileName(filePath),
275274
new GUIStyle(GUI.skin.label) { fontSize = 12, fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleLeft },
276275
GUILayout.MaxWidth(1000), GUILayout.Height(25));

Assets/LootLocker/Admin/Requests/AdminAssetsRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static void GetAssets(Action<GetAssetsResponse> onComplete, string search
9696
response.Error = serverResponse.Error;
9797
onComplete?.Invoke(response);
9898
}
99-
}, useAuthToken: true, isAdminCall: true);
99+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
100100
}
101101

102102
public static void CreateAsset(CreateAssetRequest request, Action<CreateAssetResponse> onComplete)
@@ -131,7 +131,7 @@ public static void CreateAsset(CreateAssetRequest request, Action<CreateAssetRes
131131
response.Error = serverResponse.Error;
132132
onComplete?.Invoke(response);
133133
}
134-
}, useAuthToken: true, isAdminCall: true);
134+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
135135

136136
}
137137

@@ -156,7 +156,7 @@ public static void GetContexts(Action<GetContextsResponse> onComplete)
156156
response.Error = serverResponse.Error;
157157
onComplete?.Invoke(response);
158158
}
159-
}, useAuthToken: true, isAdminCall: true);
159+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
160160
}
161161

162162
}

Assets/LootLocker/Admin/Requests/AdminEventsRequests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ public static void CreatingEvent(Dictionary<string, object> requestData, Action<
292292
response.Error = serverResponse.Error;
293293
onComplete?.Invoke(response);
294294
}
295-
}, useAuthToken: true, isAdminCall: true);
295+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
296296

297297
}
298298

@@ -324,7 +324,7 @@ public static void UpdatingEvent(LootLockerGetRequest lootLockerGetRequest, Dict
324324
response.Error = serverResponse.Error;
325325
onComplete?.Invoke(response);
326326
}
327-
}, useAuthToken: true, isAdminCall: true);
327+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
328328

329329
}
330330

@@ -350,7 +350,7 @@ public static void GettingAllEvents(LootLockerGetRequest lootLockerGetRequest, A
350350
response.Error = serverResponse.Error;
351351
onComplete?.Invoke(response);
352352
}
353-
}, useAuthToken: true, isAdminCall: true);
353+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
354354

355355
}
356356

Assets/LootLocker/Admin/Requests/AdminFilesRequest.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,12 @@ public static string UploadAFile(string filePath, string id, int gameId, Action<
8888
}
8989

9090
var eventId = Guid.NewGuid().ToString();
91-
ServerRequest.UploadFile(endPoint.endPoint, endPoint.httpMethod, System.IO.File.ReadAllBytes(filePath), formData, (serverResponse) =>
91+
92+
string[] splitFilePath = filePath.Split(new char[] { '\\', '/' });
93+
string defaultFileName = splitFilePath[splitFilePath.Length - 1];
94+
95+
ServerRequest.UploadFile(endPoint.endPoint, endPoint.httpMethod, System.IO.File.ReadAllBytes(filePath), defaultFileName,
96+
body: formData, onComplete: (serverResponse) =>
9297
{
9398
UploadAFileResponse response = new UploadAFileResponse();
9499
if (string.IsNullOrEmpty(serverResponse.Error))
@@ -105,7 +110,7 @@ public static string UploadAFile(string filePath, string id, int gameId, Action<
105110
response.Error = serverResponse.Error;
106111
onComplete?.Invoke(response);
107112
}
108-
}, useAuthToken: true, isAdminCall: true);
113+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
109114

110115
return eventId;
111116
}
@@ -134,7 +139,7 @@ public static void GetFiles(FileFilterType filter, Action<GetFilesResponse> onCo
134139
response.Error = serverResponse.Error;
135140
onComplete?.Invoke(response);
136141
}
137-
}, useAuthToken: true, isAdminCall: true);
142+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
138143
}
139144

140145
public static void DeleteFile(string fileId, Action<DeleteFileResponse> onComplete)
@@ -158,7 +163,7 @@ public static void DeleteFile(string fileId, Action<DeleteFileResponse> onComple
158163
response.Error = serverResponse.Error;
159164
onComplete?.Invoke(response);
160165
}
161-
}, useAuthToken: true, isAdminCall: true);
166+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
162167
}
163168

164169
public static void UpdateFile(string fileId, UpdateFileRequest request, Action<UpdateFileResponse> onComplete)
@@ -183,7 +188,7 @@ public static void UpdateFile(string fileId, UpdateFileRequest request, Action<U
183188
response.Error = serverResponse.Error;
184189
onComplete?.Invoke(response);
185190
}
186-
}, useAuthToken: true, isAdminCall: true);
191+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
187192
}
188193

189194

Assets/LootLocker/Admin/Requests/AdminMapsRequests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static void GettingAllMapsToAGame(LootLockerGetRequest lootLockerGetReque
117117
response.Error = serverResponse.Error;
118118
onComplete?.Invoke(response);
119119
}
120-
}, useAuthToken: true, isAdminCall: true);
120+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
121121

122122
}
123123

@@ -153,7 +153,7 @@ public static void CreatingMaps(CreatingMapsRequest data, bool sendAssetID, bool
153153
response.Error = serverResponse.Error;
154154
onComplete?.Invoke(response);
155155
}
156-
}, useAuthToken: true, isAdminCall: true);
156+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
157157
}
158158

159159
public static void UpdatingMaps(LootLockerGetRequest lootLockerGetRequest, CreatingMapsRequest data, Action<CreatingMapsResponse> onComplete)
@@ -184,7 +184,7 @@ public static void UpdatingMaps(LootLockerGetRequest lootLockerGetRequest, Creat
184184
response.Error = serverResponse.Error;
185185
onComplete?.Invoke(response);
186186
}
187-
}, useAuthToken: true, isAdminCall: true);
187+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
188188
}
189189

190190

Assets/LootLocker/Admin/Requests/AdminPlayerRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static void SearchingForPlayers(LootLockerGetRequest data, Action<Searchi
5959
response.Error = serverResponse.Error;
6060
onComplete?.Invoke(response);
6161
}
62-
}, true, true);
62+
}, true, callerRole: enums.CallerRole.Admin);
6363
}
6464

6565
}

Assets/LootLocker/Admin/Requests/AdminTriggersRequest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static void ListTriggers(LootLockerGetRequest data, Action<ListTriggersRe
4646
response.Error = serverResponse.Error;
4747
onComplete?.Invoke(response);
4848
}
49-
}, useAuthToken: true, isAdminCall: true);
49+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
5050

5151
}
5252

@@ -79,7 +79,7 @@ public static void CreateTriggers(CreateTriggersRequest requestData, LootLockerG
7979
response.Error = serverResponse.Error;
8080
onComplete?.Invoke(response);
8181
}
82-
}, useAuthToken: true, isAdminCall: true);
82+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
8383

8484
}
8585

@@ -109,7 +109,7 @@ public static void CreateTriggers(CreateTriggersRequest requestData, LootLockerG
109109
// response.Error = serverResponse.Error;
110110
// onComplete?.Invoke(response);
111111
// }
112-
// }, useAuthToken: true, isAdminCall: true);
112+
// }, useAuthToken: true, callerRole: enums.CallerRole.Admin);
113113
//}
114114
//public static void RemoveTwoFactorAuthentication(VerifyTwoFactorAuthenticationRequest data, Action<RemoveTwoFactorAuthenticationResponse> onComplete)
115115
//{
@@ -139,7 +139,7 @@ public static void CreateTriggers(CreateTriggersRequest requestData, LootLockerG
139139
// response.Error = serverResponse.Error;
140140
// onComplete?.Invoke(response);
141141
// }
142-
// }, useAuthToken: true, isAdminCall: true);
142+
// }, useAuthToken: true, callerRole: enums.CallerRole.Admin);
143143
//}
144144

145145
}

Assets/LootLocker/Admin/Requests/AdminUsersRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public static void SetupTwoFactorAuthentication(Action<SetupTwoFactorAuthenticat
6969
response.Error = serverResponse.Error;
7070
onComplete?.Invoke(response);
7171
}
72-
}, useAuthToken: true, isAdminCall: true);
72+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
7373
}
7474
public static void VerifyTwoFactorAuthenticationSetup(VerifyTwoFactorAuthenticationRequest data, Action<VerifyTwoFactorAuthenticationResponse> onComplete)
7575
{
@@ -97,7 +97,7 @@ public static void VerifyTwoFactorAuthenticationSetup(VerifyTwoFactorAuthenticat
9797
response.Error = serverResponse.Error;
9898
onComplete?.Invoke(response);
9999
}
100-
}, useAuthToken: true, isAdminCall: true);
100+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
101101
}
102102
public static void RemoveTwoFactorAuthentication(VerifyTwoFactorAuthenticationRequest data, Action<RemoveTwoFactorAuthenticationResponse> onComplete)
103103
{
@@ -127,7 +127,7 @@ public static void RemoveTwoFactorAuthentication(VerifyTwoFactorAuthenticationRe
127127
response.Error = serverResponse.Error;
128128
onComplete?.Invoke(response);
129129
}
130-
}, useAuthToken: true, isAdminCall: true);
130+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
131131
}
132132

133133
}

Assets/LootLocker/Admin/Requests/AuthenticationRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static void InitialAuthenticationRequest(InitialAuthRequest data, Action<
5353
response.Error = serverResponse.Error;
5454
onComplete?.Invoke(response);
5555
}
56-
}, useAuthToken: false, isAdminCall: true);
56+
}, useAuthToken: false, callerRole: enums.CallerRole.Admin);
5757
}
5858

5959
public static void TwoFactorAuthVerification(TwoFactorAuthVerficationRequest data, Action<AuthResponse> onComplete)
@@ -82,7 +82,7 @@ public static void TwoFactorAuthVerification(TwoFactorAuthVerficationRequest dat
8282
response.Error = serverResponse.Error;
8383
onComplete?.Invoke(response);
8484
}
85-
}, useAuthToken: false, isAdminCall: true);
85+
}, useAuthToken: false, callerRole: enums.CallerRole.Admin);
8686
}
8787

8888
public static void SubsequentRequests(Action<SubsequentRequestsResponse> onComplete)
@@ -105,7 +105,7 @@ public static void SubsequentRequests(Action<SubsequentRequestsResponse> onCompl
105105
response.Error = serverResponse.Error;
106106
onComplete?.Invoke(response);
107107
}
108-
}, useAuthToken: true, isAdminCall: true);
108+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
109109
}
110110

111111
}

Assets/LootLocker/Admin/Requests/GamesRequest.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static void GetAllGamesToTheCurrentUser(Action<GetAllGamesToTheCurrentUse
8585
response.Error = serverResponse.Error;
8686
onComplete?.Invoke(response);
8787
}
88-
}, useAuthToken: true, isAdminCall: true);
88+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
8989

9090
}
9191

@@ -113,7 +113,7 @@ public static void CreatingAGame(CreatingAGameRequest data, Action<CreatingAGame
113113
response.Error = serverResponse.Error;
114114
onComplete?.Invoke(response);
115115
}
116-
}, useAuthToken: true, isAdminCall: true);
116+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
117117
}
118118

119119
//Both this and the previous call share the same response
@@ -138,7 +138,7 @@ public static void GetDetailedInformationAboutAGame(LootLockerGetRequest lootLoc
138138
response.Error = serverResponse.Error;
139139
onComplete?.Invoke(response);
140140
}
141-
}, useAuthToken: true, isAdminCall: true);
141+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
142142

143143
}
144144

@@ -169,7 +169,7 @@ public static void UpdatingInformationAboutAGame(LootLockerGetRequest lootLocker
169169
response.Error = serverResponse.Error;
170170
onComplete?.Invoke(response);
171171
}
172-
}, useAuthToken: true, isAdminCall: true);
172+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
173173

174174
}
175175

@@ -195,7 +195,7 @@ public static void DeletingGames(LootLockerGetRequest lootLockerGetRequest, Acti
195195
response.Error = serverResponse.Error;
196196
onComplete?.Invoke(response);
197197
}
198-
}, useAuthToken: true, isAdminCall: true);
198+
}, useAuthToken: true, callerRole: enums.CallerRole.Admin);
199199

200200
}
201201

0 commit comments

Comments
 (0)