コード例 #1
0
ファイル: EnableFlight.cs プロジェクト: 7h3Cub3/ExBuddy
        private async Task <bool> Start()
        {
            if (navigator == null && BotManager.Current.EnglishName != "Fate Bot")
            {
                var settings = EnableFlightSettings.Instance;
                navigator = new FlightEnabledNavigator(
                    Navigator.NavigationProvider,
                    new FlightEnabledSlideMover(Navigator.PlayerMover, new FlightMovementArgs {
                    MountId = settings.MountId
                }),
                    new FlightNavigationArgs
                {
                    ForcedAltitude            = settings.ForcedAltitude,
                    InverseParabolicMagnitude = settings.InverseParabolicMagnitude,
                    Radius    = settings.Radius,
                    Smoothing = settings.Smoothing
                });

                cleanup = bot =>
                {
                    DoCleanup();
                    DisposeNav();
                    TreeRoot.OnStop -= cleanup;
                };

                TreeRoot.OnStop += cleanup;

                Logger.Info("Started Flight Navigator.");
            }

            return(false);
        }
コード例 #2
0
        private async Task RunEvent(BotEvent botEvent)
        {
            await botEvent.Run();

            var nextTrigger = await botEvent.GetNextRun();

            BotEvents[botEvent].Interval = nextTrigger.TotalMilliseconds;
            BotEvents[botEvent].Start();
        }
コード例 #3
0
        public Message React(Message eventMessage)
        {
            Message responseMessage = null;

            BotEvent eventType = GetBotEvent(eventMessage.Type);

            switch (eventType)
            {
            case BotEvent.BotAddedToConversation:
                responseMessage = ReactToBotAdded(eventMessage);
                break;

            case BotEvent.BotRemovedFromConversation:
                responseMessage = ReactToBotRemoved(eventMessage);
                break;

            case BotEvent.DeleteUserData:
                responseMessage = ReactToDeleteUser(eventMessage);
                break;

            case BotEvent.EndOfConversation:
                responseMessage = ReactToEndConversation(eventMessage);
                break;

            case BotEvent.Message:
                responseMessage = ReactToMessage(eventMessage);
                break;

            case BotEvent.Ping:
                responseMessage = ReactToPing(eventMessage);
                break;

            case BotEvent.UserAddedToConversation:
                responseMessage = ReactToUserAdded(eventMessage);
                break;

            case BotEvent.UserRemovedFromConversation:
                responseMessage = ReactToUserRemoved(eventMessage);
                break;

            case BotEvent.Unknown:
            default:
                responseMessage = ReactToUnknown(eventMessage);
                break;
            }

            responseMessage.Text +=
                ", JSON: " + JsonConvert.SerializeObject(eventMessage);

            return(responseMessage);
        }
コード例 #4
0
        private static void smethod_3(IBot ibot_1, BotEvent botEvent_6)
        {
            if (botEvent_6 == null)
            {
                return;
            }

            using (TritonHs.AcquireFrame())
            {
                using (TritonHs.Memory.TemporaryCacheState(false))
                {
                    botEvent_6(ibot_1);
                }
            }
        }
コード例 #5
0
 private static void smethod_3(IBot ibot_1, BotEvent botEvent_6)
 {
     if (botEvent_6 != null)
     {
         try
         {
             using (TritonHs.AcquireFrame())
             {
                 using (TritonHs.Memory.TemporaryCacheState(false))
                 {
                     botEvent_6(ibot_1);
                 }
             }
         }
         catch (Exception exception)
         {
             ilog_0.Error("[Invoke] Error during execution:", exception);
             throw;
         }
     }
 }
コード例 #6
0
ファイル: Bot.cs プロジェクト: lythm/orb3d
 void EmmitBotEvent(BotEvent.BotEvent e)
 {
     lock (FLock)
     {
         FLuaEventHandler.Call(new object[] { e });
     }
 }
コード例 #7
0
ファイル: BotPublisher.cs プロジェクト: savimar/ChatBot
 internal void OnRaiseBotEvent(BotEventArgs botEventArgs)
 {
     BotEvent?.Invoke(this, botEventArgs);
 }
コード例 #8
0
        private async Task<bool> Start()
        {
            if (navigator == null)
            {
                navigator = new FlightEnabledNavigator(
                    Navigator.NavigationProvider,
                    new FlightEnabledSlideMover(Navigator.PlayerMover),
                    new FlightNavigationArgs
                    {
                        ForcedAltitude = EnableFlightSettings.Instance.ForcedAltitude,
                        InverseParabolicMagnitude = EnableFlightSettings.Instance.InverseParabolicMagnitude,
                        LogWaypoints = EnableFlightSettings.Instance.LogWaypoints,
                        Radius = EnableFlightSettings.Instance.Radius,
                        Smoothing = EnableFlightSettings.Instance.Smoothing
                    });

                cleanup = bot =>
                {
                    DoCleanup();
                    DisposeNav();
                    TreeRoot.OnStop -= cleanup;
                };

                TreeRoot.OnStop += cleanup;

                Logging.Write(Colors.DeepSkyBlue, "Started Flight Navigator.");
            }

            return false;
        }
コード例 #9
0
 public BaseEventsBotRequest(BotEvent botEvent, TRequestBody context, string lng, string token)
     : base(context, token, lng, BotRequestType.BotEvent)
 {
     this.botEvent = botEvent;
 }
コード例 #10
0
ファイル: Extensions.cs プロジェクト: silicondev/SiliconBot
 public static void AddEvent(this DiscordClient client, BotEvent evnt) => evnt.AddEvent(ref client);