Beispiel #1
0
        public sealed override void NodeGUI()
        {
#if UNITY_EDITOR
            bool running = this.isRunning;
            if (running)
            {
                this.backgroundColor = Color.green;
            }
            else
            {
                this.backgroundColor = Color.white;
            }

            GUILayout.BeginHorizontal();
            Priority = RTEditorGUI.IntField(new GUIContent("Priority:", "state excute order "), Priority);
            GUILayout.Toggle(running, new GUIContent("Running state:", "if it is the fsm current state"));
            GUILayout.EndHorizontal();
#if UNITY_EDITOR
            TestForNext = GUILayout.Toggle(TestForNext, new GUIContent("To Next", "Just for Test"));
#endif

            DrawFSMGUI();
            if (GUI.changed)
            {
                NodeEditor.curNodeCanvas.OnNodeChange(this);
            }
#endif
        }
Beispiel #2
0
        public override void NodeGUI()
        {
            if (input == null)
            {
                if (inputKnobs.Count > 0)
                {
                    input  = inputKnobs[0];
                    output = outputKnobs[0];
                }
                else if (Canvas is DialogueCanvas)
                {
                    input  = CreateConnectionKnob(dialogueIn);
                    output = CreateConnectionKnob(dialogueOut);
                }
                else
                {
                    input  = CreateConnectionKnob(flowIn);
                    output = CreateConnectionKnob(flowOut);
                }
            }

            {
                GUILayout.BeginHorizontal();
                inputKnobs[0].DisplayLayout();
                outputKnobs[0].DisplayLayout();
                GUILayout.EndHorizontal();
            }

            GUILayout.Label("Faction Number");
            factionID = RTEditorGUI.IntField(factionID);
            GUILayout.Label("Relations sum:");
            relationsSum = RTEditorGUI.IntField(relationsSum);
        }
Beispiel #3
0
    public override void NodeGUI()
    {
        base.NodeGUI();

        GUILayout.BeginHorizontal();
        GUILayout.BeginVertical();
        GUILayout.Label("octaves:");
        GUILayout.Label("frequency:");
        GUILayout.Label("amplitude:");
        GUILayout.EndVertical();
        GUILayout.BeginVertical();
        octaves   = RTEditorGUI.IntField(octaves);
        frequency = RTEditorGUI.FloatField(frequency);
        amplitude = RTEditorGUI.FloatField(amplitude);
        GUILayout.EndVertical();
        GUILayout.EndHorizontal();


        noiseFunction = noiseGUI.Display();

        if (GUI.changed || noiseGUI.changed)
        {
            fractalNoise = new FractalNoise(noiseFunction, octaves, frequency, amplitude);
            noiseDesc    = noiseGUI.noiseDesc();
            NodeEditor.curNodeCanvas.OnNodeChange(this);
        }
    }
Beispiel #4
0
        //[ConnectionKnob("Input Left", Direction.In, "TaskFlow", NodeSide.Left, 20)]
        //public ConnectionKnob inputLeft;

        //[ConnectionKnob("Output Right", Direction.Out, "TaskFlow", NodeSide.Right, 20)]
        //public ConnectionKnob outputRight;

        public override void NodeGUI()
        {
            if (input == null)
            {
                if (inputKnobs.Count > 0)
                {
                    input  = inputKnobs[0];
                    output = outputKnobs[0];
                }
                else if (Canvas is DialogueCanvas)
                {
                    input  = CreateConnectionKnob(dialogueIn);
                    output = CreateConnectionKnob(dialogueOut);
                }
                else
                {
                    input  = CreateConnectionKnob(flowIn);
                    output = CreateConnectionKnob(flowOut);
                }
            }

            {
                GUILayout.BeginHorizontal();
                inputKnobs[0].DisplayLayout();
                outputKnobs[0].DisplayLayout();
                GUILayout.EndHorizontal();
            }

            GUILayout.Label("Variable Name:");
            variableName = GUILayout.TextField(variableName);
            GUILayout.Label("Value:");
            value         = RTEditorGUI.IntField(value);
            incrementMode = GUILayout.Toggle(incrementMode, "Increment mode: ");
        }
Beispiel #5
0
        public override void NodeGUI()
        {
            GUILayout.Label("WARNING: this node is deprecated and will later be deleted. Use a Condition Group Node with a Time Trigger.");
            GUILayout.BeginVertical(GUILayout.MinWidth(300f));
            for (int i = 0; i < times.Count; i++)
            {
                RTEditorGUI.Seperator();
                GUILayout.BeginHorizontal();
                if (GUILayout.Button("x", GUILayout.ExpandWidth(false)))
                {
                    DeleteConnectionPort(outputKnobs[i + 1]);
                    times.RemoveAt(i);
                    i--;
                    continue;
                }

                GUILayout.Label("Event " + i);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();
                times[i] = RTEditorGUI.IntField("Time:", times[i]);
                outputKnobs[i + 1].DisplayLayout();
                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Add", GUILayout.ExpandWidth(false), GUILayout.MinWidth(100f)))
            {
                CreateConnectionKnob(outputAttribute);
                times.Add(times.Count);
            }

            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
        }
        public override void NodeGUI()
        {
            GUILayout.BeginHorizontal();
            if (useIDInput)
            {
                if (IDInput == null)
                {
                    if (inputKnobs.Count == 0)
                    {
                        IDInput = CreateConnectionKnob(IDInStyle);
                    }
                    else
                    {
                        IDInput = inputKnobs[0];
                    }
                }
                IDInput.DisplayLayout();
            }
            output.DisplayLayout();
            GUILayout.EndHorizontal();

            if (nameMode = RTEditorGUI.Toggle(nameMode, "Name Mode"))
            {
                GUILayout.Label("Target Name");
                targetID = GUILayout.TextField(targetID);
            }
            else
            {
                useIDInput = RTEditorGUI.Toggle(useIDInput, "Use ID input");
                if (GUI.changed)
                {
                    if (useIDInput)
                    {
                        IDInput = CreateConnectionKnob(IDInStyle);
                    }
                    else
                    {
                        DeleteConnectionPort(IDInput);
                    }
                }
                if (!useIDInput)
                {
                    GUILayout.Label("Target ID");
                    targetID = GUILayout.TextField(targetID);
                    if (WorldCreatorCursor.instance != null)
                    {
                        if (GUILayout.Button("Select", GUILayout.ExpandWidth(false)))
                        {
                            WorldCreatorCursor.selectEntity += SetEntityID;
                            WorldCreatorCursor.instance.EntitySelection();
                        }
                    }
                }
            }
            targetCount   = RTEditorGUI.IntField("Count: ", targetCount);
            targetFaction = RTEditorGUI.IntField("Faction: ", targetFaction);
        }
        protected override void DrawConfigurationGUI()
        {
            base.DrawConfigurationGUI();

            _offsetNorth = RTEditorGUI.IntField(new GUIContent("North offset"), _offsetNorth);
            _offsetSouth = RTEditorGUI.IntField(new GUIContent("South offset"), _offsetSouth);
            _offsetEast  = RTEditorGUI.IntField(new GUIContent("East offset"), _offsetEast);
            _offsetWest  = RTEditorGUI.IntField(new GUIContent("West offset"), _offsetWest);
        }
 protected override void DrawConfigurationGUI()
 {
     _generate = RTEditorGUI.Toggle(_generate, new GUIContent("Auto-generate curve?"));
     if (_generate)
     {
         _steps = RTEditorGUI.IntField(new GUIContent("Steps"), _steps);
     }
     _inverted = RTEditorGUI.Toggle(_inverted, new GUIContent("Invert?"));
 }
Beispiel #9
0
        public override void NodeGUI()
        {
            GUILayout.Label("Variable Name:");
            variableName = GUILayout.TextField(variableName);
            GUILayout.Label("Value:");
            value = RTEditorGUI.IntField(value);

            GUILayout.Label("Comparison mode:");
            mode = GUILayout.SelectionGrid(mode, modes, 1, GUILayout.Width(128f));
        }
        protected override void DrawConfigurationGUI()
        {
            base.DrawConfigurationGUI();

            _offsetTop    = RTEditorGUI.IntField(new GUIContent("Top offset"), _offsetTop);
            _offsetLeft   = RTEditorGUI.IntField(new GUIContent("Left offset"), _offsetLeft);
            _offsetRight  = RTEditorGUI.IntField(new GUIContent("Right offset"), _offsetRight);
            _offsetBottom = RTEditorGUI.IntField(new GUIContent("Bottom offset"), _offsetBottom);
            _isSeamless   = RTEditorGUI.Toggle(_isSeamless, new GUIContent("Is seamless?"));
        }
Beispiel #11
0
        protected override void DrawConfigurationGUI()
        {
            _overrideInputDimensions = RTEditorGUI.Toggle(_overrideInputDimensions, "Override input dimensions?");

            if (_overrideInputDimensions)
            {
                _outputHeight = RTEditorGUI.IntField("Output height", _outputHeight);
                _outputWidth  = RTEditorGUI.IntField("Output width", _outputWidth);
            }
        }
        protected override void NodeGUIProperties()
        {
            GUILayout.BeginVertical();

            Displacement = RTEditorGUI.FloatField(new GUIContent("Displacement", "Displacement value of voronoi cells"), Frequency);
            Frequency    = RTEditorGUI.FloatField(new GUIContent("Frequency", "Frequency of the first octave"), Frequency);
            Seed         = RTEditorGUI.IntField(new GUIContent("Seed", "Random Seed"), Seed);
            UseDistance  = RTEditorGUI.Toggle(UseDistance, new GUIContent("UseDistance", "Apply Distance to Seed point to output value"));

            GUILayout.EndVertical();
        }
        public override void NodeGUI()
        {
            GUILayout.BeginHorizontal();
            input.DisplayLayout();
            output.DisplayLayout();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            targetFaction = RTEditorGUI.IntField("Target Faction", targetFaction);
            GUILayout.EndHorizontal();
        }
Beispiel #14
0
        protected override void NodeGUIProperties()
        {
            GUILayout.BeginVertical();

            Frequency = RTEditorGUI.FloatField(new GUIContent("Frequency", "Frequency of the first octave"), Frequency);
            Power     = RTEditorGUI.FloatField(new GUIContent("Power", "Set Power"), Power);
            Roughness = RTEditorGUI.IntField(new GUIContent("Roughness", "Set Roughness"), Roughness);
            Seed      = RTEditorGUI.IntField(new GUIContent("Seed", "Random Seed"), Seed);

            GUILayout.EndVertical();
        }
 public override void NodeGUI()
 {
     output.DisplayLayout();
     GUILayout.Label("Entity ID:");
     entityID   = RTEditorGUI.TextField(entityID);
     rangeCheck = RTEditorGUI.Toggle(rangeCheck, "Range check", GUILayout.Width(200f));
     if (rangeCheck)
     {
         distanceFromPlayer = RTEditorGUI.IntField("Distance (squared): ", distanceFromPlayer);
     }
 }
Beispiel #16
0
 public override void NodeGUI()
 {
     output.DisplayLayout();
     GUILayout.Label("Entity ID:");
     entityID   = RTEditorGUI.TextField(entityID);
     rangeCheck = RTEditorGUI.Toggle(rangeCheck, "Range check from player", GUILayout.Width(200f));
     if (rangeCheck)
     {
         distanceFromPlayer = RTEditorGUI.IntField("Distance: ", distanceFromPlayer);
         lessThan           = GUILayout.SelectionGrid(lessThan ? 0 : 1, new string[] { "Less", "Greater" }, 1) == 0;
     }
 }
Beispiel #17
0
        public override void NodeGUI()
        {
            outputKnob.DisplayLayout();

            _frequency    = RTEditorGUI.FloatField(new GUIContent("Frequency"), _frequency);
            _displacement = RTEditorGUI.FloatField(new GUIContent("Lacunarity"), _displacement);
            _seed         = RTEditorGUI.IntField(new GUIContent("Seed"), _seed);
            _distance     = RTEditorGUI.Toggle(_distance, new GUIContent("Distance"));

            if (GUI.changed)
            {
                NodeEditor.curNodeCanvas.OnNodeChange(this);
            }
        }
        public override void NodeGUI()
        {
            outputKnob.DisplayLayout();

            _frequency  = RTEditorGUI.FloatField(new GUIContent("Frequency"), _frequency);
            _lacunarity = RTEditorGUI.FloatField(new GUIContent("Lacunarity"), _lacunarity);
            _octaves    = RTEditorGUI.IntField(new GUIContent("Octaves"), _octaves);
            _seed       = SeedGUIUtils.SeedInput(_seedInputKnob, _seed);
            _quality    = (QualityMode)RTEditorGUI.EnumPopup(new GUIContent("Quality"), _quality);

            if (GUI.changed)
            {
                NodeEditor.curNodeCanvas.OnNodeChange(this);
            }
        }
Beispiel #19
0
        protected override void NodeGUIProperties()
        {
            GUILayout.BeginVertical();

            Frequency   = RTEditorGUI.FloatField(new GUIContent("Frequency", "Frequency of the first octave"), Frequency);
            Lacunarity  = RTEditorGUI.FloatField(new GUIContent("Lacunarity", "Set Lacunarity"), Lacunarity);
            OctaveCount = RTEditorGUI.IntField(new GUIContent("OctaveCount", "How many octaves to generate"), OctaveCount);
            Seed        = RTEditorGUI.IntField(new GUIContent("Seed", "Random Seed"), Seed);

#if UNITY_EDITOR
            Quality = (LibNoise.QualityMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Quality", "Quality Mode for noise"), Quality);
#else
            GUILayout.Label(new GUIContent("Quality: " + Quality.ToString(), "Quality Mode for noise"));
#endif
            GUILayout.EndVertical();
        }
Beispiel #20
0
        public static int SeedInput(ValueConnectionKnob knob, int localValue)
        {
            int seed;

            if (knob.connected())
            {
                seed = GetSeed(knob, localValue);
                RTEditorGUIExtensions.ReadOnlyTextField("Seed", seed.ToString());
            }
            else
            {
                seed = RTEditorGUI.IntField(new GUIContent("Seed"), localValue);
            }
            knob.SetPosition();
            return(seed);
        }
Beispiel #21
0
    public INoise Display()
    {
        changed         = outOfBandChange;
        outOfBandChange = false;
        string[] names = noiseFunctions.Select(n => n.Name).ToArray();
        RTEditorGUI.Popup(new GUIContent("Noise", "The noise type to use"), noiseTypeIndex, names, selected =>
        {
            noiseTypeIndex       = selected;
            Type selectedNoise   = noiseFunctions[selected];
            selectedNoiseType    = selectedNoise.ToString();
            ConstructorInfo ctor = selectedNoise.GetConstructors()[0];

            noiseParameters = defaultParams(ctor);
            noiseFunction   = (Noise)ctor.Invoke(noiseParameters);

            outOfBandChange = true;
        });

        GUILayout.BeginVertical();
        ConstructorInfo ctor2 = noiseFunctions[noiseTypeIndex].GetConstructors()[0];

        ParameterInfo[] pInfo = ctor2.GetParameters();
        for (int i = 0; i < pInfo.Length; i++)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(pInfo[i].Name);
            if (pInfo[i].ParameterType == typeof(int))
            {
                noiseParameters[i] = RTEditorGUI.IntField((int)noiseParameters[i]);
            }
            else if (pInfo[i].ParameterType == typeof(float))
            {
                noiseParameters[i] = RTEditorGUI.FloatField((float)noiseParameters[i]);
            }
            GUILayout.EndHorizontal();
        }
        GUILayout.EndVertical();

        if (GUI.changed)
        {
            noiseFunction = (Noise)ctor2.Invoke(noiseParameters);
            changed       = true;
        }

        return(noiseFunction);
    }
Beispiel #22
0
        public override void NodeGUI()
        {
            GUILayout.BeginHorizontal();
            inputLeft.DisplayLayout();
            GUILayout.BeginVertical();
            outputTrue.DisplayLayout();
            outputFalse.DisplayLayout();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.Label("Variable Name:");
            variableName = GUILayout.TextField(variableName);
            GUILayout.Label("Value:");
            value = RTEditorGUI.IntField(value);

            GUILayout.Label("Comparison mode:");
            mode = GUILayout.SelectionGrid(mode, modes, 1, GUILayout.Width(144f));
        }
        protected void DrawPreview()
        {
            Material mtrl = new Material(Shader.Find("Transparent/Diffuse"));

            mtrl.SetColor("_Color", Color.white);
            mtrl.SetTexture("_MainTex", _previewTexture);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            Rect rect = GUILayoutUtility.GetRect(_previewWidth, _previewHeight, GUI.skin.box);

            if (_previewTexture != null)
            {
                //RTEditorGUI.DrawTexture(_previewTexture, _previewWidth, GUI.skin.box);
                //GUI.BeginGroup(rect);

                GUI.color = _textureSequenceId == _nextSequenceId ? Color.white : new Color(1.0f, 1.0f, 1.0f, 0.25f);
                GUI.DrawTexture(rect, _previewTexture, ScaleMode.ScaleToFit, true);
                GUI.color = Color.white;

                //UnityEditor.EditorGUI.DrawTextureAlpha(rect, _previewTexture);
                //UnityEditor.EditorGUI.DrawPreviewTexture(rect, _previewTexture);
                //Graphics.DrawTexture(rect, _previewTexture);
                //GUI.EndGroup();
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            Cutoff           = RTEditorGUI.FloatField("Cutoff", Cutoff);
            SmoothIterations = RTEditorGUI.IntField("Smooth Iterations", SmoothIterations);

            using (var horizontalScope = new GUILayout.HorizontalScope("box"))
            {
                GUILayout.FlexibleSpace();
                const float sz = 70.0f;
                PreviewLeft   = RTEditorGUI.FloatField("Left", PreviewLeft, GUILayout.Width(sz));
                PreviewRight  = RTEditorGUI.FloatField("Right", PreviewRight, GUILayout.Width(sz));
                PreviewTop    = RTEditorGUI.FloatField("Top", PreviewTop, GUILayout.Width(sz));
                PreviewBottom = RTEditorGUI.FloatField("Bottom", PreviewBottom, GUILayout.Width(sz));
                GUILayout.FlexibleSpace();
            }
            PreviewSeamless = RTEditorGUI.Toggle(PreviewSeamless, "Seamless");
        }
Beispiel #24
0
        public override void NodeGUI()
        {
            GUILayout.Label("This node is deprecated. Use 'Flow/Condition Check Node' instead");

            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            inputLeft.DisplayLayout();
            GUILayout.BeginVertical();
            outputTrue.DisplayLayout();
            outputFalse.DisplayLayout();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();
            GUILayout.Label("Variable Name:");
            variableName = GUILayout.TextField(variableName);
            GUILayout.Label("Value:");
            value = RTEditorGUI.IntField(value);

            GUILayout.Label("Comparison mode:");
            mode = GUILayout.SelectionGrid(mode, modes, 1, GUILayout.Width(144f));
        }
    public override void NodeGUI()
    {
        inputTexKnob.SetPosition(20);

        GUILayout.BeginVertical();
        GUILayout.BeginVertical();
        width  = RTEditorGUI.IntField("Width", width);
        height = RTEditorGUI.IntField("Height", height);
        GUILayout.EndVertical();
        // Bottom row: output image
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Box(inputTex, GUILayout.MaxWidth(64), GUILayout.MaxHeight(64));
        GUILayout.EndHorizontal();
        GUILayout.Space(4);
        GUILayout.EndVertical();

        if (GUI.changed)
        {
            NodeEditor.curNodeCanvas.OnNodeChange(this);
        }
    }
Beispiel #26
0
        protected T DrawField <T>(T value, string content, string tips = null)
        {
#if UNITY_EDITOR
            if (typeof(T) == typeof(int))
            {
                return(DynamicConvert <int, T> .Convert(RTEditorGUI.IntField(new GUIContent(content, tips), DynamicConvert <T, int> .Convert(value))));
            }
            else if (typeof(T) == typeof(float))
            {
                return(DynamicConvert <float, T> .Convert(RTEditorGUI.FloatField(new GUIContent(content, tips), DynamicConvert <T, float> .Convert(value))));
            }
            else if (typeof(T) == typeof(string))
            {
                return(DynamicConvert <string, T> .Convert(RTEditorGUI.TextField(new GUIContent(content, tips), DynamicConvert <T, string> .Convert(value))));
            }
            else if (value is UnityEngine.Object)
            {
                return(DynamicConvert <UnityEngine.Object, T> .Convert(UnityEditor.EditorGUILayout.ObjectField(new GUIContent(content, tips), DynamicConvert <T, UnityEngine.Object> .Convert(value), typeof(T), true)));
            }
#endif
            return(value);
        }
Beispiel #27
0
    public override void NodeGUI()
    {
        GameObject go = RTEditorGUI.ObjectField(Enemy, allowSceneObjects: false);

        if (GUI.changed)
        {
            if (go && go.GetComponent <Enemy>())
            {
                _enemy = go;
            }
        }


        //EditorGUI.ObjectField(new Rect(0,0,100,100), enemy, typeof(Enemy),false);
        // (WaveModel) EditorGUILayout.ObjectField(model, typeof(WaveModel), true);
        Delay          = RTEditorGUI.IntField("Spawn delay", Delay);
        _enemiesCount  = RTEditorGUI.IntField("Spawn count", this.EnemiesCount);
        _spawnInterval = RTEditorGUI.IntField("Spawn interval", this.SpawnInterval);

        if (GUI.changed)
        {
            NodeEditor.curNodeCanvas.OnNodeChange(this);
        }
    }
Beispiel #28
0
    public override void NodeGUI()
    {
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Caption");
        Caption = EditorGUILayout.TextField(this.Caption);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Guid");
        Guid = EditorGUILayout.TextField(this.GetGUID().ToString());
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("Gold");
        Gold = RTEditorGUI.IntField(this.Gold);
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("IsComplete");
        IsComplete = EditorGUILayout.Toggle(IsComplete);
        GUILayout.Label("IsAvailable");
        IsAvailable = EditorGUILayout.Toggle(IsAvailable);
        EditorGUILayout.EndHorizontal();
    }
        public override void NodeGUI()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("Pass: "******"Fail: ");
            outputFail.DrawKnob();
            GUILayout.EndHorizontal();

            GUILayout.Label("Variable type:");
            if (GUILayout.Button(variableTypes[variableType]))
            {
                typePopup = new PopupMenu();
                typePopup.SetupGUI();
                for (int i = 0; i < variableTypes.Length; i++)
                {
                    typePopup.AddItem(new GUIContent(variableTypes[i]), false, SelectType, i);
                }
                typePopup.Show(GUIScaleUtility.GUIToScreenSpace(GUILayoutUtility.GetLastRect().max));
            }
            //variableType = GUILayout.SelectionGrid(variableType, variableTypes, 1, GUILayout.Width(128f));

            if (variableType <= 1 || variableType == 5)
            {
                GUILayout.Label("Variable Name:");
                GUILayout.BeginHorizontal();
                variableName = GUILayout.TextArea(variableName);
                GUILayout.EndHorizontal();
            }
            else if (variableType == 5)
            {
                GUILayout.Label("Mission Name:");
                GUILayout.BeginHorizontal();
                variableName = GUILayout.TextArea(variableName);
                GUILayout.EndHorizontal();
            }


            if (variableName.Equals(checkpointName, System.StringComparison.CurrentCulture))
            {
                checkpointName = "";
            }

            if (checkpointName != "")
            {
                GUILayout.Label("<color=red>Deprecated data detected! Checkpoint name = '" + checkpointName + "'</color>\n");
            }

            if (variableType > 0)
            {
                if (variableType != 5)
                {
                    GUILayout.Label("Value:");
                    value = RTEditorGUI.IntField(value);
                }

                GUILayout.Label("Comparison mode:");
                //comparisonMode = GUILayout.SelectionGrid(comparisonMode, comparisonModes, 1, GUILayout.Width(128f));
                string[] comparisonTexts = variableType == 5 ? missionStatus : comparisonModes;

                if (GUILayout.Button(comparisonTexts[comparisonMode]))
                {
                    comparisonPopup = new PopupMenu();
                    comparisonPopup.SetupGUI();
                    for (int i = 0; i < comparisonTexts.Length; i++)
                    {
                        comparisonPopup.AddItem(new GUIContent(comparisonTexts[i]), false, SelectMode, i);
                    }
                    comparisonPopup.Show(GUIScaleUtility.GUIToScreenSpace(GUILayoutUtility.GetLastRect().max));
                }
            }
        }
Beispiel #30
0
    public override void NodeGUI()
    {
        GUILayout.BeginVertical();

        // 1st row
        GUILayout.BeginHorizontal();

        // Capture mode - system audio vs mic
        GUILayout.BeginVertical();
        GUILayout.Label("Audio source");
#if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN
        RadioButtons(captureModeSelection);
#else
        GUILayout.Label("Mic");
#endif
        GUILayout.EndVertical();

        // Spectrum scaling mode - sqrt/decibel/linear
        GUILayout.BeginVertical();
        GUILayout.Label("Scaling");
        RadioButtons(scalingModeSelection);
        GUILayout.EndVertical();

        //Min / max frequency
        GUILayout.BeginVertical();
        GUILayout.Label("Min freq");
        newMinFreq = RTEditorGUI.IntField(minFreq);
        GUILayout.Label("Max freq");
        newMaxFreq = RTEditorGUI.IntField(maxFreq);
        GUILayout.EndVertical();

        GUILayout.EndHorizontal();

        //Smoothing iterations
        GUILayout.BeginHorizontal();

        GUILayout.Label("Smoothing");
        newSmoothing = RTEditorGUI.IntSlider(smoothingIterations, 1, 10, GUILayout.MaxWidth(DefaultSize.x - 60));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        var label = capturing ? "Stop capture" : "Start capture";
        if (GUILayout.Button(label))
        {
            capturing = !capturing;
            if (!capturing)
            {
                wasapiAudio.StopListen();
            }
            else
            {
                InitializeWasapiCapture();
                wasapiAudio.StartListen();
            }
        }

        spectrumDataKnob.DisplayLayout();
        GUILayout.EndHorizontal();
        GUILayout.EndVertical();
        if (GUI.changed)
        {
            NodeEditor.curNodeCanvas.OnNodeChange(this);
        }
    }