public static SoldCars getInstance() { if (instance == null) { instance = new SoldCars(); } return(instance); }
//-------------------------------------------------------------------- private void RealizeObserveProgram() { Pocket -= SoldCars.getInstance().TechObsserveCost; DataCollecter.getInstance().deboostIncome(SoldCars.getInstance().TechObsserveCost); PocketLbl.Text = Pocket.ToString() + " $"; }
public Form1() { InitializeComponent(); timer1.Enabled = true; timer1.Interval = 1000; Pocket = 750000; PocketLbl.Text = Pocket.ToString() + '$'; rnd = new Random(); Filial.getInstance().ChoseCount += CarNumbChoose; SoldCars.getInstance().ObserveProgram += RealizeObserveProgram; }
public static float DayActivity() { Random rnd = new Random(); var filialsCount = Filial.getInstance().Filials.Count(); int CarsBought = (rnd.Next() % 3) * filialsCount; float SoldGoodsIncome = (250 + rnd.Next() % 250) * filialsCount; float TechObservIncomes = ((2 - rnd.Next() % 2) * SoldCars.getInstance().TechObsserveCost) * filialsCount; float MoneyToChange = 0; int limit = CarsBought; if (CarsBought > Filial.getInstance().CarsInGarage) { limit = Filial.getInstance().CarsInGarage; } for (int i = 0; i < limit; i++) { SoldCars.getInstance().AddCarToObserveProgramm(); } foreach (var filial in Filial.getInstance().Filials) { filial.DaysBeforeSalary--; if (filial.DaysBeforeSalary == 0) { MoneyToChange -= filial.SalaryFund; filial.DaysBeforeSalary = 30; } } MoneyToChange += limit * (Filial.getInstance().CarPrice + 5000) + SoldGoodsIncome + TechObservIncomes; DataCollecter.getInstance().boostIncome(MoneyToChange); Filial.getInstance().CarsInGarage -= limit; SoldCars.getInstance().CheckForObserveDate(); return(MoneyToChange); }
public void Draw() { if (DataCollecter.getInstance().MonthCounter <= 1) { panel1.Visible = false; NoInfoLbl.Visible = true; } else { panel1.Visible = true; NoInfoLbl.Visible = false; IncomeLbl.Text = DataCollecter.getInstance().IncomeOfPreviousMonth.ToString(); SoldCarsLbl.Text = SoldCars.getInstance().TotalSoldCars.ToString(); CarsInTOLbl.Text = SoldCars.getInstance().soldCars.Count().ToString(); IncomeBoostlbl.Text = DataCollecter.getInstance().SellingBoostUp.ToString(); StuffRewardLbl.Text = DataCollecter.getInstance().Reward.ToString(); } }