コード例 #1
0
 public void recruitTroops()
 {
     actionMenu = null;
     int nTroops = new Random().Next(30, 50);
     sourceCounty.troops += nTroops;
     if (playerNumber == 1)
     {
         funds -= 30;
     }
     else
     {
         unionFunds -= 30;
     }
     gpWindow = new TextWindow(new String[] {
         "RECRUITED " + nTroops + " TROOPS.\\n" +
         "TROOPS IN " + sourceCounty.name.ToUpper() + ": " + sourceCounty.troops}, Content, new Vector2(25, 25), new Vector2(600, 50));
     okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelRecruit }, 1, 1, "test-semifont.png", Content);
 }
コード例 #2
0
 public void selectAttackCounty()
 {
     actionMenu = null;
     gpWindow = new TextWindow(new string[] { "SELECT TARGET" }, Content, new Vector2(25,25), new Vector2(250,25));
     selectingForAttack = 1;
 }
コード例 #3
0
        public void handleInput()
        {
            if (okayButton != null)
            {
                inputHandler.update(Keyboard.GetState());
                okayButton.handleInput(inputHandler);
                return;
            }
            if (actionMenu != null)
            {
                inputHandler.update(Keyboard.GetState());
                actionMenu.handleInput(inputHandler);
                if (selectingForAttack != 0 || selectingForRecruitment || selectingForTroopTransfer != 0)
                {
                    return;
                }
            }
            if (beginningMenu != null)
            {
                inputHandler.update(Keyboard.GetState());
                beginningMenu.handleInput(inputHandler);
                return;
            }
            MouseState currentMouseState = Mouse.GetState();
            inputHandler.updateMouse(currentMouseState);
            if (inputHandler.allowSingleClick())
            {
                List<County> selectedCounties = new List<County>();
                foreach (County c in counties)
                {
                    if (c.mapRectangle.Contains(currentMouseState.Position))
                    {
                        selectedCounties.Add(c);
                    }
                }
                if (selectedCounties.Count > 0)
                {
                    County closestCenter = selectedCounties[0];
                    for (int x = 1; x < selectedCounties.Count; x++)
                    {
                        if (Sprite.getRectangleDistance(selectedCounties[x].mapRectangle.Center, currentMouseState.Position) <
                            Sprite.getRectangleDistance(closestCenter.mapRectangle.Center, currentMouseState.Position))
                        {
                            closestCenter = selectedCounties[x];
                        }
                    }
                    individualCounty = closestCenter;
                    icTextWindow = new TextWindow(new string[] {
                        individualCounty.name.ToUpper() + " COUNTY\\n" +
                        "REVENUE: " + individualCounty.revenue + "\\n" +
                        "STATIONED TROOPS: " + individualCounty.troops + "\\n" +
                        "OWNER: " + individualCounty.getOwner() },
                        Content, new Vector2(350,630), new Vector2(400, 115));
                    if (beginning)
                    {
                        beginningTextWindow.advanceLine();
                        beginningTextWindow = new TextWindow(
                            new string[] { "SELECT " + individualCounty.name.ToUpper() },
                            Content, new Vector2(25, 25), new Vector2(300, 25));
                        beginningMenu = new Menu(
                            new Vector2(100, 100),
                            new string[] { "YES", "NO" },
                            new Menu.menuAction[] { selectStartingCounty, cancelStartingCounty },
                            2, 1, "test-semifont.png", Content);
                    }
                    else if (selectingForAttack == 1)
                    {
                        targetCounty = individualCounty;
                        selectingForAttack = 2;
                        gpWindow = new TextWindow(new string[] { "SELECT INVADING COUNTY" }, Content, new Vector2(25, 25), new Vector2(360, 25));
                    }
                    else if (selectingForAttack == 2)
                    {
                        sourceCounty = individualCounty;
                        bool adjacent = false;
                        for (int x = 0; x < sourceCounty.edges.Length; x++)
                        {
                            if (targetCounty == counties[sourceCounty.edges[x]])
                            {
                                adjacent = true;
                                break;
                            }
                        }
                        int playerFunds = funds;
                        if (playerNumber == 2) playerFunds = unionFunds;
                        if (sourceCounty.occupied != playerNumber)
                        {
                            gpWindow = new TextWindow(new String[] { "SOURCE COUNTY IS NOT YOURS" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelAttack }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (targetCounty.occupied == playerNumber)
                        {
                            gpWindow = new TextWindow(new String[] { "TARGET COUNTY IS ALREADY YOURS" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelAttack }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (!adjacent)
                        {
                            gpWindow = new TextWindow(new String[] { "TARGET COUNTY TOO FAR AWAY" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelAttack }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (playerFunds - (sourceCounty.troops / 2) < 0)
                        {
                            gpWindow = new TextWindow(new String[] { "NOT ENOUGH FUNDS  REQUIRED: " + (sourceCounty.troops / 2) }, Content, new Vector2(25, 25), new Vector2(650, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelAttack }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        selectingForAttack = 3;
                        int cost = sourceCounty.troops / 2;
                        gpWindow = new TextWindow(new string[] { "ATTACK " + targetCounty.name.ToUpper() + " FROM " + sourceCounty.name.ToUpper() + "\\nCOST: " + cost },
                            Content, new Vector2(25, 25), new Vector2(650, 50));
                        actionMenu = new Menu(
                            new Vector2(100, 100),
                            new string[] { "YES", "NO" },
                            new Menu.menuAction[] { attackCounty, cancelAttack },
                            2, 1, "test-semifont.png", Content);
                    }
                    else if (selectingForTroopTransfer == 1)
                    {
                        targetCounty = individualCounty;
                        selectingForTroopTransfer = 2;
                        gpWindow = new TextWindow(new string[] { "SELECT DONOR" }, Content, new Vector2(25, 25), new Vector2(360, 25));
                    }
                    else if (selectingForTroopTransfer == 2)
                    {
                        sourceCounty = individualCounty;
                        int playerFunds = funds;
                        if (playerNumber == 2) playerFunds = unionFunds;
                        bool connected = false;
                        List<County> visited = new List<County>();
                        Stack<County> DFSstack = new Stack<County>();
                        DFSstack.Push(sourceCounty);
                        while (DFSstack.Count != 0)
                        {
                            County chk = DFSstack.Pop();
                            if (chk == targetCounty && chk.occupied == playerNumber)
                            {
                                connected = true;
                                break;
                            }
                            else if (visited.Contains(chk))
                            {
                                continue;
                            }
                            for (int x = 0; x < chk.edges.Length; x++)
                            {
                                if (counties[chk.edges[x]].occupied == playerNumber) DFSstack.Push(counties[chk.edges[x]]);
                            }
                            visited.Add(chk);
                        }

                        if (sourceCounty.occupied != playerNumber)
                        {
                            gpWindow = new TextWindow(new String[] { "SOURCE COUNTY NOT YOURS" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelTroopMove }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (targetCounty.occupied != playerNumber)
                        {
                            gpWindow = new TextWindow(new String[] { "RECIPIENT COUNTY NOT YOURS" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelTroopMove }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (targetCounty == sourceCounty)
                        {
                            gpWindow = new TextWindow(new String[] { "THAT IS POINTLESS" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelTroopMove }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (!connected)
                        {
                            gpWindow = new TextWindow(new String[] { "NO ROUTE FROM SOURCE TO RECIPIENT" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelTroopMove }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (playerFunds - 90 < 0)
                        {
                            gpWindow = new TextWindow(new String[] { "NOT ENOUGH FUNDS  REQUIRED: 90" }, Content, new Vector2(25, 25), new Vector2(650, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelTroopMove }, 1, 1, "test-semifont.png", Content);
                            return;
                        }

                        selectingForTroopTransfer = 3;
                        gpWindow = new TextWindow(new string[] { "MOVE " + (sourceCounty.troops/3) + " FROM " +
                            sourceCounty.name.ToUpper() + " TO " + targetCounty.name.ToUpper() + "\\n" +
                            "COST: 90"},
                            Content, new Vector2(25, 25), new Vector2(650, 50));
                        actionMenu = new Menu(
                            new Vector2(100, 100),
                            new string[] { "YES", "NO" },
                            new Menu.menuAction[] { moveTroops, cancelTroopMove },
                            2, 1, "test-semifont.png", Content);
                    }
                    else if (selectingForRecruitment)
                    {
                        sourceCounty = individualCounty;
                        int playerFunds = funds;
                        if (playerNumber == 2) playerFunds = unionFunds;
                        if (sourceCounty.occupied != playerNumber)
                        {
                            gpWindow = new TextWindow(new String[] { "COUNTY NOT YOURS" }, Content, new Vector2(25, 25), new Vector2(500, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelRecruit }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        else if (playerFunds - 30 < 0)
                        {
                            gpWindow = new TextWindow(new String[] { "NOT ENOUGH FUNDS    REQUIRED: 30" }, Content, new Vector2(25, 25), new Vector2(650, 25));
                            okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelRecruit }, 1, 1, "test-semifont.png", Content);
                            return;
                        }
                        int cost = 30;
                        gpWindow = new TextWindow(new string[] { "RECRUIT TROOPS IN " + sourceCounty.name.ToUpper() + "\\nCOST: " + cost },
                            Content, new Vector2(25, 25), new Vector2(500, 50));
                        actionMenu = new Menu(
                            new Vector2(100, 100),
                            new string[] { "YES", "NO" },
                            new Menu.menuAction[] { recruitTroops, cancelRecruit },
                            2, 1, "test-semifont.png", Content);

                    }

                }

            }
        }
コード例 #4
0
 public void moveTroops()
 {
     if (playerNumber == 1)
     {
         funds -= 90;
     }
     else
     {
         Console.WriteLine("Subtracting union funds");
         unionFunds -= 90;
     }
     actionMenu = null;
     int troopsToMove = (int)(sourceCounty.troops / 3);
     sourceCounty.troops -= troopsToMove;
     targetCounty.troops += troopsToMove;
     gpWindow = new TextWindow(new String[] {
         "TROOPS IN " + sourceCounty.name.ToUpper() + ": " + sourceCounty.troops + "\\n" +
         "TROOPS IN " + targetCounty.name.ToUpper() + ": " + targetCounty.troops }, Content, new Vector2(25, 25), new Vector2(600, 50));
     okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelTroopMove }, 1, 1, "test-semifont.png", Content);
     int playerFunds = funds;
     if (playerNumber == 2) playerFunds = unionFunds;
     revWindow = new TextWindow(new string[] { playerNames[playerNumber] + "\\nWEEK " + week + "\\nFUNDS: " + playerFunds + "\\nREVENUE: " + revenue },
         Content, new Vector2(500, 100), new Vector2(225, 100), 1.0);
 }
コード例 #5
0
 private void showCredits()
 {
     m = null;
     tw = new TextWindow(new string[] { "DEVELOPED BY\\n\\2ANDREW BARRY" }, Content, new Vector2(25,25), new Vector2(200,50));
 }
コード例 #6
0
 public void startWeek()
 {
     if (playerNumber == 1)
     {
         ++week;
         unionFunds += unionRevenue;
         funds += revenue;
         revWindow = new TextWindow(new string[] { playerNames[playerNumber] + "\\nWEEK " + week + "\\nFUNDS: " + funds + "\\nREVENUE: " + revenue },
            Content, new Vector2(500, 100), new Vector2(225, 100), 1.0);
     }
     else
     {
         revWindow = new TextWindow(new string[] { playerNames[playerNumber] + "\\nWEEK " + week + "\\nFUNDS: " + unionFunds + "\\nREVENUE: " + unionRevenue },
             Content, new Vector2(500, 100), new Vector2(225, 100), 1.0);
     }
     actionMenu = new Menu(
         new Vector2(500, 225),
         new string[] { "ATTACK", "MOVE TROOPS", "RECRUIT", "END WEEK" },
         new Menu.menuAction[] { selectAttackCounty, startTroopMove, startRecruit, endWeek },
         4, 1, "test-semifont.png", Content);
 }
コード例 #7
0
 public void doDefeat()
 {
     gpWindow = new TextWindow(new string[] { "YOU WERE DEFEATED BY UNIONS\\nBETTER LUCK NEXT TIME" },
         Content, new Vector2(25, 25), new Vector2(600, 50));
     okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { returnToMainMenu }, 1, 1, "test-semifont.png", Content);
 }
コード例 #8
0
 private void showControls()
 {
     m = null;
     tw = new TextWindow(new string[] { "\\3WASD\\0 - Move. \\3Space+WASD\\0 - Drill in direction.\\n\\3ESC\\0 - Self-destruct. \\3Enter\\0 - Enter shop." }, Content, new Vector2(150, 125), new Vector2(570, 50));
 }
コード例 #9
0
 public void cancelStartingCounty()
 {
     beginningMenu = null;
     beginningTextWindow = new TextWindow(new String[] { playerNames[beginningSelector] + " SELECT A COUNTY" },
         Content, new Vector2(25, 25), new Vector2(500, 25));
     return;
 }
コード例 #10
0
 public void cancelTroopMove()
 {
     selectingForTroopTransfer = 0;
     gpWindow = null;
     okayButton = null;
     actionMenu = new Menu(
         new Vector2(500, 225),
         new string[] { "ATTACK", "MOVE TROOPS", "RECRUIT", "END WEEK" },
         new Menu.menuAction[] { selectAttackCounty, startTroopMove, startRecruit, endWeek },
         4, 1, "test-semifont.png", Content);
     updateGameLabels();
 }
コード例 #11
0
 public void cancelRecruit()
 {
     selectingForRecruitment = false;
     okayButton = null;
     gpWindow = null;
     actionMenu = new Menu(
         new Vector2(500, 225),
         new string[] { "ATTACK", "MOVE TROOPS", "RECRUIT", "END WEEK" },
         new Menu.menuAction[] { selectAttackCounty, startTroopMove, startRecruit, endWeek },
         4, 1, "test-semifont.png", Content);
     int playerFunds = funds;
     if (playerNumber == 2) playerFunds = unionFunds;
     revWindow = new TextWindow(new string[] { playerNames[playerNumber] + "\\nWEEK " + week + "\\nFUNDS: " + playerFunds + "\\nREVENUE: " + revenue },
         Content, new Vector2(500, 100), new Vector2(225, 100), 1.0);
     updateGameLabels();
 }
コード例 #12
0
 public void attackCounty()
 {
     actionMenu = null;
     if (playerNumber == 1)
     {
         funds -= sourceCounty.troops / 2;
     }
     else
     {
         unionFunds -= sourceCounty.troops / 2;
     }
     if (targetCounty.occupied == 0)
     {
         takeCounty(targetCounty, playerNumber);
         ownedCounties++;
         Console.WriteLine(ownedCounties);
         if (checkWinner() == playerNumber)
         {
             doVictory(playerNumber);
             return;
         }
         cancelAttack();
         return;
     }
     Random ra = new Random();
     int sourceOdds = 50 * (sourceCounty.troops / targetCounty.troops);
     int targetOdds = 50 * (targetCounty.troops / sourceCounty.troops);
     int loss = 0;
     int gain = 0;
     for (int x = 0; x < 500; x++)
     {
         int sourceCheck = ra.Next(0, 100);
         if (sourceCheck > sourceOdds)
         {
             sourceCounty.troops--;
             loss++;
             if (sourceCounty.troops == 0)
             {
                 break;
             }
         }
         int targetCheck = ra.Next(0, 100);
         if (targetCheck > targetOdds)
         {
             targetCounty.troops--;
             gain++;
             if (targetCounty.troops == 0)
             {
                 break;
             }
         }
     }
     if (sourceCounty.troops <= 0)
     {
         takeCounty(sourceCounty, enemyNumber);
         sourceCounty.troops = targetCounty.troops / 3;
         targetCounty.troops -= (targetCounty.troops / 3);
         if (checkWinner() == enemyNumber)
         {
             doVictory(enemyNumber);
             return;
         }
     }
     else if (targetCounty.troops <= 0)
     {
         takeCounty(targetCounty, playerNumber);
         targetCounty.troops = sourceCounty.troops / 3;
         sourceCounty.troops -= (sourceCounty.troops / 3);
         Console.WriteLine(ownedCounties);
         if (checkWinner() == playerNumber)
         {
             doVictory(playerNumber);
             return;
         }
     }
     gpWindow = new TextWindow(new String[] { "KILLED: " + gain + " LOST: " + loss }, Content, new Vector2(25, 25), new Vector2(500, 25));
     okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { cancelAttack }, 1, 1, "test-semifont.png", Content);
 }
コード例 #13
0
 public void updateGameLabels()
 {
     for (int z = 0; z < 21; z++)
     {
         troopLabels[z] = new TextWindow(new string[] { "\\5" + counties[z].troops }, Content,
             new Vector2(counties[z].mapRectangle.Center.X, counties[z].mapRectangle.Center.Y) + labelOffsets[z], new Vector2(0,0), 0.1, 0);
         troopLabels[z].update(1);
         troopLabels[z].update(1);
         troopLabels[z].update(1);
         troopLabels[z].update(1);
     }
 }
コード例 #14
0
        public void selectStartingCounty()
        {
            beginningMenu = null;
            if (individualCounty.occupied == 0)
            {
                takeCounty(individualCounty, beginningSelector);
            }
            else
            {
                cancelStartingCounty();
                return;
            }

            if (multiPlayer && beginningSelector != 2)
            {
                beginningSelector = 2;
                beginningTextWindow = new TextWindow(new String[] { playerNames[2] + " SELECT A COUNTY" },
                    Content, new Vector2(25, 25), new Vector2(500, 25));
            }
            else if (multiPlayer && beginningSelector == 2)
            {
                playerNumber = 1;
                beginning = false;
                beginningTextWindow = null;
                beginningMenu = null;
                individualCounty = null;
                icTextWindow = null;
                startWeek();
            }
            else
            {
                beginning = false;
                beginningTextWindow = null;
                beginningMenu = null;
                individualCounty = null;
                icTextWindow = null;
                int oCo = 0;
                while (oCo != 1)
                {
                    Random ra = new Random();
                    int toFill = ra.Next(0, counties.Length);
                    if (counties[toFill].occupied == 0)
                    {
                        takeCounty(counties[toFill], 2);
                        counties[toFill].occupied = 2;
                        oCo++;
                    }
                }
                startWeek();
            }

            return;
        }
コード例 #15
0
 public void doVictory(int winnerNumber)
 {
     actionMenu = null;
     string winnerString = "SOMEONE HAS WON"; // lol
     if (winnerNumber == 1)
     {
         winnerString = "\\2C\\1H\\2R\\1I\\2S\\1T\\2I\\1E \\2I\\1S \\2V\\1I\\2C\\1T\\2O\\1R\\2I\\1O\\2U\\1S\\n\\0NOW RUN FOR PRESIDENT";
     }
     else
     {
         winnerString = "\\2U\\1N\\2I\\1O\\2N\\1S \\2A\\1R\\2E \\1V\\2I\\1C\\2T\\1O\\2R\\1I\\2O\\1U\\2S\\n\\0CHRISTIE REMOVED FROM OFFICE";
     }
     gpWindow = new TextWindow(new string[] { winnerString },
         Content, new Vector2(25, 25), new Vector2(600, 50));
     okayButton = new Menu(new Vector2(700, 25), new string[] { "OK" }, new Menu.menuAction[] { returnToMainMenu }, 1, 1, "test-semifont.png", Content);
 }
コード例 #16
0
 public void startRecruit()
 {
     actionMenu = null;
     gpWindow = new TextWindow(new String[] { "SELECT A COUNTY" }, Content, new Vector2(25, 25), new Vector2(250, 25));
     selectingForRecruitment = true;
 }
コード例 #17
0
        public GameStateMap(ContentManager c, Game1 g, int nP)
        {
            Content = c;
            game = g;

            week = 0;
            revenue = 0;
            unionRevenue = 0;
            funds = 0;
            unionFunds = 0;
            ownedCounties = 1;

            multiPlayer = (nP == 2);
            playerNumber = 1;
            enemyNumber = 2;

            selectingForAttack = 0;
            selectingForTroopTransfer = 0;
            selectingForRecruitment = false;

            actionMenu = null;
            gpWindow = null;

            playerNames = new string[] { "\\0UNOCCUPIED", "\\3CHRISTIE\\0", "\\4UNION\\0" };

            beginning = true;
            beginningSelector = 1;
            beginningTextWindow = new TextWindow(new String[] { playerNames[1] + " SELECT A COUNTY" },
                Content, new Vector2(25, 25), new Vector2(500, 25));

            inputHandler = new InputHandler();

            countyNames = new string[] {
                "Atlantic", "Bergen", "Burlington", "Camden", "Cape May", "Cumberland", "Essex",
                "Gloucester", "Hudson", "Hunterdon", "Mercer", "Middlesex", "Monmouth","Morris",
                "Ocean", "Passaic", "Salem", "Somerset", "Sussex", "Union", "Warren"};
            countyRevenues = new int[]
            { 27,42,34,29,33,21,31,31,31,48,36,33,40,47,29,26,27,47,35,34,32 };
            countyPopulations = new int[]
            { 274,905,448,513,97,156,783,288,634,128,366,809,630,492,576,501,66,323,149,536,108 };

            countyGraph = new int[][]
            {
                new int[] {2,3,4,5,7}, // Atlantic
                new int[] {6,8,15}, // Bergen
                new int[] {10,12,0,3,14}, // Burlington
                new int[] {0,2,7}, // Camden
                new int[] {0,5}, // Cape May
                new int[] {4,0,16,7}, // Cumberland
                new int[] {1,8,15,19,13}, // Essex
                new int[] {16,3,5,0}, // Gloucester
                new int[] {1,6}, // Hudson
                new int[] {20,13,17,10}, // Hunterdon
                new int[] {9,17,11,12,2}, // Mercer
                new int[] {19,17,10,12}, // Middlesex
                new int[] {10,11,2,14}, // Monmouth
                new int[] {18,15,6,19,17,9,20}, // Morris
                new int[] {12,2}, // Ocean
                new int[] {13,6,1,18}, // Passaic
                new int[] {7,5}, // Salem
                new int[] {13, 19, 11, 10, 9}, // Somerset
                new int[] {15,13,20}, // Sussex
                new int[] {6,13,17,11}, // Union
                new int[] {18,13,9} // Warren
            };

            labelOffsets = new Vector2[]
            {
                new Vector2(-30,0), // Atlantic
                new Vector2(-10,-10), // Bergen
                new Vector2(-15,-20), // Burlington
                new Vector2(-120, -70), // Camden
                new Vector2(30, 0), // Cape May
                new Vector2(0,0), // Cumberland
                new Vector2(-23, -20), // Essex
                new Vector2(-30, -20), // Gloucester
                new Vector2(10, -10), // Hudson
                new Vector2(-20, -20), // Hunterdon
                new Vector2(-30, -10), // Mercer
                new Vector2(-40, 0), // Middlesex
                new Vector2(0, -5), // Monmouth
                new Vector2(-20, -5), // Morris
                new Vector2(-40, -40), // Ocean
                new Vector2(0, -70), // Passaic
                new Vector2(-40, -35), // Salem
                new Vector2(-30, 0), // Somerset
                new Vector2(-40, -20), // Sussex
                new Vector2(30, 5), // Union
                new Vector2(-100, -10) // Warren
            };

            counties = new County[countyNames.Length];
            individualCounty = null;
            icTextWindow = null;

            int x = 0;
            foreach (string co in countyNames) // load county sprites
            {
                Sprite s = new Sprite(co + ".png", Content, new Vector2(650, 600));
                s.position = new Vector2(650 - s.boundingRectangle.Width, 600 - s.boundingRectangle.Height);
                Sprite sfull = new Sprite(co + "-full.png", Content, new Vector2(0, 0));
                counties[x] = new County(co, s, sfull, countyRevenues[x], countyPopulations[x], countyGraph[x++]);
            }

            troopLabels = new TextWindow[21];
            updateGameLabels();
        }
コード例 #18
0
 private void showCredits()
 {
     m = null;
     tw = new TextWindow(new string[] { "DEVELOPED BY\\n\\2ANDREW BARRY","MARS PHOTOS:\\n\\2NASA" }, Content, new Vector2(150,125), new Vector2(200,50));
 }
コード例 #19
0
 public void endWeek()
 {
     revWindow = null;
     actionMenu = null;
     if (!multiPlayer)
     {
         doEnemyTurn();
     }
     else
     {
         int temp = playerNumber;
         playerNumber = enemyNumber;
         enemyNumber = temp;
     }
     updateGameLabels();
     startWeek();
 }
コード例 #20
0
        public void handleInput()
        {
            inputHandler.update (Keyboard.GetState ());

            if (m != null)
            {
                m.handleInput(inputHandler);
            }

            else if (inputHandler.allowSinglePress(Keys.Down) && buttonCursor != 2) {
                buttons [buttonCursor].animHandler.setAnimation (0,false);
                buttonCursor++;
                buttons [buttonCursor].animHandler.setAnimation (1,false);
            }
            else if (inputHandler.allowSinglePress(Keys.Up) && buttonCursor != 0) {
                buttons [buttonCursor].animHandler.setAnimation(0,false);
                buttonCursor--;
                buttons[buttonCursor].animHandler.setAnimation(1,false);
            }

            if (inputHandler.allowSinglePress(Keys.Enter) && tw != null)
            {
                if (tw != null)
                {
                    if (tw.waitingForContinue)
                    {
                        tw.advanceLine();
                    }
                    else
                    {
                        tw.fastForward();
                    }
                    if (tw.done)
                    {
                        tw = null;
                        m = new Menu(new Vector2(10, 10), new String[] { "NEW GAME", "CREDITS", "QUIT" }, new Menu.menuAction[] { playerCount, showCredits, quitGame }, 3, 1, "test-semifont.png", Content);
                    }
                }
            }
        }
コード例 #21
0
 public void startTroopMove()
 {
     actionMenu = null;
     gpWindow = new TextWindow(new string[] { "SELECT RECIPIENT" }, Content, new Vector2(25, 25), new Vector2(300, 25));
     selectingForTroopTransfer = 1;
 }