Ejemplo n.º 1
0
        private void AddBotVisual(SBot bot)
        {
            lock (this)
            {
                //Program.BM.Bots
                stc_Cord found = new stc_Cord();
                if (OnlineList.TryGetValue(bot.CharName, out found))
                    return;
                this.Invoke(new MethodInvoker(() =>
                {
                    DevExpress.XtraMap.MapPushpin mp = new MapPushpin()
                    {
                        //Image = global::SbotControl.Properties.Resources.Info,
                        Location = ConvertToGeoPoint(Convert.ToInt32(bot.PosX), Convert.ToInt32(bot.PosY)),
                        Text = bot.CharName,
                        TextColor = System.Drawing.Color.Lime,
                        TextGlowColor = System.Drawing.Color.Gray,
                        ToolTipPattern = string.Format("Lv. {0}\n\r{1}\n\r{2}\n\rKills: {3}\n\rXP Gained: {4}\n\rSP Gained: {5}\n\rGold: {6}\n\rDied: {7}\n\rDrops: {8}",
                        bot.Level, bot.SilkroadServerStatus, bot.BotStatus, bot.Kills, bot.XPGained, bot.SPGained, bot.Gold, bot.Died, bot.ItemDrops),
                        UseAnimation = true,
                    };
                    ((DevExpress.XtraMap.InformationLayer)MCMain.Layers[0]).Data.Items.Add(mp);
                    stc_Cord stc = new stc_Cord() { bot = bot, mp = mp };
                    //Create Context menu item
                    DevExpress.XtraBars.BarButtonItem bbiNew = new DevExpress.XtraBars.BarButtonItem();
                    barManagerMain.Items.Add(bbiNew);
                    bsiSetFocus.LinksPersistInfo.AddRange(new DevExpress.XtraBars.LinkPersistInfo[] {new DevExpress.XtraBars.LinkPersistInfo(bbiNew)});
                    bbiNew.Caption = bot.CharName;
                    bbiNew.Glyph = global::SbotControl.Properties.Resources.geopoint_16x16;
                    //bbiNew.Id = 1;
                    bbiNew.Tag = stc;
                    bbiNew.ItemClick += BbiSetFocus_ItemClick;
                    bbiNew.Name = "bbiNew" + bot.CharName;

                    stc.menu = bbiNew;
                OnlineList.Add(bot.CharName, stc);
                }));
            }
        }
Ejemplo n.º 2
0
        private void RemoveBotVisual(SBot bot)
        {
            stc_Cord item = new stc_Cord();
            if (!OnlineList.TryGetValue(bot.CharName, out item))
                return;
            ((DevExpress.XtraMap.InformationLayer)MCMain.Layers[0]).Data.Items.Remove(item.mp);
            item.mp = null;

            item.menu.ItemClick -= BbiSetFocus_ItemClick;
            barManagerMain.Items.Remove(item.menu);
            item.menu.Dispose();

            OnlineList.Remove(bot.CharName);
        }
Ejemplo n.º 3
0
        private void Bot_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            SBot bot = (SBot)sender;
            if (e.PropertyName == "PosX" || e.PropertyName == "PosY" || e.PropertyName == "Level" || e.PropertyName == "Status" || e.PropertyName == "SilkroadServerStatus" || e.PropertyName == "Kills" || e.PropertyName == "XPGained"
                || e.PropertyName == "SPGained" || e.PropertyName == "Gold" || e.PropertyName == "Died" || e.PropertyName == "ItemDrops")
            {
                stc_Cord item = new stc_Cord();
                if (!OnlineList.TryGetValue(bot.CharName, out item))
                    return;

                MCMain.Invoke(new MethodInvoker(() =>
                {
                    item.mp.ToolTipPattern = string.Format("Lv. {0}\n\r{1}\n\r{2}\n\rKills: {3}\n\rXP Gained: {4}\n\rSP Gained: {5}\n\rGold: {6}\n\rDied: {7}\n\rDrops: {8}",
                            bot.Level, bot.SilkroadServerStatus, bot.BotStatus, bot.Kills, bot.XPGained, bot.SPGained, bot.Gold, bot.Died, bot.ItemDrops);
                    if (e.PropertyName == "PosX" || e.PropertyName == "PosY")
                    {
                        item.mp.Location = ConvertToGeoPoint(Convert.ToInt32(bot.PosX), Convert.ToInt32(bot.PosY));
                        if (item.bot.CharName == _focusedCharName)
                            MCMain.SetCenterPoint(item.mp.Location, true);
                    }

                }));
            }
        }