示例#1
0
        public void Knobs_HalfConfigTest()
        {
            //top first half config
            var knobsModule = new Knobs();

            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs bottom none both none top both"), "Error test #1", null);

            //top second half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs none none none none both bottom"), "Error test #2", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");

            //bottom first half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs none top both bottom none bottom"), "Error test #3", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");

            //bottom second half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs top none top none none bottom"), "Error test #4", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");

            //Left first half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs bottom none none none top none"), "Error test #5", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");

            //Left second half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs none none none bottom top none"), "Error test #6", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");

            //Right first half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs bottom none both top both top"), "Error test #7", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");

            //Right second half config
            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs none bottom both top none none"), "Error test #8", null);
            knobsModule.Command(bomb, "both bottom both top bottom none");
        }
        void UpdateBtnsTriggerPipe()
        {
            foreach (NodeOutput btnsOutput in btnsOutputs)
            {
                DestroyImmediate(btnsOutput, true);
            }
            rect = new Rect(rect.position, new Vector2(120, 200));
            Knobs.RemoveAll(z => z.Name.Equals("Btns"));
            btnsOutputs.Clear();
            strNames.Clear();
            if (Count <= 0)
            {
                return;
            }
            int half = Count / 2;

            for (int i = 0; i < half; i++)
            {
                var output = CreateNodeOutput("Btns", "工作状态", Side.Left, i * 30);
                AssetDatabase.AddObjectToAsset(output, this);
                btnsOutputs.Add(output);
                strNames.Add(string.Empty);
            }
            for (int j = half; j < Count; j++)
            {
                var output = CreateNodeOutput("Btns", "工作状态", Side.Right, (j - half) * 30);
                AssetDatabase.AddObjectToAsset(output, this);
                btnsOutputs.Add(output);
                strNames.Add(string.Empty);
            }
            rect = new Rect(rect.position, new Vector2(120, 200 + (Count / 2) * 30));
            outputKnobs.RemoveAll(z => z.Name.Equals("Btns"));
        }
示例#3
0
        public void Knobs_FullConfigTest()
        {
            //Can't tell yet
            var knobsModule = new Knobs();

            Assert.AreEqual("Can't tell yet.", knobsModule.Command(bomb, "knobs none none none none none none"), "Error test #1", null);

            //top first config
            Assert.AreEqual("Final position is up.", knobsModule.Command(bomb, "knobs bottom bottom both bottom top both"), "Error test #2", null);

            //top second config
            Assert.AreEqual("Final position is up.", knobsModule.Command(bomb, "knobs top bottom both none both bottom"), "Error test #3", null);

            //bottom first config
            Assert.AreEqual("Final position is down.", knobsModule.Command(bomb, "knobs bottom both both bottom none both"), "Error test #4", null);

            //bottom second config
            Assert.AreEqual("Final position is down.", knobsModule.Command(bomb, "knobs top bottom top none top bottom"), "Error test #5", null);

            //Left first config
            Assert.AreEqual("Final position is left.", knobsModule.Command(bomb, "knobs bottom none none bottom both bottom"), "Error test #6", null);

            //Left second config
            Assert.AreEqual("Final position is left.", knobsModule.Command(bomb, "knobs none none none bottom both none"), "Error test #7", null);

            //Right first config
            Assert.AreEqual("Final position is right.", knobsModule.Command(bomb, "knobs both bottom both top both top"), "Error test #8", null);

            //Right second config
            Assert.AreEqual("Final position is right.", knobsModule.Command(bomb, "knobs both bottom both top bottom none"), "Error test #9", null);
        }
 /// <summary>
 /// Add effects knobs to panel.  Attempts to recycle existing filters.
 /// </summary>
 /// <param name="select">Select multiple knobs via logical OR.
 /// e.g. Knobs.distortion | Knobs.reverb</param>
 /// <remarks>TODO Figure out a way to make filters chain (lowpass LAST).</remarks>
 public void AddKnobs(Knobs select)
 {
     if ((select & Knobs.distortion) == Knobs.distortion)
     {
         distortion = gameObj.GetComponent <AudioDistortionFilter>();
         if (distortion == null)
         {
             Log.dbg("Adding distortion filter");
             distortion = gameObj.AddComponent <AudioDistortionFilter>();
         }
     }
     if ((select & Knobs.reverb) == Knobs.reverb)
     {
         reverb = gameObj.GetComponent <AudioReverbFilter>();
         if (reverb == null)
         {
             Log.dbg("Adding reverb filter");
             reverb = gameObj.AddComponent <AudioReverbFilter>();
         }
     }
     if ((select & Knobs.lowpass) == Knobs.lowpass)
     {
         lowpass = gameObj.GetComponent <AudioLowPassFilter>();
         if (lowpass == null)
         {
             Log.dbg("Adding low-pass filter");
             lowpass = gameObj.AddComponent <AudioLowPassFilter>();
         }
         lowpass.lowpassResonaceQ = 0f;
     }
 }
示例#5
0
 public KnobArranger(Letters letters, Knobs knobs, ILayerCreator layerCreator, ILogicalLayoutPlacer layoutPlacer)
 {
     this.layerCreator = layerCreator;
     this.layoutPlacer = layoutPlacer;
     this.letters      = letters;
     this.knobs        = knobs;
 }
 /// <summary>
 /// Add effects knobs to panel.  Attempts to recycle existing filters.
 /// </summary>
 /// <param name="select">Select multiple knobs via logical OR.
 /// e.g. Knobs.distortion | Knobs.reverb</param>
 /// <remarks>TODO Figure out a way to make filters chain (lowpass LAST).</remarks>
 public void AddKnobs(Knobs select)
 {
     if ((select & Knobs.distortion) == Knobs.distortion)
     {
         distortion = gameObj.GetComponent<AudioDistortionFilter>();
         if (distortion == null)
         {
             //Debug.Log("ASE -- Adding distortion filter");
             distortion = gameObj.AddComponent<AudioDistortionFilter>();
         }
     }
     if ((select & Knobs.reverb) == Knobs.reverb)
     {
         reverb = gameObj.GetComponent<AudioReverbFilter>();
         if (reverb == null)
         {
             //Debug.Log("ASE -- Adding reverb filter");
             reverb = gameObj.AddComponent<AudioReverbFilter>();
         }
     }
     if ((select & Knobs.lowpass) == Knobs.lowpass)
     {
         lowpass = gameObj.GetComponent<AudioLowPassFilter>();
         if (lowpass == null)
         {
             //Debug.Log("ASE -- Adding low-pass filter");
             lowpass = gameObj.AddComponent<AudioLowPassFilter>();
         }
         lowpass.lowpassResonaceQ = 0f;
     }
 }
示例#7
0
 void Update()
 {
     for (int i = 0; i < _numKnobs; i++)
     {
         _knobs[i] = Knobs.Get(i);
         Shader.SetGlobalFloat("Knob" + i.ToString(), _knobs[i]);
     }
 }
 internal override void Notify(MessageType msg, NamedElement element, object param)
 {
     base.Notify(msg, element, param);
     Scales.Notify(msg, element, param);
     Ranges.Notify(msg, element, param);
     Pointers.Notify(msg, element, param);
     Knobs.Notify(msg, element, param);
 }
 protected override void OnDispose()
 {
     base.OnDispose();
     Scales.Dispose();
     Ranges.Dispose();
     Pointers.Dispose();
     Knobs.Dispose();
 }
 internal override void EndInit()
 {
     base.EndInit();
     Scales.EndInit();
     Ranges.EndInit();
     Pointers.EndInit();
     Knobs.EndInit();
 }
 internal override void BeginInit()
 {
     base.BeginInit();
     Scales.BeginInit();
     Ranges.BeginInit();
     Pointers.BeginInit();
     Knobs.BeginInit();
 }
 /// <summary>
 /// Adjust effects knobs
 /// </summary>
 /// <param name="select">Select multiple knobs via logical OR.
 /// e.g. Knobs.distortion | Knobs.reverb</param>
 /// <param name="setting">-1 to turn off</param>
 /// <remarks>TODO error checking on filter knobs.</remarks>
 public void SetKnobs(Knobs select, float setting)
 {
     if ((select & Knobs.lowpass) == Knobs.lowpass)
     {
         if (setting >= 0)
         {
             Log.dbg("Setting low-pass filter to {0}", setting);
             lowpass.enabled         = true;
             lowpass.cutoffFrequency = setting;
         }
         else
         {
             Log.dbg("Disabling-low pass filter");
             lowpass.enabled = false;
         }
     }
     if ((select & Knobs.distortion) == Knobs.distortion)
     {
         if (setting >= 0)
         {
             Log.dbg("Setting distortion filter to {0}", setting);
             distortion.enabled         = true;
             distortion.distortionLevel = setting;
         }
         else
         {
             Log.dbg("Disabling distortion filter");
             distortion.enabled = false;
         }
     }
     if ((select & Knobs.reverb) == Knobs.reverb)
     {
         if (setting >= 0)
         {
             Log.dbg("Setting reverb filter to {0}", setting);
             reverb.enabled     = true;
             reverb.reverbLevel = setting;
         }
         else
         {
             Log.dbg("Disabling reverb filter");
             reverb.enabled = false;
         }
     }
     if ((select & Knobs.volume) == Knobs.volume)
     {
         if (setting >= 0)
         {
             Log.dbg("Setting volume to {0}", setting);
             input.volume = setting;
         }
         else
         {
             Log.dbg("Muting volume");
             input.volume = 0;
         }
     }
 }
示例#13
0
    public void SetUp()
    {
        var knobsGo = new GameObject();

        knobs = knobsGo.AddComponent <Knobs>();

        knobA = knobs.Create(A.Letter("a"), 0, 0, 0, 0);
        knobB = knobs.Create(A.Letter("b"), 1, 0, 0, 0);
        knobC = knobs.Create(A.Letter("c"), 2, 0, 0, 0);
    }
示例#14
0
    public void SetUp()
    {
        var knobsObject   = new GameObject("knobs");
        var lettersObject = new GameObject("letters");

        knobs     = knobsObject.AddComponent <Knobs>();
        letters   = lettersObject.AddComponent <Letters>();
        arranger  = new KnobArranger(letters, knobs);
        rightHand = new StubHand(HandSide.Left);
    }
示例#15
0
    public void SetUp()
    {
        var knobsObject   = new GameObject("knobs");
        var lettersObject = new GameObject("letters");

        knobs     = knobsObject.AddComponent <Knobs>();
        letters   = lettersObject.AddComponent <Letters>();
        arranger  = new KnobArranger(letters, knobs, new PredictiveLayerCreator(letters), new AlphabeticLogicalLettersPlacer());
        leftHand  = new StubHand(HandSide.Left);
        rightHand = new StubHand(HandSide.Right);
    }
示例#16
0
文件: Knob.cs 项目: damned/textry-vr
    public Knob(Knobs knobs, GameObject gameObject, Vector3 where, int layer = -1)
    {
        this.Layer      = layer;
        this.knobs      = knobs;
        this.id         = (++knobId);
        this.gameObject = gameObject;
        this.gameObject.transform.localPosition = where + visualOffset;
        this.letter = gameObject.GetComponent <Letter>();

        SetupMaterials();
    }
示例#17
0
        static void OnEditorUpdate()
        {
            if (Knobs.HasNewValues())
            {
                for (int i = 0; i < Knobs.NUM_KNOBS; i++)
                {
                    Shader.SetGlobalFloat($"Knob{i}", Knobs.Get(i));
                }

                EditorApplication.QueuePlayerLoopUpdate();
            }
        }
示例#18
0
    void Start()
    {
        hands = GetComponent <LeapHands>();
        debug = GetComponent <LiveDebug>();

        knobs   = GameObject.Find("interactables").GetComponent <Knobs>();
        letters = GameObject.Find("letters").GetComponent <Letters>();

        debug.Log("knobs and letters: " + knobs + ", " + letters);

        knobArranger = new KnobArranger(letters, knobs);
        knobArranger.Arrange(0f);

        grabStrategy = new GrabStrategy(knobs, knobArranger, debug);

        hands.OnHandUpdate += OnHandUpdate;
    }
示例#19
0
 public dynamic MakePedalSetting(GameVersion gameVersion)
 {
     if (gameVersion == GameVersion.RS2014)
     {
         return(new DLCPackage.Manifest.Tone.Pedal2014
         {
             PedalKey = Key,
             KnobValues = Knobs.ToDictionary(k => k.Key, k => k.DefaultValue),
             Category = Category,
             Type = Type
         });
     }
     else
     {
         return(new DLCPackage.Tone.Pedal
         {
             PedalKey = Key,
             KnobValues = Knobs.ToDictionary(k => k.Key, k => (decimal)k.DefaultValue)
         });
     }
 }
 public dynamic MakePedalSetting(GameVersion gameVersion)
 {
     if (gameVersion == GameVersion.RS2014)
     {
         return(new Pedal2014
         {
             PedalKey = Key,
             KnobValues = Knobs.ToDictionary(k => k.Key, k => k.DefaultValue),
             Skin = Skin,
             SkinIndex = SkinIndex,
             Category = Category,
             Type = Type
         });
     }
     else
     {
         return(new Pedal
         {
             PedalKey = Key,
             KnobValues = Knobs.ToDictionary(k => k.Key, k => (decimal)k.DefaultValue)
         });
     }
 }
示例#21
0
 public Gesture(HandSide side, Knobs knobs)
 {
     this.knobs  = knobs;
     this.side   = side;
     trailObject = GameObject.FindWithTag("TrailPoint");
 }
示例#22
0
 public Gestures(Knobs knobs) : this(new Gesture[] { new Gesture(HandSide.Right, knobs), new Gesture(HandSide.Left, knobs) })
 {
 }
示例#23
0
 void OnDestroy()
 {
     print(String.Join("\n", Enumerable.Range(0, _numKnobs).Select(i => String.Format("{0}:\t{1}", i, Knobs.Get(i))).ToArray()));
     Knobs.Stop();
 }
 /// <summary>
 /// Adjust effects knobs
 /// </summary>
 /// <param name="select">Select multiple knobs via logical OR.
 /// e.g. Knobs.distortion | Knobs.reverb</param>
 /// <param name="setting">-1 to turn off</param>
 /// <remarks>TODO error checking on filter knobs.</remarks>
 public void SetKnobs(Knobs select, float setting)
 {
     if ((select & Knobs.lowpass) == Knobs.lowpass)
     {
         if (setting >= 0)
         {
             //Debug.Log("ASE -- Setting low-pass filter to " + setting);
             lowpass.enabled = true;
             lowpass.cutoffFrequency = setting;
         }
         else
         {
             //Debug.Log("ASE -- Disabling-low pass filter");
             lowpass.enabled = false;
         }
     }
     if ((select & Knobs.distortion) == Knobs.distortion)
     {
         if (setting >= 0)
         {
             //Debug.Log("ASE -- Setting distortion filter to " + setting);
             distortion.enabled = true;
             distortion.distortionLevel = setting;
         }
         else
         {
             //Debug.Log("ASE -- Disabling distortion filter");
             distortion.enabled = false;
         }
     }
     if ((select & Knobs.reverb) == Knobs.reverb)
     {
         if (setting >= 0)
         {
             //Debug.Log("ASE -- Setting reverb filter to " + setting);
             reverb.enabled = true;
             reverb.reverbLevel = setting;
         }
         else
         {
             //Debug.Log("ASE -- Disabling reverb filter");
             reverb.enabled = false;
         }
     }
     if ((select & Knobs.volume) == Knobs.volume)
         if (setting >= 0)
         {
             //Debug.Log("ASE -- Setting volume to " + setting);
             input.volume = setting;
         }
         else
         {
             //Debug.Log("ASE -- Muting volume");
             input.volume = 0;
         }
 }
 internal override void ReconnectData(bool exact)
 {
     base.ReconnectData(exact);
     Pointers.ReconnectData(exact);
     Knobs.ReconnectData(exact);
 }
示例#26
0
 void Start()
 {
     Knobs.Start(_numKnobs);
 }
示例#27
0
 public KnobArranger(Letters letters, Knobs knobs)
 {
     this.letters = letters;
     this.knobs   = knobs;
 }
示例#28
0
 public GrabStrategy(Knobs knobs, KnobArranger knobArranger, IDebug debug)
 {
     this.knobArranger = knobArranger;
     this.debug        = debug;
     this.knobs        = knobs;
 }