static public void Init() { GameSparksPopUp window = (GameSparksPopUp)EditorWindow.GetWindowWithRect(typeof(GameSparksPopUp), new Rect((Screen.width - 350) / 2, (Screen.height - 265) / 2, 350, 265), false, "GameSparksSDK"); window.Focus(); }
private static void FixSDK() { //bool update = false; if (UnityEditorInternal.InternalEditorUtility.inBatchMode) { return; } try { /*string[] oldFiles1 = { * "Assets/GameSparks/Platforms/IOS", * * "Assets/Plugins/GameSparks.Api.dll.mdb.meta", * "Assets/Plugins/GameSparks.Api.dll.mdb", * * "Assets/Plugins/iOS/GameSparksWebSocket.h", * "Assets/Plugins/iOS/GameSparksWebSocket.m", * "Assets/Plugins/iOS/SRWebSocket.h", * "Assets/Plugins/iOS/SRWebSocket.m", * "Assets/Plugins/iOS/SocketController.h", * "Assets/Plugins/iOS/SocketController.m", * * "Assets/GameSparks/Editor/GameSparksPostprocessScript.cs", * "Assets/GameSparks/Editor/mod_pbxproj.py", * "Assets/GameSparks/Editor/mod_pbxproj.pyc", * "Assets/GameSparks/Editor/post_process.py" * }; * * string[] oldFiles2 = { * "Assets/Plugins/gamesparksunityosx.bundle/Contents/_CodeSignature/CodeResources.meta", * "Assets/Plugins/gamesparksunityosx.bundle/Contents/_CodeSignature/CodeResources", * "Assets/Plugins/gamesparksunityosx.bundle/Contents/MacOS/gamesparksunityosx.meta", * "Assets/Plugins/gamesparksunityosx.bundle/Contents/MacOS/gamesparksunityosx", * "Assets/Plugins/gamesparksunityosx.bundle/Contents/Info.plist.meta", * "Assets/Plugins/gamesparksunityosx.bundle/Contents/Info.plist", * "Assets/Plugins/iOS/GSExternal.h.meta", * "Assets/Plugins/iOS/GSExternal.h", * "Assets/Plugins/iOS/GSExternal.m.meta", * "Assets/Plugins/iOS/GSExternal.m", * "Assets/Plugins/Metro/GameSparks.dll.meta", * "Assets/Plugins/Metro/GameSparks.dll", * "Assets/Plugins/Metro/GameSparks.pri.meta", * "Assets/Plugins/Metro/GameSparks.pri", * "Assets/Plugins/Metro/GameSparks.XML.meta", * "Assets/Plugins/Metro/GameSparks.XML", * "Assets/Plugins/Metro/GameSparksRT.dll.meta", * "Assets/Plugins/Metro/GameSparksRT.dll", * "Assets/Plugins/Metro/GameSparksRT.pri.meta", * "Assets/Plugins/Metro/GameSparksRT.pri", * "Assets/Plugins/Metro/GameSparksRT.xml.meta", * "Assets/Plugins/Metro/GameSparksRT.xml", * "Assets/Plugins/WebGL/GameSparks.jslib.meta", * "Assets/Plugins/WebGL/GameSparks.jslib", * "Assets/Plugins/WP8/GameSparks.dll.meta", * "Assets/Plugins/WP8/GameSparks.dll", * "Assets/Plugins/WP8/GameSparks.XML.meta", * "Assets/Plugins/WP8/GameSparks.XML", * "Assets/Plugins/x86_64/GameSparksNative.dll.meta", * "Assets/Plugins/x86_64/GameSparksNative.dll", * "Assets/Plugins/XboxOne/GameSparksNative.dll.meta", * "Assets/Plugins/XboxOne/GameSparksNative.dll", * "Assets/Plugins/BouncyCastle_GameSparks.dll.meta", * "Assets/Plugins/BouncyCastle_GameSparks.dll", * "Assets/Plugins/GameSparks.Api.dll.meta", * "Assets/Plugins/GameSparks.Api.dll", * "Assets/Plugins/GameSparks.Api.XML.meta", * "Assets/Plugins/GameSparks.Api.XML", * "Assets/Plugins/GameSparks.dll.meta", * "Assets/Plugins/GameSparks.dll", * "Assets/Plugins/GameSparks.XML.meta", * "Assets/Plugins/GameSparks.XML", * "Assets/Plugins/GameSparksRT.dll.meta", * "Assets/Plugins/GameSparksRT.dll", * "Assets/Plugins/GameSparksRT.xml.meta", * "Assets/Plugins/GameSparksRT.xml" * }; * * foreach (string oldFile in oldFiles1) { * if (File.Exists (oldFile)) { * File.Delete (oldFile); * * update = true; * } else if (Directory.Exists (oldFile)) { * Directory.Delete (oldFile, true); * * update = true; * } * } * * if (!update) { * foreach (string oldFile in oldFiles2) { * if (File.Exists (oldFile) || Directory.Exists (oldFile)) { * update = true; * * break; * } * } * }*/ if (/*update ||*/ !EditorPrefs.GetBool(PlayerSettings.productName + "_GameSparksPopUpSeen", false) || !EditorPrefs.GetString(PlayerSettings.productName + "_GameSparksVersion").Equals(GameSparks.Core.GS.Version)) { EditorPrefs.SetBool(PlayerSettings.productName + "_GameSparksPopUpSeen", true); EditorPrefs.SetString(PlayerSettings.productName + "_GameSparksVersion", GameSparks.Core.GS.Version); /*string baseDir = "Plugins"; * string targetDir = "Assets/GameSparks/Plugins"; * DirectoryInfo dirInfo = new DirectoryInfo (targetDir); * DirectoryInfo dirInfo2 = new DirectoryInfo ("Assets/" + baseDir); * * if (!dirInfo.Exists) { * Directory.CreateDirectory (dirInfo.ToString ()); * } * * foreach (string file in oldFiles2) { * try { * FileInfo fileInfo = new FileInfo (file); * * string relativePath = fileInfo.DirectoryName; * * int index = relativePath.IndexOf (baseDir); * * if (index + baseDir.Length < relativePath.Length) { * index++; * } * * relativePath = relativePath.Substring (index + baseDir.Length); * * DirectoryInfo dirInfo3 = new DirectoryInfo (dirInfo + "/" + relativePath); * * if (!dirInfo3.Exists) { * Directory.CreateDirectory (dirInfo3.ToString ()); * } * * if ((new FileInfo (dirInfo3 + "/" + fileInfo.Name)).Exists) { * if (fileInfo.Exists) { * fileInfo.Delete (); * } * } else { * fileInfo.MoveTo (dirInfo3 + "/" + fileInfo.Name); * } * } catch { * } * }*/ AssetDatabase.Refresh(); //RecursiveDeleteFolders (dirInfo2); var assembly = Assembly.GetAssembly(typeof(UnityEditor.ActiveEditorTracker)); #if UNITY_2017_1_OR_NEWER var type = assembly.GetType("UnityEditor.LogEntries"); #else var type = assembly.GetType("UnityEditorInternal.LogEntries"); #endif var method = type.GetMethod("Clear"); method.Invoke(new object(), null); Selection.activeObject = GetOrCreateSettingsAsset(); ShowInspector(); GameSparksPopUp.Init(); } } catch { } }