Пример #1
0
        public static void Load()
        {
            if (i != null)
            {
                return;
            }

            i = JsonUtility.FromJson <SettingsProject>(fs.ReadAllText(projectSettingsPath));
            if (i == null)
            {
                i = new SettingsProject();
                Save();
            }
        }
Пример #2
0
 void OnDisable()
 {
     singleton.asmdefGraphWindow = null;
     SettingsProject.Save();
 }
Пример #3
0
        public AsmdefNode(Assembly assembly, VisualElement parentContentContainer)
        {
            title         = assembly.name;
            this.assembly = assembly;

            leftPort = Port.Create <Edge>(Orientation.Horizontal, Direction.Input, Port.Capacity.Multi, typeof(Port));
            inputContainer.Add(leftPort);

            rightPort = Port.Create <Edge>(Orientation.Horizontal, Direction.Output, Port.Capacity.Multi, typeof(Port));
            outputContainer.Add(rightPort);

            RegisterCallback(( MouseDownEvent evt ) => {
                // 左クリック
                if (evt.button == 0)
                {
                    //focus = true;  // 選択
                    if (selectPort != null)
                    {
                        selectPort.portColor = Color.white;
                        foreach (var p in selectPort.connections)
                        {
                            p.UpdateEdgeControl();
                        }
                    }
                    if (selectPortR != null)
                    {
                        selectPortR.portColor = Color.white;
                        foreach (var p in selectPortR.connections)
                        {
                            p.UpdateEdgeControl();
                        }
                    }
                    leftPort.portColor  = Color.magenta;
                    rightPort.portColor = Color.cyan;
                    foreach (var p in leftPort.connections)
                    {
                        p.UpdateEdgeControl();
                    }
                    foreach (var p in rightPort.connections)
                    {
                        p.UpdateEdgeControl();
                    }
                    selectPort  = leftPort;
                    selectPortR = rightPort;

                    var path = CompilationPipeline.GetAssemblyDefinitionFilePathFromAssemblyName(title);
                    Selection.activeObject = path.LoadAsset();

                    singleton.treeViewAsmdef?.SelectAsmdef(assembly);
                    singleton.treeViewAsmdef?.SetFocusAndEnsureSelectedItem();
                    singleton.asmdefFilesWindow?.Repaint();

                    var refBy = leftPort.connections.Select(x => ((AsmdefNode)x.output.node)).ToArray();
                    var refTo = rightPort.connections.Select(x => ((AsmdefNode)x.input.node)).ToArray();
                    singleton.treeViewAsmdef?.RegisterFiles(refBy, refTo);
                    singleton.asmdefFilesWindow?.Repaint();
                }
            });
            RegisterCallback(( MouseUpEvent evt ) => {
                if (evt.button == 0)
                {
                    //Debug.Log( $"{title}: {GetPosition()}" );
                    SettingsProject.Save();
                }
            });
        }