コード例 #1
0
        private void AssignBattleToSiteConquer()
        {
            //Assign a Conquering Event its corresponding battle
            //Battle = first Battle prior to the conquering?
            foreach (SiteConquered conquer in World.EventCollections.OfType <SiteConquered>())
            {
                for (int i = conquer.Id - 1; i >= 0; i--)
                {
                    EventCollection collection = World.GetEventCollection(i);
                    if (collection == null)
                    {
                        continue;
                    }

                    if (collection.GetType() == typeof(Battle))
                    {
                        conquer.Battle = collection as Battle;
                        if (conquer.Battle != null)
                        {
                            conquer.Battle.Conquering = conquer;
                            if (conquer.Battle.Defender == null && conquer.Defender != null)
                            {
                                conquer.Battle.Defender = conquer.Defender;
                            }
                        }

                        break;
                    }
                }
            }
        }