Beispiel #1
0
        private async Task <bool> RunEventsAsync(ITransaction tx, Animal animal, IEnumerable <AnimalEvent> userEvents)
        {
            var animalBox = new AnimalBox(_rulesets, _animals, _scheduleProvider);
            await animalBox.SetAnimalAsync(tx, animal);

            IEnumerable <AnimalEvent> events = userEvents;

            if (animal != null)
            {
                events = events.Concat(await GetRulesetChangeEventsAsync(tx, animal));
            }

            bool isSuccess = await animalBox.RunEventsAsync(events);

            if (isSuccess)
            {
                await animalBox.CommitAsync();
            }

            return(isSuccess);
        }
Beispiel #2
0
        public void LoadEntityLists(CP enemyCP, QuestEntities questDetails)
        {
            ShiftVisibilities(true);
            string currentRegion = enemyCP.CPname.Substring(0,4);

            string[] subtypes = new string[0];
            comboBox_subtype.Items.Clear();
            comboBox_subtype2.Items.Clear();
            if (currentRegion.Equals("afgh"))
                subtypes = BodyInfo.afghSubTypes;
            else
                subtypes = BodyInfo.mafrSubTypes;

            comboBox_subtype.Items.AddRange(subtypes);
            comboBox_subtype2.Items.AddRange(subtypes);

            if (comboBox_subtype.Items.Contains(questDetails.soldierSubType))
                comboBox_subtype.Text = questDetails.soldierSubType;
            else
                comboBox_subtype.SelectedIndex = 0;

            h_checkBox_intrgt.Checked = questDetails.canInter;

            comboBox_Body.Items.Clear();
            if (currentRegion.Equals("mtbs"))
                foreach (BodyInfoEntry infoEntry in BodyInfo.BodyInfoArray)
                {
                    if (infoEntry.hasface)
                        this.comboBox_Body.Items.Add(infoEntry.bodyName);
                }
            else
                foreach (BodyInfoEntry infoEntry in BodyInfo.BodyInfoArray)
                {
                    this.comboBox_Body.Items.Add(infoEntry.bodyName);
                }

            if (comboBox_Body.Items.Count <= questDetails.hostageBodyIndex)
                comboBox_Body.SelectedIndex = 0;
            else
                comboBox_Body.SelectedIndex = questDetails.hostageBodyIndex;

            //
            // Quest-Specific Soldiers
            //
            Panel currentPanel = panelQuestEnemyDet;
            currentPanel.AutoScroll = false;
            foreach (Enemy questEnemy in questDetails.questEnemies)
            {
                EnemyBox questEnemyBox = new EnemyBox(questEnemy, enemyCP);
                questEnemyBox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(questEnemyBox.getGroupBoxMain());
                questEnemyBoxes.Add(questEnemyBox);
            }
            currentPanel.AutoScroll = true;
            //
            // CP-Specific soldiers
            //
            currentPanel = panelCPEnemyDet;
            currentPanel.AutoScroll = false;
            foreach (Enemy cpEnemy in questDetails.cpEnemies)
            {
                EnemyBox cpEnemyBox = new EnemyBox(cpEnemy, enemyCP);
                cpEnemyBox.BuildObject(currentPanel.Width);
                cpEnemyBox.e_label_spawn.Text = "Customize:"; cpEnemyBox.e_label_spawn.Left = 26;
                currentPanel.Controls.Add(cpEnemyBox.getGroupBoxMain());
                CPEnemyBoxes.Add(cpEnemyBox);
            }
            currentPanel.AutoScroll = true;
            //
            // Hostages
            //
            currentPanel = panelHosDet;
            currentPanel.AutoScroll = false;
            foreach (Hostage hostage in questDetails.hostages)
            {
                HostageBox hostageBox = new HostageBox(hostage, questDetails.hostageBodyIndex);
                hostageBox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(hostageBox.getGroupBoxMain());
                hostageBoxes.Add(hostageBox);
            }
            currentPanel.AutoScroll = true;
            //
            // Heavy Vehicles
            //
            currentPanel = panelVehDet;
            currentPanel.AutoScroll = false;
            foreach (Vehicle vehicle in questDetails.vehicles)
            {
                VehicleBox vehiclebox = new VehicleBox(vehicle);
                vehiclebox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(vehiclebox.getGroupBoxMain());
                vehicleBoxes.Add(vehiclebox);
            }
            currentPanel.AutoScroll = true;
            //
            // Animal Clusters
            //
            currentPanel = panelAnimalDet;
            currentPanel.AutoScroll = false;
            foreach (Animal animal in questDetails.animals)
            {
                AnimalBox anibox = new AnimalBox(animal);
                anibox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(anibox.getGroupBoxMain());
                animalBoxes.Add(anibox);
            }
            currentPanel.AutoScroll = true;
            //
            // Dormant Items
            //
            currentPanel = panelItemDet;
            currentPanel.AutoScroll = false;
            foreach (Item item in questDetails.items)
            {
                ItemBox itemBox = new ItemBox(item);
                itemBox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(itemBox.getGroupBoxMain());
                itemBoxes.Add(itemBox);
            }
            currentPanel.AutoScroll = true;
            //
            // Active Items
            //
            currentPanel = panelAcItDet;
            currentPanel.AutoScroll = false;
            foreach (ActiveItem acitem in questDetails.activeItems)
            {
                ActiveItemBox activeItemBox = new ActiveItemBox(acitem);
                activeItemBox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(activeItemBox.getGroupBoxMain());
                activeItemBoxes.Add(activeItemBox);
            }
            currentPanel.AutoScroll = true;
            //
            // Models
            //
            currentPanel = panelStMdDet;
            currentPanel.AutoScroll = false;
            foreach (Model model in questDetails.models)
            {
                ModelBox modelBox = new ModelBox(model);
                modelBox.BuildObject(currentPanel.Width);
                currentPanel.Controls.Add(modelBox.getGroupBoxMain());
                modelBoxes.Add(modelBox);
            }
            currentPanel.AutoScroll = true;


            panelDetails.AutoScroll = false;
            ShiftVisibilities(false);
            ShiftGroups(Height, Width);
            panelDetails.AutoScroll = true;
        }