Beispiel #1
0
 private IGameState[] CreateNoPartnerWindow(GameInfo gameInfo)
 {
     var waitState = StateFactory.GetState(GameStates.GameStates.Wait);
     var alert = new Alert(gameInfo.Manager, "You can not have children\nYou must have a partner", "No partner", icon: "Images/AlertIcons/NoPartner");
     alert.Closed += (sender, args) => WindowClosed(gameInfo, waitState);
     gameInfo.Manager.Add(alert);
     return new[] { waitState };
 }
 private IGameState[] CreateSuccessWindow(GameInfo gameInfo)
 {
     var waitState = StateFactory.GetState(GameStates.GameStates.Wait);
     var alert = new Alert(gameInfo.Manager, SuccessText, "You now have a new " + Transportable.Name, icon: Transportable.Icon);
     alert.Closed += (sender, args) => WindowClosed(gameInfo, waitState);
     gameInfo.Manager.Add(alert);
     return new[] { waitState };
 }
 private IGameState[] CreateCarFullWindow(GameInfo gameInfo)
 {
     var waitState = StateFactory.GetState(GameStates.GameStates.Wait);
     var alert = new Alert(gameInfo.Manager, String.Format("Your car is too full for another {0}", Transportable.Name), "Car Full!", icon: "Images/AlertIcons/Fail");
     alert.Closed += (sender, args) => WindowClosed(gameInfo, waitState);
     gameInfo.Manager.Add(alert);
     return new[] { waitState };
 }
Beispiel #4
0
        private IGameState[] CreateAlert(GameInfo gameInfo, IGameState waitState, String message, IGameState[] addStates = null, String icon = null)
        {
            var alert = new Alert(gameInfo.Manager, message, icon: icon);
            gameInfo.Manager.Add(alert);
            alert.Closing += (sender, args) => gameInfo.Fsm.Remove(waitState);

            return addStates ?? new[] { waitState };
        }
Beispiel #5
0
 private IGameState[] CreateAlreadyMarriedWindow(GameInfo gameInfo)
 {
     var waitState = StateFactory.GetState(GameStates.GameStates.Wait);
     gameInfo.CurrentPlayer.Cash += AnniversaryAmount;
     var alert = new Alert(gameInfo.Manager, String.Format("You are already married!\nCelebrate your anniversary and get ${0:N0}", AnniversaryAmount), "Celebrate your Anniversary", icon: "Images/AlertIcons/Married");
     alert.Closed += (sender, args) => WindowClosed(gameInfo, waitState);
     gameInfo.Manager.Add(alert);
     return new[] { waitState };
 }
        public override IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
        {
            var waitState = StateFactory.GetState(GameStates.GameStates.Wait);

            var alert = new Alert(gameInfo.Manager, "Lawsuit!\n\nChoose a player to sue by clicking on their vehicle!", "Sue Player", icon: "Images/AlertIcons/money");
            alert.Closed += (sender, args) => CreateDelegates(gameInfo, waitState);
            gameInfo.Manager.Add(alert);

            return new[] { waitState };
        }
        public override IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
        {
            gameInfo.CurrentPlayer.Cash += AddCash;

            var waitState = StateFactory.GetState(GameStates.GameStates.Wait);

            var alert = new Alert(gameInfo.Manager,
                String.Format(AddCash < 0 ? CashTileData.GetRandomBad() : CashTileData.GetRandomGood(), AddCash),
                "Cash Changed!",
                icon: "Images/AlertIcons/money");
            gameInfo.Manager.Add(alert);
            alert.Closed += (sender, obj) => gameInfo.Fsm.Remove(waitState);
            return new[] { waitState };
        }
 public override IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
 {
     var waitState = StateFactory.GetState(GameStates.GameStates.Wait);
     var alert = new Alert(gameInfo.Manager,
                           String.Format("You have just started University and \nmust pay ${0:N0} in fees.\nYou will need to pass your exam to start career", +Constants.GameRules.UniversityCost),
                           "Start University");
     var university = new ImageBox(gameInfo.Manager) { Image = gameInfo.Content.Load<Texture2D>("Images/AlertIcons/Graduated" + gameInfo.CurrentPlayer.Gender), Top = 15, Left = 10 };
     university.Init();
     university.Parent = alert;
     gameInfo.Manager.Add(alert);
     alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);
     gameInfo.CurrentPlayer.CareerType = CareerType.CollegeCareer;
     gameInfo.CurrentPlayer.Cash -= Constants.GameRules.UniversityCost;
     return new[] { waitState };
 }
        public IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
        {
            // Increase the age
            bool endWorld = gameInfo.IncreaseAgeCounter();

            var waitState = StateFactory.GetState(GameStates.Wait);
            var alert = new Alert(gameInfo.Manager, "You just spun a 10!\nThe world age increases!\n" + (endWorld ? "Retirement Age Reached!" : String.Empty),
                "World age increased",
                icon : Constants.ImageIcons.SpinToWin);
            gameInfo.Manager.Add(alert);
            alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);

            gameInfo.CreateMessage(endWorld ? "Retirement Age Reached!" : "The world age counter increases by 10!");
            return endWorld ? new[] { waitState, StateFactory.GetState(GameStates.EndGame) } : new[] { waitState };
        }
Beispiel #10
0
 public IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
 {
     var waitState = StateFactory.GetState(GameStates.Wait);
     var alert = new Alert(gameInfo.Manager,
         string.Format("{3} you are now in debt!\n" +
             "Your original loan was for ${0:N0}\n" +
             "But with current interest rates at {1}%" +
             "\nYou must pay back ${2:n0}", LoanRequired, Loan.CurrentInterestRate, Loan.Value * -1, Player.Name),
             "You required a loan", icon:
             "Images/AlertIcons/Wallet");
     alert.Init();
     alert.Closing += (sender, args) => gameInfo.Fsm.Remove(waitState);
     gameInfo.Manager.Add(alert);
     alert.SendToBack();
     return new[] { waitState };
 }
Beispiel #11
0
        public override IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
        {
            var waitState = StateFactory.GetState(GameStates.GameStates.Wait);

            if (gameInfo.CurrentPlayer.PromotionLevel < 3) {
                CreateMessage(gameInfo.Manager, gameInfo, waitState);
            } else {
                var alert = new Alert(gameInfo.Manager, "You are already at your highest salary range!",
                                 "Cannot get promotion", true);
                alert.Init();
                gameInfo.Manager.Add(alert);
                alert.Closed += (sender, args) => alertClosed(gameInfo, waitState);
            }

            return new[] { new PayDay(), waitState };
        }
        public IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
        {
            var waitState = StateFactory.GetState(GameStates.Wait);
            var alert = new Alert(gameInfo.Manager,
                "You have just spun a 1!\n" +
                "The world will now begin to change!\n\n" +
                "This will affect both house prices\n" +
                "And the logic in the world tiles!\n",
                "The world is going to change!", icon: Constants.ImageIcons.SpinToWin);
            gameInfo.Manager.Add(alert);
            alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);
            gameInfo.CreateMessage("The world is changing!");

            return new[] {
                    new FadeInWorld(_changeableNode.Concat(_houseNodes).Cast<WorldObject>().ToList()),
                    new ChangeWorldLogic(_changeableNode, _houseNodes),
                    new FadeOutWorld(_changeableNode.Concat(_houseNodes).Cast<WorldObject>().ToList()),
                    waitState
                };
        }
 private void CreateWorldEditor(String worldName, List<WorldObject> worldObjects)
 {
     if (worldObjects == null) {
         var alert = new Alert(ControlManager.Manager, "That world has become corrupt!\nPlease choose or create a different world", "Invalid world!");
         ControlManager.Add(alert);
     } else {
         ScreenManager.AddGameLayer(new WorldEditor(worldName, worldObjects), true);
         ScreenManager.HideScreen(this);
     }
 }
        private void PlayerClicked(Player clickedPlayer, Vector2 location, GameInfo gameInfo, IGameState waitState)
        {
            //Cash will be entered negative, so "minus-minus" for you,
            //"plus-minus for the player you sued"
            clickedPlayer.Cash += CashValue;
            gameInfo.CurrentPlayer.Cash -= CashValue;

            foreach (var player in gameInfo.PlayerList) {
                player.ListenMouseDown -= _clickPlayer;
                player.ListenMouseOver -= PlayerMouseIn;
                player.ListenMouseOut -= PlayerMouseOut;
                player.ResetColorState();
            }
            gameInfo.ClearTargets();

            //Alert will be appear to confirm you sued them
            var alert = new Alert(gameInfo.Manager, String.Format("You successfully sue {0}!", clickedPlayer.Name), String.Format("Sue {0}!", clickedPlayer.Name), icon : "Images/AlertIcons/Loan");
            gameInfo.Manager.Add(alert);
            alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);
        }
Beispiel #15
0
 private void CreateAlert(String message, String icon)
 {
     var alert = new Alert(ControlManager.Manager, message, icon: icon);
     EnableWorld(false);
     alert.Closed += (sender, args) => EnableWorld(true);
     ControlManager.Add(alert);
 }
Beispiel #16
0
 private void ForceTravel(Manager manager, GameInfo gameInfo, IGameState waitState)
 {
     // Tell the user they're about to travel!
     _confirmWindow = new Alert(manager,
         "You must now travel to a different island.\n"
         + "Click on the flashing travel icons to begin!", icon: "Images/AlertIcons/Travel");
     _confirmWindow.DenyButton.Click
         += (sender, args) => BeginTravel(gameInfo, waitState);
 }
Beispiel #17
0
 private void OfferTravel(Manager manager, GameInfo gameInfo, IGameState waitState)
 {
     // Create a window asking if the player wants to travel
     _confirmWindow = new ConfirmWindow(manager,
         String.Format("Do you want to travel to a different island?\n" +
                      "Travelling will earn you a new passport stamp\n" +
                      "Deciding to travel will end your current go\n"),
         "Travel to another island?", icon: "Images/AlertIcons/Travel");
     ((ConfirmWindow)_confirmWindow).AffirmButton.Click += (sender, args) => BeginTravel(gameInfo, waitState);
     _confirmWindow.DenyButton.Click
         += (sender, args) => { _confirmWindow.Close(); gameInfo.Fsm.Remove(waitState); };
 }
Beispiel #18
0
 private void HouseHasOwner(GameInfo gameInfo, IGameState waitState)
 {
     var alert = new Alert(gameInfo.Manager,
         String.Format("This house '{0}' is already owned by {1}",
         House.Name,
         (House == gameInfo.CurrentPlayer.House ? "you" : House.OwnerName)),
         "This house is not for sale"
     );
     alert.Closed += (sender, args) => CloseWindow(alert, gameInfo, waitState);
     gameInfo.Manager.Add(alert);
 }
Beispiel #19
0
 private void SellHouse(Player player, House house, Window window)
 {
     CloseMenuWindow();
     var alertString = String.Format("You just sold your house {0} for a price of ${1:N0}" +
                                     "\n\nYou made a profit of ${2:N0}",
                                     house.Name, house.Value, house.Value - house.PlayerBuyingValue);
     var alert = new Alert(ControlManager.Manager, alertString, "House Sold");
     ControlManager.Add(alert);
     player.Remove(house);
     alert.BringToFront();
     window.Enabled = false;
     alert.Closed += (sender, args) => window.Enabled = true;
 }
Beispiel #20
0
 private void PassExam(GameInfo gameInfo, IGameState waitState)
 {
     gameInfo.CurrentPlayer.PassedExam = true;
     gameInfo.Content.Load<SoundEffect>("Sounds/applause").Play();
     gameInfo.CurrentPlayer.CurrentlyTakingExam = false;
     var alert = new Alert(gameInfo.Manager, "You passed your exam! Start your career", title: "Congratulations! You passed your exam!", icon: "Images/AlertIcons/Graduated" + gameInfo.CurrentPlayer.Gender);
     alert.BringToFront();
     alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);
     gameInfo.Manager.Add(alert);
     gameInfo.Fsm.Push(new StartCareer());
     gameInfo.Fsm.Push(waitState);
 }
        private void CreateNewWorld(String worldName)
        {
            // Check the world doesn't already exist and isn't the default world name
            if (WorldNames.Contains(worldName) && worldName != Constants.Locations.DefaultWorldName) {
                var alert = new Alert(ControlManager.Manager, "Sorry a world with that name already exists!", "Can not create this world");
                ControlManager.Add(alert);
                return;
            } else if (worldName == string.Empty) {
                var alert = new Alert(ControlManager.Manager, "The world name can not be empty!", "Can not create this world");
                ControlManager.Add(alert);
                return;
            }

            WorldLoader.instance.LoadWorld(Constants.Locations.DefaultWorldPath, i => CreateWorldEditor(worldName, i));
        }
Beispiel #22
0
 private static void CloseWindow(Alert window, GameInfo gameInfo, IGameState waitState)
 {
     if (gameInfo.Fsm.Remove(waitState)) {
         window.Close();
     }
 }
Beispiel #23
0
        private void WorldReady(List<WorldObject> worldObjects, GameInfoLoader gameInfoLoader)
        {
            if (worldObjects == null) {
                var alert = new Alert(ControlManager.Manager, "That world has become corrupt!\nPlease choose or create a different world", "Invalid world!");
                ControlManager.Add(alert);
                return;
            }

            var playerList = new Player[_playerCount];
            var i = 0;
            foreach (var tabPage in _tabs.TabPages) {
                if (tabPage == _gameInfoTab) continue;
                var player = playerList[i] = _playerObjectEditors[tabPage].CreateInstance();
                player.Cash = Constants.GameRules.StartingCash;
                player.Gender =
                    Constants.DefaultPlayerInfo.NamesAndColors.First(tuple => tuple.Item2 == player.PlayerColor).Item3;
                player.InitializeContent(Content);
                // Give them their basic car transport
                player.SetTransport(TransportType.Car);
                i++;
            }

            var gameInfo = new GameInfo(worldObjects, playerList, gameInfoLoader.AgeCounterTarget, gameInfoLoader.GameRuleType);
            var level = new Level(gameInfo);
            ScreenManager.AddGameLayer(level);
            ScreenManager.SwapScreens(this, level);
        }
Beispiel #24
0
 private void RepayLoan(Player player, Loan loan, Window window)
 {
     Alert alert;
     if (player.Cash > -loan.Value) {
         player.Remove(loan);
         alert = new Alert(ControlManager.Manager, String.Format("You have successfully repaid your loan of ${0}", loan.Value), "Loan repaid", icon : "Images/AlertIcons/Loan");
     } else {
         alert = new Alert(ControlManager.Manager, "Sorry, you do not have enough funds to pay this loan back", "Loan Not Repaid");
     }
     ControlManager.Add(alert);
     alert.BringToFront();
     window.Enabled = false;
     alert.Closed += (sender, args) => window.Enabled = true;
 }