using System; using UnityEngine; using UnityEditor; using UnityEngine.UIElements; using System.Collections.Generic; using System.IO; using System.Net; using System.Threading; using System.Threading.Tasks; using Algolia.Search.Clients; using Algolia.Search.Models.Search; using UnityEditor.UIElements; using VRC.Core; using AlgoliaPackage = VRC.ExampleCentral.Types.Algolia.UnityPackage; using Button = UnityEngine.UIElements.Button; #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed namespace VRC.ExampleCentral.Window { public class ExampleDownloaderPanel : EditorWindow { [SerializeField] private VisualTreeAsset VisualTree; // Visual Elements, cached after creation private VisualElement goToLoginView; private VisualElement mainView; private VisualElement previewThumbnail; private Label previewTitle; private Label previewTags; private Label previewVersion; private Label previewDescription; private Button previewDownloadButton; private Button previewDocsButtons; private ToolbarSearchField searchField; private VisualElement examplesScrollviewContainer; private Button settingsButton; // Searching private CancellationTokenSource typingCancellation; private int searchDelayMs = 500; private AlgoliaPackage selectedPackage; private PackageButton selectedButton; // Algolia Info public const string AlgoliaSearchKey = "60b185254097bf630e913ceaf103822a"; public const string AlgoliaAppKey = "P787M8AJR8"; public const string AlgoliaIndexName = "unity-packages"; // Analytics rate-limiting private const int EVENT_LIMIT_EXAMPLE_PREVIEWED = 10; private const int TIME_LIMIT_EXAMPLE_PREVIEWED = 60; private int eventCounterExamplePreviewed; private DateTime lastResetTimeExamplePreviewed = DateTime.Now; #region Setup and Basics [MenuItem("VRChat SDK/🏠 Example Central", false, 980)] public static void ShowWindow() { ExampleDownloaderPanel window = GetWindow(); window.titleContent = new GUIContent("VRChat Example Central"); window.Show(); AnalyticsSDK.ExampleCentralOpened(); } private void CreateGUI() { // Set up base layout VisualTree.CloneTree(rootVisualElement); // Get top-level UI containers goToLoginView = rootVisualElement.Query("go-to-login"); mainView = rootVisualElement.Query("split-main"); // Get Auth View elements Button goToLoginButton = goToLoginView.Query