protected void OnRenderUploadGUI([NotNull] IUploadedContentDataDefinition uploadDefinition, [NotNull] UnityEngine.Object contentObject, Action <ContentUploadToken> onContentTokenCallback = null) { if (uploadDefinition == null) { throw new ArgumentNullException(nameof(uploadDefinition)); } //If the content is null, we should render DISABLED buttons here if (contentObject == null) { EditorGUI.BeginDisabledGroup(true); } if (uploadDefinition.ContentId > 0) { EditorGUILayout.LabelField($"{ContentType} Id: {uploadDefinition.ContentId}"); EditorGUILayout.LabelField($"{ContentType} GUID: {uploadDefinition.ContentGuid.ToString()}"); //TODO: Conssolidate if (GUILayout.Button($"Update {ContentType}")) { string assetBundlePath = GenerateContentBundle(contentObject); var contentServerServiceClient = new DownloadableContentServiceClientFactory().Create(EmptyFactoryContext.Instance); UploadContentAssetBundle(assetBundlePath, new UpdatedContentUploadTokenFactory(contentServerServiceClient, uploadDefinition), onContentTokenCallback); } } else { //TODO: Consolidate //If there is no world data definition then we should allow users //to upload a new world. if (GUILayout.Button($"Upload {ContentType}")) { string assetBundlePath = GenerateContentBundle(contentObject); var contentServerServiceClient = new DownloadableContentServiceClientFactory().Create(EmptyFactoryContext.Instance); UploadContentAssetBundle(assetBundlePath, new NewContentUploadTokenFactory(contentServerServiceClient), onContentTokenCallback); } } //If the content is null, we should render DISABLED buttons here if (contentObject == null) { EditorGUI.EndDisabledGroup(); } }
public UpdatedContentUploadTokenFactory([NotNull] IDownloadableContentServerServiceClient contentClient, [NotNull] IUploadedContentDataDefinition contentDataDefinition) { ContentClient = contentClient ?? throw new ArgumentNullException(nameof(contentClient)); ContentDataDefinition = contentDataDefinition ?? throw new ArgumentNullException(nameof(contentDataDefinition)); }