Skip to content

Commit

Permalink
feat: New component Transactions Data | of an NFT - Solana + Ethereum
Browse files Browse the repository at this point in the history
  • Loading branch information
saszer committed Aug 17, 2022
1 parent 78c8b3d commit b2eea29
Show file tree
Hide file tree
Showing 10 changed files with 601 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Editor/Resources/c_tx_nft 1.psd
Git LFS file not shown
98 changes: 98 additions & 0 deletions Editor/Resources/c_tx_nft 1.psd.meta

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

3 changes: 3 additions & 0 deletions Editor/Resources/c_tx_nft.psd
Git LFS file not shown
134 changes: 134 additions & 0 deletions Editor/Resources/c_tx_nft.psd.meta

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

35 changes: 35 additions & 0 deletions Editor/Txn_NFT_Editor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using UnityEngine;

namespace NFTPort.Editor
{
using UnityEditor;
using Internal;

[CustomEditor(typeof(Txn_NFT))]
public class Txn_NFT_Editor : Editor
{
public override void OnInspectorGUI()
{

Txn_NFT myScript = (Txn_NFT)target;


Texture banner = Resources.Load<Texture>("c_tx_nft");
GUILayout.BeginHorizontal();
GUILayout.Box(banner);
GUILayout.EndHorizontal();

if (GUILayout.Button("Get NFT Transactions", GUILayout.Height(45)))
{
PortUser.SetFromEditorWin();
myScript.Run();
}


if(GUILayout.Button("View Documentation", GUILayout.Height(25)))
Application.OpenURL(PortConstants.Docs_Txns_NFT);
DrawDefaultInspector();
}
}
}

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

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

41 changes: 41 additions & 0 deletions Runtime/Internal/DrawIfAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using UnityEngine;
using System;

/// <summary>
/// Draws the field/property ONLY if the compared property compared by the comparison type with the value of comparedValue returns true.
/// Based on: https://forum.unity.com/threads/draw-a-field-only-if-a-condition-is-met.448855/
/// </summary>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class DrawIfAttribute : PropertyAttribute
{
#region Fields

public string comparedPropertyName { get; private set; }
public object comparedValue { get; private set; }
public DisablingType disablingType { get; private set; }

/// <summary>
/// Types of comperisons.
/// </summary>
public enum DisablingType
{
ReadOnly = 2,
DontDraw = 3,
DontDrawInverse = 4
}

#endregion

/// <summary>
/// Only draws the field only if a condition is met. Supports enum and bools.
/// </summary>
/// <param name="comparedPropertyName">The name of the property that is being compared (case sensitive).</param>
/// <param name="comparedValue">The value the property is being compared to.</param>
/// <param name="disablingType">The type of disabling that should happen if the condition is NOT met. Defaulted to DisablingType.DontDraw.</param>
public DrawIfAttribute(string comparedPropertyName, object comparedValue, DisablingType disablingType = DisablingType.DontDraw)
{
this.comparedPropertyName = comparedPropertyName;
this.comparedValue = comparedValue;
this.disablingType = disablingType;
}
}
11 changes: 11 additions & 0 deletions Runtime/Internal/DrawIfAttribute.cs.meta

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

Loading

0 comments on commit b2eea29

Please sign in to comment.