Exemplo n.º 1
0
    private void ExportToDisk(ActorPrefab prefab)
    {
#if USE_FILEBROWSER
        string path = Crosstales.FB.FileBrowser.OpenSingleFolder("Select save location");
        if (!path.IsNullOrEmpty())
        {
            sceneActorLibrary.WritePrefabToDir(prefab.GetId(), path);
            popups.Show("Actor exported!", "Ok");
        }
#else
        sceneActorLibrary.WritePrefabToDir(prefab.GetId(), System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments), "GBActors"));
        popups.Show("Actor exported to Documents/GBActors folder.\nFor more control over export location, build with the free CrossTales FileBrowser plugin.", "Ok");
#endif
    }
Exemplo n.º 2
0
    protected override void DoUpload(
        System.Action <Util.Maybe <ulong> > onComplete, System.Action <WorkshopAssetSource.GetUploadProgress> onStatus)
    {
        string name       = nameField.text;
        string desc       = descField.text;
        string contentDir = Util.CreateTempDirectory();

        sceneActorLibrary.WritePrefabToDir(actorPrefab.GetId(), contentDir);
        string thumbnailDir  = Util.CreateTempDirectory();
        string thumbnailPath = Path.Combine(thumbnailDir, "thumbnail.png");

        Util.SaveTextureToPng((Texture2D)thumbnailImage.texture, thumbnailPath);
        PublishedFileId_t?maybePublishedId;

        if (workshopId.IsEmpty())
        {
            maybePublishedId = null;
        }
        else
        {
            PublishedFileId_t publishedFileId = new PublishedFileId_t(workshopId.Value);
            maybePublishedId = publishedFileId;
        }
        workshopAssetSource.Put(contentDir, name, desc, GameBuilder.SteamUtil.GameBuilderTags.Actor, thumbnailPath,
                                maybePublishedId, onComplete, onStatus);
    }