public AchForm() { InitializeComponent(); formMain Main = Owner as formMain; }
private void lbJobs_DoubleClick(object sender, EventArgs e) { FormWork Work = new FormWork(); formMain Main = Owner as formMain; Work.Owner = Main; switch (lbJobs.SelectedIndex) { case 0: Work.NewMoney = rand.Next(2, 3); Work.min = 70; Work.max = 90; Work.ShowDialog(); Work.Dispose(); workTimeGluePaper++; break; case 1: if (!(workTimeGluePaper <= 5)) { Work.NewMoney = rand.Next(2, 4); Work.min = 60; Work.max = 85; Work.ShowDialog(); Work.Dispose(); workTimeWashingFloors++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 2: if (!(workTimeWashingFloors <= 5)) { Work.NewMoney = rand.Next(4, 5); Work.min = 50; Work.max = 70; Work.ShowDialog(); Work.Dispose(); workTimeCarryFood++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 3: if (!(workTimeCarryFood <= 5)) { Work.NewMoney = rand.Next(5, 6); Work.min = 40; Work.max = 65; Work.ShowDialog(); Work.Dispose(); workTimeCashier++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 4: if (!(workTimeCashier <= 5)) { Work.NewMoney = rand.Next(6, 7); Work.min = 30; Work.max = 50; Work.ShowDialog(); Work.Dispose(); workTimeCarwash++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 5: if (!(workTimeCarwash <= 5)) { Work.NewMoney = rand.Next(7, 9); Work.min = 20; Work.max = 45; Work.ShowDialog(); Work.Dispose(); workTimeFactory++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 6: if (!(workTimeFactory <= 5)) { Work.NewMoney = rand.Next(9, 12); Work.min = 10; Work.max = 35; Work.ShowDialog(); Work.Dispose(); workTimeSite++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 7: if (!(workTimeSite <= 5)) { Work.NewMoney = rand.Next(15, 20); Work.min = 10; Work.max = 30; Work.ShowDialog(); Work.Dispose(); workTimeGame++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 8: if (!(workTimeGame <= 5)) { Work.NewMoney = rand.Next(20, 25); Work.min = 5; Work.max = 15; Work.ShowDialog(); Work.Dispose(); workTimeStream++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; case 9: if (!(workTimeStream <= 5)) { Work.NewMoney = rand.Next(30, 40); Work.min = 1; Work.max = 10; Work.ShowDialog(); Work.Dispose(); workTimeBook++; } else { MessageBox.Show("У вас недостаточно опыта для данной работы", ""); } break; default: break; } }
private void formCatName_FormClosing(object sender, FormClosingEventArgs e) { formMain Main = Owner as formMain; Main.petName = tbCatName.Text; }
private void formEvent_Load(object sender, EventArgs e) { formMain Main = Owner as formMain; evNumber = Convert.ToByte(rnd.Next(0, events.Length)); lblEvent.Text = events[evNumber]; switch (evNumber) { case 0: if (Main.health >= 10) { Main.health -= 10; } else { Main.health = 0; } Main.frameUpdate(); Main.saveProgress(); break; case 1: if (Main.satiety <= 100) { Main.satiety++; } else { Main.satiety = 100; } if (Main.mood <= 90) { Main.mood += 10; } else { Main.mood = 100; } Main.frameUpdate(); Main.saveProgress(); break; case 2: if (Main.mood >= 20) { Main.mood -= 20; } else { Main.mood = 0; } Main.frameUpdate(); Main.saveProgress(); break; case 3: if (Main.mood >= 10) { Main.mood -= 10; } else { Main.mood = 0; } Main.frameUpdate(); Main.saveProgress(); break; case 4: if (Main.satiety >= 20) { Main.satiety -= 20; } else { Main.satiety = 0; } Main.frameUpdate(); Main.saveProgress(); break; case 5: if (Main.health >= 3) { Main.health -= 3; } else { Main.health = 0; } if (Main.mood <= 95) { Main.mood += 5; } else { Main.mood = 100; } Main.frameUpdate(); Main.saveProgress(); break; case 6: if (Main.health <= 95) { Main.health += 5; } else { Main.health = 100; } if (Main.mood <= 95) { Main.mood += 5; } else { Main.mood = 100; } if (Main.satiety <= 85) { Main.satiety += 15; } else { Main.satiety = 100; } if (Main.thirst <= 95) { Main.thirst += 5; } else { Main.thirst = 100; } Main.frameUpdate(); Main.saveProgress(); break; case 7: if (Main.mood <= 90) { Main.mood += 10; } else { Main.mood = 100; } Main.frameUpdate(); Main.saveProgress(); break; case 8: if (Main.thirst >= 10) { Main.thirst -= 10; } else { Main.thirst = 0; } Main.frameUpdate(); Main.saveProgress(); break; case 9: if (Main.mood >= 5) { Main.mood -= 5; } else { Main.mood = 0; } Main.frameUpdate(); Main.saveProgress(); break; } }