Ejemplo n.º 1
0
    public void Put(
        string contentDir,
        string name,
        string description,
        SteamUtil.GameBuilderTags typeTag,
        System.Action <Util.Maybe <ulong> > onComplete,
        System.Action <GetUploadProgress> onStatus = null)
    {
        ulong id = 0;

        while (Directory.Exists(Path.Combine(tempDir, id.ToString())))
        {
            id++;
        }
        string entryDir = Path.Combine(tempDir, id.ToString());

        Directory.CreateDirectory(entryDir);
        Util.CopyDirectoryRecursive(contentDir, entryDir);

        Util.Log($"Wrote all to {entryDir}");
        if (onComplete != null)
        {
            StartCoroutine(CompleteRoutine(id, onComplete));
        }
    }
Ejemplo n.º 2
0
 public void Put(
     string contentPath,
     string name,
     string description,
     SteamUtil.GameBuilderTags typeTag,
     string ignored,
     object ignored2,
     System.Action <Util.Maybe <ulong> > onComplete,
     System.Action <GetUploadProgress> onStatus = null)
 {
     Put(contentPath, name, description, typeTag, onComplete, onStatus);
 }
Ejemplo n.º 3
0
 public void Put(
     string contentPath,
     string name,
     string description,
     SteamUtil.GameBuilderTags typeTag,
     string thumbnailPath,
     PublishedFileId_t?fileIdToUpdate,
     System.Action <Util.Maybe <ulong> > onComplete,
     System.Action <GetUploadProgress> onStatus = null)
 {
     StartCoroutine(PutRoutine(contentPath, name, description, typeTag, thumbnailPath, fileIdToUpdate, onComplete, onStatus));
 }
Ejemplo n.º 4
0
    IEnumerator PutRoutine(
        string contentPath,
        string name,
        string description,
        SteamUtil.GameBuilderTags typeTag,
        string thumbnailPath,
        PublishedFileId_t?fileIdToUpdate,
        System.Action <Util.Maybe <ulong> > onComplete,
        System.Action <GetUploadProgress> onStatus = null)
    {
        yield return(null);

        if (!SteamManager.Initialized)
        {
            onComplete(Util.Maybe <ulong> .CreateError("Steam Workshop not available. Are you logged in? Maybe it's down?"));
            yield break;
        }

        WorkshopItemUpdate updateInfo = null;

        // NOTE: If we want to update the item, we can just remember the old file ID. Not sure how best to do this...we'd have to remember who the item belongs to..?
        // if (File.Exists(Path.Combine(contentPath, SteamUtil.WorkshopItemInfoFileName)))
        // {
        //   uploadItem = SteamWorkshopMain.Instance.GetItemUpdateFromFolder(contentPath);
        // }

        updateInfo             = new WorkshopItemUpdate();
        updateInfo.Name        = name;
        updateInfo.Description = description;
        updateInfo.ContentPath = contentPath;
        updateInfo.IconPath    = thumbnailPath;
        updateInfo.Tags.Add(SteamUtil.GameBuilderTags.Asset.ToString());
        updateInfo.Tags.Add(typeTag.ToString());
        if (fileIdToUpdate != null)
        {
            updateInfo.SteamNative.m_nPublishedFileId = fileIdToUpdate.Value;
        }
        if (updateInfo.IconPath == null && typeTag == SteamUtil.GameBuilderTags.CardPack)
        {
            updateInfo.IconPath = Path.Combine(
                Util.GetConcretePath(Util.AbstractLocation.StreamingAssets), CARD_PACK_ICON_PATH);
        }
        // uploadItem.IconPath // TODO
        SteamWorkshopMain.Instance.Upload(updateInfo, (args) => UploadCallback(args, onComplete));
        onStatus?.Invoke(() =>
        {
            return(SteamWorkshopMain.Instance.GetUploadProgress(updateInfo));
        });
    }