Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
 /// <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);
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 /// <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();
 }
Ejemplo n.º 7
0
 void AnsweredD(object sender, PlayerIndexEventArgs e)
 {
     wrong = true;
     if (correctAnswer == 4)
         OnComplete(e);
 }
Ejemplo n.º 8
0
 /// <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++;
 }
Ejemplo n.º 9
0
 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);
     }
 }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
 void LoadBank(object sender, PlayerIndexEventArgs e)
 {
     BankScreen bank = new BankScreen();
     ScreenManager.AddScreen(bank, e.PlayerIndex);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Starts Game over screen
 /// </summary>
 void GameOver(object sender, PlayerIndexEventArgs e)
 {
 }
Ejemplo n.º 13
0
        /// <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);
        }
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 15
0
        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;
        }
Ejemplo n.º 16
0
 void LoadTransactionScreen(object sender, PlayerIndexEventArgs e)
 {
     TransactionScreen transactionScreen = new TransactionScreen();
     ScreenManager.AddScreen(transactionScreen, e.PlayerIndex);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Triggers when the user presses the Back button
 /// </summary>
 void Back(object sender, PlayerIndexEventArgs e)
 {
     if (page == 0)
         ExitScreen();
     else
         page--;
 }
Ejemplo n.º 18
0
 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;
     }
 }
Ejemplo n.º 19
0
 internal virtual void OnComplete(PlayerIndexEventArgs e)
 {
     correct = true;
     wrong = false;
     if (Complete != null)
         Complete(this, e);
 }
Ejemplo n.º 20
0
        /// <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);
        }
Ejemplo n.º 21
0
 /// <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);
 }
Ejemplo n.º 22
0
 void SaveState(object sender, PlayerIndexEventArgs e)
 {
     eventSave = ((PaymentScreen)sender).PaymentEvent;
     transactionsSave = GlobalVariables.Finance.Transactions.Count-1 ;
 }
Ejemplo n.º 23
0
 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);
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Shows the Dashboard
 /// </summary>
 void ShowDash(object sender, PlayerIndexEventArgs e)
 {
     dashboard.ResetDate();
     ScreenManager.AddScreen(dashboard, e.PlayerIndex);
 }
Ejemplo n.º 25
0
 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);
 }
Ejemplo n.º 26
0
 void Undo(object sender, PlayerIndexEventArgs e)
 {
     if (transactionsSave != -1)
     {
         eventSave.Completed = false;
         GlobalVariables.Finance.Transactions.RemoveAt(transactionsSave);
         GlobalVariables.Finance.Transactions.TrimExcess();
         transactionsSave = -1;
     }
 }
Ejemplo n.º 27
0
 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);
 }
Ejemplo n.º 28
0
 /// <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());
 }
Ejemplo n.º 29
0
 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);
 }
Ejemplo n.º 30
0
 /// <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);
 }