예제 #1
0
        void frmBattle_MouseUp(object sender, MouseEventArgs e)
        {
            if (_frmHeroInfo != null)
            {
                _frmHeroInfo.Close();
                _frmHeroInfo.Dispose();
                _frmHeroInfo = null;
            }

            if (_frmArmyInfo != null)
            {
                _frmArmyInfo.Close();
                _frmArmyInfo.Dispose();
                _frmArmyInfo = null;
            }
        }
예제 #2
0
        public frmBattle()
        {
            InitializeComponent();

            ts = BasicEngine.TurnTimeSpan;

            // Make sure all the painting occurs in the PaintEvent
            //this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.Opaque, true);

            _isActivated = true;
            _clicked = false;

            // flags
            _isMultiPlayer = false;
            _playerIdMe = 0;

            _timer1 = new Timer();
            _timer1.Interval = 100;
            _timer1.Stop();
            _timer1.Tick += new EventHandler(_timer1_Tick);

            _isExit = false;

            _frmHeroInfo = null;
            _frmArmyInfo = null;

            // bar
            _rectRetreat = new Rectangle(104, 556 + 4, 50, 38);
            _rectCastSpell = new Rectangle(644, 556 + 4, 50, 38);
            _rectWait = new Rectangle(695, 556 + 4, 50, 38);
            _rectDefend = new Rectangle(746, 556 + 4, 50, 38);
            _rectStatus = new Rectangle(214, 556 + 7, 400, 32);

            this.MouseMove += new MouseEventHandler(frmMain_MouseMove);
            this.MouseClick += new MouseEventHandler(frmMain_MouseClick);
            this.MouseDoubleClick += new MouseEventHandler(frmMain_MouseDoubleClick);
            this.MouseDown += new MouseEventHandler(frmBattle_MouseDown);
            this.MouseUp += new MouseEventHandler(frmBattle_MouseUp);

            this.FormClosing += new FormClosingEventHandler(frmMain_FormClosing);
        }
예제 #3
0
        void frmBattle_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                // get hero info
                // attack hero
                if (_engine._attacker != null)
                {
                    Heroes.Core.Battle.Characters.Hero hero = _engine._attacker;
                    if (hero._rect.Contains(e.X, e.Y))
                    {
                        _frmHeroInfo = new frmHeroInfo();
                        _frmHeroInfo.StartPosition = FormStartPosition.Manual;

                        Point pt = this.PointToScreen(new Point(e.X, e.Y));
                        _frmHeroInfo.Location = pt;

                        _frmHeroInfo.Show(this, hero);

                        return;
                    }
                }

                // defend hero
                if (_engine._defender != null)
                {
                    Heroes.Core.Battle.Characters.Hero hero = (Heroes.Core.Battle.Characters.Hero)_engine._defender;
                    if (hero._rect.Contains(e.X, e.Y))
                    {
                        _frmHeroInfo = new frmHeroInfo();
                        _frmHeroInfo.StartPosition = FormStartPosition.Manual;

                        Point pt = this.PointToScreen(new Point(e.X, e.Y));
                        _frmHeroInfo.Location = pt;

                        _frmHeroInfo.Show(this, hero);

                        return;
                    }
                }

                // get army info
                {
                    Heroes.Core.Battle.Characters.Armies.Army army = _engine.GetArmy(e.X, e.Y);
                    if (army == null) return;

                    _frmArmyInfo = new frmArmyInfo();
                    _frmArmyInfo.StartPosition = FormStartPosition.Manual;

                    Point pt = this.PointToScreen(new Point(e.X, e.Y));
                    _frmArmyInfo.Location = pt;

                    _frmArmyInfo.Show(this, army);

                    return;
                }
            }
        }