Esempio n. 1
0
        private void CreateToolbar()
        {
            _toolbar = new Toolbar();
            StyleSheetUtils.AddStyleSheets(_toolbar, "Toolbar");

            _toolbar.Add(new Button(() => SaveLoadUtils.SaveGraphView(_graphView, AssetGuid))
            {
                text = "Save"
            });

            _toolbar.Add(new Button(() => SaveLoadUtils.LoadGraphViewAsset(_graphView))
            {
                text = "Load"
            });

            var toggleMiniMap = new Toggle("MiniMap");

            toggleMiniMap.RegisterValueChangedCallback((change) => {
                _miniMap.visible = change.newValue;
            });
            _miniMap.visible = toggleMiniMap.value;
            _toolbar.Add(toggleMiniMap);

            rootVisualElement.Add(_toolbar);
        }
Esempio n. 2
0
        public void Initialize(string guid)
        {
            AssetGuid = guid;
            string path = AssetDatabase.GUIDToAssetPath(guid);

            EasyGraphAsset easyGraphAsset = AssetDatabase.LoadAssetAtPath <EasyGraphAsset>(path);

            if (easyGraphAsset == null)
            {
                Debug.LogError("load failed");
                return;
            }

            SaveLoadUtils.LoadGraphViewAsset(easyGraphAsset, _graphView);
            Repaint();
        }