public void SetOpenSaveOrWorkshop(bool on)
    {
        if (!on)
        {
#if USE_STEAMWORKS
            workshopInfo.Close();
#endif
            saveMenu.SetOpen(false);
            return;
        }

        if (!ShowWorkshopInfo())
        {
            saveMenu.SetOpen(true);
        }
        else
        {
#if USE_STEAMWORKS
            SteamUtil.GetWorkShopItem(GetWorkshopFileID(), maybeItem =>
            {
                if (!maybeItem.IsEmpty())
                {
                    LapinerTools.Steam.Data.WorkshopItem item = maybeItem.Value;
                    workshopInfo.Open(maybeItem.Value);
                }
            });
#endif
        }
    }
Exemple #2
0
    IEnumerator QueryResumeInfoCoroutine(ResumeOptionHandler handler)
    {
        if (PlayerPrefs.HasKey(NetworkingController.LastJoinedRoomPrefKey) &&
            !PlayerPrefs.GetString(NetworkingController.LastJoinedRoomPrefKey).IsNullOrEmpty())
        {
            handler.HandleJoinCode(PlayerPrefs.GetString(NetworkingController.LastJoinedRoomPrefKey));
            yield break;
        }

        if (!PlayerPrefs.HasKey(ResumeInfoPlayerPrefKey))
        {
            yield break;
        }

        // Hmm ideally this is done in GetWorkShopItem, but I need to make that a MonoBehaviour.
#if USE_STEAMWORKS
        while (!SteamManager.Initialized)
        {
            yield return(null);
        }
#endif

        ResumeInfo info = JsonUtility.FromJson <ResumeInfo>(PlayerPrefs.GetString(ResumeInfoPlayerPrefKey));
#if USE_STEAMWORKS
        if (info.steamWorkshopFileId != 0)
        {
            SteamUtil.GetWorkShopItem(info.steamWorkshopFileId, item =>
            {
                if (!item.IsEmpty())
                {
                    handler.HandleWorkshopItem(item.Value);
                }
            });
            yield break;
        }
        else
#endif
        if (info.bundleId != null)
        {
            handler.HandleBundleId(info.bundleId);
            yield break;
        }
        else
        {
            Util.LogError($"resume pref key exists, but it didn't have valid info. Json: {PlayerPrefs.GetString(ResumeInfoPlayerPrefKey)}");
        }
    }
Exemple #3
0
    IEnumerator GetRoutine(ulong fileId, System.Action <Util.Maybe <string> > onComplete, System.Action <float> onProgress, System.Action <WorkshopItem> handleItem)
    {
        yield return(null);

        // In the non-Steam cache?
        string cachedItemDir = Path.Combine(cacheDirectory ?? "", fileId.ToString());

        Util.Log($"Looking for cached {cachedItemDir} - cacherootDir: {cacheDirectory}");
        if (cacheDirectory != null && Directory.Exists(cachedItemDir))
        {
            Util.Log($"OK load asset from cache: {cachedItemDir}");
            onComplete(Util.Maybe <string> .CreateWith(cachedItemDir));
            yield break;
        }

        if (!SteamManager.Initialized)
        {
            onComplete(Util.Maybe <string> .CreateError("Steam Workshop not available. Are you logged in? Maybe it's down?"));
            yield break;
        }
        SteamUtil.GetWorkShopItem(fileId, maybeItem => GetWorkshopHandler(maybeItem, onComplete, onProgress, handleItem));
    }
Exemple #4
0
    //TO DO: Steam panel here...

    public void Open()
    {
        gameObject.SetActive(true);

#if USE_STEAMWORKS
        if (steamLoadedItemId == 0)
        {
            // saveMenu.Open();
        }
        else
        {
            SteamUtil.GetWorkShopItem(steamLoadedItemId, maybeItem =>
            {
                if (!maybeItem.IsEmpty())
                {
                    currentItem = maybeItem.Value;
                    steamDetailPanel.Open(maybeItem.Value);
                }
            });
        }
#endif

        UpdateMultiplayerAdminButtonsVisibility();
    }