コード例 #1
0
 private void InitialCreateingTroop()
 {
     if (this.ShellMilitaryKind == null)
     {
         if (this.CreatingArchitecture.GetCampaignMilitaryList().Count == 1)
         {
             this.CreatingTroop = Troop.CreateSimulateTroop(this.CreatingArchitecture, this.CreatingPersons, this.CreatingLeader, this.CreatingMilitary, this.RationDays, this.CreatingArchitecture.Position);
             this.MoveCandidatesToPersons();
             this.CreatingMilitary = this.CreatingArchitecture.CampaignMilitaryList[0] as Military;
             this.AfterSelectMilitary();
         }
     }
     else
     {
         this.CreatingMilitary = Military.SimCreate(this.screen.Scenario, this.CreatingArchitecture, this.ShellMilitaryKind);
         if (this.CreatingArchitecture.GetCampaignMilitaryList().Count == 1)
         {
             this.CreatingTroop = Troop.CreateSimulateTroop(this.CreatingArchitecture, this.CreatingPersons, this.CreatingLeader, this.CreatingMilitary, this.RationDays, this.CreatingArchitecture.Position);
             this.MoveCandidatesToPersons();
             this.CreatingMilitary.SetShelledMilitary(this.CreatingArchitecture.CampaignMilitaryList[0] as Military);
             this.AfterSelectMilitary();
         }
     }
     this.RefreshDetailDisplay();
 }
コード例 #2
0
 private void frmEditMilitary_Load(object sender, EventArgs e)
 {
     this.editingMilitary = this.Militaries[0] as Military;
     if (this.editingMilitary != null)
     {
         this.tbName.Text = this.editingMilitary.Name;
         foreach (MilitaryKind kind in this.editingMilitary.Scenario.GameCommonData.AllMilitaryKinds.MilitaryKinds.Values)
         {
             this.cbKind.Items.Add(kind);
         }
         if (this.editingMilitary.Kind == null)
         {
             this.cbKind.SelectedIndex = -1;
         }
         else
         {
             this.cbKind.SelectedIndex = this.cbKind.Items.IndexOf(this.editingMilitary.Kind);
         }
         this.tbQuantity.Text         = this.editingMilitary.Quantity.ToString();
         this.tbMorale.Text           = this.editingMilitary.Morale.ToString();
         this.tbCombativity.Text      = this.editingMilitary.Combativity.ToString();
         this.tbExperience.Text       = this.editingMilitary.Experience.ToString();
         this.tbFollowedLeaderID.Text = this.editingMilitary.FollowedLeaderID.ToString();
         this.tbLeaderID.Text         = this.editingMilitary.LeaderID.ToString();
         this.tbLeaderExperience.Text = this.editingMilitary.LeaderExperience.ToString();
         if (this.CurrentArchitecture == null)
         {
             this.btnSelectFollowedLeaderInCurrentArchitecture.Visible = false;
             this.btnSelectLeaderInCurrentArchitecture.Visible         = false;
         }
     }
 }
コード例 #3
0
        public async Task <ActionResult <Military> > PostMilitary(Military military)
        {
            _context.Militaries.Add(military);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMilitary", new { id = military.MilitaryId }, military));
        }
コード例 #4
0
        public async Task <IActionResult> PutMilitary(int id, Military military)
        {
            if (id != military.MilitaryId)
            {
                return(BadRequest());
            }

            _context.Entry(military).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MilitaryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #5
0
ファイル: Order.cs プロジェクト: local-minimum/suffertheking
        bool Allocate(MilitaryUnitType type, int amount)
        {
            var troop         = GetTroop(type);
            var previousValue = troop == null ? 0 : troop.count;

            if (troop == null)
            {
                Debug.Log("No previous deployment for " + type + " on current order.");
                troop = Military.Allocate(Game.GetParticipant(data.participantId), Game.Map.GetProvince(data.pathByRegionNames[0]), type, amount);
                if (troop == null)
                {
                    Debug.LogWarning("Can't fulfill allocation!");
                    return(false);
                }
                var newUnits = new MilitaryUnit[data.troops.Length + 1];
                Array.Copy(data.troops, newUnits, data.troops.Length);
                newUnits[newUnits.Length - 1] = troop;
                data.troops = newUnits;
            }
            else
            {
                Military.AllocateInto(ref troop, Game.GetParticipant(data.participantId), Game.Map.GetProvince(data.pathByRegionNames[0]), type, amount);
            }

            return(previousValue != troop.count);
        }
コード例 #6
0
        private void HandleNewTileInspection(Tile tile, Input.InteractionType type)
        {
            if (!(type == Input.InteractionType.Select || type == Input.InteractionType.Inspect))
            {
                return;
            }

            int actives  = 0;
            int busies   = 0;
            int building = 0;
            var units    = Military.AllUnits(tile, Game.activeUserID, unitType);

            Debug.Log(string.Format("Summing up units of type {0} for player {1} ({2})", unitType, Game.activeUserID, units.Count));

            while (units.Count > 0)
            {
                var unit = units.Dequeue();
                if (unit.underConstruction)
                {
                    building += unit.count;
                }
                else if (unit.available)
                {
                    actives += unit.count;
                }
                else
                {
                    busies += unit.count;
                }
            }

            UpdateText(actives, busies, building);
        }
コード例 #7
0
    public void CreateMilitary()
    {
        Vector2  createPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Military mily      = Instantiate(militaryPrefab, createPos, Quaternion.identity);

        mily.gameObject.transform.parent = gameObject.transform;
        InfoController.m.scrollBar.SetActive(false);
    }
コード例 #8
0
ファイル: Country.cs プロジェクト: Macflash/Cold-War
 public Country()
 {
     funds = 10;
     clout = 10;
     economy = new Economy();
     military = new Military();
     politics = new Politics();
     climate = new Climate();
 }
コード例 #9
0
        protected virtual IEnumerable <BattleEffect> UnderAttack(BattleEffect effect)
        {
            if (Health <= 0)
            {
                Military.Die(this);
            }

            return(Enumerable.Empty <BattleEffect>());
        }
コード例 #10
0
        private void FrameFunction_Architecture_AfterGetTrainingMilitary()  //修改后未用
        {
            GameObjectList selectedList = this.CurrentArchitecture.TrainingMilitaryList.GetSelectedList();

            if ((selectedList != null) && (selectedList.Count == 1))
            {
                this.CurrentMilitary = selectedList[0] as Military;
                this.mainGameScreen.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Work, FrameFunction.GetTrainingPerson, false, true, true, false, this.CurrentArchitecture.Persons, null, "训练", "训练");
            }
        }
コード例 #11
0
        private void FrameFunction_Architecture_AfterGetMergeMilitary()
        {
            GameObjectList selectedList = this.CurrentArchitecture.MergeMilitaryList.GetSelectedList();

            if ((selectedList != null) && (selectedList.Count == 1))
            {
                this.CurrentMilitary = selectedList[0] as Military;
                this.mainGameScreen.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Military, FrameFunction.GetBeMergedMilitaries, false, true, true, false, this.CurrentArchitecture.GetBeMergedMilitaryList(this.CurrentMilitary), null, "选择编队", "");
            }
        }
コード例 #12
0
    private void GenerateMilitaryInfo(GameObject resultDisplay, string key)
    {
        Military military = Game.DB.Militaries[key];

        resultDisplay.name = military.ID;
        resultDisplay.GetComponent <Button>().onClick.AddListener(delegate {
            DatapadInformation.text = military.DatapadDescription();
        });
        resultDisplay.GetComponentInChildren <Text>().text = military.Name;
    }
コード例 #13
0
ファイル: Program.cs プロジェクト: Radells/shooting-gallery
        static void Main(string[] args)
        {
            Civilian        visitor1        = new Civilian("Антон Бурмистров", "05.06.2000", "М", "M4A1", true);
            Military        visitor2        = new Military("Максим Пентешихин", "15.05.1995", "М", "AK-47");
            Civilian        visitor3        = new Civilian("Анна Шеховцова", "24.02.1988", "Ж", "USP", false);
            ShootingGallery shootingGallery = new ShootingGallery();

            shootingGallery.GetGun(visitor1);
            shootingGallery.GetGun(visitor2);
            shootingGallery.GetGun(visitor3);
        }
コード例 #14
0
        private void buttonSetCar_Click_1(object sender, EventArgs e)
        {
            ColorDialog dialog = new ColorDialog();

            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var car   = new Military(100, 4, 10, 1600, dialog.Color);
                int place = parking.PutCarInParking(car);
                Draw();
                MessageBox.Show("Ваше место: " + place);
            }
        }
コード例 #15
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Military = await _context.Militaries
                       .Include(m => m.Group).FirstOrDefaultAsync(m => m.MilitaryId == id);

            if (Military == null)
            {
                return(NotFound());
            }
            return(Page());
        }
コード例 #16
0
ファイル: Cart.cs プロジェクト: Selitski8/LB9
 /// <summary>
 /// Добавление в корзину
 /// </summary>
 /// <param name="military">добавляемый объект</param>
 public virtual void AddToCart(Military military)
 {
     // если объект есть в корзине
     // то увеличить количество
     if (Items.ContainsKey(military.MilitaryId))
     {
         Items[military.MilitaryId].Quantity++;
     }
     // иначе - добавить объект в корзину
     else
     {
         Items.Add(military.MilitaryId, new CartItem {
             Military = military, Quantity = 1
         });
     }
 }
コード例 #17
0
ファイル: Delete.cshtml.cs プロジェクト: Selitski8/LB9
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Military = await _context.Militaries.FindAsync(id);

            if (Military != null)
            {
                _context.Militaries.Remove(Military);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
コード例 #18
0
ファイル: Order.cs プロジェクト: local-minimum/suffertheking
        bool Free(MilitaryUnitType type, int amount)
        {
            var troop = GetTroop(type);

            if (amount <= 0 || troop == null || troop.count < amount)
            {
                return(false);
            }

            var success = Military.FreeFrom(ref troop, amount);

            if (!troop.deployed || troop.count == 0)
            {
                data.troops = data.troops.Where(t => t != troop).ToArray();
            }

            return(success);
        }
コード例 #19
0
        public void Show()
        {
            totalCountAvailable = deploymentOrder.GetCount(type);;
            var units = Military.AllUnits(type);

            while (units.Count > 0)
            {
                var unit = units.Dequeue();
                totalCountAvailable += unit.available ? unit.count : 0;
            }
            if (totalCountAvailable > 0)
            {
                //UpdateCount(totalCountAvailable);
                Debug.Log("Can allocate " + totalCountAvailable);
            }
            else
            {
                Hide();
            }
        }
コード例 #20
0
 private void SelectMilitary()
 {
     if (this.ShellMilitaryKind == null)
     {
         this.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Military, FrameFunction.GetCampaignMilitary, false, true, true, false, this.CreatingArchitecture.GetCampaignMilitaryList(), (this.CreatingMilitary == null) ? null : this.CreatingMilitary.GetGameObjectList(), "选择编队", "");
     }
     else
     {
         this.ShowTabListInFrame(UndoneWorkKind.Frame, FrameKind.Military, FrameFunction.GetCampaignMilitary, false, true, true, false, this.CreatingArchitecture.GetShelledMilitaryList(this.ShellMilitaryKind.Type), (this.CreatingMilitary.ShelledMilitary == null) ? null : this.CreatingMilitary.ShelledMilitary.GetGameObjectList(), "选择编队", "");
     }
     this.GameFramePlugin.SetOKFunction(delegate {
         if (this.ShellMilitaryKind == null)
         {
             this.CreatingMilitary = this.TabListPlugin.SelectedItem as Military;
         }
         else
         {
             this.CreatingMilitary.SetShelledMilitary(this.TabListPlugin.SelectedItem as Military);
         }
         this.AfterSelectMilitary();
         this.RefreshDetailDisplay();
     });
 }
コード例 #21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.men_questions);
            // put UInfoViewModel instance of UserInformationViewModel.cs
            UInfoViewModel = ServiceLocator.Current.GetInstance <UserInformationViewModel>();
            // in this pary get intent variable that was sent by MainActivity and set them for UInfoViewModel properties.
            var nav   = (NavigationService)ServiceLocator.Current.GetInstance <INavigationService>();
            var param = nav.GetAndRemoveParameter <List <string> >(Intent);

            UInfoViewModel.GenderType  = param[0];
            UInfoViewModel.PhoneNumber = param[1];
            // put MenViewModel instance of MenQuestionViewModel.cs
            MenViewModel = ServiceLocator.Current.GetInstance <MenQuestionViewModel>();
            // binding views
            mMenBinding = this.SetBinding(() => MenViewModel.JobSubject
                                          , () => Job.Text
                                          , BindingMode.TwoWay);
            // get spinner content that user seleced and assign it to MenViewModel.Gender property
            Military.ItemSelected += (sender, e) =>
            {
                var content = string.Format(Military.GetItemAtPosition(e.Position).ToString());
                MenViewModel.MilitaryStatusCommand = content;
            };
            // when Confirme button clicked call ConfirmeDataCommand  methode in MenViewModel.cs and send data to other activity and navigates to it.
            Confirme.SetCommand(
                "Click",
                MenViewModel.ConfirmeDataCommand);
            // set spinner items from resource
            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.military_array, Android.Resource.Layout.SimpleExpandableListItem1);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            Military.Adapter = adapter;
        }
コード例 #22
0
ファイル: CartService.cs プロジェクト: Selitski8/LB9
 // переопределение методов класса Cart
 // для сохранения результатов в сессии
 public override void AddToCart(Military dish)
 {
     base.AddToCart(dish);
     Session?.Set <CartService>("Cart", this);
 }
コード例 #23
0
 public IResult Delete(Military military)
 {
     throw new NotImplementedException();
 }
コード例 #24
0
 public IResult Update(Military military)
 {
     _militaryDal.Update(military);
     return(new SuccessResult());
 }
コード例 #25
0
        public static IEnumerable <MilitaryItem> GetMilitaryItems(List <Military> military, List <Country> countries)
        {
            List <MilitaryItem> militaryItemList = new List <MilitaryItem>();

            if (military.IsNullOrEmpty())
            {
                return((IEnumerable <MilitaryItem>)militaryItemList);
            }
            List <Military> .Enumerator enumerator = military.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Military      current       = enumerator.Current;
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.Append(current.unit);
                    bool flag      = false;
                    long countryId = current.country_id;
                    if (countryId > 0L)
                    {
                        Country country = countries == null ? null : Enumerable.FirstOrDefault <Country>(countries, (Func <Country, bool>)(c => c.id == countryId));
                        if (country != null)
                        {
                            stringBuilder.Append("\n").Append(country.name);
                            flag = true;
                        }
                    }
                    if (current.from > 0)
                    {
                        stringBuilder.Append(flag ? ", " : "\n");
                        if (current.until == current.from)
                        {
                            stringBuilder.Append(string.Format("{0} {1} {2}", CommonResources.In, current.from, CommonResources.YearsShort));
                        }
                        else if (current.until == 0)
                        {
                            stringBuilder.Append(string.Format("{0} {1} {2}", CommonResources.Since, current.from, CommonResources.YearsShort));
                        }
                        else
                        {
                            stringBuilder.Append(current.from);
                        }
                    }
                    if (current.until > 0 && current.until != current.from)
                    {
                        if (current.from > 0)
                        {
                            stringBuilder.Append(string.Format("–{0}", current.until));
                        }
                        else
                        {
                            stringBuilder.Append(string.Format("{0}{1} {2} {3}", (flag ? ", " : "\n"), CommonResources.Until, current.until, CommonResources.YearsShort));
                        }
                    }
                    militaryItemList.Add(new MilitaryItem(stringBuilder.ToString()));
                }
            }
            finally
            {
                enumerator.Dispose();
            }
            return((IEnumerable <MilitaryItem>)militaryItemList);
        }
コード例 #26
0
ファイル: ClassandStuff.cs プロジェクト: technetist/DGM1600
 void Test(Military mil, string num)
 {
     mil.airforce = 100;
     num          = "hello";
 }
コード例 #27
0
 public virtual BattleAction Move()
 {
     return(Military.Move(this));
 }
コード例 #28
0
ファイル: ClassandStuff.cs プロジェクト: vehcklox/DGM1600
 void Test(Military mil, string num)
 {
     mil.airforce = 100;
     num = "hello";
 }
コード例 #29
0
        public ActionResult MilitaryUpdate(Military military)

        {
            _militaryService.Update(military);
            return(RedirectToAction(""));
        }