Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit eac89d5

Browse files
author
Erik Bylund
committed
Add a warning about the asset store version being deprecated, helping people to migrate to openupm
1 parent 7ce5515 commit eac89d5

File tree

4 files changed

+71
-6
lines changed

4 files changed

+71
-6
lines changed

Runtime/Editor/Editor UI/LootLockerAdminExtension.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class LootLockerAdminExtension : EditorWindow
2121
StyleColor live;
2222
StyleColor defaultButton;
2323

24+
private Label versionDeprecatedWarningContentLabel;
2425

2526
[Header("Environment")]
2627
private VisualElement environmentBackground, environmentHandle;
@@ -136,6 +137,9 @@ public void CreateGUI()
136137
stage.value = new Color(0.094f, 0.749f, 0.352f, 1);
137138
defaultButton.value = new Color(0.345f, 0.345f, 0.345f, 1);
138139

140+
versionDeprecatedWarningContentLabel = root.Q<Label>("VersionDeprecatedWarningContent");
141+
versionDeprecatedWarningContentLabel.text = LootLockerConfig.htmlVersionDeprecatedWarningText;
142+
139143
menuLogoutBtn = root.Q<Button>("LogoutBtn");
140144

141145
menuLogoutBtn.style.display = DisplayStyle.None;

Runtime/Editor/Editor UI/LootLockerAdminExtension.uxml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" engine="UnityEngine.UIElements" editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
2-
<Style src="project://database/Assets/LootLockerSDK/Editor/Editor%20UI/LootLockerAdminExtension.uss?fileID=7433441132597879392&amp;guid=f1130e18dfb99e04cbd54f3fac00ff15&amp;type=3#LootLockerAdminExtension" />
2+
<Style src="project://database/Packages/com.lootlocker.lootlockersdk/Runtime/Editor/Editor%20UI/LootLockerAdminExtension.uss?fileID=7433441132597879392&amp;guid=f1130e18dfb99e04cbd54f3fac00ff15&amp;type=3#LootLockerAdminExtension" />
33
<ui:VisualElement style="align-self: stretch; justify-content: center; align-items: stretch; height: 100%;">
44
<ui:VisualElement name="Topbar" style="flex-grow: 1; visibility: visible; display: flex; border-bottom-width: 2px; border-bottom-color: rgb(46, 46, 46); flex-direction: row; justify-content: flex-start; align-self: auto; align-items: stretch; flex-wrap: wrap;">
5-
<ui:Label tabindex="-1" text="LootLocker" display-tooltip-when-elided="true" name="GameName" style="align-items: flex-start; align-self: center; font-size: 28px; -unity-text-align: middle-left; text-overflow: clip; width: auto; white-space: nowrap; max-width: 750px; margin-left: 24px; justify-content: flex-start;" />
6-
<ui:VisualElement name="Environment" style="flex-grow: 1; flex-direction: row; flex-shrink: 1; align-self: stretch; justify-content: flex-end; margin-right: 24px;">
7-
<ui:Label tabindex="-1" text="Environment: Stage" display-tooltip-when-elided="true" name="EnvironmentTitle" style="align-items: flex-start; align-self: center; font-size: 14px; -unity-text-align: middle-left; text-overflow: clip; white-space: nowrap; margin-right: 8px;" />
8-
<ui:VisualElement name="SwitchBackground" class="environmentToStageBackground" style="flex-grow: 1; background-color: rgb(28, 232, 109); min-width: 0; min-height: 26px; border-top-left-radius: 12px; border-top-right-radius: 12px; border-bottom-right-radius: 12px; border-bottom-left-radius: 12px; align-items: auto; align-self: center; max-width: 45px; justify-content: center; flex-shrink: 0;">
9-
<ui:VisualElement name="Handle" style="flex-grow: 1; background-color: rgb(255, 255, 255); align-self: flex-start; align-items: flex-end; justify-content: flex-start; border-top-left-radius: 90px; border-top-right-radius: 90px; border-bottom-right-radius: 90px; border-bottom-left-radius: 90px; margin-right: 4px; margin-left: 4px; flex-shrink: 0; width: 20px; height: 20px; min-width: 20px; min-height: 20px; max-height: 20px; max-width: 20px; margin-top: 0;" />
5+
<ui:VisualElement name="VisualElement" style="flex-grow: 1; flex-direction: row; align-items: center;">
6+
<ui:VisualElement style="flex-grow: 1; flex-wrap: nowrap;">
7+
<ui:Label tabindex="-1" text="LootLocker" display-tooltip-when-elided="true" name="GameName" style="align-items: flex-start; align-self: center; font-size: 28px; -unity-text-align: middle-left; text-overflow: clip; width: auto; white-space: nowrap; max-width: 750px; margin-left: 24px; justify-content: flex-start;" />
8+
<ui:VisualElement style="flex-grow: 1; flex-direction: row; align-items: center; align-self: center; padding-top: 8px; padding-right: 8px; padding-bottom: 8px; padding-left: 8px; justify-content: flex-start; flex-wrap: wrap;">
9+
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="VersionDeprecatedWarning" text="WARNING: " style="align-self: flex-start; align-items: flex-start; color: rgb(209, 3, 3); justify-content: flex-start;" />
10+
<ui:Label tabindex="-1" display-tooltip-when-elided="true" name="VersionDeprecatedWarningContent" style="flex-wrap: wrap; white-space: normal;" />
11+
</ui:VisualElement>
12+
</ui:VisualElement>
13+
<ui:VisualElement name="Environment" style="flex-grow: 1; flex-direction: row; flex-shrink: 1; align-self: stretch; justify-content: flex-end; margin-right: 24px;">
14+
<ui:Label tabindex="-1" text="Environment: Stage" display-tooltip-when-elided="true" name="EnvironmentTitle" style="align-items: flex-start; align-self: center; font-size: 14px; -unity-text-align: middle-left; text-overflow: clip; white-space: nowrap; margin-right: 8px;" />
15+
<ui:VisualElement name="SwitchBackground" class="environmentToStageBackground" style="flex-grow: 1; background-color: rgb(28, 232, 109); min-width: 0; min-height: 26px; border-top-left-radius: 12px; border-top-right-radius: 12px; border-bottom-right-radius: 12px; border-bottom-left-radius: 12px; align-items: auto; align-self: center; max-width: 45px; justify-content: center; flex-shrink: 0;">
16+
<ui:VisualElement name="Handle" style="flex-grow: 1; background-color: rgb(255, 255, 255); align-self: flex-start; align-items: flex-end; justify-content: flex-start; border-top-left-radius: 90px; border-top-right-radius: 90px; border-bottom-right-radius: 90px; border-bottom-left-radius: 90px; margin-right: 4px; margin-left: 4px; flex-shrink: 0; width: 20px; height: 20px; min-width: 20px; min-height: 20px; max-height: 20px; max-width: 20px; margin-top: 0;" />
17+
</ui:VisualElement>
1018
</ui:VisualElement>
1119
</ui:VisualElement>
1220
</ui:VisualElement>

Runtime/Editor/ProjectSettings.cs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,60 @@ public override void OnGUI(string searchContext)
7070
}
7171
m_CustomSettings.ApplyModifiedProperties();
7272
}
73+
74+
static void HorizontalLine(Color color)
75+
{
76+
// create your style
77+
var horizontalLine = new GUIStyle
78+
{
79+
normal =
80+
{
81+
background = EditorGUIUtility.whiteTexture
82+
},
83+
margin = new RectOffset(0, 0, 4, 4),
84+
fixedHeight = 1
85+
};
86+
87+
var c = GUI.color;
88+
GUI.color = color;
89+
GUILayout.Box(GUIContent.none, horizontalLine);
90+
GUI.color = c;
91+
}
7392

7493
private void DrawGameSettings()
7594
{
95+
EditorGUILayout.Space(); EditorGUILayout.Space();
96+
HorizontalLine(Color.gray);
97+
var warningHeader = new GUIContent("DEPRECATION WARNING");
98+
var warningHeaderStyle = new GUIStyle
99+
{
100+
alignment = TextAnchor.UpperCenter,
101+
fontSize = 18,
102+
normal =
103+
{
104+
textColor = Color.red
105+
}
106+
};
107+
EditorGUILayout.LabelField(warningHeader, warningHeaderStyle);
108+
EditorGUILayout.Space();
109+
var versionDeprecatedWarningContent = new GUIContent
110+
{
111+
text = LootLockerConfig.htmlVersionDeprecatedWarningText
112+
};
113+
var versionDeprecatedWarningContentStyle = new GUIStyle
114+
{
115+
richText = true,
116+
wordWrap = true,
117+
normal =
118+
{
119+
textColor = Color.white
120+
}
121+
};
122+
EditorGUILayout.LabelField(versionDeprecatedWarningContent, versionDeprecatedWarningContentStyle);
123+
EditorGUILayout.Space();
124+
HorizontalLine(Color.gray);
125+
EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space();
126+
76127
EditorGUI.BeginChangeCheck();
77128
EditorGUILayout.PropertyField(m_CustomSettings.FindProperty("apiKey"));
78129
if (EditorGUI.EndChangeCheck())

Runtime/Game/Resources/LootLockerConfig.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public static LootLockerConfig Get()
3333
settingsInstance = Resources.Load<LootLockerConfig>("Config/LootLockerConfig");
3434

3535
#if UNITY_EDITOR
36+
Debug.LogWarning(htmlVersionDeprecatedWarningText);
3637
// Could not be loaded, create it
3738
if (settingsInstance == null)
3839
{
@@ -260,6 +261,7 @@ public static LootLockerConfig current
260261
public enum DebugLevel { All, ErrorOnly, NormalOnly, Off , AllAsNormal}
261262
public DebugLevel currentDebugLevel = DebugLevel.All;
262263
public bool allowTokenRefresh = true;
264+
[HideInInspector] public const string htmlVersionDeprecatedWarningText = "LootLocker SDK has moved from Unity Asset Store to Open UPM. If you want to continue receiving updates, <a href=\"https://openupm.com/packages/com.lootlocker.lootlockersdk/\">please use our Open UPM version</a>. Read more <a href=\"https://docs.lootlocker.com/reference/deprecation-guide/unity-sdk-deprecation-log/version-2.1.5-migration-to-open-upm\">here</a>.";
263265

264266
#if UNITY_EDITOR
265267
[InitializeOnEnterPlayMode]

0 commit comments

Comments
 (0)