Ejemplo n.º 1
0
 public override void Process()
 {
     base.Process();
     if (Subregion != null)
     {
         if (Subregion.BattleEventCollections == null)
         {
             Subregion.BattleEventCollections = new ConcurrentBag <EC_Battle>();
         }
         Subregion.BattleEventCollections.Add(this);
         if (Subregion.Coords == null)
         {
             Subregion.Coords = new List <Point>();
         }
         Subregion.Coords.Add(Coords);
     }
     if (Site != null)
     {
         if (Site.BattleEventCollections == null)
         {
             Site.BattleEventCollections = new ConcurrentBag <EC_Battle>();
         }
         Site.BattleEventCollections.Add(this);
     }
     if (AttackingHf != null)
     {
         foreach (var hf in AttackingHf)
         {
             if (hf.BattleEventCollections == null)
             {
                 hf.BattleEventCollections = new ConcurrentBag <EC_Battle>();
             }
             hf.BattleEventCollections.Add(this);
         }
     }
     if (DefendingHf != null)
     {
         foreach (var hf in DefendingHf)
         {
             if (hf.BattleEventCollections == null)
             {
                 hf.BattleEventCollections = new ConcurrentBag <EC_Battle>();
             }
             hf.BattleEventCollections.Add(this);
         }
     }
     if (_nonComHf != null)
     {
         foreach (var hf in _nonComHf)
         {
             if (hf.BattleEventCollections == null)
             {
                 hf.BattleEventCollections = new ConcurrentBag <EC_Battle>();
             }
             hf.BattleEventCollections.Add(this);
         }
     }
     if (AttackingSquad != null)
     {
         foreach (var squad in AttackingSquad.Where(squad => squad.EntityPopulation != null))
         {
             if (squad.EntityPopulation.BattleEventCollections == null)
             {
                 squad.EntityPopulation.BattleEventCollections = new ConcurrentBag <EC_Battle>();
             }
             squad.EntityPopulation.BattleEventCollections.Add(this);
         }
     }
     if (DefendingSquad != null)
     {
         foreach (var squad in DefendingSquad.Where(squad => squad.EntityPopulation != null))
         {
             if (squad.EntityPopulation.BattleEventCollections == null)
             {
                 squad.EntityPopulation.BattleEventCollections = new ConcurrentBag <EC_Battle>();
             }
             squad.EntityPopulation.BattleEventCollections.Add(this);
         }
     }
     if (!BattleTotaled)
     {
         TotalBattle();
     }
 }
Ejemplo n.º 2
0
        public override void Select(MainForm frm)
        {
            base.Select(frm);

            foreach (var tabpage in frm.MainTabEventCollectionTypes.TabPages.Cast <TabPage>().Where(tabpage => tabpage != frm.tabEventCollectionBattle))
            {
                frm.MainTabEventCollectionTypes.TabPages.Remove(tabpage);
            }
            if (!frm.MainTabEventCollectionTypes.TabPages.Contains(frm.tabEventCollectionBattle))
            {
                frm.MainTabEventCollectionTypes.TabPages.Add(frm.tabEventCollectionBattle);
            }

            frm.lblBattleName.Text = ToString();
            if (StartTime != null || EndTime != null)
            {
                frm.lblBattleTime.Text     = $"{StartTime} - {EndTime}";
                frm.lblBattleDuration.Text = WorldTime.Duration(EndTime, StartTime);
            }
            else
            {
                frm.lblBattleTime.Text     = "";
                frm.lblBattleDuration.Text = "";
            }
            frm.lblBattleWar.Data    = WarEventCol;
            frm.lblBattleRegion.Data = Subregion;
            frm.lblBattleSite.Data   = Site;
            frm.lblBattleCoord.Data  = new Coordinate(Coords);

            frm.lblBattleAttackerCombatants.Text = BattleData.AttackingNumber.ToString();
            if (BattleData.AttackingHFs > 0)
            {
                frm.lblBattleAttackerCombatants.Text += $" + {BattleData.AttackingHFs} HFs";
            }
            frm.lblBattleAttackerLosses.Text = BattleData.AttackingDeaths.ToString();
            if (BattleData.AttackingHfDeaths > 0)
            {
                frm.lblBattleAttackerLosses.Text += $" + {BattleData.AttackingHfDeaths} HFs";
            }

            frm.lblBattleDefenderCombatants.Text = BattleData.DefendingNumber.ToString();
            if (BattleData.DefendingHFs > 0)
            {
                frm.lblBattleDefenderCombatants.Text += $" + {BattleData.DefendingHFs} HFs";
            }
            frm.lblBattleDefenderLosses.Text = BattleData.DefendingDeaths.ToString();
            if (BattleData.DefendingHfDeaths > 0)
            {
                frm.lblBattleDefenderLosses.Text += $" + {BattleData.DefendingHfDeaths} HFs";
            }



            if (Outcome == "attacker won")
            {
                frm.lblBattleAttackerOutcome.Text = @"Attacker Won";
                frm.lblBattleDefenderOutcome.Text = @"Defender Lost";
            }
            else
            {
                frm.lblBattleAttackerOutcome.Text = @"Attacker Lost";
                frm.lblBattleDefenderOutcome.Text = @"Defender Won";
            }
            frm.lstBattleAttackingHF.Items.Clear();
            frm.lstBattleAttackingHF.Tag = this;
            if (AttackingHf != null)
            {
                frm.lstBattleAttackingHF.Items.AddRange(AttackingHf.ToArray());
            }

            frm.grpBattleAttackingHF.Text = $"Historical Figures ({frm.lstBattleAttackingHF.Items.Count})";

            frm.lstBattleDefendingHF.Items.Clear();
            frm.lstBattleDefendingHF.Tag = this;
            if (DefendingHf != null)
            {
                frm.lstBattleDefendingHF.Items.AddRange(DefendingHf.ToArray());
            }

            frm.grpBattleDefendingHF.Text = $"Historical Figures ({frm.lstBattleDefendingHF.Items.Count})";

            frm.lstBattleAttackingSquad.Items.Clear();
            if (AttackingSquad != null)
            {
                frm.lstBattleAttackingSquad.Items.AddRange(AttackingSquad.ToArray());
            }

            if (frm.lstBattleAttackingSquad.Items.Count > 0)
            {
                frm.lstBattleAttackingSquad.SelectedIndex = 0;
            }
            else
            {
                frm.lblBattleAttackingSquadDeaths.Text = "";
                frm.lblBattleAttackingSquadEntPop.Data = null;
                frm.lblBattleAttackingSquadNumber.Text = "";
                frm.lblBattleAttackingSquadRace.Data   = null;
                frm.lblBattleAttackingSquadSite.Data   = null;
            }
            frm.grpBattleAttackingSquad.Text = $"Squads ({frm.lstBattleAttackingSquad.Items.Count})";


            frm.lstBattleDefendingSquad.Items.Clear();
            if (DefendingSquad != null)
            {
                frm.lstBattleDefendingSquad.Items.AddRange(DefendingSquad.ToArray());
            }

            if (frm.lstBattleDefendingSquad.Items.Count > 0)
            {
                frm.lstBattleDefendingSquad.SelectedIndex = 0;
            }
            else
            {
                frm.lblBattleDefendingSquadDeaths.Text = "";
                frm.lblBattleDefendingSquadEntPop.Data = null;
                frm.lblBattleDefendingSquadNumber.Text = "";
                frm.lblBattleDefendingSquadRace.Data   = null;
                frm.lblBattleDefendingSquadSite.Data   = null;
            }
            frm.grpBattleDefendingSquad.Text = $"Squads ({frm.lstBattleDefendingSquad.Items.Count})";

            frm.lstBattleEventCols.Items.Clear();
            if (EventCol != null)
            {
                frm.lstBattleEventCols.Items.AddRange(EventCol.ToArray());
            }

            frm.grpBattleEventCols.Visible = frm.lstBattleEventCols.Items.Count > 0;

            frm.lstBattleEvents.Items.Clear();
            if (Event != null)
            {
                frm.lstBattleEvents.Items.AddRange(Event.ToArray());
            }

            frm.grpBattleEvents.Visible = frm.lstBattleEvents.Items.Count > 0;
            if (frm.lstBattleEvents.Items.Count > 0)
            {
                frm.lstBattleEvents.SelectedIndex = 0;
            }

            frm.lstBattleNonComHFs.Items.Clear();
            if (_nonComHf != null)
            {
                frm.lstBattleNonComHFs.Items.AddRange(_nonComHf.ToArray());
            }

            frm.grpBattleNonComHFs.Visible = frm.lstBattleNonComHFs.Items.Count > 0;

            SelectTab(frm);
        }