/// <summary> /// Event handler for when the Quit Game menu entry is selected. /// </summary> void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { const string message = "Are you sure you want to quit this game?"; MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message); confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted; ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer); }
void PayCash(object sender, PlayerIndexEventArgs e) { if (GlobalVariables.Finance.Cash >= amount) { GlobalVariables.Finance.Cash -= amount; if (title == "Credit Card Payment") GlobalVariables.Finance.CreditCardBalance -= amount; Transaction temp = new Transaction(title, amount); GlobalVariables.Finance.Transactions.Add(temp); OnPaid(); payment.Completed = true; } }
/// <summary> /// Shows the Dashboard /// </summary> void ShowDash(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "This icon will bring up the dashboard, alternatively you can access the dashboard by F1.\n" + "The Dashboard will show important information such as your bank account balance, cash\n" + "and credit balance.", Selection = calendarT, }; ScreenManager.AddScreen(hfs, e.PlayerIndex); }
void LoadTransactionScreen(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "This is your record book.This icon on the right will bring up this book.\n" + "The arrow on the bottom will close the book.This is where you can\n" + "view your transaction history.", Selection = book, }; TransactionScreen transactionScreen = new TransactionScreen(); hfs.Exit += delegate(object s, PlayerIndexEventArgs x) { transactionScreen.ExitScreen(); }; ScreenManager.AddScreen(transactionScreen, e.PlayerIndex); ScreenManager.AddScreen(hfs, e.PlayerIndex); }
void LoadPaymentScreen(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "These sticky notes represents the events that occured today. Every day you will need\n" + "to pay each event which requires payment before you can continue you can view\n" + "upcoming and past events on the dashboard.", Selection = (Tile)sender, }; ScreenManager.AddScreen(hfs, e.PlayerIndex); }
/// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to exit" message box. /// </summary> void ConfirmExitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { ExitScreen(); }
void AnsweredD(object sender, PlayerIndexEventArgs e) { wrong = true; if (correctAnswer == 4) OnComplete(e); }
/// <summary> /// Triggers when the user presses the Next button /// </summary> void Next(object sender, PlayerIndexEventArgs e) { int totalPages = (int)((GlobalVariables.Finance.Transactions.Count) / 13); if (page < totalPages) page++; }
void LoadQuiz(object sender, PlayerIndexEventArgs e) { if (!quizComplete) { QuizScreen quiz = new QuizScreen(); quiz.Complete += delegate(object o, PlayerIndexEventArgs arg) { quizComplete = true; }; ScreenManager.AddScreen(quiz, e.PlayerIndex); } }
void LoadPaymentScreen(object sender, PlayerIndexEventArgs e) { Tile tile = (Tile)sender; PaymentScreen paymentScreen = new PaymentScreen(); paymentScreen.Maximum = GlobalVariables.Finance.CreditCardBalance+GlobalVariables.Finance.CreditCardMonthBalance; if (tile.LinkedEvent.Name != "Credit Card Payment") paymentScreen.Maximum = tile.LinkedEvent.Amount; paymentScreen.Minimum = tile.LinkedEvent.Amount; paymentScreen.Title = tile.LinkedEvent.Name; paymentScreen.PaymentEvent = tile.LinkedEvent; paymentScreen.Paid += SaveState; ScreenManager.AddScreen(paymentScreen, e.PlayerIndex); }
void LoadBank(object sender, PlayerIndexEventArgs e) { BankScreen bank = new BankScreen(); ScreenManager.AddScreen(bank, e.PlayerIndex); }
/// <summary> /// Starts Game over screen /// </summary> void GameOver(object sender, PlayerIndexEventArgs e) { }
/// <summary> /// Called once per month calculates the minumum payment and resets the month balance /// </summary> void CreditBill(object sender, PlayerIndexEventArgs e) { int limit = GlobalVariables.Finance.CreditCardLimit; int balance = GlobalVariables.Finance.CreditCardBalance; int monthBalance = GlobalVariables.Finance.CreditCardMonthBalance; int fees = 0; //Calculate new balance = oldbalance + intrest + this months balance GlobalVariables.Finance.CreditCardBalance += (int)(balance * 0.18f + monthBalance); GlobalVariables.Finance.CreditCardMonthBalance = 0; if (monthBalance >limit ) fees += 35; ((CalendarEvent)sender).Amount = (int)Math.Ceiling((balance + monthBalance) * 0.01f + fees); }
public void DateSelected(object o, PlayerIndexEventArgs arg) { int day = Convert.ToInt32(((Tile)o).Text); selectedDate = new DateTime(GlobalVariables.Date.Year, GlobalVariables.Date.Month, day); selectedEvents = DateEvents(selectedDate); }
void PayCredit(object sender, PlayerIndexEventArgs e) { GlobalVariables.Finance.CreditCardMonthBalance += amount; Transaction temp = new Transaction(title, amount); GlobalVariables.Finance.Transactions.Add(temp); OnPaid(); payment.Completed = true; }
void LoadTransactionScreen(object sender, PlayerIndexEventArgs e) { TransactionScreen transactionScreen = new TransactionScreen(); ScreenManager.AddScreen(transactionScreen, e.PlayerIndex); }
/// <summary> /// Triggers when the user presses the Back button /// </summary> void Back(object sender, PlayerIndexEventArgs e) { if (page == 0) ExitScreen(); else page--; }
void NewDay(object sender, PlayerIndexEventArgs e) { bool done = quizComplete; foreach(CalendarEvent cE in todaysEvents) done = (done && cE.Completed); if (done) { int year = GlobalVariables.Date.Year; calendar.NewDay(); todaysEvents = calendar.DateEvents(GlobalVariables.Date); transactionsSave = -1; eventSave = todaysEvents[0]; if (GlobalVariables.Date.Year != year) calendar.Events = GenerateEvents(); UpdateNotes(); quizComplete = false; } }
internal virtual void OnComplete(PlayerIndexEventArgs e) { correct = true; wrong = false; if (Complete != null) Complete(this, e); }
/// <summary> /// Called once a week, gives player money! /// </summary> void PayDay(object sender, PlayerIndexEventArgs e) { Random n = new Random(); int pay = (int)(n.Next(20,31) * 7.25f); ((CalendarEvent)sender).Amount = pay; GlobalVariables.Finance.Cash += pay; Transaction temp = new Transaction("Pay Check (in cash)", pay); GlobalVariables.Finance.Transactions.Add(temp); }
/// <summary> /// Helper overload makes it easy to use OnCancel as a MenuEntry event handler. /// </summary> protected void OnCancel(object sender, PlayerIndexEventArgs e) { OnCancel(e.PlayerIndex); }
void SaveState(object sender, PlayerIndexEventArgs e) { eventSave = ((PaymentScreen)sender).PaymentEvent; transactionsSave = GlobalVariables.Finance.Transactions.Count-1 ; }
void LoadBank(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "This is the bank. This icon on the right will bring up the bank.\n" + "The arrow in the top left will close the bank. The bank is where\n" + "you can withdraw or deposit money.", Selection = bankT, }; BankScreen bank = new BankScreen(); hfs.Exit += delegate(object s, PlayerIndexEventArgs x) { bank.ExitScreen(); }; ScreenManager.AddScreen(bank, e.PlayerIndex); ScreenManager.AddScreen(hfs, e.PlayerIndex); }
/// <summary> /// Shows the Dashboard /// </summary> void ShowDash(object sender, PlayerIndexEventArgs e) { dashboard.ResetDate(); ScreenManager.AddScreen(dashboard, e.PlayerIndex); }
void LoadQuiz(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "This is the quiz.This icon on the right will bring up the quiz. You must\n" + "Select the correct answer before you continue to the next day. The arrow\n" + "in the top left will exit our of the quiz.", Selection = test, }; QuizScreen quiz = new QuizScreen(); hfs.Exit += delegate(object s, PlayerIndexEventArgs x) { quiz.ExitScreen(); }; ScreenManager.AddScreen(quiz, e.PlayerIndex); ScreenManager.AddScreen(hfs, e.PlayerIndex); }
void Undo(object sender, PlayerIndexEventArgs e) { if (transactionsSave != -1) { eventSave.Completed = false; GlobalVariables.Finance.Transactions.RemoveAt(transactionsSave); GlobalVariables.Finance.Transactions.TrimExcess(); transactionsSave = -1; } }
void NewDay(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "This arrow will advance the game into the next day. You may only advance\n"+ "once you have completed all the days events and answered correctly on the\n" + "quiz.", Selection = (Tile)sender, }; ScreenManager.AddScreen(hfs, e.PlayerIndex); }
/// <summary> /// Event handler for when the user selects ok on the "are you sure /// you want to quit" message box. This uses the loading screen to /// transition from the game back to the main menu screen. /// </summary> void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e) { LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(), new MainMenuScreen()); }
void Undo(object sender, PlayerIndexEventArgs e) { HelpFadeScreen hfs = new HelpFadeScreen() { Title = "This icon will undo the last transaction. This should be used if you pay more or less\n" + "than you meant to.\n", Selection = undoButton, }; ScreenManager.AddScreen(hfs, e.PlayerIndex); }
/// <summary> /// Event handler for when the Play Game menu entry is selected. /// </summary> void PlayGameMenuEntrySelected(object sender, PlayerIndexEventArgs e) { //LoadingScreen.Load(ScreenManager, false, e.PlayerIndex, // new GameplayScreen()); GameScreen gameplay = new GameplayScreen(); ScreenManager.AddScreen(gameplay, e.PlayerIndex); }