void playerBox_MouseDown(object sender, MouseEventArgs mea)
        {
            if (mea.Button == MouseButtons.Left)
            {
                if (playerBox.HoverItem != null)
                {
                    if (playerBox.HoverItem.IsSpectatorsTitle)
                    {
                        ActionHandler.Spectate();
                    }
                    else if (playerBox.HoverItem.SlotButton != null)
                    {
                        ActionHandler.JoinSlot(playerBox.HoverItem.MissionSlot);
                    }
                    else if (playerBox.HoverItem.AllyTeam.HasValue)
                    {
                        ActionHandler.JoinAllyTeam(playerBox.HoverItem.AllyTeam.Value);
                    }
                }
            }

            if (mea.Button == MouseButtons.Right || !Program.Conf.LeftClickSelectsPlayer)
            {
                if (playerBox.HoverItem == null && mea.Button == MouseButtons.Right)
                {
                    var cm = ContextMenus.GetPlayerContextMenu(Program.TasClient.MyUser, true);
                    Program.ToolTip.Visible = false;
                    try {
                        cm.Show(playerBox, mea.Location);
                    } catch (Exception ex) {
                        Trace.TraceError("Error displaying tooltip: {0}", ex);
                    } finally {
                        Program.ToolTip.Visible = true;
                    }
                }
            }
            if (playerBox.HoverItem != null)
            {
                if (playerBox.HoverItem.BotBattleStatus != null)
                {
                    playerBox.SelectedItem = playerBox.HoverItem;
                    var cm = ContextMenus.GetBotContextMenu(playerBox.HoverItem.BotBattleStatus.Name);
                    Program.ToolTip.Visible = false;
                    try {
                        cm.Show(playerBox, mea.Location);
                    } catch (Exception ex) {
                        Trace.TraceError("Error displaying tooltip: {0}", ex);
                    } finally {
                        Program.ToolTip.Visible = true;
                    }
                }

                /*
                 *      if (playerBox.HoverItem.UserBattleStatus != null) {
                 *              playerBox.SelectedItem = playerBox.HoverItem;
                 *              var cm = ContextMenus.GetPlayerContextMenu(playerBox.HoverItem.User, true);
                 *              Program.ToolTip.Visible = false;
                 *              cm.Show(playerBox, mea.Location);
                 *              Program.ToolTip.Visible = true;
                 *      }*/
            }
        }
Пример #2
0
        protected override void PlayerBox_MouseClick(object sender, MouseEventArgs mea)
        {
            if (mea.Button == MouseButtons.Left)
            {
                if (this.playerBox.HoverItem != null)
                {
                    if (this.playerBox.HoverItem.IsSpectatorsTitle)
                    {
                        ActionHandler.Spectate();
                    }
                    else if (this.playerBox.HoverItem.Button != null)
                    {
                        ActionHandler.JoinAllyTeam(this.playerBox.HoverItem.AllyTeam.Value);
                    }
                }
            }

            if (mea.Button == MouseButtons.Right || !Program.Conf.LeftClickSelectsPlayer)
            {
                if (this.playerBox.HoverItem == null && mea.Button == MouseButtons.Right)
                { //right click on empty space
                    var cm = ContextMenus.GetPlayerContextMenu(Program.TasClient.MyUser, true);
                    Program.ToolTip.Visible = false;
                    try
                    {
                        cm.Show(playerBox, mea.Location);
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceError("Error displaying tooltip: {0}", ex);
                    }
                    finally
                    {
                        Program.ToolTip.Visible = true;
                    }
                    return;
                }
                //NOTE: code that display player's context menu on Left-mouse-click is in ChatControl.playerBox_MouseClick();
            }
            if (this.playerBox.HoverItem != null)
            {
                if (this.playerBox.HoverItem.BotBattleStatus != null)
                {
                    playerBox.SelectedItem = this.playerBox.HoverItem;
                    var cm = ContextMenus.GetBotContextMenu(this.playerBox.HoverItem.BotBattleStatus.Name);
                    Program.ToolTip.Visible = false;
                    try
                    {
                        cm.Show(playerBox, mea.Location);
                    }
                    catch (Exception ex)
                    {
                        Trace.TraceError("Error displaying tooltip: {0}", ex);
                    }
                    finally
                    {
                        Program.ToolTip.Visible = true;
                    }
                    return;
                }

                /*
                 *                      if (playerBox.HoverItem.UserBattleStatus != null) {
                 *                              playerBox.SelectedItem = playerBox.HoverItem;
                 *                              var cm = ContextMenus.GetPlayerContextMenu(playerBox.HoverItem.User, true);
                 *                              Program.ToolTip.Visible = false;
                 *                              cm.Show(playerBox, mea.Location);
                 *                              Program.ToolTip.Visible = true;
                 *                      }*/
            }
            base.PlayerBox_MouseClick(sender, mea);
        }