예제 #1
0
        public override void Activate(Renderer renderer)
        {
            if (renderer == null)
            {
                throw new ArgumentNullException("renderer");
            }

            Point bottomRightPointOfScreen = new Point(MainGame.SCREEN_WIDTH_LOGICAL, MainGame.SCREEN_HEIGHT_LOGICAL);

            string mapPath = ContentManager.GetContentPath(mapPathToLoad);

            tiledMap = new TiledMap(mapPath, renderer, agentFactory);

            simulationManager.SetCurrentMap(tiledMap);

            bankAccount = new BankAccount(1000);
            bankAccount.AmountDeposited += bankAccount_AmountDeposited;
            bankAccount.AmountWithdrawn += bankAccount_AmountWithdrawn;

            mailManager = new MailManager();
            mailManager.UnreadMailCountChanged += mailbox_UnreadMailCountChanged;

            Employee employee  = agentFactory.CreateEmployee(SimulationManager.SimulationTime, simulationManager.WorldDateTime, GetRandomEmployeePosition());
            Resume   resume    = new Resume(r => userInterfaceManager.ShowMenuResume(r), employee, "At my past job, I spent a lot of time sleeping at my desk. I promise not to do that if you hire me. Also, I need money. That said, I can't promise that my narcolepsy is completely cured. I have a doctor's note if you need one.");
            Employee employee2 = agentFactory.CreateEmployee(SimulationManager.SimulationTime, simulationManager.WorldDateTime, GetRandomEmployeePosition());
            Resume   resume2   = new Resume(r => userInterfaceManager.ShowMenuResume(r), employee2, "At my past job, I spent a lot of time sleeping at my desk. I promise not to do that if you hire me. Also, I need money. That said, I can't promise that my narcolepsy is completely cured. I have a doctor's note if you need one.");
            Employee employee3 = agentFactory.CreateEmployee(SimulationManager.SimulationTime, simulationManager.WorldDateTime, GetRandomEmployeePosition());
            Resume   resume3   = new Resume(r => userInterfaceManager.ShowMenuResume(r), employee3, "At my past job, I spent a lot of time sleeping at my desk. I promise not to do that if you hire me. Also, I need money. That said, I can't promise that my narcolepsy is completely cured. I have a doctor's note if you need one.");

            mailManager.SendMail(new MailItem("*****@*****.**", "*****@*****.**", "Test Subject 1", "Test Body 1", resume, MailState.Unread));
            mailManager.SendMail(new MailItem("*****@*****.**", "*****@*****.**", "Test Subject 2", "Test Body 2", resume2, MailState.Unread));
            mailManager.SendMail(new MailItem("*****@*****.**", "*****@*****.**", "Test Subject 3", "Test Body 3", resume3, MailState.Unread));
            mailManager.SendMail(new MailItem("*****@*****.**", "*****@*****.**", "Test Subject 4", "Test Body 4", resume, MailState.Unread));
            mailManager.SendMail(new MailItem("*****@*****.**", "*****@*****.**", "Test Subject 5", "Test Body 5", resume, MailState.Unread));

            IEnumerable <IPurchasable> purchasableEquipment = GetPurchasableEquipment();
            IEnumerable <IPurchasable> purchasableRooms     = GetPurchasableRooms();

            userInterfaceManager = new UserInterfaceManager(ContentManager, bottomRightPointOfScreen,
                                                            purchasableEquipment,
                                                            purchasableRooms,
                                                            mailManager.PlayerInbox,
                                                            mailManager.PlayerOutbox,
                                                            mailManager.PlayerArchive,
                                                            mailManager.PlayerUnreadMailCount,
                                                            bankAccount.Balance,
                                                            simulationManager.TrackedEmployees.Count());

            userInterfaceManager.PurchasableItemSelected += UserInterfaceManagerOnPurchasableItemSelected;
            userInterfaceManager.PurchasableItemPlaced   += UserInterfaceManagerOnPurchasableItemPlaced;
            userInterfaceManager.MailArchived            += UserInterfaceManagerOnMailArchived;
            userInterfaceManager.MainMenuButtonClicked   += (sender, e) => ScreenManager.AddScreen(CreatePauseMenuScreen());
            userInterfaceManager.ResumeAccepted          += (sender, e) => simulationManager.AddAgent(e.Employee);
            userInterfaceManager.EmployeeFired           += UserInterfaceManagerOnEmployeeFired;
            userInterfaceManager.EmployeePromoted        += UserInterfaceManagerOnEmployeePromoted;
            userInterfaceManager.EmployeeDisciplined     += UserInterfaceManagerOnEmployeeDisciplined;
            userInterfaceManager.EquipmentSold           += HandleEquipmentSold;
            userInterfaceManager.EquipmentRepaired       += HandleEquipmentRepaired;

            business = new BusinessManager();
        }