Ejemplo n.º 1
0
 private void CreateLabels()
 {
     _phaseLabel = new Label
     {
         Location = new Point(4, TopMargin),
         Size     = new Size(31, LabelHeight + 2)
     };
     _phaseLabel.Click += PhaseLabelClick;
     Controls.Add(_phaseLabel);
     _rankLabel = new Label
     {
         Location = new Point(37, TopMargin),
         Size     = new Size(42, LabelHeight)
     };
     Controls.Add(_rankLabel);
     _supportLabel = new Label
     {
         Location = new Point(77, TopMargin),
         AutoSize = true
     };
     Controls.Add(_supportLabel);
     _cellLabel = new Label
     {
         Location = new Point(0, TopMargin),
         AutoSize = true
     };
     Controls.Add(_cellLabel);
     for (var i = 0; i < 13; i++)
     {
         var friend = new ShipLabels
         {
             Name      = new ShipLabel.Name(new Point(1, LabelMargin), ShipNameWidth.BattleResult),
             Hp        = new ShipLabel.Hp(new Point(101, 0), LineHeight),
             BackPanel = new Panel
             {
                 Location  = new Point(0, LineHeight * i + 38),
                 Size      = new Size(0, LineHeight),
                 BackColor = CustomColors.ColumnColors.DarkFirst(i),
                 Visible   = false
             }
         };
         _friendLabels.Add(friend);
         friend.Arrange(this, CustomColors.ColumnColors.DarkFirst(i));
         _hpLabels.Add(friend.Hp);
         friend.Hp.Click += HpLabelClickHandler;
         var enemy = new ShipLabels
         {
             Name = new ShipLabel.Name(new Point(EnemyNameLeft, LabelMargin), ShipNameWidth.Max),
             Hp   = new ShipLabel.Hp
             {
                 Location    = new Point(119, 0),
                 AutoSize    = true,
                 MinimumSize = new Size(0, LineHeight),
                 TextAlign   = ContentAlignment.MiddleLeft
             }
         };
         _enemyLabels.Add(enemy);
         enemy.Arrange(friend.BackPanel, CustomColors.ColumnColors.DarkFirst(i));
     }
 }
Ejemplo n.º 2
0
        public void CreateShipLabels(int i)
        {
            var       y      = ShipListPanel.LineHeight * i + 1;
            const int height = ShipListPanel.LabelHeight;
            var       labels = new ShipLabels
            {
                Fleet     = new ShipLabel.Fleet(new Point(1, 2)),
                Name      = new ShipLabel.Name(new Point(10, 2), ShipNameWidth.ShipList),
                Hp        = new ShipLabel.Hp(new Point(126, 0), ShipListPanel.LineHeight),
                Cond      = new ShipLabel.Cond(new Point(127, 0), ShipListPanel.LineHeight),
                Level     = new ShipLabel.Level(new Point(152, 2), height),
                Exp       = new ShipLabel.Exp(new Point(174, 2), height),
                BackPanel = new Panel
                {
                    Location = new Point(0, y),
                    Size     = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),
                    Anchor   = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top
                }
            };

            SetAnchorRight(labels.Hp, labels.Cond, labels.Level, labels.Exp);
            _labelList.Add(labels);
            labels.Arrange(_shipListPanel, CustomColors.ColumnColors.BrightFirst(i));
            labels.Scale();
            _shipListPanel.SetHpPercent(labels.Hp);
        }
Ejemplo n.º 3
0
        public void CreateComponents(int i)
        {
            var y      = ShipListPanel.LineHeight * i + 1;
            var labels = new ShipLabels
            {
                Fleet     = new ShipLabel.Fleet(new Point(1, 2)),
                Name      = new ShipLabel.Name(new Point(10, 2), ShipNameWidth.GroupConfig),
                Level     = new ShipLabel.Level(new Point(90, 2), ShipListPanel.LabelHeight),
                BackPanel = new Panel
                {
                    Location = new Point(0, y),
                    Size     = new Size(ListForm.PanelWidth, ShipListPanel.LineHeight),
                    Anchor   = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top
                }
            };
            var cb = new CheckBox[GroupCount];

            for (var j = 0; j < cb.Length; j++)
            {
                cb[j] = new CheckBox
                {
                    Location  = new Point(125 + j * 24, 2),
                    FlatStyle = FlatStyle.Flat,
                    Size      = new Size(12, 11),
                    Tag       = i * 10 + j
                };
                cb[j].CheckedChanged += checkboxGroup_CheckedChanged;
            }
            SetAnchorRight(cb.Concat(new Control[] { labels.Level }).ToArray());
            _labelList.Add(labels);
            _checkBoxesList.Add(cb);
            labels.Arrange(_shipListPanel, CustomColors.ColumnColors.BrightFirst(i));
            labels.BackPanel.Controls.AddRange(cb);
            labels.Scale();
        }