//建立網格背景
    private void ConstructGraphView()
    {
        graphView = new LevelFlowGraphView(this);
        graphView.StretchToParentSize();
        rootVisualElement.Add(graphView);

        mapSaveLoad = new MapSaveLoad(graphView);
    }
Beispiel #2
0
    public StartNode(Vector2 _position, LevelEditorWindow _editorWindow, LevelFlowGraphView _graphView)
    {
        title = "Enter";
        SetPosition(new Rect(_position, defaultNodeSize));

        UnityEngine.UIElements.Label label_statName = new UnityEngine.UIElements.Label("name");
        mainContainer.Add(label_statName);

        startNameTextField = new TextField(""); //傳入label標籤,會跟對應到的label同行,否則獨立一行
        startNameTextField.RegisterValueChangedCallback(value =>
        {
            startName = value.newValue;
        });

        startNameTextField.SetValueWithoutNotify(startName);
        mainContainer.Add(startNameTextField);

        _graphView.AddToClassList("GraphViewStyleSheet");

        SetUpPort();

        RefreshExpandedState();
        RefreshPorts();
    }
Beispiel #3
0
    public LevelNode(Vector2 _position, LevelEditorWindow _editorWindow, LevelFlowGraphView _graphView)
    {
        SetPosition(new Rect(_position, defaultNodeSize));

        CreateSubGraphView();

        //Scene Object field
        sceneField = new ObjectField
        {
            objectType        = typeof(Scene),
            allowSceneObjects = false
        };

        sceneField.RegisterValueChangedCallback(ValueTuple =>
        {
            scene         = ValueTuple.newValue;
            title         = ValueTuple.newValue.name;
            scenAssetGuid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(ValueTuple.newValue as SceneAsset));
            scenePath     = AssetDatabase.GetAssetPath(ValueTuple.newValue as SceneAsset);
            //SetScenePath();
        });
        mainContainer.Add(sceneField);


        //Async? Enum field
        asyncTypeField = new EnumField()
        {
            value = asyncType
        };
        asyncTypeField.Init(asyncType);

        asyncTypeField.RegisterValueChangedCallback((value) =>
        {
            //賦予新value
            asyncType = (AsyncLoadType)value.newValue;
        });

        asyncTypeField.SetValueWithoutNotify(asyncType);

        mainContainer.Add(asyncTypeField);

        //Load Type Enum field
        loadTypeField = new EnumField()
        {
            value = loadType
        };
        loadTypeField.Init(loadType);

        loadTypeField.RegisterValueChangedCallback((value) =>
        {
            //賦予新value
            loadType = (SceneLoadType)value.newValue;
        });

        loadTypeField.SetValueWithoutNotify(loadType);

        mainContainer.Add(loadTypeField);



        //新增節點須refresh
        RefreshExpandedState();
        RefreshPorts();
    }
 public void Configure(LevelEditorWindow _editorWindow, LevelFlowGraphView _graphView)
 {
     editorWindow = _editorWindow;
     graphView    = _graphView;
 }
Beispiel #5
0
 public MapSaveLoad(LevelFlowGraphView _graphView)
 {
     graphView = _graphView;
 }