Beispiel #1
0
        private void AddNewBot()
        {
            BotView BotView = new BotView();

            BotView.botName.Content = "Schisch";
            BotViews.Add(BotView);
        }
Beispiel #2
0
        public MainWindow()
        {
            InitializeComponent();

            BotView DefaultBotView = new BotView();

            DefaultBotView.botName.Content             = "Click to add bot...";
            DefaultBotView.botImage.MouseLeftButtonUp += DefaultBotImage_MouseLeftButtonUp;

            BotManagers = new List <BotManager>();
            BotViews    = new List <BotView>
            {
                DefaultBotView
            };

            botPanel.Children.Add(DefaultBotView);
        }
Beispiel #3
0
        private void UIUpdateTimer_Tick(object sender, EventArgs e)
        {
            if (BotManager.IsRegisteredAtServer)
            {
                botViewPanel.Children.Clear();

                List <NetworkBot> networkBots = BotManager.NetworkBots;
                if (networkBots != null)
                {
                    foreach (NetworkBot bot in networkBots)
                    {
                        BotView    botView = new BotView();
                        SendableMe me      = bot.GetMe();
                        botView.botName.Content  = me.Name;
                        botView.botLevel.Content = me.Level;

                        botView.botHealth.Content = $"{me.Health} / {me.MaxHealth}";
                        botView.botEnergy.Content = $"{me.Energy} / {me.MaxEnergy}";
                        botView.botExp.Content    = $"{me.Exp} / {me.MaxExp}";

                        botView.botHealthProgressbar.Maximum = me.MaxHealth;
                        botView.botEnergyProgressbar.Maximum = me.MaxEnergy;
                        botView.botExpProgressbar.Maximum    = me.MaxExp;
                        botView.botHealthProgressbar.Value   = me.Health;
                        botView.botEnergyProgressbar.Value   = me.Energy;
                        botView.botExpProgressbar.Value      = me.Exp;

                        if (bot.picture != "")
                        {
                            botView.botImage.Source = Utils.Base64ToBitmapImage(bot.picture);
                        }

                        botViewPanel.Children.Add(botView);
                    }
                }
            }
        }