//private CT_EditPanel _viewPanel;
    #endregion

    /// <summary>
    /// Constructor
    /// </summary>
    /// <param name="skin">Theme skin</param>
    public CryptoItemsTab(GUISkin skin)
    {
        _skin       = skin;
        _controller = new CryptoItemsController
        {
            ClipBoard = skin.GetStyle("Images").normal.scaledBackgrounds[1] as Texture2D
        };

        // link local controller instance to NotificationMonitor
        EnjinEditor.NotificationMonitor.CIController = _controller;

        EditorUtility.DisplayProgressBar("Loading", "Building CryptoItems", 0.95f);

        _detailsPane  = new CT_DetailsPane();
        _mintCostPane = new CT_MintCostPane();
        _optionsPane  = new CT_OptionsPane();
        _searchPane   = new CT_SearchPane();
        _walletPane   = new CT_WalletPane();

        _createPanel = new CT_CreatePanel();
        _editPanel   = new CT_EditPanel();
        _mainPanel   = new CT_MainPanel();
        _meltPanel   = new CT_MeltPanel();
        _mintPanel   = new CT_MintPanel();
        //_viewPanel = new CT_EditPanel();
    }
    /// <summary>
    /// Options Pane for main CI tab
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(5, 10, 230, 100), skin.GetStyle("TopBackground"));
        EditorGUILayout.LabelField(new GUIContent("CREATE"), skin.GetStyle("MainTitle"));

        if (EnjinEditor.HasPermission(EnjinSDK.UserPermission.manageTokens))
        {
            if (EnjinEditor.CurrentUserIdentity.linking_code == string.Empty)
            {
                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal(GUILayout.Width(100));
                GUILayout.Space(14);

                if (GUILayout.Button(new GUIContent("CREATE"), GUILayout.Height(36), GUILayout.Width(100)))
                {
                    controller.State = CryptoItemsController.CryptoItemState.CREATE;
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
                GUILayout.FlexibleSpace();
            }
        }

        GUILayout.EndArea();
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Build and draw search pane (main CI tab)
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(248, 10, 670, 100), skin.GetStyle("TopBackground"));
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("SEARCH CRYPTOITEMS"), skin.GetStyle("MainTitle"), GUILayout.Width(190));
        EditorGUILayout.BeginVertical();
        GUILayout.Space(12);
        EditorGUILayout.LabelField(new GUIContent("Eth Address, CryptoItem ID, CryptoItem Name"), skin.GetStyle("ContentDark"));
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginVertical();
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        controller.SearchText = EditorGUILayout.TextField(controller.SearchText, skin.textField, GUILayout.Height(30));
        // NOTE: Below code will be reinstated once we have a filter system in place on TP to filter by search criteria
        //EditorStyles.popup.fixedHeight = 30;
        //EditorStyles.popup.fontSize = 12;
        //_searchOptionIndex = EditorGUILayout.Popup(_searchOptionIndex, _searchOptions, GUILayout.Width(140), GUILayout.Height(30));
        //EditorStyles.popup.fixedHeight = 15;
        //EditorStyles.popup.fontSize = 11;

        if (GUILayout.Button(new GUIContent("SEARCH"), GUILayout.Width(100), GUILayout.Height(32)))
        {
            controller.CryptoItemList.Clear();
            controller.CryptoItemList   = new List <CryptoItem>(Enjin.SearchCryptoItems(controller.SearchText));
            controller.HasListRefreshed = false;
            controller.IsSearchMode     = true;
            controller.SelectedIndex    = 0;
        }

        if (controller.SearchText == "" && !controller.HasListRefreshed)
        {
            controller.ResetCryptoItemList();
            controller.HasListRefreshed = true;
            controller.IsSearchMode     = false;
            controller.SelectedIndex    = 0;
        }

        GUILayout.Space(10);
        EditorGUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        EditorGUILayout.EndVertical();
        GUILayout.Space(10);

        GUILayout.EndArea();
    }
    /// <summary>
    /// Build and draw details pane (main CI tab)
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(368, 10, 550, 100), skin.GetStyle("TopBackground"));
        EditorGUILayout.BeginHorizontal();                  // header
        EditorGUILayout.BeginVertical();                    // header
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM DETAILS"), skin.GetStyle("MainTitle"), GUILayout.Width(140));
        EditorGUILayout.EndVertical();                      // end header
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginVertical();                    // space?
        EditorGUILayout.EndVertical();                      // end space?
        EditorGUILayout.EndHorizontal();                    // end header

        GUILayout.Space(30);                                // hoz. space

        EditorGUILayout.BeginHorizontal();                  // detail group

        GUILayout.Space(16);                                // margin
        EditorGUILayout.BeginVertical(GUILayout.Width(32)); // icon
        GUILayout.Label(controller.CurrentCryptoItem.iconTexture, GUILayout.Width(32), GUILayout.Height(32));
        EditorGUILayout.EndVertical();                      // end icon

        GUILayout.Space(10);                                // margin

        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginHorizontal();

        EditorGUILayout.LabelField(new GUIContent("ID"), skin.GetStyle("Subtitle"), GUILayout.Width(80));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.token_id, controller.CurrentCryptoItem.token_id), skin.GetStyle("ContentDark"), GUILayout.Width(240));
        GUILayout.Space(2);
        if (GUILayout.Button(new GUIContent(controller.ClipBoard, "Copy ID to clipboard"), GUILayout.Width(30), GUILayout.Height(18)))
        {
            EditorGUIUtility.systemCopyBuffer = controller.CurrentCryptoItem.token_id;
        }

        EditorGUILayout.EndHorizontal();
        GUILayout.Space(4); // hoz margin
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("CREATOR"), skin.GetStyle("Subtitle"), GUILayout.Width(80));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.creator), skin.GetStyle("ContentDark"), GUILayout.Width(300));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.EndVertical();

        EditorGUILayout.EndHorizontal(); // end group

        GUILayout.EndArea();
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Build and draw Wallet pane (main CI tab)
 /// </summary>
 public void DrawPane(CryptoItemsController controller, GUISkin skin)
 {
     GUILayout.BeginArea(new Rect(5, 10, 350, 100), skin.GetStyle("TopBackground"));
     EditorGUILayout.LabelField(new GUIContent("WALLET BALANCE"), skin.GetStyle("MainTitle"));
     GUILayout.Space(10);
     GUILayout.FlexibleSpace();
     EditorGUILayout.BeginVertical();
     EditorGUILayout.BeginHorizontal();
     GUILayout.Space(16);
     EditorGUILayout.LabelField(new GUIContent("Wallet Balance:"), skin.GetStyle("ContentDark"), GUILayout.Width(94));
     EditorGUILayout.LabelField(new GUIContent(Enjin.GetEnjBalance.ToString("#,##0.###") + " ENJ"), skin.GetStyle("ContentLight"), GUILayout.Width(140));
     GUILayout.FlexibleSpace();
     EditorGUILayout.EndHorizontal();
     GUILayout.Space(4);
     EditorGUILayout.BeginHorizontal();
     GUILayout.Space(16);
     EditorGUILayout.LabelField(new GUIContent(EnjinEditor.CurrentUserIdentity.ethereum_address), skin.GetStyle("ContentLight"));
     EditorGUILayout.EndHorizontal();
     EditorGUILayout.EndVertical();
     GUILayout.FlexibleSpace();
     GUILayout.EndArea();
 }
    /// <summary>
    /// Minimum Cost Pane UI Builder
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(368, 10, 550, 100), skin.GetStyle("TopBackground"));
        EditorGUILayout.LabelField(new GUIContent("CREATE COST"), skin.GetStyle("MainTitle"));
        GUILayout.Space(20);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        EditorGUILayout.LabelField(new GUIContent("ENJ PER ITEM"), skin.GetStyle("ContentDark"), GUILayout.Width(100));
        EditorGUILayout.LabelField(new GUIContent("ITEM COUNT"), skin.GetStyle("ContentDark"), GUILayout.Width(100));
        EditorGUILayout.LabelField(new GUIContent("TOTAL ENJ COST"), skin.GetStyle("ContentDark"), GUILayout.Width(120));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(4);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        if (controller.MeltValue == 0)
        {
            EditorGUILayout.LabelField(new GUIContent((controller.MinWei / 1000000000000000000).ToString("N7") + " ENJ"), skin.GetStyle("ContentLight"), GUILayout.Width(168));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent(controller.MeltValue.ToString("N7") + " ENJ"), skin.GetStyle("ContentLight"), GUILayout.Width(168));
        }

        EditorGUILayout.LabelField(new GUIContent(controller.InitialItems.ToString()), skin.GetStyle("ContentLight"), GUILayout.Width(168));
        skin.GetStyle("ContentLight").fontSize = 12;

        if (controller.MeltValue == 0)
        {
            EditorGUILayout.LabelField(new GUIContent(((controller.MinWei / 1000000000000000000) * controller.InitialItems).ToString("N7") + " ENJ"), skin.GetStyle("ContentGreen"), GUILayout.Width(120));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent((controller.MeltValue * controller.InitialItems).ToString("N7") + " ENJ"), skin.GetStyle("ContentGreen"), GUILayout.Width(120));
        }

        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        if (controller.InitialItems > controller.TotalItems)
        {
            controller.InitialItems = controller.TotalItems;
        }

        // Input Trap for dynamic population of min melt fee and est ENJ cost
        if (Event.current.type == EventType.MouseDown || Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Tab)
        {
            if (controller.NewCryptoItem.reserve != "0")
            {
                if (controller.LastReserve != controller.NewCryptoItem.reserve)
                {
                    controller.MinWei      = System.Convert.ToInt64(GraphQLClient.GraphQuery.GetEndPointData(Enjin.MeltValueURL + controller.NewCryptoItem.reserve));
                    controller.LastReserve = controller.NewCryptoItem.reserve;
                }
            }
        }

        GUILayout.BeginArea(new Rect(5, 126, 912, 490), skin.GetStyle("TopBackground"));

        #region TITLE
        EditorGUILayout.LabelField(new GUIContent(controller.State + " CRYPTOITEM"), skin.GetStyle("MainTitle"));
        #endregion

        GUILayout.Space(30);
        EditorGUILayout.BeginHorizontal();

        #region PANEL COLUMN 1
        GUILayout.Space(16);
        EditorGUILayout.BeginVertical(GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM NAME"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        controller.NewCryptoItem.name = EditorGUILayout.TextField(controller.NewCryptoItem.name, skin.textField, GUILayout.Width(260), GUILayout.Height(30));

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TOTAL SUPPLY", "Max amount of CryptoItems that can be minted"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        controller.TotalItems = EditorGUILayout.IntField(controller.TotalItems, skin.textField, GUILayout.Width(260), GUILayout.Height(30));
        controller.TotalItems = (controller.TotalItems < 0) ? 0 : controller.TotalItems;
        controller.TotalItems = (controller.TotalItems > (int)Mathf.Pow(10, 9)) ? (int)Mathf.Pow(10, 9) : controller.TotalItems;
        controller.NewCryptoItem.totalSupply = controller.TotalItems.ToString();

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("INITIAL RESERVE", "Actual amount of CryptoItems minted less than total supply. Allows for reserve CryptoItems"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        controller.InitialItems          = EditorGUILayout.IntField(controller.InitialItems, skin.textField, GUILayout.Width(260), GUILayout.Height(30));
        controller.InitialItems          = (controller.InitialItems <= 0) ? 1 : controller.InitialItems;
        controller.InitialItems          = (controller.InitialItems > (int)Mathf.Pow(10, 9)) ? (int)Mathf.Pow(10, 9) : controller.InitialItems;
        controller.NewCryptoItem.reserve = controller.InitialItems.ToString();

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("MELT VALUE (MIN COST: " + (controller.MinWei / 1000000000000000000).ToString("N8") + " ENJ)", "Base value of item in Enjin Coin"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        //nTest = EditorGUILayout.TextField(Regex.Replace(nTest, @"[^.0-9 ]", ""), skin.textField, GUILayout.Width(260), GUILayout.Height(30));
        //nTest = nTest.Replace(".", "");
        //nTest = nTest.PadRight(18, '0');
        controller.EnjValue  = Mathf.Clamp(EditorGUILayout.FloatField(controller.EnjValue, skin.textField, GUILayout.Width(260), GUILayout.Height(30)), (float)(controller.MinWei / 1000000000000000000), Mathf.Pow(10, 9));
        controller.MeltValue = System.Convert.ToDecimal(controller.EnjValue);
        EditorGUILayout.EndVertical();
        #endregion

        #region PANEL COLUMN 2
        GUILayout.Space(20);
        EditorGUILayout.BeginVertical(GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent("SUPPLY TYPE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorStyles.popup.fixedHeight       = 30;
        EditorStyles.popup.fontSize          = 12;
        controller.ModelType                 = (SupplyModel2)EditorGUILayout.EnumPopup(controller.ModelType, GUILayout.Width(260), GUILayout.Height(30));
        controller.NewCryptoItem.supplyModel = (SupplyModel)System.Enum.Parse(typeof(SupplyModel), controller.ModelType.ToString());
        EditorStyles.popup.fixedHeight       = 15;
        EditorStyles.popup.fontSize          = 11;

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TRANSFERABLE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorStyles.popup.fixedHeight        = 30;
        EditorStyles.popup.fontSize           = 12;
        controller.NewCryptoItem.transferable = (Transferable)EditorGUILayout.EnumPopup(controller.NewCryptoItem.transferable, GUILayout.Width(260), GUILayout.Height(30));
        EditorStyles.popup.fixedHeight        = 15;
        EditorStyles.popup.fontSize           = 11;

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TRANSFER FEE SETTINGS"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorStyles.popup.fixedHeight = 30;
        EditorStyles.popup.fontSize    = 12;
        controller.NewCryptoItem.transferFeeSettings.type = (TransferType)EditorGUILayout.EnumPopup(controller.NewCryptoItem.transferFeeSettings.type, GUILayout.Width(260), GUILayout.Height(30));
        EditorStyles.popup.fixedHeight = 15;
        EditorStyles.popup.fontSize    = 11;

        /**
         * Re-enable token ID (for NFI) after v1 as part of the expanded NFI task set
         */
        //if (controller.NewCryptoItem.transferFeeSettings.type != TransferType.NONE)
        //{
        //    GUILayout.Space(20);
        //    EditorGUILayout.LabelField(new GUIContent("TOKEN ID"), skin.GetStyle("Subtitle"), GUILayout.Width(120));

        //    controller.NewCryptoItem.transferFeeSettings.token_id = "0";
        //    EditorGUILayout.LabelField(controller.NewCryptoItem.transferFeeSettings.token_id, skin.GetStyle("LargeTextDark"), GUILayout.Width(120), GUILayout.Height(30));
        //}

        EditorGUILayout.EndVertical();
        #endregion

        #region PANEL COLUMN 3
        GUILayout.Space(20);
        EditorGUILayout.BeginVertical(GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent("CREATOR MELT FEE %", "Sets the max melt fee. Max value is 50"), skin.GetStyle("Subtitle"), GUILayout.Width(260)); // was 120
        controller.MeltFee = Mathf.Clamp(EditorGUILayout.FloatField(controller.MeltFee, skin.textField, GUILayout.Width(260), GUILayout.Height(30)), 0.00f, 50.00f);
        controller.NewCryptoItem.meltFeeRatio = (int)(controller.MeltFee * Mathf.Pow(10, 2));

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM TYPE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorStyles.popup.fixedHeight       = 30;
        EditorStyles.popup.fontSize          = 12;
        controller.ItemType                  = (CryptoItemType)EditorGUILayout.EnumPopup(controller.ItemType, GUILayout.Width(260), GUILayout.Height(30));
        EditorStyles.popup.fixedHeight       = 15;
        EditorStyles.popup.fontSize          = 11;
        controller.NewCryptoItem.nonFungible = (controller.ItemType == CryptoItemType.NONFUNGIBLE) ? true : false;

        if (controller.NewCryptoItem.transferFeeSettings.type != TransferType.NONE)
        {
            GUILayout.Space(20);

            if (controller.NewCryptoItem.transferFeeSettings.type == TransferType.NONE)
            {
                EditorGUILayout.LabelField("0", skin.GetStyle("LargeTextDark"), GUILayout.Width(120), GUILayout.Height(30));
                controller.NewCryptoItem.transferFeeSettings.token_id = "0";
                controller.NewCryptoItem.transferFeeSettings.value    = ((decimal)0).ToString();
            }
            else if (controller.NewCryptoItem.transferFeeSettings.type == TransferType.RATIO_CUT || controller.NewCryptoItem.transferFeeSettings.type == TransferType.RATIO_EXTRA)
            {
                EditorGUILayout.LabelField(new GUIContent("TRANSFER FEE % (MAX 50)"), skin.GetStyle("Subtitle"), GUILayout.Width(120));

                controller.TransferFeeEnj = Mathf.Clamp(EditorGUILayout.FloatField(controller.TransferFeeEnj, skin.textField, GUILayout.Width(120), GUILayout.Height(30)), 0f, 50f);
                // 50% is 5000 in Unit16 (for queries); Max value for transferFee is 50% or 5000.
                controller.NewCryptoItem.transferFeeSettings.value = ((decimal)(Mathf.Pow(10, 2) * controller.TransferFeeEnj)).ToString();
            }
            else if (controller.NewCryptoItem.transferFeeSettings.type == TransferType.PER_CRYPTO_ITEM || controller.NewCryptoItem.transferFeeSettings.type == TransferType.PER_TRANSFER)
            {
                EditorGUILayout.LabelField(new GUIContent("TRANSFER FEE (ENJ)"), skin.GetStyle("Subtitle"), GUILayout.Width(120));

                controller.TransferFeeEnj = Mathf.Max(EditorGUILayout.FloatField(controller.TransferFeeEnj, skin.textField, GUILayout.Width(120), GUILayout.Height(30)), 0f);
                controller.NewCryptoItem.transferFeeSettings.value = ((decimal)(Mathf.Pow(10, 18) * controller.TransferFeeEnj)).ToString();
            }
        }

        EditorGUILayout.EndVertical();
        #endregion

        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        EditorGUILayout.BeginVertical();
        GUILayout.Space(10);
        EditorGUILayout.LabelField(new GUIContent("METADATA URI"), skin.GetStyle("Subtitle"), GUILayout.Width(120));
        controller.MetaDataURI = EditorGUILayout.TextField(controller.MetaDataURI, skin.textField, GUILayout.Height(30), GUILayout.Width(820));

        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        #region BUTTON MENU
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (GUILayout.Button(new GUIContent("CREATE"), GUILayout.Width(100), GUILayout.Height(36)))
        {
            controller.Properties.Clear();
            bool process = true;

            if (controller.InitialItems == 0)
            {
                if (EditorUtility.DisplayDialog("WARNING", "Initial Reserve is set to 0. You do not have the permissions for this setting. Continue item creation with initial reserve set to 1?", "Pr1oceed", "Cancel"))
                {
                    controller.NewCryptoItem.reserve = "1";
                }
                else
                {
                    process = false;
                }
            }

            if ((decimal)controller.EnjValue < (controller.MinWei / 1000000000000000000))
            {
                if (EditorUtility.DisplayDialog("WARNING", "Your melt value is not greater than or equal to the minimum melt value. Would you like to set the melt value to the minimum (" + controller.MinWei / 1000000000000000000 + " ENJ) and continue?", "Proceed", "Cancel"))
                {
                    controller.EnjValue  = (float)(controller.MinWei / 1000000000000000000);
                    controller.MeltValue = System.Convert.ToDecimal(controller.EnjValue);

                    if (controller.Properties.ContainsKey("MeltValue"))
                    {
                        controller.Properties.Remove("MeltValue");
                    }

                    controller.Properties.Add("MeltValue", (float)controller.MeltValue);
                }
                else
                {
                    process = false;
                }
            }
            else
            {
                controller.MeltValue = System.Convert.ToDecimal(controller.EnjValue);

                if (controller.Properties.ContainsKey("MeltValue"))
                {
                    controller.Properties.Remove("MeltValue");
                }

                controller.Properties.Add("MeltValue", (float)controller.MeltValue);
            }

            if (controller.MeltValue == 0)
            {
                EditorUtility.DisplayDialog("INVALID MELT VALUE", "Melt value can't be 0", "Ok");
                process = false;
            }

            if (controller.NewCryptoItem.transferFeeSettings.type != TransferType.NONE)
            {
                if (controller.TransferFeeEnj == 0)
                {
                    EditorUtility.DisplayDialog("WARNING", "Transfer Fee must be greater than 0.", "OK");
                    process = false;
                }
            }

            if (controller.TotalItems == 0)
            {
                EditorUtility.DisplayDialog("INVALID SUPPLY TOTAL", "Supply total must be at least 1", "Ok");
                process = false;
            }

            if (controller.NewCryptoItem.name == null || controller.NewCryptoItem.name.Trim() == "" || controller.NewCryptoItem.name == string.Empty)
            {
                EditorUtility.DisplayDialog("INVALID TOKEN NAME", "Token must have a name", "Ok");
                process = false;
            }

            if (controller.IsValidURI(controller.MetaDataURI))
            {
                if (controller.MetaDataURI != "")
                {
                    controller.Properties.Add("MetaDataURI", controller.MetaDataURI);
                }
            }
            else if (!controller.IsValidURI(controller.MetaDataURI))
            {
                EditorUtility.DisplayDialog("INVALID METADATA URI", "Your metadata URI must be valid in a web browser", "Ok");
                process = false;
            }

            // Please note that this call is attached to button press logic
            if (process)
            {
                Request request = controller.ProcessCryptoItem(ProcessTasks.CREATE, controller.NewCryptoItem, controller.Properties);

                if (EnjinEditor.IsRequestSuccessfull(request.state))
                {
                    EditorUtility.DisplayDialog("SUCCESS", "The request has posted with a status of " + request.state + ". Please see your wallet to complete the transaction!", "Ok");
                }
                else
                {
                    EditorUtility.DisplayDialog("FAILURE", "The request could not be processed due to a status of " + request.state + ".", "Ok");
                }

                controller.State = CryptoItemsController.CryptoItemState.MAIN;
            }
            // if process is false, we should already have shown a dialog so no false condition is required here.
        }

        if (GUILayout.Button(new GUIContent("BACK"), GUILayout.Width(100), GUILayout.Height(36)))
        {
            controller.Reset();
            controller.State = CryptoItemsController.CryptoItemState.MAIN;
        }

        GUILayout.Space(6);
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        #endregion

        GUILayout.EndArea();
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Build and Draw View/Edit CI Panel
    /// Embedded UI logic for field validation and request return status (Edit Mode)
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(5, 126, 912, 490), skin.GetStyle("TopBackground"));
        EditorGUILayout.LabelField(new GUIContent(controller.State + " CRYPTOITEM"), skin.GetStyle("MainTitle"));
        GUILayout.Space(30);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        EditorGUILayout.BeginVertical(GUILayout.Width(260));

        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM NAME"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

        if (controller.CurrentCryptoItem.isCreator && controller.State.Equals(CryptoItemsController.CryptoItemState.EDIT))
        {
            controller.EditItemName = EditorGUILayout.TextField(controller.EditItemName, skin.textField, GUILayout.Width(260), GUILayout.Height(30));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.name), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TOTAL SUPPLY", "Total number of items in the supply"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

        if (controller.CurrentCryptoItem.supplyModel != SupplyModel.INFINITE)
        {
            EditorGUILayout.LabelField(new GUIContent(System.String.Format("{0:N0}", System.Double.Parse(controller.CurrentCryptoItem.totalSupply))), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent("INFINITE"), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("INITIAL RESERVE", "Number of items that are prepaid for"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(System.String.Format("{0:N0}", System.Double.Parse(controller.CurrentCryptoItem.reserve)), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("MELT VALUE", "Base value of item in Enjin Coin"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent((System.Convert.ToDouble(controller.CurrentCryptoItem.meltValue) / Mathf.Pow(10, 18)).ToString("N4") + " ENJ"), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        EditorGUILayout.EndVertical();
        GUILayout.Space(20);
        EditorGUILayout.BeginVertical(GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent("SUPPLY TYPE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.supplyModel.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TRANSFERABLE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.transferable.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TRANSFER FEE SETTINGS"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.transferFeeSettings.type.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));

        EditorGUILayout.EndVertical();
        GUILayout.Space(20);
        EditorGUILayout.BeginVertical(GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent("CREATOR MELT FEE %", "Sets the max melt fee. Max value controller.Is 50"), skin.GetStyle("Subtitle"), GUILayout.Width(260)); // was 120

        EditorGUILayout.LabelField(new GUIContent((controller.CurrentCryptoItem.meltFeeRatio * 0.01f).ToString() + "%"), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("NONFUNGIBLE ITEM", "Flags the item as nonfungible"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.nonFungible.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260));

        if (controller.CurrentCryptoItem.nonFungible)
        {
            GUILayout.Space(20);
            EditorGUILayout.LabelField(new GUIContent("INDEX", "The particular index for thcontroller.Is non-fungible item"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

            int tokenIndex;
            if (System.Int32.TryParse(controller.CurrentCryptoItem.index, out tokenIndex))
            {
                EditorGUILayout.LabelField(new GUIContent("" + tokenIndex), skin.GetStyle("LargeTextDark"), GUILayout.Width(260));
            }
            else if (controller.CurrentCryptoItem.index.Contains(",") && controller.CurrentCryptoItem.index.Split(',').Length > 0)
            {
                string   indexList = "";
                string[] indices   = controller.CurrentCryptoItem.index.Split(',');

                for (int indexIndex = 0; indexIndex < indices.Length; indexIndex++)
                {
                    int subItemIndex;
                    if (System.Int32.TryParse(indices[indexIndex], out subItemIndex))
                    {
                        if (indexIndex > 0 && indexIndex < indices.Length)
                        {
                            indexList += ", ";
                        }

                        indexList += subItemIndex;
                    }
                }

                skin.GetStyle("LargeTextDark").wordWrap = true;
                EditorGUILayout.LabelField(new GUIContent(indexList), skin.GetStyle("LargeTextDark"), GUILayout.Width(260));
                skin.GetStyle("LargeTextDark").wordWrap = false;
            }
            else
            {
                EditorGUILayout.LabelField(new GUIContent("Invalid index"), skin.GetStyle("LargeTextDark"), GUILayout.Width(260));
            }
        }

        if (controller.CurrentCryptoItem.transferFeeSettings.type != TransferType.NONE)
        {
            GUILayout.Space(20);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("TOKEN ID"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(controller.CurrentCryptoItem.token_id, skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
            EditorGUILayout.EndHorizontal();
            GUILayout.Space(10);

            if (controller.CurrentCryptoItem.transferFeeSettings.type == TransferType.RATIO_CUT || controller.CurrentCryptoItem.transferFeeSettings.type == TransferType.RATIO_EXTRA)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("TRANSFER FEE %"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField((float.Parse(controller.CurrentCryptoItem.transferFeeSettings.value) / Mathf.Pow(10, 2)) + "%", skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
                EditorGUILayout.EndHorizontal();
            }
            else if (controller.CurrentCryptoItem.transferFeeSettings.type == TransferType.PER_CRYPTO_ITEM || controller.CurrentCryptoItem.transferFeeSettings.type == TransferType.PER_TRANSFER)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("TRANSFER FEE (ENJ)"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField((float.Parse(controller.CurrentCryptoItem.transferFeeSettings.value) / Mathf.Pow(10, 18)).ToString(), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
                EditorGUILayout.EndHorizontal();
            }
        }

        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        EditorGUILayout.BeginVertical();
        GUILayout.Space(10);
        EditorGUILayout.LabelField(new GUIContent("METADATA URI"), skin.GetStyle("Subtitle"), GUILayout.Width(120));
        if (controller.CurrentCryptoItem.isCreator && controller.State.Equals(CryptoItemsController.CryptoItemState.EDIT))
        {
            controller.MetaDataURI = EditorGUILayout.TextField(controller.MetaDataURI, skin.textField, GUILayout.Height(30), GUILayout.Width(820));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.itemURI), skin.GetStyle("LargeTextDark"), GUILayout.Height(30), GUILayout.Width(260));
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();

        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (controller.CurrentCryptoItem.isCreator && controller.State.Equals(CryptoItemsController.CryptoItemState.EDIT))
        {
            if (GUILayout.Button(new GUIContent("UPDATE"), GUILayout.Width(100), GUILayout.Height(30)))
            {
                if (!controller.IsValidURI(controller.MetaDataURI))
                {
                    EditorUtility.DisplayDialog("INVALID METADATA URI", "Your metadata URI must be valid in a web browser", "Ok");
                }
                else
                {
                    controller.Properties.Clear();
                    controller.Properties.Add("ItemName", controller.EditItemName);
                    controller.Properties.Add("MetaDataURI", controller.MetaDataURI);
                    controller.Properties.Add("TranferFeeEnj", controller.TransferFeeEnj);
                    controller.Properties.Add("MeltFeeRatio", controller.MeltFee);
                    controller.ProcessCryptoItem(ProcessTasks.EDIT, controller.CurrentCryptoItem, controller.Properties);

                    if (Enjin.ServerResponse == ResponseCodes.SUCCESS)
                    {
                        EditorUtility.DisplayDialog("SUCCESS", "The request has posted successfully. Please see your wallet to complete the transaction!", "Ok");
                    }
                    else
                    {
                        EditorUtility.DisplayDialog("FAILURE", "The request could not be processed.", "Ok");
                    }

                    controller.State = CryptoItemsController.CryptoItemState.MAIN;
                }
            }
        }

        if (GUILayout.Button(new GUIContent("BACK"), GUILayout.Width(100), GUILayout.Height(30)))
        {
            controller.Reset();
        }

        GUILayout.Space(6);
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        GUILayout.EndArea();
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Build and Draw Mint CI Panel
    /// Embedded UI logic for field validation and initial request return status
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        controller.TotalReserveCost = System.Convert.ToInt64(controller.CurrentCryptoItem.reserve);
        controller.TotalReserveCost = controller.TotalReserveCost * (double)((float)System.Convert.ToDecimal(controller.CurrentCryptoItem.meltValue) / Mathf.Pow(10, 18));

        GUILayout.BeginArea(new Rect(5, 126, 912, 490), skin.GetStyle("TopBackground"));
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("MINT CRYPTOITEM"), skin.GetStyle("MainTitle"));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(30);
        // Begin Columns
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        #region Column 1
        EditorGUILayout.BeginVertical(GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM NAME"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.name), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TOTAL SUPPLY"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

        if (controller.CurrentCryptoItem.supplyModel != SupplyModel.INFINITE)
        {
            EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.totalSupply), skin.GetStyle("LargeTextDark"), GUILayout.Height(30), GUILayout.Width(260));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent("INFINITE"), skin.GetStyle("LargeTextDark"), GUILayout.Height(30), GUILayout.Width(260));
        }

        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TOTAL RESERVE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.reserve), skin.GetStyle("LargeTextDark"), GUILayout.Height(30), GUILayout.Width(260));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("MINT ALLOWANCE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.LabelField(new GUIContent(controller.MintableCryptoItems.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("NUMBER TO MINT"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

        if (controller.CurrentCryptoItem.nonFungible)
        {
            controller.NumToMint = 1;
            EditorGUILayout.LabelField(new GUIContent(controller.NumToMint.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }
        else
        {
            controller.NumToMint = (controller.NumToMint < 1) ? 1 : controller.NumToMint;
            controller.NumToMint = (controller.NumToMint > int.MaxValue) ? int.MaxValue : controller.NumToMint;
            controller.NumToMint = EditorGUILayout.IntField(controller.NumToMint, skin.textField, GUILayout.Width(260), GUILayout.Height(30));
        }

        EditorGUILayout.EndVertical();
        #endregion

        #region Column 2
        EditorGUILayout.BeginVertical(GUILayout.Width(600)); // double wide
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM ID"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.token_id, controller.CurrentCryptoItem.token_id), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("RESERVE BALANCE"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.TotalReserveCost.ToString("N4") + " ENJ"), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(20);

        if (controller.NumToMint <= controller.Reserve)
        {
            controller.TotalReserveCost = controller.NumToMint * controller.MeltValue2;
            controller.TotalEnjCost     = 0;
        }
        else if (controller.NumToMint > controller.Reserve && controller.Reserve == 0)
        {
            controller.TotalReserveCost = 0;
            controller.TotalEnjCost     = controller.NumToMint * controller.MeltValue2;
        }
        else if (controller.NumToMint > controller.Reserve && controller.Reserve > 0)
        {
            controller.TotalReserveCost = controller.Reserve * controller.MeltValue2;
            controller.TotalEnjCost     = (controller.NumToMint - controller.Reserve) * (double)((float)System.Convert.ToDecimal(controller.CurrentCryptoItem.meltValue) / Mathf.Pow(10, 18));
        }

        EditorGUILayout.LabelField(new GUIContent("RESERVE ENJ COST", "ENJ PER ITEM: " + controller.MeltValue2), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.TotalReserveCost.ToString("N4") + " ENJ"), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TOTAL ENJ COST", "ENJ PER ITEM: " + controller.MeltValue2), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.TotalEnjCost.ToString("N4") + " ENJ"), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(20);
        EditorGUILayout.LabelField(new GUIContent("TRANSFER TO ID"), skin.GetStyle("Subtitle"));
        controller.RecieverAddress[0] = EditorGUILayout.TextField(controller.RecieverAddress[0], skin.textField, GUILayout.Height(30));
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        #endregion
        // End Columns

        // Buttons
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (GUILayout.Button("MINT", GUILayout.Width(100), GUILayout.Height(30)))
        {
            if (!Enjin.ValidateAddress(controller.RecieverAddress[0].Trim()))
            {
                EditorUtility.DisplayDialog("INVALID ADDRESS", "The address you entered is not valid. Please enter a valid address", "Ok");
            }
            else if (controller.CurrentCryptoItem.supplyModel != SupplyModel.INFINITE)
            {
                if (controller.NumToMint > System.Int32.Parse(controller.MintableCryptoItems))
                {
                    EditorUtility.DisplayDialog("INVALID MINT VALUE", "The number of items to mint can not exceed the mint allowance", "Ok");
                }
            }

            if (controller.NumToMint <= int.MaxValue)
            {
                controller.Properties.Clear();
                controller.Properties.Add("RecieverAddress", controller.RecieverAddress);

                if (!controller.CurrentCryptoItem.nonFungible)
                {
                    controller.Properties.Add("NumToMint", controller.NumToMint);
                }

                Request request = controller.ProcessCryptoItem(ProcessTasks.MINT, controller.CurrentCryptoItem, controller.Properties);

                if (EnjinEditor.IsRequestSuccessfull(request.state))
                {
                    EditorUtility.DisplayDialog("SUCCESS", "The request has posted with a status of " + request.state + ". Please see your wallet to complete the transaction!", "Ok");
                }
                else
                {
                    EditorUtility.DisplayDialog("FAILURE", "The request could not be processed due to a status of " + request.state + ".", "Ok");
                }

                controller.State = CryptoItemsController.CryptoItemState.MAIN;
            }
            else
            {
                EditorUtility.DisplayDialog("Invalid Mintable CryptoItem Amount", "The token amount you selected is greater than the maximum limit. The maximum limit is " + int.MaxValue.ToString(), "Ok");
            }
        }

        if (GUILayout.Button("BACK", GUILayout.Width(100), GUILayout.Height(30)))
        {
            controller.State = CryptoItemsController.CryptoItemState.MAIN;
        }

        GUILayout.Space(10);
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        GUILayout.EndArea();
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Build and Draw Melt CI Panel
    /// Embedded UI logic for field validation and initial request return status
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(5, 126, 912, 490), skin.GetStyle("TopBackground"));
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("MELT CRYPTOITEM"), skin.GetStyle("MainTitle"));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(20);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        EditorGUILayout.BeginVertical();
        EditorGUILayout.BeginHorizontal(GUILayout.Width(280));
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM ID"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.token_id.Substring(0, 8) + "..", controller.CurrentCryptoItem.token_id), skin.GetStyle("LargeTextDark"), GUILayout.Height(30), GUILayout.Width(30));
        EditorGUILayout.EndVertical();
        EditorGUILayout.BeginVertical();
        GUILayout.Label(controller.CurrentCryptoItem.iconTexture, GUILayout.Width(60), GUILayout.Height(60));
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM NAME"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.name), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(10);
        EditorGUILayout.LabelField(new GUIContent("AVAILABLE COUNT"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.Balance.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(10);

        if (!controller.CurrentCryptoItem.nonFungible)
        {
            EditorGUILayout.LabelField(new GUIContent("NUMBER TO MELT"), skin.GetStyle("Subtitle"));
            controller.NumToMelt = EditorGUILayout.IntField(controller.NumToMelt, skin.textField, GUILayout.Width(260), GUILayout.Height(30));

            if (controller.NumToMelt > controller.Balance)
            {
                controller.NumToMelt = controller.Balance;
            }
        }
        else
        {
            controller.NumToMelt = 1;
            EditorGUILayout.LabelField(new GUIContent("NUMBER TO MELT"), skin.GetStyle("Subtitle"));
            EditorGUILayout.LabelField(new GUIContent(controller.NumToMelt.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }

        if (controller.NumToMelt == 0)
        {
            controller.NumToMelt = 1;
        }

        GUILayout.Space(10);
        EditorGUILayout.LabelField(new GUIContent("CREATOR MELT FEE"), skin.GetStyle("Subtitle"));
        EditorGUILayout.LabelField(new GUIContent(controller.EnjPerItem.ToString("N4") + " ENJ"), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(10);
        EditorGUILayout.LabelField(new GUIContent("ENJ RETURNED"), skin.GetStyle("Subtitle"));
        controller.EnjReturned = (controller.NumToMelt * controller.EnjPerItem);
        EditorGUILayout.LabelField(new GUIContent(controller.EnjReturned.ToString("N4")), skin.GetStyle("LargeTextDark"), GUILayout.Height(30));
        GUILayout.Space(10);

        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (GUILayout.Button("MELT", GUILayout.Width(100), GUILayout.Height(30)))
        {
            if (controller.NumToMelt == 0)
            {
                EditorUtility.DisplayDialog("INVALID MELT VALUE", "Melt value must be at least one.", "Ok");
            }
            else
            {
                controller.Properties.Clear();
                controller.Properties.Add("NumToMelt", controller.NumToMelt);

                Request request = controller.ProcessCryptoItem(ProcessTasks.MELT, controller.CurrentCryptoItem, controller.Properties);

                if (EnjinEditor.IsRequestSuccessfull(request.state))
                {
                    EditorUtility.DisplayDialog("SUCCESS", "The request has posted with a status of " + request.state + ". Please see your wallet to complete the transaction!", "Ok");
                }
                else
                {
                    EditorUtility.DisplayDialog("FAILURE", "The request could not be processed due to a status of " + request.state + ".", "Ok");
                }

                EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADITEMS);
                controller.State = CryptoItemsController.CryptoItemState.MAIN;
            }
        }
        GUILayout.Space(16);

        if (GUILayout.Button("BACK", GUILayout.Width(100), GUILayout.Height(30)))
        {
            controller.State = CryptoItemsController.CryptoItemState.MAIN;
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
Ejemplo n.º 11
0
    /// <summary>
    /// Build and Draw View CI Panel (Deprecated)
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(5, 126, 912, 490), skin.GetStyle("TopBackground"));
        EditorGUILayout.LabelField(new GUIContent("VIEW CRYPTOITEM"), skin.GetStyle("MainTitle"));
        GUILayout.Space(20);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(8);
        EditorGUILayout.BeginVertical();

        EditorGUILayout.LabelField(new GUIContent("CRYPTOITEM NAME"), skin.GetStyle("Subtitle"), GUILayout.Width(260));
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(controller.CurrentCryptoItem.name, skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));

        EditorGUILayout.LabelField(controller.CurrentCryptoItem.token_id, skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));

        if (GUILayout.Button(new GUIContent(controller.ClipBoard, "Copy ID to clipboard"), GUILayout.Width(32), GUILayout.Height(32)))
        {
            EditorGUIUtility.systemCopyBuffer = controller.CurrentCryptoItem.token_id;
        }

        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.LabelField(new GUIContent("ITEM TYPE"), skin.GetStyle("Subtitle"), GUILayout.Width(260));

        if (controller.CurrentCryptoItem.nonFungible)
        {
            EditorGUILayout.LabelField(new GUIContent("Non-fungible"), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent("Fungible"), skin.GetStyle("LargeTextDark"), GUILayout.Width(260), GUILayout.Height(30));
        }

        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("TOTAL SUPPLY"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.LabelField(new GUIContent("TOTAL RESERVE"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();

        if (controller.CurrentCryptoItem.supplyModel != EnjinSDK.SupplyModel.INFINITE)
        {
            EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.totalSupply), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent("INFINITE"), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        }

        EditorGUILayout.LabelField(controller.CurrentCryptoItem.reserve, skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("TRANSFERABLE"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.LabelField(new GUIContent("SUPPLY TYPE"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.transferable.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.supplyModel.ToString()), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("CREATOR MELT FEE %"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.LabelField(new GUIContent("ENJ PER ITEM"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent((controller.CurrentCryptoItem.meltFeeRatio * 0.01f).ToString() + "%"), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.LabelField(new GUIContent((System.Convert.ToDouble(controller.CurrentCryptoItem.meltValue) / Mathf.Pow(10, 18)).ToString("N4") + " ENJ"), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent("CIRCULATING SUPPLY"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.LabelField(new GUIContent("ITEM URI"), skin.GetStyle("Subtitle"), GUILayout.Width(200));
        EditorGUILayout.EndHorizontal();
        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.circulatingSupply), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.LabelField(new GUIContent(controller.CurrentCryptoItem.itemURI), skin.GetStyle("LargeTextDark"), GUILayout.Width(200), GUILayout.Height(30));
        EditorGUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(250);

        if (GUILayout.Button("BACK", GUILayout.Width(80), GUILayout.Height(30)))
        {
            controller.State = CryptoItemsController.CryptoItemState.MAIN;
        }

        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
Ejemplo n.º 12
0
    /// <summary>
    /// Build and Draw Main Panel
    /// </summary>
    public void DrawPane(CryptoItemsController controller, GUISkin skin)
    {
        GUILayout.BeginArea(new Rect(5, 126, 912, 490), skin.GetStyle("TopBackground"));
        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();

        if (controller.HasListRefreshed)
        {
            EditorGUILayout.LabelField(new GUIContent(EnjinEditor.CurrentAppName.ToUpper()), skin.GetStyle("MainTitle"));
            GUILayout.FlexibleSpace();
            //GUILayout.Space(16);
            //EditorStyles.popup.fixedHeight = 30;
            //EditorStyles.popup.fontSize = 12;
            //controller.ItemFilter = (CryptoItemsController.ItemFilterType)EditorGUILayout.EnumPopup(controller.ItemFilter, GUILayout.Width(180), GUILayout.Height(30));
            //EditorStyles.popup.fixedHeight = 15;
            //EditorStyles.popup.fontSize = 11;
        }
        else
        {
            EditorGUILayout.LabelField(new GUIContent("SEARCH RESULTS"), skin.GetStyle("MainTitle"));
        }

        if (GUILayout.Button("REFRESH", GUILayout.Height(30), GUILayout.Width(80)))
        {
            EnjinEditor.ExecuteMethod(EnjinEditor.CallMethod.RELOADITEMS);
        }

        GUILayout.Space(10);
        EditorGUILayout.EndHorizontal();

        if (controller.LastFilterSelected != controller.FilterSelection)
        {
            controller.LastFilterSelected = controller.FilterSelection;
        }

        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);
        EditorGUILayout.LabelField(new GUIContent("Type"), skin.GetStyle("Subtitle"), GUILayout.Width(76));
        EditorGUILayout.LabelField(new GUIContent("Name"), skin.GetStyle("Subtitle"), GUILayout.Width(100));
        EditorGUILayout.LabelField(new GUIContent("Index"), skin.GetStyle("Subtitle"), GUILayout.Width(74));
        EditorGUILayout.LabelField(new GUIContent("Balance"), skin.GetStyle("Subtitle"), GUILayout.Width(108));
        EditorGUILayout.LabelField(new GUIContent("Total Supply"), skin.GetStyle("Subtitle"), GUILayout.Width(102));
        EditorGUILayout.LabelField(new GUIContent("Total Reserve"), skin.GetStyle("Subtitle"), GUILayout.Width(98));
        EditorGUILayout.LabelField(new GUIContent("Circulating"), skin.GetStyle("Subtitle"), GUILayout.Width(86));
        EditorGUILayout.LabelField(new GUIContent("Transferable"), skin.GetStyle("Subtitle"), GUILayout.Width(114));
        EditorGUILayout.LabelField(new GUIContent("Supply Type"), skin.GetStyle("Subtitle"));
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(16);

        _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, GUILayout.Width(890), GUILayout.Height(342));

        if (EnjinEditor.CurrentUserIdentity.linking_code != string.Empty)
        {
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("WARNING: You don't have a wallet linked. Select the wallet tab to link your wallet"), skin.GetStyle("MainTitle"));
            EditorGUILayout.EndHorizontal();
            GUILayout.FlexibleSpace();
        }
        else if (controller.CryptoItemList != null && controller.CryptoItemList.Count != 0)
        {
            for (int i = 0; i < controller.CryptoItemList.Count; i++)
            {
                if (controller.SelectedIndex == i)
                {
                    EditorGUILayout.BeginHorizontal(skin.box);
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();
                }

                if (controller.CryptoItemList[i].nonFungible)
                {
                    EditorGUILayout.LabelField(new GUIContent("Non-fungible"), skin.GetStyle("ContentDark"), GUILayout.Width(75));
                }
                else
                {
                    EditorGUILayout.LabelField(new GUIContent("Fungible"), skin.GetStyle("ContentDark"), GUILayout.Width(75));
                }

                Rect lastRect = GUILayoutUtility.GetLastRect();

                if (GUI.Button(new Rect(lastRect.x, lastRect.y, 890.0f, lastRect.height), GUIContent.none, skin.button))
                {
                    if (controller.SelectedIndex == i)
                    {
                        controller.State                     = CryptoItemsController.CryptoItemState.VIEW;
                        controller.CurrentCryptoItem         = controller.CryptoItemList[controller.SelectedIndex];
                        controller.CurrentCryptoItem.itemURI = Enjin.GetCryptoItemURI(controller.CurrentCryptoItem.token_id, controller.CurrentCryptoItem.index, false);
                    }

                    controller.SelectedIndex = i;
                }

                GUILayout.Space(10);

                if (controller.CryptoItemList[i].name.Length > 40)
                {
                    EditorGUILayout.LabelField(new GUIContent(controller.CryptoItemList[i].name.Substring(0, 38) + ".."), skin.GetStyle("ContentDark"), GUILayout.Width(160));
                }
                else
                {
                    EditorGUILayout.LabelField(new GUIContent(controller.CryptoItemList[i].name), skin.GetStyle("ContentDark"), GUILayout.Width(100));
                }

                GUILayout.Space(10);

                try
                {
                    if (controller.CryptoItemList[i].index != null)
                    {
                        string   indexList = "";
                        string[] indices   = controller.CryptoItemList[i].index.Split(',');

                        for (int indexIndex = 0; indexIndex < indices.Length; indexIndex++)
                        {
                            int subItemIndex = 0;
                            if (System.Int32.TryParse(indices[indexIndex], out subItemIndex))
                            {
                                if (indexIndex > 0 && indexIndex < indices.Length)
                                {
                                    indexList += ", ";
                                }

                                indexList += subItemIndex;
                            }
                        }

                        EditorGUILayout.LabelField(new GUIContent(indexList), skin.GetStyle("ContentDark"), GUILayout.Width(50));
                    }
                    else
                    {
                        EditorGUILayout.LabelField(new GUIContent(""), skin.GetStyle("ContentDark"), GUILayout.Width(50));
                    }
                }
                catch (System.Exception)
                {
                    EditorGUILayout.LabelField(new GUIContent(""), skin.GetStyle("ContentDark"), GUILayout.Width(50));
                }

                GUILayout.Space(10);
                EditorGUILayout.LabelField(new GUIContent(controller.CryptoItemList[i].balance.ToString()), skin.GetStyle("ContentDark"), GUILayout.Width(90));
                GUILayout.Space(10);

                if (controller.CryptoItemList[i].supplyModel != SupplyModel.INFINITE)
                {
                    if (controller.CryptoItemList[i].totalSupply.Length > 12)
                    {
                        EditorGUILayout.LabelField(new GUIContent(System.String.Format("{0:N0}..", System.Int32.Parse(controller.CryptoItemList[i].totalSupply.Substring(0, 9)))), skin.GetStyle("ContentDark"), GUILayout.Width(90));
                    }
                    else
                    {
                        EditorGUILayout.LabelField(new GUIContent(System.String.Format("{0:N0}", System.Int32.Parse(controller.CryptoItemList[i].totalSupply))), skin.GetStyle("ContentDark"), GUILayout.Width(90));
                    }
                }
                else
                {
                    EditorGUILayout.LabelField(new GUIContent("INFINITE"), skin.GetStyle("ContentDark"), GUILayout.Width(90));
                }

                GUILayout.Space(10);
                EditorGUILayout.LabelField(new GUIContent(System.String.Format("{0:N0}", System.Int32.Parse(controller.CryptoItemList[i].reserve))), skin.GetStyle("ContentDark"), GUILayout.Width(80));
                GUILayout.Space(10);
                EditorGUILayout.LabelField(new GUIContent(System.String.Format("{0:N0}", System.Int32.Parse(controller.CryptoItemList[i].circulatingSupply))), skin.GetStyle("ContentDark"), GUILayout.Width(70));
                GUILayout.Space(10);
                EditorGUILayout.LabelField(new GUIContent(controller.CryptoItemList[i].transferable.ToString()), skin.GetStyle("ContentDark"), GUILayout.Width(100));
                GUILayout.Space(10);

                if (controller.CryptoItemList[i].supplyModel == SupplyModel.COLLAPSING)
                {
                    EditorGUILayout.LabelField(new GUIContent("COLLAPSE"), skin.GetStyle("ContentDark"), GUILayout.Width(66));
                }
                else if (controller.CryptoItemList[i].supplyModel == SupplyModel.ANNUAL_PERCENTAGE)
                {
                    EditorGUILayout.LabelField(new GUIContent("ANNUAL %"), skin.GetStyle("ContentDark"), GUILayout.Width(66));
                }
                else if (controller.CryptoItemList[i].supplyModel == SupplyModel.ANNUAL_VALUE)
                {
                    EditorGUILayout.LabelField(new GUIContent("ANNUAL #"), skin.GetStyle("ContentDark"), GUILayout.Width(66));
                }
                else
                {
                    EditorGUILayout.LabelField(new GUIContent(controller.CryptoItemList[i].supplyModel.ToString()), skin.GetStyle("ContentDark"), GUILayout.Width(66));
                }

                if (controller.CryptoItemList[i].markedForDelete)
                {
                    EditorGUILayout.LabelField(new GUIContent(skin.GetStyle("Images").normal.scaledBackgrounds[2] as Texture2D, "Marked for Deletion"), GUILayout.Width(16), GUILayout.Height(16));
                }
                else
                {
                    EditorGUILayout.LabelField(new GUIContent(""), GUILayout.Width(16), GUILayout.Height(16));
                }

                EditorGUILayout.EndHorizontal();
                GUI.backgroundColor = _bgDefault;
                GUILayout.Space(8);
            }
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        EditorGUILayout.BeginHorizontal();

        if (!controller.IsSearchMode && controller.CryptoItemList.Count != 0)
        {
            if (controller.CurrentPage != 1)
            {
                GUILayout.Space(10);

                if (GUILayout.Button(new GUIContent("<<"), GUILayout.Height(20)))
                {
                    if (controller.CurrentPage != 1)
                    {
                        controller.CurrentPage--;
                        controller.PageCheck();
                    }
                }
            }

            GUILayout.Space(5);

            for (int i = controller.FirstPage; i < controller.TotalPages + 1; i++)
            {
                if (i != controller.CurrentPage)
                {
                    _numStyle = skin.GetStyle("PageNumberDark");
                }
                else
                {
                    _numStyle = skin.GetStyle("PageNumberLight");
                }


                if (GUILayout.Button(new GUIContent(i.ToString()), _numStyle, GUILayout.Width(30)))
                {
                    controller.CurrentPage = i;
                    controller.PageCheck();
                }

                if (i - controller.FirstPage == 9)
                {
                    break;
                }
            }

            if (controller.CurrentPage != controller.TotalPages)
            {
                if (GUILayout.Button(new GUIContent(">>"), GUILayout.Height(20)))
                {
                    if (controller.CurrentPage != controller.TotalPages)
                    {
                        controller.CurrentPage++;
                        controller.PageCheck();
                    }
                }
            }
        }

        GUILayout.FlexibleSpace();

        if (controller.CryptoItemList.Count > 0)
        {
            // =================== ADVANCED SEND TEST BUTTON ========================
            //if (GUILayout.Button("A SEND", GUILayout.Width(100), GUILayout.Height(30)))
            //{
            //CryptoItemBatch testItems = new CryptoItemBatch(EnjinEditor.CurrentUserIdentity.id);

            //for (int i = 0; i < controller.CryptoItemList.Count; i++)
            //    testItems.Add(EnjinEditor.CurrentUserIdentity.ethereum_address, "0xeD7aA45fd86c4D58261B3B2Cce9f68009c76C7d1", controller.CryptoItemList[i], controller.CryptoItemList[i].balance);

            //testItems.Send();
            //}
            // ======================================================================

            if (GUILayout.Button("VIEW", GUILayout.Width(100), GUILayout.Height(30)))
            {
                controller.CurrentCryptoItem = controller.CryptoItemList[controller.SelectedIndex];

                // On-demand loading of item URI to avoid performance issues-- this is a demanding call.
                if (controller.CurrentCryptoItem.itemURI == null)
                {
                    controller.CurrentCryptoItem.itemURI = Enjin.GetCryptoItemURI(controller.CurrentCryptoItem.token_id, controller.CurrentCryptoItem.index, false);
                }

                controller.State = CryptoItemsController.CryptoItemState.VIEW;
            }

            if (controller.IsCreator(controller.CryptoItemList[controller.SelectedIndex].creator) && !controller.CryptoItemList[controller.SelectedIndex].markedForDelete)
            {
                if (GUILayout.Button("EDIT", GUILayout.Width(100), GUILayout.Height(30)))
                {
                    controller.CurrentCryptoItem = controller.CryptoItemList[controller.SelectedIndex];

                    if (controller.CurrentCryptoItem.itemURI == null)
                    {
                        if (controller.CurrentCryptoItem.nonFungible)
                        {
                            controller.CurrentCryptoItem.itemURI = Enjin.GetCryptoItemURI(controller.CurrentCryptoItem.token_id, controller.CurrentCryptoItem.index, false);
                        }
                        else
                        {
                            controller.CurrentCryptoItem.itemURI = Enjin.GetCryptoItemURI(controller.CurrentCryptoItem.token_id, "0", false);
                        }
                    }

                    controller.TransferFeeEnj = float.Parse((decimal.Parse(controller.CurrentCryptoItem.transferFeeSettings.value) / ((decimal)Mathf.Pow(10, 18))).ToString());
                    controller.NewCryptoItem.transferFeeSettings = controller.CurrentCryptoItem.transferFeeSettings;
                    controller.EditItemName                = controller.CurrentCryptoItem.name;
                    controller.MetaDataURI                 = controller.CurrentCryptoItem.itemURI;
                    controller.EditMetaDataURI             = controller.MetaDataURI;
                    controller.CurrentCryptoItem.isCreator = controller.IsCreator(controller.CurrentCryptoItem.creator);
                    controller.MeltFee = controller.CurrentCryptoItem.meltFeeRatio * 0.01f;
                    controller.State   = CryptoItemsController.CryptoItemState.EDIT;
                }

                if (GUILayout.Button(new GUIContent("MINT"), GUILayout.Width(100), GUILayout.Height(30)))
                {
                    controller.MintableCryptoItems = Enjin.GetMintableItems(controller.CryptoItemList[controller.SelectedIndex].token_id);
                    controller.NumToMint           = 1;
                    controller.RecieverAddress     = new string[1];
                    controller.RecieverAddress[0]  = EnjinEditor.CurrentUserIdentity.ethereum_address;
                    controller.Reserve             = System.Convert.ToInt32(controller.CurrentCryptoItem.reserve);
                    controller.MeltValue2          = (double)((float)System.Convert.ToDecimal(controller.CurrentCryptoItem.meltValue) / Mathf.Pow(10, 18));
                    controller.CurrentCryptoItem   = controller.CryptoItemList[controller.SelectedIndex];
                    controller.State = CryptoItemsController.CryptoItemState.MINT;
                }
            }

            if (controller.CryptoItemList[controller.SelectedIndex].nonFungible == false) //  || System.Int32.Parse(controller.CryptoItemList[controller.SelectedIndex].index) != 0
            {
                if (controller.CryptoItemList[controller.SelectedIndex].balance != 0)
                {
                    if (GUILayout.Button(new GUIContent("MELT"), GUILayout.Width(100), GUILayout.Height(30)))
                    {
                        controller.CurrentCryptoItem = controller.CryptoItemList[controller.SelectedIndex];
                        controller.Balance           = controller.CurrentCryptoItem.balance;
                        controller.State             = CryptoItemsController.CryptoItemState.MELT;
                    }
                }
            }
        }
        GUILayout.Space(8);
        EditorGUILayout.EndHorizontal();
        GUILayout.Space(10);
        GUILayout.EndArea();
    }