diff --git a/Editor/FeatureSpawner.cs b/Editor/FeatureSpawner.cs new file mode 100644 index 0000000..c81647c --- /dev/null +++ b/Editor/FeatureSpawner.cs @@ -0,0 +1,82 @@ +using NFTPort.Internal; +using UnityEditor; +using UnityEngine; + +namespace NFTPort.Editor +{ + + public class FeatureSpawner : EditorWindow + { + + //GameObject + private const string GameObjMenu = "GameObject/NFTPort/"; + + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_NFTs_OfAccount)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_NFTs_OfAccount)] + static void Spawn_NFtsOfAccount() + { + new GameObject(PortConstants.FeatureName_NFTs_OfAccount).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_NFTs_OfContract)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_NFTs_OfContract)] + static void Spawn_NFtsOfContract() + { + new GameObject(PortConstants.FeatureName_NFTs_OfContract).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_StorageFiles)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_StorageFiles)] + static void Spawn_StorageFile() + { + new GameObject(PortConstants.FeatureName_StorageFiles).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_StorageMetadata)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_StorageMetadata)] + static void Spawn_StorageMetadata() + { + new GameObject(PortConstants.FeatureName_StorageMetadata).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_AssetDownloader)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_AssetDownloader)] + static void FeatureName_AssetDownloader() + { + new GameObject(PortConstants.FeatureName_AssetDownloader).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_ConnectUserWallet)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_ConnectUserWallet)] + static void FeatureName_ConnectWallet() + { + new GameObject(PortConstants.FeatureName_ConnectUserWallet).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_Mint_Custom)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_Mint_Custom)] + static void FeatureName_Mint_Custom() + { + new GameObject(PortConstants.FeatureName_Mint_Custom).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_Mint_URL)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_Mint_URL)] + static void FeatureName_Mint_URL() + { + new GameObject(PortConstants.FeatureName_Mint_URL).AddComponent(); + } + + [MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_Deploy)] + [MenuItem(GameObjMenu + PortConstants.FeatureName_Deploy)] + static void FeatureName_Deploy() + { + new GameObject(PortConstants.FeatureName_Deploy).AddComponent(); + } + + + + } + +} diff --git a/Editor/FeatureSpawner.cs.meta b/Editor/FeatureSpawner.cs.meta new file mode 100644 index 0000000..b64e7ec --- /dev/null +++ b/Editor/FeatureSpawner.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d10cdad613a2084eb8eba7338d3bdb3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Editor/Mint_Custom_Editor.cs b/Editor/Mint_Custom_Editor.cs index 857be91..6364f0e 100644 --- a/Editor/Mint_Custom_Editor.cs +++ b/Editor/Mint_Custom_Editor.cs @@ -26,7 +26,7 @@ public override void OnInspectorGUI() if(GUILayout.Button("View Documentation", GUILayout.Height(25))) - Application.OpenURL(PortConstants.Docs_GettingStarted); + Application.OpenURL(PortConstants.Docs_Mint_Custom); DrawDefaultInspector(); } } diff --git a/Editor/Mint_Custom_Editor1.cs b/Editor/Mint_Custom_Editor1.cs new file mode 100644 index 0000000..963dfcd --- /dev/null +++ b/Editor/Mint_Custom_Editor1.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +namespace NFTPort.Editor +{ + using UnityEditor; + using Internal; + + [CustomEditor(typeof(Deploy))] + public class Deploy_Contract_Editor : Editor + { + public override void OnInspectorGUI() + { + + Deploy myScript = (Deploy)target; + + + Texture banner = Resources.Load("c_productmint"); + GUILayout.BeginHorizontal(); + GUILayout.Box(banner); + GUILayout.EndHorizontal(); + + if (GUILayout.Button("Deploy Product Contract", GUILayout.Height(45))) + { + myScript.Run(); + } + + + if(GUILayout.Button("View Documentation", GUILayout.Height(25))) + Application.OpenURL(PortConstants.Docs_DeployContract); + DrawDefaultInspector(); + } + } +} + diff --git a/Editor/Mint_Custom_Editor1.cs.meta b/Editor/Mint_Custom_Editor1.cs.meta new file mode 100644 index 0000000..6ee154d --- /dev/null +++ b/Editor/Mint_Custom_Editor1.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: af17817248e98a04692a3562f4b7dca5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/AssetDownloader.cs b/Runtime/AssetDownloader.cs index c026480..a86f1e9 100644 --- a/Runtime/AssetDownloader.cs +++ b/Runtime/AssetDownloader.cs @@ -1,4 +1,6 @@ using System.Collections; +using System.ComponentModel.Design; +using NFTPort.Internal; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; @@ -9,6 +11,8 @@ namespace NFTPort /// /// Downloads Asset from given url /// + [AddComponentMenu(PortConstants.BaseComponentMenu + PortConstants.FeatureName_AssetDownloader)] + [HelpURL(PortConstants.Docs_AssetDownloader)] public class AssetDownloader : MonoBehaviour { public bool debugErrorLog = true; diff --git a/Runtime/ConnectPlayerWallet.cs b/Runtime/ConnectPlayerWallet.cs index 6a5d2f1..0b14cf5 100644 --- a/Runtime/ConnectPlayerWallet.cs +++ b/Runtime/ConnectPlayerWallet.cs @@ -5,7 +5,10 @@ namespace NFTPort { using UnityEngine; using UnityEngine.Events; + using Internal; + [AddComponentMenu(PortConstants.BaseComponentMenu + PortConstants.FeatureName_ConnectUserWallet)] + [HelpURL(PortConstants.Docs_ConnectUserWallet)] public class ConnectPlayerWallet : MonoBehaviour { public string connectedWalletAddress; diff --git a/Runtime/Internal/PortConstants.cs b/Runtime/Internal/PortConstants.cs index 0e540e9..a9d54a6 100644 --- a/Runtime/Internal/PortConstants.cs +++ b/Runtime/Internal/PortConstants.cs @@ -11,11 +11,28 @@ public static class PortConstants public const string NFTs_OfAccount = "https://docs.nftport.xyz/docs/nftport/ZG9jOjUyMzI4NTkz-nf-ts-owned-by-an-account"; public const string NFTs_OfContract = "https://docs.nftport.xyz/docs/nftport/ZG9jOjUzNjI2MzQ0-nf-ts-of-a-contract-collection"; public const string Docs_Mint_URL = "https://docs.nftport.xyz/docs/nftport/ZG9jOjU1MDM4OTgw-minting-w-url"; + public const string Docs_Mint_Custom = "https://docs.nftport.xyz/docs/nftport/ZG9jOjYzMDIzNDgx-customizable-minting"; + public const string Docs_AssetDownloader = "https://docs.nftport.xyz/docs/nftport/ZG9jOjU2NjAzOTE0-asset-downloader"; + public const string Docs_ConnectUserWallet = "https://docs.nftport.xyz/docs/nftport/ZG9jOjU3MTU2NTE5-player-wallet-connect"; + public const string Docs_DeployContract = "https://docs.nftport.xyz/docs/nftport/b3A6MjE0MDYzNzU-deploy-a-contract-for-nft-products"; public const string DiscordInvite = "https://discord.gg/w92sXkNmBR"; public const string Github = "https://github.com/nftport/nftport-unity.git"; + + public const string BaseComponentMenu = "NFTPort/"; + public const string BaseFeatureSpawnerMenu = "NFTPort/Spawner/"; + public const string FeatureName_ConnectUserWallet = "Connect Player Wallet"; + public const string FeatureName_NFTs_OfContract = "NFT Data | of a contract-collection"; + public const string FeatureName_NFTs_OfAccount = "NFT Data | of an Account"; + public const string FeatureName_StorageFiles = "Storage | Upload File"; + public const string FeatureName_StorageMetadata = "Storage | Upload Metadata"; + public const string FeatureName_AssetDownloader = "Asset Downloader"; + public const string FeatureName_Mint_Custom = "Mint | Customizable minting"; + public const string FeatureName_Mint_URL = "Mint | Easy mint using URL"; + public const string FeatureName_Deploy = "Deploy Contract"; + } } diff --git a/Runtime/Mint_Custom.cs b/Runtime/Mint_Custom.cs index 5494693..6cf0799 100644 --- a/Runtime/Mint_Custom.cs +++ b/Runtime/Mint_Custom.cs @@ -11,7 +11,10 @@ namespace NFTPort /// /// Customizable minting. Mints an NFT to your previously contract for NFT products. /// - [ExecuteInEditMode] + /// + [AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_Mint_Custom)] + [ExecuteAlways] + [HelpURL(PortConstants.Docs_Mint_Custom)] public class Mint_Custom : MonoBehaviour { public enum Chains diff --git a/Runtime/Mint_URL.cs b/Runtime/Mint_URL.cs index 8630b28..b49b50b 100644 --- a/Runtime/Mint_URL.cs +++ b/Runtime/Mint_URL.cs @@ -11,7 +11,9 @@ namespace NFTPort /// /// Easy minting w/URL, If you wish to customize the minting process e.g. use your own contract, set more metadata, see Customizable minting. /// - [ExecuteInEditMode] + [AddComponentMenu(PortConstants.BaseComponentMenu + PortConstants.FeatureName_Mint_URL)] + [ExecuteAlways] + [HelpURL(PortConstants.Docs_Mint_URL)] public class Mint_URL : MonoBehaviour { public enum Chains diff --git a/Runtime/NFTs_OfAContract.cs b/Runtime/NFTs_OfAContract.cs index 2533258..4fb0247 100644 --- a/Runtime/NFTs_OfAContract.cs +++ b/Runtime/NFTs_OfAContract.cs @@ -10,7 +10,9 @@ namespace NFTPort /// /// NFTs of a contract / collections /// - [ExecuteInEditMode] + [AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_NFTs_OfContract)] + [ExecuteAlways] + [HelpURL(PortConstants.NFTs_OfContract)] public class NFTs_OfAContract : MonoBehaviour { /// diff --git a/Runtime/NFTs_OwnedByAnAccount.cs b/Runtime/NFTs_OwnedByAnAccount.cs index b08c171..8b0835a 100644 --- a/Runtime/NFTs_OwnedByAnAccount.cs +++ b/Runtime/NFTs_OwnedByAnAccount.cs @@ -13,7 +13,9 @@ namespace NFTPort /// /// NFTs owned by a given account (wallet address), Can also return each NFT metadata with include parameter and filter from specific collection. /// - [ExecuteInEditMode] + [AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_NFTs_OfAccount)] + [ExecuteAlways] + [HelpURL(PortConstants.NFTs_OfAccount)] public class NFTs_OwnedByAnAccount : MonoBehaviour { /// diff --git a/Runtime/Storage_UploadFile.cs b/Runtime/Storage_UploadFile.cs index ec343e5..ee6dcc6 100644 --- a/Runtime/Storage_UploadFile.cs +++ b/Runtime/Storage_UploadFile.cs @@ -10,7 +10,9 @@ namespace NFTPort using Internal; using Utils; - [ExecuteInEditMode] + [AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_StorageFiles)] + [ExecuteAlways] + [HelpURL(PortConstants.Docs_StorageFile)] public class Storage_UploadFile : MonoBehaviour { #region Parameter Defines diff --git a/Runtime/Storage_UploadMetadata.cs b/Runtime/Storage_UploadMetadata.cs index deb9a5b..005611d 100644 --- a/Runtime/Storage_UploadMetadata.cs +++ b/Runtime/Storage_UploadMetadata.cs @@ -13,7 +13,9 @@ namespace NFTPort { using Internal; using Utils; - [ExecuteInEditMode] + [AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_StorageMetadata)] + [ExecuteAlways] + [HelpURL(PortConstants.Docs_StorageMetadata)] public class Storage_UploadMetadata : MonoBehaviour { #region Parameter Defines