protected virtual void Asset_Click(Button sender, Core.Asset asset)
        {
            //Spawns the selected asset
            asset.SpawnAssetInstance();

            OnAssetSelected.Invoke();
        }
        void CreateBundle(string bundleName)
        {
            Debug.Log("Building a bundle for " + assetPath);

            string[] assetPaths = new string[1];
            assetPaths[0] = assetPath;

            AssetBundleBuild[] buildMap = new AssetBundleBuild[1];
            buildMap[0].assetBundleName = bundleName;
            buildMap[0].assetNames      = assetPaths;

            if (!System.IO.Directory.Exists("Bundles"))
            {
                System.IO.Directory.CreateDirectory("Bundles");
            }

            var    manifest   = BuildPipeline.BuildAssetBundles(Spaces.Core.Constants.SPACES_BUNDLES, buildMap, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows);
            string bundlePath = Spaces.Core.Constants.SPACES_BUNDLES + "\\" + bundleName.ToLower();

            this.Focus();

            if (System.IO.File.Exists(bundlePath))
            {
                m_bundle = new AvailableBundle(bundlePath);
                m_asset  = m_bundle.CreateAsset(bundleName);
            }
        }
 private void AssetUpdated(Core.Asset sender, Core.Asset.Process[] lastState, Core.Asset.Process newState)
 {
     if (newState == Core.Asset.Process.Deleting)
     {
         sender.onProcessEnd -= AssetUpdated;
     }
 }
Example #4
0
 public WalletInfo(string address, Core.Asset asset, double balance, double mineQuantity)
 {
     Address      = address;
     Asset        = asset;
     Balance      = balance;
     MineQuantity = mineQuantity;
 }
            public ThumbFetch(Core.Asset asset)
            {
                this.asset = asset;
                Debug.Log(asset.name + " (" + asset.id + ") " + this.asset.previewUrl);
                www = new WWW(asset.previewUrl);

                Start();
            }
Example #6
0
 void AssetUpdated(Core.Asset sender, Core.Asset.Process[] processSet, Core.Asset.Process endedProcess)
 {
     if (endedProcess == Core.Asset.Process.FetchingMetadata)
     {
         if (asset.metadata != null)
         {
             rootNode = asset.metadata.node;
             nodeWidgetExpandState = new Dictionary <Core.Node, bool[]>();
         }
     }
 }
Example #7
0
        public Spaces.Core.Asset CreateAsset(string assetName)
        {
            AssetName = assetName;
            UpdateState(State.Creating);

            var createdAsset = Spaces.Core.Asset.Create(assetName, Core.Constants.AssetType.assetbundle.ToString(), PathToBundle);

            //createdAsset.onStateEnd += AssetUpdated;
            currentAsset = createdAsset;

            return(createdAsset);
        }
        protected virtual void InitalizeAssetInfo(Core.Asset asset)
        {
            if (!string.IsNullOrEmpty(asset.id))
            {
                GameObject assetEntry = Instantiate(AssetEntryPrefab, AssetsPanel.transform) as GameObject;
                assetEntry.GetComponentInChildren <Text>().text = asset.name;

                var button = assetEntry.GetComponent <Button>();
                button.onClick.AddListener(delegate { Asset_Click(button, asset); });;
                assetEntry.SetActive(true);
            }
        }
Example #9
0
        void OnGUI()
        {
            using (var nodeViewerPanel = new EditorGUILayout.VerticalScope())
            {
                using (var assetPanel = new EditorGUILayout.HorizontalScope())
                {
                    GUILayout.Label("Name: " + gameObjectTitle);

                    bool wasEnabled = GUI.enabled;
                    GUI.enabled = wasEnabled && isAsset;
                    if (GUILayout.Button("Save", GUILayout.Width(100)))
                    {
                        UpdateAssetMetadata();
                    }
                    GUI.enabled = wasEnabled;

                    if (GUILayout.Button("Refresh", GUILayout.Width(100)))
                    {
                        if (rootObject)
                        {
                            gameObjectTitle = rootObject.name;
                            rootNode        = new Core.Node(rootObject);

                            assetWidget = rootObject.GetComponent <Spaces.Core.AssetWidget>();
                            asset       = assetWidget.Asset;
                        }
                        else if (asset != null)
                        {
                            asset.RefreshInfo();
                        }
                    }
                }

                using (var scrollView = new EditorGUILayout.ScrollViewScope(scrollPos, EditorStyles.helpBox))
                //scrollPos = EditorGUILayout.BeginScrollView(scrollPos, EditorStyles.helpBox);
                {
                    scrollPos = scrollView.scrollPosition;

                    if (rootNode != null)
                    {
                        DrawNodeEditor(rootNode, ref nodeWidgetExpandState);
                    }
                }
                //EditorGUILayout.EndScrollView();
            }
        }
Example #10
0
        public static void OpenGraphViewer(Core.Asset asset)
        {
            var window = GetWindow <SpaceGraphNodeViewer>();

            window.asset           = asset;
            window.gameObjectTitle = window.asset.name;

            if (asset.metadata != null)
            {
                window.rootNode = asset.metadata.node != null ? asset.metadata.node : new Core.Node(asset.name);
                window.nodeWidgetExpandState = new Dictionary <Core.Node, bool[]>();
            }
            else
            {
                window.SubscribeToAsset();
            }
        }
        //[MenuItem("Spaces/Create/(Re)Build Bundles")]
        //static void BuildAllAssetBundles(BuildTarget platform = BuildTarget.StandaloneWindows64)
        //{
        //    //Create the folder if it does not exist
        //    if (!System.IO.Directory.Exists(Spaces.Core.Constants.SPACES_BUNDLES))
        //        System.IO.Directory.CreateDirectory(Spaces.Core.Constants.SPACES_BUNDLES);

        //    //Create the bundles
        //    var manifest = BuildPipeline.BuildAssetBundles(Spaces.Core.Constants.SPACES_BUNDLES, BuildAssetBundleOptions.None, platform);
        //    Debug.Log("Bundle Count: " + manifest.GetAllAssetBundles().Length);
        //}

        //[MenuItem("Spaces/Create/Make Test Bundles")]
        //static void BuildAssetBundles()
        //{
        //    BuildTarget platform = BuildTarget.StandaloneWindows64;

        //    //Create the folder if it does not exist
        //    if (!System.IO.Directory.Exists("Bundles"))
        //        System.IO.Directory.CreateDirectory("Bundles");

        //    //Create the bundles
        //    var manifest = BuildPipeline.BuildAssetBundles("Bundles", BuildAssetBundleOptions.None, platform);
        //    Debug.Log("Bundle Count: " + manifest.GetAllAssetBundles().Length);
        //}

        //private void GetAvailableAssetBundles()
        //{
        //    if (bundles == null)
        //        bundles = new List<AvailableBundle>();
        //    else
        //        bundles.Clear();

        //    //Get all of the asset bundles in the asset bundle folder
        //    if (System.IO.Directory.Exists(Spaces.Core.Constants.SPACES_BUNDLES))
        //    {
        //        //Get all of the local asset bundles
        //        if (System.IO.File.Exists(Spaces.Core.Constants.SPACES_BUNDLES + "/AvailableBundles.json"))
        //        {
        //            try
        //            {
        //                var availableBundles = Spaces.Core.JSONTools.Load<List<AvailableBundle>>(Spaces.Core.Constants.SPACES_BUNDLES + "/AvailableBundles.json");

        //                foreach (var bundle in availableBundles)
        //                {
        //                    if (System.IO.File.Exists(bundle.PathToBundle))
        //                    {
        //                        bundle.onStateChanged += BundleUpdated;
        //                        bundles.Add(bundle);
        //                    }
        //                }
        //            }
        //            catch (System.Exception ex)
        //            {
        //                Debug.Log(ex);
        //            }
        //        }

        //        //Get all of the local asset bundles
        //        foreach (string file in
        //            System.IO.Directory.GetFiles(Spaces.Core.Constants.SPACES_BUNDLES)
        //            .Where(file => string.IsNullOrEmpty(System.IO.Path.GetExtension(file)) && System.IO.File.Exists(file + ".manifest")))
        //        {
        //            if (!bundles.Any(b => b.PathToBundle == file.Replace("\\", "/")))
        //            {
        //                var bundle = new AvailableBundle(file.Replace("\\", "/"));
        //                bundle.onStateChanged += BundleUpdated;
        //                bundles.Add(bundle);
        //            }
        //        }

        //        bundles.Sort((b1, b2) => b1.BundleName.CompareTo(b2.BundleName));

        //        bundlesUpdated = true;
        //    }
        //}


        private void AssetUpdated(Core.Asset sender, Core.Asset.Process[] currentState, Core.Asset.Process endingState)
        {
            if (endingState == Core.Asset.Process.Deleting)
            {
                sender.onProcessEnd -= AssetUpdated;
            }

            // Asset creation steps
            if (endingState == Core.Asset.Process.Creating)
            {
                if (assetData.ContainsKey(sender) && !string.IsNullOrEmpty(assetData[sender].updatedResourcePath))
                {
                    sender.AddData(assetData[sender].updatedResourcePath);
                }
            }
            else if (endingState == Core.Asset.Process.Fetching && !string.IsNullOrEmpty(sender.assetType))
            {
                if (!assetTypeList.Contains(sender.assetType.ToLower()))
                {
                    assetTypeList.Add(sender.assetType.ToLower());
                }

                if (sender.assetType == Core.Constants.AssetType.image.ToString() && sender.previewUrl == "NONE")
                {
                    if (thumbs == null)
                    {
                        thumbs = new List <ThumbFetch>();
                    }

                    sender.previewUrl = sender.pathToData;
                    thumbs.Add(new ThumbFetch(sender));
                }
            }
            else if (endingState == Core.Asset.Process.FetchingPreviewPath)
            {
                if (thumbs == null)
                {
                    thumbs = new List <ThumbFetch>();
                }

                if (sender.previewUrl != "NONE")
                {
                    thumbs.Add(new ThumbFetch(sender));
                }
            }

            //if (state == State.FetchingAssets)
            //{
            //    if (assets.All(a => !a.InProcess(Core.Asset.Process.Fetching)))
            //    {
            //        UpdateState(State.Idle);
            //    }
            //}
            //else
            if (state == State.CreatingAsset)
            {
                if (assets.All(a => !a.InProcess(Core.Asset.Process.Creating)))
                {
                    UpdateState(State.Idle);
                }
            }
        }
        void DrawEditAssetPanel(Core.Asset asset)
        {
            Color bgColor = GUI.backgroundColor;

            GUI.backgroundColor = Color.green;//BG_COLOR_EVEN;

            using (var assetDetailPanel = new EditorGUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.MinHeight(ASSET_EDIT_PANEL_MIN_HEIGHT)))
            {
                using (var nameField = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Asset Name:", GUILayout.Width(160));
                    assetData[asset].updateAssetName = GUILayout.TextField(assetData[asset].updateAssetName);
                }

                using (var idField = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Asset ID:", GUILayout.Width(160));
                    EditorGUILayout.SelectableLabel(asset.id, GUILayout.Width(ASSET_ID_WIDTH), GUILayout.Height(EditorStyles.label.lineHeight + 1));
                }

                using (var typeField = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Asset Type:", GUILayout.Width(160));
                    assetData[asset].updateAssetTypeIndex = EditorGUILayout.Popup(assetData[asset].updateAssetTypeIndex, assetTypeList.ToArray(), GUILayout.Width(160));
                }

                using (var pathField = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Path to Data:", GUILayout.Width(160));
                    EditorGUILayout.SelectableLabel(asset.pathToData, GUILayout.ExpandWidth(true), GUILayout.Height(EditorStyles.label.lineHeight + 1));
                }

                EditorGUILayout.LabelField("");

                //if (assetData[asset].updateAssetTypeIndex > -1 && assetData[asset].updateAssetTypeIndex < assetTypeList.Count && asset.assetType.ToLower() == assetTypeList[assetData[asset].updateAssetTypeIndex] && !externalBundle)
                //{
                //    EditorGUILayout.BeginHorizontal();
                //    {
                //        EditorGUILayout.LabelField("Bundle:", GUILayout.Width(160));
                //        assetData[asset].updateBundleIndex = EditorGUILayout.Popup(assetData[asset].updateBundleIndex, bundles.Select(b => b.BundleName).ToArray(), GUILayout.Width(BUNDLE_NAME_WIDTH));

                //        bool wasEnabled = GUI.enabled;
                //        GUI.enabled = wasEnabled && (!asset.InProcess(Core.Asset.Process.Uploading) || !asset.InProcess(Core.Asset.Process.RequestingEndpoint));
                //        if (GUILayout.Button("Re-Upload", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                //        {
                //            asset.AddData(bundles[assetData[asset].updateBundleIndex].PathToBundle);
                //        }
                //        GUI.enabled = wasEnabled;

                //        if (assetData[asset].updateBundleIndex > -1 && assetData[asset].updateBundleIndex < bundles.Count)
                //            DrawStatus(bundles[assetData[asset].updateBundleIndex].GetStatusMessage());
                //    }
                //    EditorGUILayout.EndHorizontal();
                //}
                //else
                //{
                using (var filePathField = new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField("Asset File Path:", GUILayout.Width(160));
                    assetData[asset].updatedResourcePath = EditorGUILayout.TextField(assetData[asset].updatedResourcePath);

                    bool wasEnabled = GUI.enabled;
                    GUI.enabled = wasEnabled && !asset.InProcess(Core.Asset.Process.Uploading);
                    if (GUILayout.Button("Re-Upload", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                    {
                        asset.AddData(assetData[asset].updatedResourcePath);
                    }
                    GUI.enabled = wasEnabled;
                }
                //}

                //if (asset.assetType == assetTypeList[assetData[asset].updateAssetTypeIndex])
                //    externalBundle = EditorGUILayout.Toggle("external bundle file", externalBundle, GUILayout.Width(160));

                EditorGUILayout.LabelField("", GUILayout.ExpandHeight(true));

                using (var graphButtonField = new EditorGUILayout.HorizontalScope())
                {
                    if (GUILayout.Button("Open Graph", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                    {
                        Manager.SpaceGraphNodeViewer.OpenGraphViewer(asset);
                    }

                    if (GUILayout.Button("Reset to Default", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                    {
                        if (asset != null)
                        {
                            asset.ResetToDefault();
                        }
                    }

                    EditorGUILayout.LabelField("");
                    bool wasEnabled = GUI.enabled;
                    GUI.enabled = wasEnabled && assetData[asset].updateAssetName != asset.name;
                    if (GUILayout.Button("Update", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                    {
                        asset.Update(assetData[asset].updateAssetName, assetTypeList[assetData[asset].updateAssetTypeIndex], "", "");
                    }
                    GUI.enabled = wasEnabled;

                    if (GUILayout.Button("Cancel", GUILayout.Width(ASSET_WIDE_BUTTON_WIDTH)))
                    {
                        assetData.Remove(asset);
                        //externalBundle = false;
                    }
                }
            }
            GUI.backgroundColor = bgColor;
        }
Example #13
0
 public AssetPairInfo(Core.Asset forAsset, Core.Asset domAsset, NodaTime.Instant[] quoteDates)
 {
     ForAsset   = forAsset;
     DomAsset   = domAsset;
     QuoteDates = quoteDates;
 }
Example #14
0
 public TransactionInfoQuery(string txId, Core.Asset denominator = null) : base(txId)
 {
     TxId        = txId;
     Denominator = denominator;
 }
        void DrawCreateAssetPanel()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Asset Name:", GUILayout.Width(160));
                    assetName = EditorGUILayout.TextField(assetName);
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Asset Type:", GUILayout.Width(160));
                    assetTypeIndex = EditorGUILayout.Popup(assetTypeIndex, assetTypeList, GUILayout.Width(160));
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Asset File Path:", GUILayout.Width(160));
                    assetPath = EditorGUILayout.TextField(assetPath);
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.Label("", GUILayout.ExpandHeight(true));

                if (m_asset == null)
                {
                    GUILayout.Label("");
                }
                else
                {
                    DrawStatus(m_asset.GetStatusMessage());
                }

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("");

                    bool wasEndabled = GUI.enabled;
                    GUI.enabled = wasEndabled && m_asset == null && !string.IsNullOrEmpty(assetName) && System.IO.File.Exists(assetPath);
                    if (GUILayout.Button("Create Asset", GUILayout.Width(120)))
                    {
                        m_asset = Core.Asset.Create(assetName, assetTypeList[assetTypeIndex], assetPath);
                    }
                    GUI.enabled = wasEndabled;

                    if (GUILayout.Button("Close", GUILayout.Width(120)))
                    {
                        if (wasCreateCalled)
                        {
                            GetWindow <AssetManagerWindow>().RefreshAssetList();
                        }

                        Close();
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
Example #16
0
 public CoinInfo(string name, string ticker, Core.Asset asset)
 {
     Name   = name;
     Ticker = ticker;
     Asset  = asset;
 }