public WindowsRunner(IBotInfo botInfo, MessengerType messengerType) { try { this.MessengerType = messengerType; this.MessageProcess = new MessageProcess(botInfo); switch (messengerType) { case MessengerType.Bale: _tlBotClient = new TelegramBotClient(botInfo.Token_Bale); break; case MessengerType.Telegram: _tlBotClient = new TelegramBotClient(botInfo.Token_Telegram, baseUrl: "https://api.telegram.org/bot"); break; default: throw new NotImplementedException("WindowsRunner is writed only for telegram and bale"); } _tlBotClient.OnUpdate += TlBotClient_OnUpdate; } catch (Exception e) { OnLogEvent(LogEntity.GetLogEntity(e)); } }
public SimulationVisualBot2D( IBotInfo bot, DetailLevel detailLevel, Transformation2D transformer, double strokeThickness, MouseButtonEventHandler elementClickAction, SimulationAnimation2D controller) : base(bot, detailLevel, transformer, strokeThickness, elementClickAction, controller) { _bot = bot; // Build geometry _geometry.Children.Add(new EllipseGeometry( new Point(0, 0), _transformer.ProjectXLength(_bot.GetInfoRadius()), _transformer.ProjectYLength(_bot.GetInfoRadius()))); // Add orientation marker double orientationMarkerX = _transformer.ProjectXLength(_bot.GetInfoRadius()) * Math.Cos(0); double orientationMarkerY = _transformer.ProjectXLength(_bot.GetInfoRadius()) * Math.Sin(0); _geometry.Children.Add(new LineGeometry( new Point(0, 0), new Point(orientationMarkerX, orientationMarkerY))); // Paint it Fill = VisualizationConstants.BrushBotVisual; Cursor = System.Windows.Input.Cursors.Hand; MouseDown += _elementClickAction; Stroke = VisualizationConstants.BrushOutline; StrokeThickness = StrokeThicknessReference; // Initialize Init(); }
public void Register(IBotInfo bot, SimulationVisualBot2D visual) { if (!_managedInfoObjects.ContainsKey(bot)) { _managedInfoObjects[bot] = new SimulationInfoBot(_infoHost, bot); } _managed2DVisuals[visual] = _managedInfoObjects[bot]; _managed2DVisuals[visual].ManagedVisual2D = visual; }
public SimulationVisualPathMarker2D( IBotInfo bot, DetailLevel detailLevel, Transformation2D transformer, double strokeThickness, MouseButtonEventHandler elementClickAction, SimulationAnimation2D controller) : base(detailLevel, transformer, strokeThickness, elementClickAction, controller) { _bot = bot; // Init geometry Stroke = VisualizationConstants.BrushGoalMarker; StrokeThickness = StrokeThicknessReference * VisualizationConstants.PATH_MARKER_STROKE_THICKNESS_FACTOR; }
public SimulationVisualDestinationMarker2D( IBotInfo bot, DetailLevel detailLevel, Transformation2D transformer, double strokeThickness, MouseButtonEventHandler elementClickAction, SimulationAnimation2D controller) : base(detailLevel, transformer, strokeThickness, elementClickAction, controller) { _bot = bot; // Init geometry _geometry = new LineGeometry(new Point(0, 0), new Point(0, 0)); Stroke = VisualizationConstants.BrushDestinationMarker; StrokeThickness = StrokeThicknessReference * VisualizationConstants.DESTINATION_MARKER_STROKE_THICKNESS_FACTOR; }
public SimulationVisualBot3D(IBotInfo bot, DetailLevel detailLevel) : base(bot) { Bot = bot; var visual = new BoxVisual3D { Fill = VisualizationConstants.BrushBotVisual, Center = new Point3D(0, 0, 0), Length = Bot.GetInfoRadius() * 2, Width = Bot.GetInfoRadius() * 2, Height = _height, }; Children.Add(visual); }
public Brush GetBotColor(IBotInfo bot, string state) { // Check whether we already generated a color for the bot if (!_rainbowBotColors.ContainsKey(bot)) { Random randomizer = new Random(); _rainbowBotColors[bot] = new SolidColorBrush(HeatVisualizer.GenerateBiChromaticHeatColor(Colors.Purple, Colors.Red, randomizer.NextDouble())); } // Return color BotColorMode colorMode = _botColorModeGetter(); switch (colorMode) { case BotColorMode.DefaultBotDefaultState: return(VisualizationConstants.StateBrushes[state]); case BotColorMode.RainbowBotSingleState: return(state == "Move" ? _rainbowBotColors[bot] : VisualizationConstants.StateBrushHidden); case BotColorMode.RainbowBotDefaultState: return(state == "Move" ? _rainbowBotColors[bot] : VisualizationConstants.StateBrushes[state]); default: throw new ArgumentException("Unknown bot coloring mode: " + colorMode.ToString()); } }
public MessageProcess(IBotInfo botInfo) { this.BotInfo = botInfo; }