private void Update()
    {
        bool loading = IsLoading;

        downloadButton.button.interactable = !TaskMaker.IsBusy() || loading;
        downloadButton.buttonText.text     = loading ? "Cancel" : "Download/Update";
        loadingBarBack.SetActive(loading);
        if (loading)
        {
            loadingBar.fillAmount = DepotDownloader.ContentDownloader.DownloadPercent;
        }

        UpdateFilterButtons();
    }
Exemple #2
0
    private void Update()
    {
        noMatchPanel.SetActive(match == null);
        viewingMatchPanel.SetActive(match != null);
        if (match != null)
        {
            RefreshLoadingBar();

            bool isLoading = match.IsLoading;
            watch3DButton.buttonText.text = isLoading ? "Cancel" : "Watch 3D";
            watch2DButton.gameObject.SetActive(!isLoading);

            bool taskMakerBusy = !isLoading && TaskMaker.IsBusy();
            watch3DButton.button.interactable = !taskMakerBusy;
            watch2DButton.button.interactable = !taskMakerBusy;
        }
    }
Exemple #3
0
    private void UpdateMapUI()
    {
        emptyListLabel.text = SteamController.steamInScene.IsLoggedIn ? loggedInEmptyListMessage : notLoggedInEmptyListMessage;

        MapData currentMap = MapLoaderController.mapLoaderInScene.currentMap;

        noMapSelectedPanel.SetActive(currentMap == null);
        mapSelectedPanel.SetActive(currentMap != null);
        if (currentMap != null)
        {
            mapPreview.gameObject.SetActive(currentPreview != null);
            if (currentPreview != null)
            {
                mapPreview.sprite = currentPreview;
            }

            bool mapLoading2D = currentMap.IsLoading2D;
            bool mapLoading3D = currentMap.IsLoading3D;

            bool taskMakerBusy = TaskMaker.IsBusy();
            twoDeeViewButton.button.interactable   = !taskMakerBusy || mapLoading2D;
            threeDeeViewButton.button.interactable = !taskMakerBusy || mapLoading3D;

            loadingBar.SetActive(mapLoading2D || mapLoading3D);
            loadingBarBar.fillAmount = (currentMap.IsDownloading2D || currentMap.IsDownloading3D || currentMap.IsDownloadingDependencies) ? DepotDownloader.ContentDownloader.DownloadPercent : currentMap.GetPercentBuilt();
            loadingText.text         = mapLoading3D ? currentMap.GetStatus3D() : currentMap.GetStatus2D();

            //bool overviewAvailable = currentMap.IsOverviewAvailable();
            twoDeeViewButton.leftHalf.gameObject.SetActive(!mapLoading2D && !currentMap.IsOverviewAvailable());
            twoDeeViewButton.buttonText.text = !mapLoading2D ? "2D View" : "Cancel";
            //twoDeeViewButton.icon.sprite = !overviewAvailable ? downloadIcon : (currentMap.IsDownloading2D ? downloadingIcon : builtIcon);

            threeDeeViewButton.leftHalf.gameObject.SetActive((!currentMap.IsMapAvailable() || currentMap.IsBuilt) && !mapLoading3D);
            threeDeeViewButton.icon.sprite     = currentMap.IsBuilt ? builtIcon : downloadIcon;
            threeDeeViewButton.buttonText.text = !currentMap.IsLoading3D ? "3D View" : "Cancel";

            titleText.text = currentMap.GetMapName();
        }

        bottomLoadingPanel.SetActive(SteamController.steamInScene.isManifestDownloading);
        if (SteamController.steamInScene.isManifestDownloading)
        {
            bottomLoadingText.text = "Retrieving maps from Steam";
        }
    }
    private void RefreshItemInfo()
    {
        if (item != null && item is DepotDownloader.ProtoManifest.FileData)
        {
            var resourcePakData = (DepotDownloader.ProtoManifest.FileData)item;

            var fullFilePath = Path.Combine(SettingsController.gameLocation, resourcePakData.FileName);

            packNameLabel.text        = Path.GetFileNameWithoutExtension(resourcePakData.FileName);
            packSizeLabel.text        = (resourcePakData.TotalSize / 1000000) + "MB";
            deleteButton.interactable = File.Exists(fullFilePath);
            downloadToggle.isOn       = SettingsController.HasPak(resourcePakData.FileName);

            fileNeedsUpdate = false;
            if (!TaskMaker.IsBusy() && deleteButton.interactable)
            {
                if (resourcePakData.Chunks != null && resourcePakData.Chunks.Count > 0)
                {
                    hashTask = UnityHelpers.TaskManagerController.CreateTask((ct) => { CheckForUpdates(fullFilePath, resourcePakData, ct); });
                    UnityHelpers.TaskManagerController.QueueTask(hashTask);
                }
            }
        }
    }