void SaveState(object sender, PlayerIndexEventArgs e) { eventSave = ((PaymentScreen)sender).PaymentEvent; transactionsSave = GlobalVariables.Finance.Transactions.Count-1 ; }
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; } }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); SpriteFont font = content.Load<SpriteFont>("EventFont"); SpriteFont midFont = content.Load<SpriteFont>("MediumButtonFont"); SpriteFont calendarFont = content.Load<SpriteFont>("CalendarFont"); SpriteFont dashboardFont = content.Load<SpriteFont>("DashboardFont"); gameFont = content.Load<SpriteFont>("gamefont"); background = content.Load<Texture2D>("finance"); dashboardTexture = content.Load<Texture2D>("gradient"); textBoxTexture = content.Load<Texture2D>("textbox"); calendarTexture = content.Load<Texture2D>("calendar"); smallCalendarTexture = content.Load<Texture2D>("vcalendar_new"); summaryTexture = content.Load<Texture2D>("Money Calculator"); bookTexture = content.Load<Texture2D>("book_icon"); testTexture = content.Load<Texture2D>("Exams_icon_100"); undoTexture = content.Load<Texture2D>("undo-icon-64"); backTexture = content.Load<Texture2D>("Back_64"); continueTexture = content.Load<Texture2D>("Continue_64"); noteTexture = content.Load<Texture2D>("note-small"); todayTexture = content.Load<Texture2D>("Calendar blank 128"); transactionsSave = -1; #region Generate Tiles Tile today = new Tile() { Position = new Vector2(margin.X * 2, margin.Y), Background = todayTexture, Screen = this, Size = new Vector2(128, 128), TileAlignment = Tile.Alignment.Fill, }; today.Selected += ShowDash; tiles.Add(today); note1 = new Tile() { Text = " Credit Card \n Payment Due", Position = new Vector2(margin.X * 2, margin.Y * 8), Background = noteTexture, Size = new Vector2(noteTexture.Width, noteTexture.Height), Font = font, Screen = this, TextColor = Color.Red, }; note1.Selected += LoadPaymentScreen; tiles.Add(note1); note2 = new Tile() { Text = "Car Repair", Position = note1.Position + new Vector2(note1.Size.X + margin.X * 2, 0), Background = noteTexture, Size = new Vector2(noteTexture.Width, noteTexture.Height), Font = font, Screen = this, TextColor = Color.Red, }; note2.Selected += LoadPaymentScreen; tiles.Add(note2); note3 = new Tile() { Text = " Cell Phone\nPayment Due", Position = note2.Position + new Vector2(note2.Size.X + margin.X * 2, 0), Background = noteTexture, Size = new Vector2(noteTexture.Width, noteTexture.Height), Font = font, Screen = this, TextColor = Color.Red, }; note3.Selected += LoadPaymentScreen; tiles.Add(note3); bankT = new Tile() { Size = new Vector2(margin.Y * 2.5f, margin.Y * 2f), Position = new Vector2(GlobalVariables.ScreenWidth - margin.Y * 4, margin.Y * 2), Screen = this, TileIteraction = Tile.Interaction.Image, Scale = .8f, Background = summaryTexture, TileAlignment = Tile.Alignment.Center, }; bankT.Selected += LoadBank; tiles.Add(bankT); calendarT = new Tile() { Size = new Vector2(margin.Y * 2.5f, margin.Y * 2.5f), Position = bankT.Position + new Vector2(0, bankT.Size.Y + margin.Y * 2), Background = smallCalendarTexture, Screen = this, TileIteraction = Tile.Interaction.Image, Scale = .8f, TileAlignment = Tile.Alignment.Center, }; calendarT.Selected += ShowDash; tiles.Add(calendarT); book = new Tile() { Size = new Vector2(margin.Y * 2.7f, margin.Y * 2.5f), Position = calendarT.Position + new Vector2(0, calendarT.Size.Y + margin.Y * 2), Background = bookTexture, Screen = this, TileIteraction = Tile.Interaction.Image, Scale = .8f, TileAlignment = Tile.Alignment.Fill, }; book.Selected += LoadTransactionScreen; tiles.Add(book); test = new Tile() { Size = new Vector2(margin.Y * 2.5f, margin.Y * 2.5f), Position = book.Position + new Vector2(0, book.Size.Y + margin.Y * 2), Background = testTexture, Screen = this, TileAlignment = Tile.Alignment.Fill, TileIteraction = Tile.Interaction.Image, Scale = .8f, }; test.Selected += LoadQuiz; tiles.Add(test); undoButton = new Tile() { Size = new Vector2(undoTexture.Width, undoTexture.Height), Position = new Vector2(GlobalVariables.ScreenWidth / 2 - undoTexture.Width / 2 - margin.Y * 2, margin.Y * 17), Screen = this, Font = midFont, ButtonColor = buttonColor, Background = undoTexture, TileIteraction = Tile.Interaction.Image, Scale = .8f, TileAlignment = Tile.Alignment.Fill, }; undoButton.Selected += Undo; tiles.Add(undoButton); continueButton = new Tile() { Position = undoButton.Position + new Vector2(undoButton.Size.X + margin.Y * 2, 0), Screen = this, Background = continueTexture, Font = midFont, ButtonColor = buttonColor, TileIteraction = Tile.Interaction.Image, Scale = .8f, Size = new Vector2(continueTexture.Width, continueTexture.Height), }; continueButton.Selected += NewDay; tiles.Add(continueButton); backButton = new Tile() { Size = new Vector2(backTexture.Width, backTexture.Height), Position = undoButton.Position - new Vector2(backTexture.Width + margin.Y * 2, 0), Screen = this, TileIteraction = Tile.Interaction.Image, Scale = .8f, Background = backTexture, }; backButton.Selected += OnCancel; tiles.Add(backButton); #endregion calendar = new Calendar(); calendar.Size = new Vector2(GlobalVariables.ScreenWidth * 0.3f, GlobalVariables.ScreenHeight * 0.35f); calendar.Position = new Vector2(GlobalVariables.ScreenWidth - calendar.Size.X -margin.X * 1.5f, margin.Y * 1.5f); calendar.Screen = this; calendar.Events = GenerateEvents(); calendar.Font = calendarFont; calendar.Background = calendarTexture; dashboard = new DashboardScreen(); dashboard.Calendar = calendar; dashboard.Screen = this; dashboard.Font = dashboardFont; dashboard.TextBox = textBoxTexture; dashboard.Background = dashboardTexture; dashboard.Initialize(); int year = GlobalVariables.Date.Year; GlobalVariables.Date = GlobalVariables.Date.AddDays(-1); calendar.NewDay(); todaysEvents = calendar.DateEvents(GlobalVariables.Date); eventSave = todaysEvents[0]; if (GlobalVariables.Date.Year != year) calendar.Events = GenerateEvents(); UpdateNotes(); quizComplete = false; UpdateNotes(); // A real game would probably have more content than this sample, so // it would take longer to load. We simulate that by delaying for a // while, giving you a chance to admire the beautiful loading screen. //Thread.Sleep(1000); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }
List<CalendarEvent> GenerateEvents() { List<CalendarEvent> evs = new List<CalendarEvent>(); CalendarEvent temp; DateTime date; //Credit Card bills String name = "Credit Card Payment"; date = new DateTime(GlobalVariables.Date.Year, GlobalVariables.Date.Month + 1,1); while (date.AddDays(-1).Year == GlobalVariables.Date.Year) { temp = new CalendarEvent(); temp.DueDate = date.AddDays(-1); temp.Name = name; temp.Due += CreditBill; evs.Add(temp); date = date.AddMonths(1); } //PayDay name = "Pay Day"; date = GlobalVariables.Date; while (date.DayOfWeek != DayOfWeek.Friday) date = date.AddDays(1); while (date.Year == GlobalVariables.Date.Year) { temp = new CalendarEvent(); temp.DueDate = date; temp.Name = name; temp.Due += PayDay; temp.Completed = true; evs.Add(temp); date = date.AddDays(7); } return evs; }
void SupriseEvent(Random n) { CalendarEvent temp; int ran = n.Next(0, 100); if (ran < 5) { temp = new CalendarEvent() { Name = "Car Repair", Amount = n.Next(1,40)*50, DueDate = GlobalVariables.Date, }; } else if (ran < 15) { temp = new CalendarEvent() { Name = "Receive Medical Help", Amount = n.Next(1, 40) * 50, DueDate = GlobalVariables.Date, }; } else if (ran < 35) { temp = new CalendarEvent() { Name = "Get Gas", Amount = n.Next(40, 80) , DueDate = GlobalVariables.Date, }; } else if (ran < 65) { temp = new CalendarEvent() { Name = "Bought Luxury", Amount = n.Next(40, 300), DueDate = GlobalVariables.Date, }; } else { temp = new CalendarEvent() { Name = "Random Expense", Amount = n.Next(1, 50), DueDate = GlobalVariables.Date, }; } events.Add(temp); }