|
1 | 1 | using System;
|
2 | 2 | using System.IO;
|
| 3 | +using UnityEditor.PackageManager.Requests; |
3 | 4 | #if UNITY_EDITOR
|
4 | 5 | using UnityEditor;
|
| 6 | +using UnityEditor.PackageManager.UI; |
| 7 | +using UnityEditor.PackageManager; |
5 | 8 | #endif
|
6 | 9 | using UnityEngine;
|
7 | 10 |
|
@@ -78,8 +81,32 @@ static void CreateConfigFile()
|
78 | 81 | EditorPrefs.SetBool(configFileEditorPref, true);
|
79 | 82 | }
|
80 | 83 | }
|
| 84 | + |
| 85 | + protected static ListRequest ListInstalledPackagesRequest; |
| 86 | + |
| 87 | + [InitializeOnLoadMethod] |
| 88 | + static void StoreSDKVersion() |
| 89 | + { |
| 90 | + ListInstalledPackagesRequest = Client.List(); |
| 91 | + EditorApplication.update += ListRequestProgress; |
| 92 | + } |
| 93 | + |
| 94 | + static void ListRequestProgress() |
| 95 | + { |
| 96 | + if (ListInstalledPackagesRequest.IsCompleted) |
| 97 | + { |
| 98 | + EditorApplication.update -= ListRequestProgress; |
| 99 | + foreach (var package in ListInstalledPackagesRequest.Result) |
| 100 | + { |
| 101 | + if (package.name.Equals("com.lootlocker.lootlockersdk")) |
| 102 | + { |
| 103 | + LootLockerConfig.current.sdk_version = package.version; |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + } |
81 | 108 | #endif
|
82 |
| - public static bool CreateNewSettings(string apiKey, string gameVersion, string domainKey, DebugLevel debugLevel = DebugLevel.All, bool allowTokenRefresh = false) |
| 109 | + public static bool CreateNewSettings(string apiKey, string gameVersion, string domainKey, LootLockerConfig.DebugLevel debugLevel = DebugLevel.All, bool allowTokenRefresh = false) |
83 | 110 | {
|
84 | 111 | _current = Get();
|
85 | 112 |
|
@@ -135,6 +162,7 @@ public static LootLockerConfig current
|
135 | 162 | [HideInInspector]
|
136 | 163 | public int gameID;
|
137 | 164 | public string game_version = "1.0.0.0";
|
| 165 | + [HideInInspector] public string sdk_version = ""; |
138 | 166 | [HideInInspector]
|
139 | 167 | public string deviceID = "defaultPlayerId";
|
140 | 168 |
|
|
0 commit comments