Пример #1
0
        protected override void DrawNode(ModuleGraphView graphView)
        {
            Debug.Log(Script.SceneIndex);
            var inputPort = graphView.GeneratePort <float>(this, Direction.Input, Port.Capacity.Multi);

            inputPort.portName = "Input";
            inputContainer.Add(inputPort);
            AddToClassList("action");

            var outputPort = graphView.GeneratePort <float>(this, Direction.Output);

            outputPort.portName = "Output";
            outputContainer.Add(outputPort);

            IntegerField intField = new IntegerField("Scene Index", 2);

            intField.value = Script.SceneIndex;
            intField.RegisterValueChangedCallback(evt =>
            {
                var temp = evt.newValue < 0 ? 0 : evt.newValue > 99 ? 99 : evt.newValue;
                intField.SetValueWithoutNotify(temp);
                Script.SceneIndex = temp;
                graphView.SetDirty();
            });

            extensionContainer.Add(intField);

            graphView.RefreshNode(this);
            graphView.AddElement(this);
        }
Пример #2
0
    private void OnEnable()
    {
        ConstructGraphView();
        GenerateToolbar();

        var cached = Resources.Load <ActionContainer>(DefaultCacheName);

        if (cached != null)
        {
            graphView.IsCachedFile = true;
            Load(DefaultCacheName);
            AssetDatabase.DeleteAsset($"Assets/Resources/{DefaultCacheName}.asset");
            graphView.SetDirty();
        }
    }