private void OnEnable() { if (EditorPrefs.HasKey(invoiceNumberKey)) { invoiceNumber = EditorPrefs.GetString(invoiceNumberKey); } else { invoiceNumber = ""; } if (EditorPrefs.HasKey(channelKey)) { channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt(channelKey); } else { channel = OnlineMapsUpdateChannel.stable; } string[] files = Directory.GetFiles("Assets", "HelpIcon.png", SearchOption.AllDirectories); if (files.Length > 0) { Texture helpIcon = AssetDatabase.LoadAssetAtPath(files[0], typeof(Texture)) as Texture; helpContent = new GUIContent(helpIcon, "You can find out your Invoice Number in the email confirming the purchase, or page the user in Unity Asset Store.\nClick to go to the Unity Asset Store."); } }
private void OnGUI() { EditorGUILayout.BeginHorizontal(); invoiceNumber = EditorGUILayout.TextField("Invoice Number:", invoiceNumber).Trim(' '); GUIStyle helpStyle = new GUIStyle(); helpStyle.margin = new RectOffset(2, 2, 2, 2); if (helpContent != null && GUILayout.Button(helpContent, helpStyle, GUILayout.ExpandWidth(false))) { Process.Start("https://www.assetstore.unity3d.com/en/#!/account/transactions"); } EditorGUILayout.EndHorizontal(); channel = (OnlineMapsUpdateChannel)EditorGUILayout.EnumPopup("Channel:", channel); GUILayout.Label("Current version: " + OnlineMaps.version); if (GUILayout.Button("Check new versions")) { CheckNewVersions(); } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); if (updates != null) { foreach (OnlineMapsUpdateItem update in updates) { update.Draw(); } if (updates.Count == 0) { GUILayout.Label("No updates"); } } EditorGUILayout.EndScrollView(); }
private void OnEnable() { if (EditorPrefs.HasKey(invoiceNumberKey)) { invoiceNumber = EditorPrefs.GetString(invoiceNumberKey); } else { invoiceNumber = ""; } if (EditorPrefs.HasKey(channelKey)) { channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt(channelKey); } else { channel = OnlineMapsUpdateChannel.stable; } helpContent = new GUIContent(OnlineMapsEditorUtils.LoadAsset <Texture2D>("Icons\\HelpIcon.png"), "You can find out your Invoice Number in the email confirming the purchase, or page the user in Unity Asset Store.\nClick to go to the Unity Asset Store."); }
public static void CheckNewVersionAvailable() { if (EditorPrefs.HasKey(lastVersionKey)) { lastVersionID = EditorPrefs.GetString(lastVersionKey); if (CompareVersions()) { hasNewVersion = true; return; } } const long ticksInHour = 36000000000; if (EditorPrefs.HasKey(lastVersionCheckKey)) { long lastVersionCheck = EditorPrefs.GetInt(lastVersionCheckKey) * ticksInHour; if (DateTime.Now.Ticks - lastVersionCheck < 24 * ticksInHour) { return; } } EditorPrefs.SetInt(lastVersionCheckKey, (int)(DateTime.Now.Ticks / ticksInHour)); if (EditorPrefs.HasKey(channelKey)) { channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt(channelKey); } else { channel = OnlineMapsUpdateChannel.stable; } if (channel == OnlineMapsUpdateChannel.stablePrevious) { channel = OnlineMapsUpdateChannel.stable; } WebClient client = new WebClient(); client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; client.UploadDataCompleted += delegate(object sender, UploadDataCompletedEventArgs response) { if (response.Error != null) { Debug.Log(response.Error.Message); return; } string version = Encoding.UTF8.GetString(response.Result); try { string[] vars = version.Split(new[] { '.' }); string[] vars2 = new string[4]; while (vars[1].Length < 8) { vars[1] += "0"; } vars2[0] = vars[0]; vars2[1] = int.Parse(vars[1].Substring(0, 2)).ToString(); vars2[2] = int.Parse(vars[1].Substring(2, 2)).ToString(); vars2[3] = int.Parse(vars[1].Substring(4)).ToString(); version = string.Join(".", vars2); } catch (Exception) { Debug.Log("Automatic check for Online Maps updates: Bad response."); return; } lastVersionID = version; hasNewVersion = CompareVersions(); EditorApplication.update += SetLastVersion; }; client.UploadDataAsync(new Uri("http://infinity-code.com/products_update/getlastversion.php"), "POST", Encoding.UTF8.GetBytes("c=" + (int)channel + "&package=" + WWW.EscapeURL(packageID))); }
private void OnGUI() { invoiceNumber = EditorGUILayout.TextField("Invoice Number:", invoiceNumber).Trim(new[] { ' ' }); channel = (OnlineMapsUpdateChannel) EditorGUILayout.EnumPopup("Channel:", channel); if (GUILayout.Button("Check new versions")) CheckNewVersions(); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); if (updates != null) { foreach (OnlineMapsUpdateItem update in updates) update.Draw(); if (updates.Count == 0) GUILayout.Label("No updates"); } EditorGUILayout.EndScrollView(); }
private void OnEnable() { if (EditorPrefs.HasKey("OnlineMapsInvoiceNumber")) invoiceNumber = EditorPrefs.GetString("OnlineMapsInvoiceNumber"); else invoiceNumber = ""; if (EditorPrefs.HasKey("OnlineMapsUpdateChannel")) channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt("OnlineMapsUpdateChannel"); else channel = OnlineMapsUpdateChannel.stable; }
public static void CheckNewVersionAvailable() { if (EditorPrefs.HasKey(lastVersionKey)) { lastVersionID = EditorPrefs.GetString(lastVersionKey); if (CompareVersions()) { hasNewVersion = true; return; } } const long ticksInHour = 36000000000; if (EditorPrefs.HasKey(lastVersionCheckKey)) { long lastVersionCheck = EditorPrefs.GetInt(lastVersionCheckKey) * ticksInHour; if (DateTime.Now.Ticks - lastVersionCheck < 24 * ticksInHour) { return; } } EditorPrefs.SetInt(lastVersionCheckKey, (int)(DateTime.Now.Ticks / ticksInHour)); if (EditorPrefs.HasKey(channelKey)) channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt(channelKey); else channel = OnlineMapsUpdateChannel.stable; if (channel == OnlineMapsUpdateChannel.stablePrevious) channel = OnlineMapsUpdateChannel.stable; WebClient client = new WebClient(); client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; client.UploadDataCompleted += delegate(object sender, UploadDataCompletedEventArgs response) { if (response.Error != null) { Debug.Log(response.Error.Message); return; } string version = Encoding.UTF8.GetString(response.Result); try { string[] vars = version.Split(new[] { '.' }); string[] vars2 = new string[4]; while (vars[1].Length < 8) vars[1] += "0"; vars2[0] = vars[0]; vars2[1] = int.Parse(vars[1].Substring(0, 2)).ToString(); vars2[2] = int.Parse(vars[1].Substring(2, 2)).ToString(); vars2[3] = int.Parse(vars[1].Substring(4)).ToString(); version = string.Join(".", vars2); } catch (Exception) { Debug.Log("Automatic check for Online Maps updates: Bad response."); return; } lastVersionID = version; hasNewVersion = CompareVersions(); EditorApplication.update += SetLastVersion; }; client.UploadDataAsync(new Uri("http://infinity-code.com/products_update/getlastversion.php"), "POST", Encoding.UTF8.GetBytes("c=" + (int)channel + "&package=" + WWW.EscapeURL(packageID))); }
private void OnGUI() { EditorGUILayout.BeginHorizontal(); invoiceNumber = EditorGUILayout.TextField("Invoice Number:", invoiceNumber).Trim(new[] { ' ' }); GUIStyle helpStyle = new GUIStyle(); helpStyle.margin = new RectOffset(2, 2, 2, 2); if (helpContent != null && GUILayout.Button(helpContent, helpStyle, GUILayout.ExpandWidth(false))) { Process.Start("https://www.assetstore.unity3d.com/en/#!/account/transactions"); } EditorGUILayout.EndHorizontal(); channel = (OnlineMapsUpdateChannel) EditorGUILayout.EnumPopup("Channel:", channel); GUILayout.Label("Current version: " + OnlineMaps.version); if (GUILayout.Button("Check new versions")) CheckNewVersions(); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); if (updates != null) { foreach (OnlineMapsUpdateItem update in updates) update.Draw(); if (updates.Count == 0) GUILayout.Label("No updates"); } EditorGUILayout.EndScrollView(); }
private void OnEnable() { if (EditorPrefs.HasKey(invoiceNumberKey)) invoiceNumber = EditorPrefs.GetString(invoiceNumberKey); else invoiceNumber = ""; if (EditorPrefs.HasKey(channelKey)) channel = (OnlineMapsUpdateChannel)EditorPrefs.GetInt(channelKey); else channel = OnlineMapsUpdateChannel.stable; string[] files = Directory.GetFiles("Assets", "HelpIcon.png", SearchOption.AllDirectories); if (files.Length > 0) { Texture helpIcon = AssetDatabase.LoadAssetAtPath(files[0], typeof(Texture)) as Texture; helpContent = new GUIContent(helpIcon, "You can find out your Invoice Number in the email confirming the purchase, or page the user in Unity Asset Store.\nClick to go to the Unity Asset Store."); } }