public DefaultPvpEngine(AmeisenBotInterfaces bot, AmeisenBotConfig config)
        {
            Bot    = bot;
            Config = config;

            INode mainNode = new Waterfall
                             (
                new Leaf(() => BtStatus.Ongoing),
                (() => QueueStatus == 0, new Leaf(QueueForBattlegrounds))
                //  (() => QueueStatus == 2, new Leaf(() => { Bot.Wow.AcceptBattlegroundInvite(); return BtStatus.Success; }))
                             );

            Bt = new(mainNode);
        }
        public async Task Waterfall()
        {
            var activities = TranscriptUtilities.GetFromTestContext(TestContext);

            var convState    = new ConversationState(new MemoryStorage());
            var testProperty = convState.CreateProperty <Dictionary <string, object> >("test");

            var adapter = new TestAdapter()
                          .Use(convState);

            await new TestFlow(adapter, async(turnContext, cancellationToken) =>
            {
                if (turnContext.Activity.Type == ActivityTypes.Message)
                {
                    var state = await testProperty.GetAsync(turnContext, () => new Dictionary <string, object>());

                    var waterfall = new Waterfall(new WaterfallStep[]
                    {
                        async(dc, args, next) => { await dc.Context.SendActivityAsync("step1"); },
                        async(dc, args, next) => { await dc.Context.SendActivityAsync("step2"); },
                        async(dc, args, next) => { await dc.Context.SendActivityAsync("step3"); },
                    });


                    var dialogCompletion = await waterfall.ContinueAsync(turnContext, state);
                    if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                    {
                        await waterfall.BeginAsync(turnContext, state);
                    }
                }
            })
            .Test(activities)
            .StartTestAsync();
        }
Exemple #3
0
        public async Task Waterfall()
        {
            var activities = TranscriptUtilities.GetFromTestContext(TestContext);

            TestAdapter adapter = new TestAdapter()
                                  .Use(new ConversationState <Dictionary <string, object> >(new MemoryStorage()));

            await new TestFlow(adapter, async(turnContext) =>
            {
                var waterfall = new Waterfall(new WaterfallStep[]
                {
                    async(dc, args, next) => { await dc.Context.SendActivityAsync("step1"); },
                    async(dc, args, next) => { await dc.Context.SendActivityAsync("step2"); },
                    async(dc, args, next) => { await dc.Context.SendActivityAsync("step3"); },
                });

                var state = ConversationState <Dictionary <string, object> > .Get(turnContext);

                var dialogCompletion = await waterfall.Continue(turnContext, state);
                if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                {
                    await waterfall.Begin(turnContext, state);
                }
            })
            .Test(activities)
            .StartTestAsync();
        }
        public async Task Waterfall()
        {
            ConversationState convoState = new ConversationState(new MemoryStorage());
            var testProperty             = convoState.CreateProperty <Dictionary <string, object> >("test", () => new Dictionary <string, object>());

            TestAdapter adapter = new TestAdapter()
                                  .Use(convoState);

            await new TestFlow(adapter, async(turnContext) =>
            {
                var state     = await testProperty.GetAsync(turnContext);
                var waterfall = new Waterfall(new WaterfallStep[]
                {
                    async(dc, args, next) => { await dc.Context.SendActivityAsync("step1"); },
                    async(dc, args, next) => { await dc.Context.SendActivityAsync("step2"); },
                    async(dc, args, next) => { await dc.Context.SendActivityAsync("step3"); },
                });

                var dialogCompletion = await waterfall.ContinueAsync(turnContext, state);
                if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                {
                    await waterfall.BeginAsync(turnContext, state);
                }
            })
            .Send("hello")
            .AssertReply("step1")
            .Send("hello")
            .AssertReply("step2")
            .Send("hello")
            .AssertReply("step3")
            .StartTestAsync();
        }
Exemple #5
0
        public WaterfallChart(ChartView BaseChart)
        {
            waterfall = new Waterfall();
            var       = new Variables.Variables();

            waterfall.FillSampleValues();
            waterfall.StartColor = var.GetPaletteBasic[0].AddLuminosity(0.3);
            waterfall.MidColor   = var.GetPaletteBasic[0];
            waterfall.EndColor   = var.GetPaletteBasic[0].AddLuminosity(-0.3);

            BaseChart.Chart.Axes.Left.AxisPen.Visible = true;
            BaseChart.Chart.Axes.Left.Visible         = true;
            BaseChart.Chart.Axes.Bottom.Visible       = true;
            BaseChart.Chart.Panel.MarginLeft          = 3;

            BaseChart.Chart.Axes.Left.Automatic    = true;
            BaseChart.Chart.Axes.Left.Increment    = 1;
            BaseChart.Chart.Axes.Bottom.Automatic  = true;
            BaseChart.Chart.Axes.Left.Grid.Visible = true;

            BaseChart.Chart.Title.Text     = "Waterfall series";
            BaseChart.Chart.Legend.Visible = false;

            BaseChart.Chart.Series.Add(waterfall);
        }
Exemple #6
0
        private void FftAnalyzerIf_FftCalculated(object sender, FftEventArgs e)
        {
            var bin = new FrequencyBins(e,
                                        new BinParameters
            {
                MinimumIntensityDb   = _model.Settings.IfParameter.MinimumIntensityDb,
                SamplingRate         = 100000000,
                BinsPerPoint         = IfSpectrumView.SelectedResolution.Resolution,
                CalibrationAmplitude = _model.Settings.IfParameter.CalibrationAmplitude,
                CalibrationOffset    = _model.Settings.IfParameter.CalibrationOffset
            });

            if (SpectrumAnalyzerIf != null)
            {
                SpectrumAnalyzerIf.Update(bin);
            }

            if (Waterfall != null)
            {
                Waterfall.Update(bin);
            }

            /*
             * if (!VideoFilter)
             *  bin = new FrequencyBins(e, _model.Radio.BinParametersDefault());
             * else
             *  bin = new FrequencyBins(e, _model.Radio.BinParametersVideoFilter(_model.FftAnalyzerIf.FftLength, VideoPoints));
             */

            /*
             * FrequencyBins bin = new FrequencyBins(e, new BinParameters
             * {
             *  BinsPerPoint = 4,
             *  CalibrationAmplitude = 1.1, //1.5,//1.0 in sweeper is better
             *  CalibrationOffset = 20,//8,
             *  MinimumIntensityDb = -150,
             *  Relative = true,
             *  SamplingRate = 100000000
             * });
             */

            /*
             * if (_model.Settings.AsyncAnalyze)
             *  TaskUtility.Run(() => Analyze(e, bin));
             * else
             *  Analyze(e, bin);
             *
             * UpdateSquelch();
             *
             * if (AutoStep)
             *  FrequencyStep = (uint)Math.Abs(MeterView.FrequencyErrorValue * 500000);
             *
             * if (AfcState)
             * {
             *  if (Math.Abs(MeterView.FrequencyErrorValue * 1000000) > _model.Settings.AfcThreshold) //1000 as default
             *      FrequencyValue = (uint)(MeterView.PeakFrequencyValue * 1000000);
             * }
             * RecordingView.Tick();
             */
        }
Exemple #7
0
 private void butWaterfall_Click(object sender, RoutedEventArgs e)
 {
     Reset(ChartType.Waterfall);
     modelChart            = Waterfall.Create();
     controller.ChartModel = modelChart;
     RenderChart();
 }
        public async Task Waterfall()
        {
            TestAdapter adapter = new TestAdapter()
                                  .Use(new ConversationState <Dictionary <string, object> >(new MemoryStorage()));

            await new TestFlow(adapter, async(turnContext) =>
            {
                var waterfall = new Waterfall(new WaterfallStep[]
                {
                    async(dc, args, next) => { await dc.Context.SendActivity("step1"); },
                    async(dc, args, next) => { await dc.Context.SendActivity("step2"); },
                    async(dc, args, next) => { await dc.Context.SendActivity("step3"); },
                });

                var state = ConversationState <Dictionary <string, object> > .Get(turnContext);

                var dialogCompletion = await waterfall.Continue(turnContext, state);
                if (!dialogCompletion.IsActive && !dialogCompletion.IsCompleted)
                {
                    await waterfall.Begin(turnContext, state);
                }
            })
            .Send("hello")
            .AssertReply("step1")
            .Send("hello")
            .AssertReply("step2")
            .Send("hello")
            .AssertReply("step3")
            .StartTest();
        }
Exemple #9
0
    // Start is called before the first frame update
    void Start()
    {
        myCapsuleCollider = GetComponent <CapsuleCollider2D>();
        myRigidbody       = GetComponent <Rigidbody2D>();

        if (forWaterfall)
        {
            waterfallScript = waterfall.GetComponent <Waterfall>();
        }
    }
Exemple #10
0
        public G31DdcMainWnd()
        {
            InitializeComponent();

            Waterfall.Begin(new WaterfallConfig
            {
                DownSample   = 8,
                History      = 50,
                MaxIntensity = 0,
                MinIntensity = -100,
                MinFrequency = 0,
                MaxFrequency = 50000000,
                Points       = 2048,
                RefreshRate  = 2
            });
        }
Exemple #11
0
        private Waterfall SetSeriesTable(ExcelWorksheet ws)
        {
            Waterfall waFa = new Waterfall();
            int       c    = 1;
            int       r    = 10;

            // Adding Cap Range
            while (ws.Cells[r, 0] != null)
            {
                waFa.cap.Add(ws.Cells[r, 0].Text);
                r++;
            }
            // Adding lookup values
            while (ws.Cells[4, c] != null)
            {
                waFa.lookup.Add(ws.Cells[4, c].Text);
                c++;
            }
            // Adding table values
            int max   = waFa.cap.Count * waFa.lookup.Count;
            int count = 0;

            for (int x = 1; x < waFa.lookup.Count + 1; x++)
            {
                List <string> temp = new List <string>();
                for (int y = 10; y < waFa.cap.Count + 10; y++)
                {
                    if (ws.Cells[y, x] == null)
                    {
                        temp.Add("");
                    }
                    else
                    {
                        temp.Add(ws.Cells[y, x].Text);
                    }
                    count++;
                    minion.ReportProgress(100 * (count / max));
                }
                waFa.table.Add(temp);
            }
            return(waFa);
        }
    // Start is called before the first frame update
    void Start()
    {
        myCapsuleCollider = GetComponent <CapsuleCollider2D>();
        myRigidbody       = GetComponent <Rigidbody2D>();

        if (forGate)
        {
            gateScript = gate.GetComponent <Gate>();
        }
        if (forBridge)
        {
            bridgeScript = bridge.GetComponent <Bridge>();
        }
        if (forElevator)
        {
            elevatorScript = elevator.GetComponent <Elevator>();
        }
        if (forWaterfall)
        {
            waterfallScript = waterfall.GetComponent <Waterfall>();
        }
    }
Exemple #13
0
 /// <summary>
 /// Turn off all effects from selected mode
 /// </summary>
 public static void offLightAlgs()
 {
     if (effects)
     {
         if (Equalizer.getState())
         {
             Equalizer.stop();
         }
         else if (Volume.getState())
         {
             Volume.stop();
         }
         else if (Effects.Random.getState())
         {
             Effects.Random.stop();
         }
     }
     else if (animations)
     {
         if (Animations.Timer.getState())
         {
             Animations.Timer.stop();
         }
         else if (Smiles.getState())
         {
             Smiles.stop();
         }
         else if (Waterfall.getState())
         {
             Waterfall.stop();
         }
         else if (NyanCat.getState())
         {
             NyanCat.stop();
         }
     }
     Thread.Sleep(100);
 }
Exemple #14
0
 /// <summary>
 /// Turn on specified effect from selected mode
 /// </summary>
 public static void onLightAlg()
 {
     if (effects)
     {
         if (ei == 0)
         {
             Equalizer.start();
         }
         else if (ei == 1)
         {
             Volume.start();
         }
         else if (ei == 2)
         {
             Effects.Random.start();
         }
     }
     else if (animations)
     {
         if (ai == 0)
         {
             Animations.Timer.start();
         }
         else if (ai == 1)
         {
             Smiles.start();
         }
         else if (ai == 2)
         {
             Waterfall.start();
         }
         else if (ai == 3)
         {
             NyanCat.start();
         }
     }
 }
Exemple #15
0
 public void PlayWaterfall()
 {
     Waterfall.volume = 0;
     Waterfall.loop   = true;
     Waterfall.Play();
 }
        public void WaterfallTreeTest()
        {
            int treeResult0 = 0;
            int treeResult1 = 0;
            int treeResult2 = 0;

            TestBlackboard testBlackboard = new TestBlackboard()
            {
            };

            AmeisenBotBehaviorTree <TestBlackboard> tree = new AmeisenBotBehaviorTree <TestBlackboard>
                                                           (
                new Waterfall <TestBlackboard>
                (
                    new Leaf <TestBlackboard>((b) => { ++treeResult2; return(BehaviorTreeStatus.Success); }),
                    (
                        (blackboard) => treeResult0 == 0,
                        new Leaf <TestBlackboard>
                        (
                            (blackboard) =>
            {
                ++treeResult0;
                return(BehaviorTreeStatus.Success);
            }
                        )
                    ),
                    (
                        (blackboard) => treeResult0 == 1,
                        new Leaf <TestBlackboard>
                        (
                            (blackboard) =>
            {
                ++treeResult0;
                return(BehaviorTreeStatus.Success);
            }
                        )
                    ),
                    (
                        (blackboard) => treeResult0 == 2,
                        new Leaf <TestBlackboard>
                        (
                            (blackboard) =>
            {
                ++treeResult1;
                return(BehaviorTreeStatus.Success);
            }
                        )
                    )
                ),
                testBlackboard
                                                           );

            tree.Tick();

            Assert.AreEqual(1, treeResult0);
            Assert.AreEqual(0, treeResult1);
            Assert.AreEqual(0, treeResult2);

            tree.Tick();
            tree.Tick();

            Assert.AreEqual(2, treeResult0);
            Assert.AreEqual(1, treeResult1);
            Assert.AreEqual(0, treeResult2);

            ++treeResult0;

            tree.Tick();
            tree.Tick();

            Assert.AreEqual(3, treeResult0);
            Assert.AreEqual(1, treeResult1);
            Assert.AreEqual(2, treeResult2);
        }
Exemple #17
0
        private Waterfall SetSeriesTable(ExcelWorksheet ws)
        {
            Waterfall waFa = new Waterfall();
            int c = 1;
            int r = 10;

            // Adding Cap Range
            while (ws.Cells[r,0] != null) {
                waFa.cap.Add(ws.Cells[r,0].Text);
                r++;
            }
            // Adding lookup values
            while (ws.Cells[4,c] != null)
            {
                waFa.lookup.Add(ws.Cells[4,c].Text);
                c++;
            }
            // Adding table values
            int max = waFa.cap.Count * waFa.lookup.Count;
            int count = 0;
            for (int x = 1; x < waFa.lookup.Count + 1; x++)
            {
                List<string> temp = new List<string>();
                for (int y = 10; y < waFa.cap.Count + 10; y++)
                {
                    if (ws.Cells[y,x] == null)
                        temp.Add("");
                    else
                        temp.Add(ws.Cells[y,x].Text);
                    count++;
                    minion.ReportProgress(100 * (count / max));
                }
                waFa.table.Add(temp);
            }
            return waFa;
        }
 private void CheckBoxWaterfallHorizontal_Checked(object sender, RoutedEventArgs e)
 {
     Waterfall.turnHorizontal();
 }
 private void CheckBoxWaterfallDiagonal_Checked(object sender, RoutedEventArgs e)
 {
     Waterfall.turnDiagonal();
 }
 private void CheckBoxWaterfallInvert_Checked(object sender, RoutedEventArgs e)
 {
     Waterfall.turnInvert();
 }
 private void CheckBoxWaterfallTail_Checked(object sender, RoutedEventArgs e)
 {
     Waterfall.turnTail();
 }
Exemple #22
0
 public void SetWaterfall(Waterfall w)
 {
     waterfall = w;
 }
Exemple #23
0
 public void StopWaterfall()
 {
     Waterfall.Stop();
 }
Exemple #24
0
 public static Waterfall Begin(Action<Context> action)
 {
     Waterfall w = new Waterfall(action);
     return w;
 }