Skip to content

Commit

Permalink
feat: Style updates and Feature Spawners : NFTPort Features now avail…
Browse files Browse the repository at this point in the history
…able in Component and Game Object Add menus
  • Loading branch information
saszer committed Jun 2, 2022
1 parent f896f8c commit 8e33d74
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 7 deletions.
82 changes: 82 additions & 0 deletions Editor/FeatureSpawner.cs
Original file line number Diff line number Diff line change
@@ -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<NFTs_OwnedByAnAccount>();
}

[MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_NFTs_OfContract)]
[MenuItem(GameObjMenu + PortConstants.FeatureName_NFTs_OfContract)]
static void Spawn_NFtsOfContract()
{
new GameObject(PortConstants.FeatureName_NFTs_OfContract).AddComponent<NFTs_OfAContract>();
}

[MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_StorageFiles)]
[MenuItem(GameObjMenu + PortConstants.FeatureName_StorageFiles)]
static void Spawn_StorageFile()
{
new GameObject(PortConstants.FeatureName_StorageFiles).AddComponent<Storage_UploadFile>();
}

[MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_StorageMetadata)]
[MenuItem(GameObjMenu + PortConstants.FeatureName_StorageMetadata)]
static void Spawn_StorageMetadata()
{
new GameObject(PortConstants.FeatureName_StorageMetadata).AddComponent<Storage_UploadMetadata>();
}

[MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_AssetDownloader)]
[MenuItem(GameObjMenu + PortConstants.FeatureName_AssetDownloader)]
static void FeatureName_AssetDownloader()
{
new GameObject(PortConstants.FeatureName_AssetDownloader).AddComponent<AssetDownloader>();
}

[MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_ConnectUserWallet)]
[MenuItem(GameObjMenu + PortConstants.FeatureName_ConnectUserWallet)]
static void FeatureName_ConnectWallet()
{
new GameObject(PortConstants.FeatureName_ConnectUserWallet).AddComponent<ConnectPlayerWallet>();
}

[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<Mint_Custom>();
}

[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<Mint_URL>();
}

[MenuItem(PortConstants.BaseFeatureSpawnerMenu + PortConstants.FeatureName_Deploy)]
[MenuItem(GameObjMenu + PortConstants.FeatureName_Deploy)]
static void FeatureName_Deploy()
{
new GameObject(PortConstants.FeatureName_Deploy).AddComponent<Deploy>();
}



}

}
11 changes: 11 additions & 0 deletions Editor/FeatureSpawner.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Editor/Mint_Custom_Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
Expand Down
34 changes: 34 additions & 0 deletions Editor/Mint_Custom_Editor1.cs
Original file line number Diff line number Diff line change
@@ -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<Texture>("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();
}
}
}

11 changes: 11 additions & 0 deletions Editor/Mint_Custom_Editor1.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Runtime/AssetDownloader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Collections;
using System.ComponentModel.Design;
using NFTPort.Internal;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
Expand All @@ -9,6 +11,8 @@ namespace NFTPort
/// <summary>
/// Downloads Asset from given url
/// </summary>
[AddComponentMenu(PortConstants.BaseComponentMenu + PortConstants.FeatureName_AssetDownloader)]
[HelpURL(PortConstants.Docs_AssetDownloader)]
public class AssetDownloader : MonoBehaviour
{
public bool debugErrorLog = true;
Expand Down
3 changes: 3 additions & 0 deletions Runtime/ConnectPlayerWallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 17 additions & 0 deletions Runtime/Internal/PortConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

}
}

5 changes: 4 additions & 1 deletion Runtime/Mint_Custom.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ namespace NFTPort
/// <summary>
/// Customizable minting. Mints an NFT to your previously contract for NFT products.
/// </summary>
[ExecuteInEditMode]
///
[AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_Mint_Custom)]
[ExecuteAlways]
[HelpURL(PortConstants.Docs_Mint_Custom)]
public class Mint_Custom : MonoBehaviour
{
public enum Chains
Expand Down
4 changes: 3 additions & 1 deletion Runtime/Mint_URL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ namespace NFTPort
/// <summary>
/// Easy minting w/URL, If you wish to customize the minting process e.g. use your own contract, set more metadata, see Customizable minting.
/// </summary>
[ExecuteInEditMode]
[AddComponentMenu(PortConstants.BaseComponentMenu + PortConstants.FeatureName_Mint_URL)]
[ExecuteAlways]
[HelpURL(PortConstants.Docs_Mint_URL)]
public class Mint_URL : MonoBehaviour
{
public enum Chains
Expand Down
4 changes: 3 additions & 1 deletion Runtime/NFTs_OfAContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ namespace NFTPort
/// <summary>
/// NFTs of a contract / collections
/// </summary>
[ExecuteInEditMode]
[AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_NFTs_OfContract)]
[ExecuteAlways]
[HelpURL(PortConstants.NFTs_OfContract)]
public class NFTs_OfAContract : MonoBehaviour
{
/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion Runtime/NFTs_OwnedByAnAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ namespace NFTPort
/// <summary>
/// NFTs owned by a given account (wallet address), Can also return each NFT metadata with include parameter and filter from specific collection.
/// </summary>
[ExecuteInEditMode]
[AddComponentMenu(PortConstants.BaseComponentMenu+PortConstants.FeatureName_NFTs_OfAccount)]
[ExecuteAlways]
[HelpURL(PortConstants.NFTs_OfAccount)]
public class NFTs_OwnedByAnAccount : MonoBehaviour
{
/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion Runtime/Storage_UploadFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Runtime/Storage_UploadMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e33d74

Please sign in to comment.