示例#1
0
 public void ResetUnit()
 {
     this.flp_Units.Controls.Clear();
     _selectedUnit.Clear();
     foreach (var u in _area.Units)
     {
         var uCtrl = new UnitImageControl { Unit = u, CanSelect = true };
         if (u.Acted)
             uCtrl.Text = "Finish";
         uCtrl.Click += this.UnitClick;
         this.flp_Units.Controls.Add(uCtrl);
     }
 }
示例#2
0
        public void SetAreas(Area left, Area right)
        {
            _left = left; _right = right;

            // ユニット配置
            foreach (var u in left.Units)
            {
                var ctrl = new UnitImageControl { Unit = u };
                if (u.Acted)
                    ctrl.Text = ACTED;
                else
                    ctrl.Click += this.MoveLtR;
                flp_Left.Controls.Add(ctrl);
            }
            foreach (var u in right.Units)
            {
                var ctrl = new UnitImageControl { Unit = u };
                if (u.Acted)
                    ctrl.Text = ACTED;
                else
                    ctrl.Click += this.MoveRtL;
                flp_Right.Controls.Add(ctrl);
            }
        }
 private void PrepareWarWindow_Load(object sender, EventArgs e)
 {
     // ページの作成
     _tabControl.TabPages.Clear();
     foreach (var area in AdjArea)
     {
         var tab = new TabPage(area.Name) {
             Margin = new Padding(0),
             Padding = new Padding(0),
         };
         var flp = new FlowLayoutPanel {
             Tag = area,
             Dock = DockStyle.Fill,
             BackColor = Color.Navy,
             Margin = new Padding(0),
             Padding = new Padding(0),
         };
         foreach (var unit in area.Units) {
             var uCtrl = new UnitImageControl(unit);
             uCtrl.Click += this.UnitClick;
             flp.Controls.Add(uCtrl);
         }
         _flps.Add(flp);
         tab.Controls.Add(flp);
         _tabControl.TabPages.Add(tab);
     }
 }
示例#4
0
        private void UnitMove(UnitImageControl uCtrl, bool l2r)
        {
            if (uCtrl.Text == ACTED) return;
            var clicks = new EventHandler[] { this.MoveLtR, this.MoveRtL };
            var flows = new[] { flp_Left.Controls, flp_Right.Controls };
            int src = l2r ? 0 : 1;
            int dst = src ^ 1;

            if (flows[dst].Count == 20) return;
            Debug.Assert(flows[dst].Count < 20);

            uCtrl.Click -= clicks[src];
            uCtrl.Click += clicks[dst];
            flows[src].Remove(uCtrl);
            flows[dst].Add(uCtrl);

            if (uCtrl.Text == MOVED)
                uCtrl.Text = "";
            else
                uCtrl.Text = MOVED;
        }