Esempio n. 1
0
        private void Weapon_MouseEnter(object sender, MouseEventArgs e)
        {
            Weapon weapon = (sender as WeaponControl).Weapon;

            if (weapon != null)
            {
                weaponWindow.Top  = e.GetPosition(this).Y + Top - weaponWindow.Height / 2;
                weaponWindow.Left = e.GetPosition(this).X + Left - 10 - weaponWindow.Width;
                // Restrict in this window
                if (Top - weaponWindow.Top > 30)
                {
                    weaponWindow.Top = Top - 30;
                }
                if (Left - weaponWindow.Left > 40)
                {
                    weaponWindow.Left = Left - 40;
                }
                if (weaponWindow.Top + weaponWindow.Height - (Top + Height) > 30)
                {
                    weaponWindow.Top = Top + Height - weaponWindow.Height + 30;
                }
                if (weaponWindow.Left + weaponWindow.Width - (Left + Width) > 30)
                {
                    weaponWindow.Left = Left + Width - weaponWindow.Width + 30;
                }
                weaponWindow.SetWeapon(weapon, false);
                ((Storyboard)FindResource("window_fade_in")).Begin(weaponWindow);
            }
        }
Esempio n. 2
0
        private void Player_MouseEnterWeapon(object sender, MouseEventArgs e)
        {
            Player player = (sender as PlayerControl).Player;
            bool   isMy   = (sender as PlayerControl).IsMy;

            if (player != null)
            {
                weaponWindow.Top  = e.GetPosition(this).Y + Top - weaponWindow.Height / 2;
                weaponWindow.Left = e.GetPosition(this).X + Left + 10;
                // Restrict in this window
                if (Top - weaponWindow.Top > 30)
                {
                    weaponWindow.Top = Top - 30;
                }
                if (Left - weaponWindow.Left > 30)
                {
                    weaponWindow.Left = Left - 30;
                }
                if (weaponWindow.Top + weaponWindow.Height - (Top + Height) > 30)
                {
                    weaponWindow.Top = Top + Height - weaponWindow.Height + 30;
                }
                if (weaponWindow.Left + weaponWindow.Width - (Left + Width) > 30)
                {
                    weaponWindow.Left = Left + Width - weaponWindow.Width + 30;
                }
                weaponWindow.SetWeapon(player.Weapon, isMy);
                ((Storyboard)FindResource("window_fade_in")).Begin(weaponWindow);
            }
        }