Skip to content

Commit 4e9ce42

Browse files
author
Mikkel Sørensen
committed
Added ifdefs
1 parent b061928 commit 4e9ce42

9 files changed

+15
-53
lines changed

Runtime/Editor/NewUI/LootLockerAdminExtension.cs renamed to Runtime/Editor/Editor UI/LootLockerAdminExtension.cs

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
5+
using UnityEditor;
16
using UnityEngine;
27
using UnityEngine.UIElements;
38
using LootLocker;
4-
59
using LootLocker.Extension;
6-
using LootLocker.Extension.DataTypes;
710
using LootLocker.Extension.Responses;
811

9-
using UnityEditor;
10-
1112
public class LootLockerAdminExtension : EditorWindow
1213
{
1314
[SerializeField]
@@ -46,7 +47,6 @@ public class LootLockerAdminExtension : EditorWindow
4647

4748
private Button popupBtn;
4849

49-
5050
private Label infoText;
5151

5252
private Label newApiKeyCancel;
@@ -58,25 +58,16 @@ public class LootLockerAdminExtension : EditorWindow
5858

5959
private Button createApiKeyBtn;
6060

61-
//Login Flow Start
6261
private TextField emailField, passwordField;
6362
private Label signupLink, gettingStartedLink, forgotPasswordLink;
6463
private Button loginBtn;
65-
//Login Flow End
66-
67-
//MFA Flow Begin
6864

6965
private TextField codeField;
7066
private Button signInBtn;
7167
private string mfaKey;
72-
//MFA Flow End
73-
74-
//Game Selector Flow Begin
7568

7669
VisualElement gameSelectorList;
77-
//Game Selector Flow End
7870

79-
//API Key Flow Begin
8071
VisualElement apiKeyList;
8172

8273
bool isStage = true;
@@ -143,7 +134,7 @@ public void CreateGUI()
143134

144135
if(LootLockerConfig.current.apiKey != null || LootLockerConfig.current.apiKey != "")
145136
{
146-
//activeKey.text = "Active Key: " + LootLockerConfig.current.apiKey;
137+
activeKey.text = "Active Key: " + LootLockerConfig.current.apiKey;
147138
} else
148139
{
149140
activeKey.text = "Active Key: Not selected";
@@ -181,8 +172,6 @@ public void CreateGUI()
181172
popupBtn.clickable.clickedWithEventInfo += ClosePopup;
182173

183174

184-
//Login Flow Start
185-
186175
loginFlow = root.Q<VisualElement>("LoginFlow");
187176

188177
emailField = root.Q<TextField>("EmailField");
@@ -196,7 +185,7 @@ public void CreateGUI()
196185
}
197186
});
198187

199-
signupLink = root.Q <Label>("newUserLink");
188+
signupLink = root.Q <Label>("newUserLink");
200189
gettingStartedLink = root.Q<Label>("gettingStartedLink");
201190
forgotPasswordLink = root.Q<Label>("forgotPasswordLink");
202191

@@ -209,9 +198,6 @@ public void CreateGUI()
209198
loginBtn.clickable.clicked += Login;
210199

211200
loginFlow.style.display = DisplayStyle.Flex;
212-
//Login Flow End
213-
214-
//MFA Flow Begin
215201

216202
mfaFlow = root.Q<VisualElement>("MFAFlow");
217203

@@ -222,20 +208,13 @@ public void CreateGUI()
222208
signInBtn.clickable.clickedWithEventInfo += SignIn;
223209

224210
mfaFlow.style.display = DisplayStyle.None;
225-
//MFA Flow End
226-
227-
228-
//Game Selector Flow Begin
229211

230212
gameSelectorFlow = root.Q<VisualElement>("GameSelectorFlow");
231213

232214
gameSelectorList = root.Q<VisualElement>("GamesList");
233215

234216
gameSelectorFlow.style.display = DisplayStyle.None;
235217

236-
//Game Selector Flow End
237-
238-
//API Key Flow Begin
239218
apiKeyFlow = root.Q<VisualElement>("APIKeyFlow");
240219

241220
apiKeyFlow.style.display = DisplayStyle.None;
@@ -275,8 +254,6 @@ public void CreateGUI()
275254
newApiKeyWindow.style.display = DisplayStyle.Flex;
276255
};
277256

278-
//API Key Flow End
279-
280257
if (StoredUser.current.user != null)
281258
{
282259
LootLockerConfig.current.adminToken = EditorPrefs.GetString("LootLocker.AdminToken");
@@ -386,7 +363,6 @@ private void ClosePopup(EventBase e)
386363
popup.style.display = DisplayStyle.None;
387364
}
388365

389-
//Login Flow Start
390366
public void Login()
391367
{
392368

@@ -432,10 +408,6 @@ public void Login()
432408
});
433409
}
434410

435-
//Login Flow End
436-
437-
//MFA Flow Start
438-
439411
public void SignIn(EventBase e)
440412
{
441413
EditorApplication.update += OnEditorUpdate;
@@ -458,9 +430,7 @@ public void SignIn(EventBase e)
458430
});
459431

460432
}
461-
//MFA Flow End
462433

463-
//Game Selector Flow Start
464434
public void CreateGameButtons()
465435
{
466436

@@ -476,21 +446,18 @@ public void CreateGameButtons()
476446

477447
public void GameButtonTemplate(Game game, string orgName)
478448
{
479-
//Parent
480449
Button button = new Button();
481450

482451
button.style.flexDirection = FlexDirection.Column;
483452
button.name = game.id.ToString();
484453

485454
button.AddToClassList("gameButton");
486455

487-
//Game title
488456
Label gameTitle = new Label();
489457
gameTitle.text = game.name;
490458

491459
gameTitle.AddToClassList("gameButtonTitle");
492460

493-
//Org title
494461
Label gameOrg = new Label();
495462
gameOrg.text = orgName;
496463

@@ -535,11 +502,6 @@ void OnGameSelected(EventBase e)
535502

536503
}
537504

538-
//Game Selector Flow End
539-
540-
//API Key Flow Start
541-
542-
543505
void CreateNewAPIKey()
544506
{
545507

@@ -635,7 +597,7 @@ void OnAPIKeySelected(EventBase e)
635597

636598
LootLockerConfig.current.apiKey = target.name;
637599

638-
//activeKey.text = "Active Key: " + LootLockerConfig.current.apiKey;
600+
activeKey.text = "Active Key: " + LootLockerConfig.current.apiKey;
639601
SwapNewSelectedKey();
640602

641603
}
@@ -670,4 +632,4 @@ void Logout()
670632
}
671633

672634
}
673-
//#endif
635+
#endif

Runtime/Editor/LootLockerAdminEndPoints.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using UnityEngine;
22

3-
//#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
3+
#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
44
namespace LootLocker
55
{
66
public class LootLockerAdminEndPoints
@@ -17,4 +17,4 @@ public class LootLockerAdminEndPoints
1717
public static EndPointClass adminExtensionGetUserRole = new EndPointClass("roles/{0}", LootLockerHTTPMethod.GET);
1818
}
1919
}
20-
//#endif
20+
#endif

Runtime/Editor/LootLockerExtensionCalls.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using UnityEngine;
33

4-
//#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
4+
#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
55
using LootLocker.Extension.Requests;
66
using LootLocker.Extension.Responses;
77

@@ -92,4 +92,4 @@ public static void GetUserRole(string userId, Action<UserRoleResponse> onComplet
9292
}
9393
}
9494
}
95-
//#endif
95+
#endif

Runtime/Editor/LootLockerExtensionResponses.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
//#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
3+
#if UNITY_EDITOR && UNITY_2021_3_OR_NEWER
44
using LootLocker.Extension.DataTypes;
55
namespace LootLocker.Extension.Requests
66
{
@@ -109,4 +109,4 @@ public class KeyResponse : LootLockerResponse
109109
}
110110

111111
}
112-
//#endif
112+
#endif

0 commit comments

Comments
 (0)