示例#1
0
文件: Icons.cs 项目: ybug/CivOne
        public static IBitmap GovernmentPortrait(IGovernment government, Advisor advisor, bool modern)
        {
            string filename;
            int    governmentId;

            if (government is Monarchy)
            {
                governmentId = (modern ? 3 : 2);
                filename     = $"GOVT1" + (modern ? "M" : "A");
            }
            else if (government is Republic || government is Democracy)
            {
                governmentId = (modern ? 5 : 4);
                filename     = $"GOVT2" + (modern ? "M" : "A");
            }
            else if (government is Communism)
            {
                governmentId = 6;
                filename     = "GOVT3A";
            }
            else             // Anarchy or Despotism
            {
                governmentId = (modern ? 1 : 0);
                filename     = "GOVT0" + (modern ? "M" : "A");
            }
            if (_governmentPortrait[governmentId, (int)advisor] == null)
            {
                _governmentPortrait[governmentId, (int)advisor] = Resources[filename][(40 * (int)advisor), 0, 40, 60];
            }
            return(_governmentPortrait[governmentId, (int)advisor]);
        }
示例#2
0
        public override bool HasUpdate(uint gameTick)
        {
            if (_update)
            {
                _canvas.FillLayerTile(_background);
                _canvas.AddBorder(1, 1, 0, 0, 123, 38);
                _canvas.FillRectangle(0, 123, 0, 1, 38);

                IUnit[] units = _city.Units.Take(14).ToArray();
                for (int i = 0; i < units.Length; i++)
                {
                    int xx = 5 + ((i % 7) * 16);
                    int yy = 1 + (((i - (i % 7)) / 7) * 16);

                    // Diplomat and Caravan units cost nothing.
                    if (!(units[i] is Diplomat) && !(units[i] is Caravan))
                    {
                        int         shields = 0, food = 0;
                        IGovernment government = Game.GetPlayer(_city.Owner).Government;
                        if (government is Anarchy || government is Despotism)
                        {
                            if (i >= _city.Size)
                            {
                                shields++;
                            }
                            if (units[i] is Settlers)
                            {
                                food++;
                            }
                        }
                        else
                        {
                            shields++;
                            if (units[i] is Settlers)
                            {
                                food += 2;
                            }
                        }
                        if (food > 0)
                        {
                            for (int ix = 0; ix < food; ix++)
                            {
                                AddLayer(Icons.Food, xx + (4 * ix), yy + 12);
                            }
                        }
                        if (shields > 0)
                        {
                            AddLayer(Icons.Shield, xx + 8, yy + 12);
                        }
                    }

                    AddLayer(units[i].GetUnit(units[0].Owner, showState: false), xx, yy);
                }

                _update = false;
            }
            return(true);
        }
示例#3
0
文件: CityUnits.cs 项目: ybug/CivOne
        protected override bool HasUpdate(uint gameTick)
        {
            if (_update)
            {
                this.Tile(Pattern.PanelBlue)
                .DrawRectangle(colour: 1);

                IUnit[] units = _city.Units.Take(14).ToArray();
                for (int i = 0; i < units.Length; i++)
                {
                    int xx = 5 + ((i % 7) * 16);
                    int yy = 1 + (((i - (i % 7)) / 7) * 16);

                    // Diplomat and Caravan units cost nothing.
                    if (!(units[i] is Diplomat) && !(units[i] is Caravan))
                    {
                        int         shields = 0, food = 0;
                        IGovernment government = Game.GetPlayer(_city.Owner).Government;
                        if (government is Anarchy || government is Despotism)
                        {
                            if (i >= _city.Size)
                            {
                                shields++;
                            }
                            if (units[i] is Settlers)
                            {
                                food++;
                            }
                        }
                        else
                        {
                            shields++;
                            if (units[i] is Settlers)
                            {
                                food += 2;
                            }
                        }
                        if (food > 0)
                        {
                            for (int ix = 0; ix < food; ix++)
                            {
                                this.AddLayer(Icons.Food, xx + (4 * ix), yy + 12);
                            }
                        }
                        if (shields > 0)
                        {
                            this.AddLayer(Icons.Shield, xx + 8, yy + 12);
                        }
                    }

                    this.AddLayer(units[i].ToBitmap(false), xx, yy);
                }

                _update = false;
            }
            return(true);
        }
示例#4
0
        // Government
        public async Task <int> GovernmentSaveAsync(IGovernment government)
        {
            // Record locally
            // raise event with data to persistence

            if (government.GovernmentKey != Guid.Empty)
            {
                _dbContext.Entry(government).State = EntityState.Modified;
            }
            else
            {
                _dbContext.Government.Add((Government)government);
            }
            _recordsAffected = await _dbContext.SaveChangesAsync();

            return(_recordsAffected);
        }
 public GovernmentalMeeting(IGovernment gov, IBill bill)
 {
     this.gov     = gov;
     this.parties = gov.Parties;
     this.Bill    = bill;
 }
示例#6
0
 public Nation(string name, IGovernment government)
 {
     Name       = name;
     Government = government;
 }
示例#7
0
 private void GovernmentChoice(object sender, EventArgs args)
 {
     Result = _availableGovernments[(sender as Menu.Item).Value];
     CloseMenus();
     Cancel();
 }
示例#8
0
 private void GovernmentChoice(object sender, MenuItemEventArgs <IGovernment> args)
 {
     Result = args.Value;
     CloseMenus();
     Cancel();
 }
示例#9
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="GovernmentService"/> class from a <see cref="IGovernment"/>
 ///     component.
 /// </summary>
 /// <param name="groupService">The component used to represents the state of the government of the Ritimba
 /// republic.</param>
 public GovernmentService(IGovernment government)
 {
     this.government      = government;
     government.LastScore = 0;
     Initialise();
 }