示例#1
0
        public double GetBuyPrice(Plane.Models model)
        {
            PlaneCharacteristics chars = PlaneCharacteristicsStorage.Characteristics[model];
            int d = GetCurrentDateTime().Day;
            int m = GetCurrentDateTime().Month;

            return(0.1 * (chars.Speed * 1000 + chars.Range * 1000 + chars.MaxSeatings * 110) * (Math.Abs(d - m) + 1));
        }
        public PlaneMarket(IGameLogicInteractable game, Plane.Models model, int days)
        {
            InitializeComponent();
            BackColor        = MainForm.MostlyBackColor;
            btnBuy.BackColor = MainForm.MostlyBackColor;
            cbType.BackColor = MainForm.MostlyBackColor;
            cbType.Items.AddRange(new object[] { "Покупка", "Аренда", "Лизинг" });
            Bitmap picture = null;

            switch (model)
            {
            case Plane.Models.AirbusA330_200:
            {
                picture = Resources.AirbusA330_200;
            }
            break;

            case Plane.Models.Boeing747_8I:
            {
                picture = Resources.Boeing747_8i;
            }
            break;

            case Plane.Models.McDonnelDouglasMD11F:
            {
                picture = Resources.McDonnelDouglasMD11F;
            }
            break;
            }
            this.model = model;
            this.game  = game;
            PlaneName  = model.ToString();
            PlaneCharacteristics chars = PlaneCharacteristicsStorage.Characteristics[model];

            SpeedValue = chars.Speed;
            RangeValue = chars.Range;
            SetMaxValue(chars.MaxSeatings, chars.Payload);
            DaysValue = days;

            PriceValue           = game.GetBuyPrice(model);
            cbType.SelectedIndex = 0;
        }