예제 #1
0
        private void purchase_item_Click(object sender, EventArgs e)
        {
            if (global.select_storage == 0 && global.select_value == 0)
            {
                Nothing_Selected form = new Nothing_Selected();
                form.ShowDialog();
                return;
            }
            if (global.Ship.return_value() < global.select_value)
            {
                Not_Enough_Cash form = new Not_Enough_Cash();
                form.ShowDialog();
                return;
            }

            if (global.select_storage <= global.Ship.return_storage_cap() && global.select_fuel == global.Ship.return_total_fuel())
            { label10.Text = ""; label9.Text = "Cannot Purchase"; return; }
            if (global.select_fuel <= global.Ship.return_total_fuel() && global.select_storage == global.Ship.return_storage_cap())
            { label10.Text = ""; label9.Text = "Cannot Purchase"; return; }

            global.Ship.change_storage_cap(global.select_storage);
            global.Ship.change_totalFuel(global.select_fuel);
            global.Ship.change_value(global.select_value);
            label10.Text = "Purchased";

            init_current_labels();
        }
예제 #2
0
        //==================================================================================================
        public void refuel(int num)
        {
            global.temp = num;

            if (_totalFuel == _currentFuel)
            {
                Tank_Full form = new Tank_Full();
                form.ShowDialog();

                return;
            }
            if (_value < num) //if you dont have enough money
            {
                Not_Enough_Cash form = new Not_Enough_Cash();
                form.ShowDialog();
                return;
            }

            if (_currentFuel + num > _totalFuel)
            {
                global.temp = Convert.ToInt32(_totalFuel - _currentFuel);
                _currentFuel = _totalFuel;
                _value -= global.temp;
                you_filled_up form = new you_filled_up();
                form.ShowDialog();

            }
            else
            {
                _currentFuel += num;
                _value -= num;
                you_filled_up form = new you_filled_up();
                form.ShowDialog();
            }
        }