Example #1
0
        //Checks how a player with neighbours west and east would have to spend in order to meet the given cost
        //Returns -1 if the player cannot possibly build the card (including if his neighbours have the required
        //resources, but he cannot afford to purchase them)
        //Returns 0 if the player has all of the required resources and does not need to purchase any
        //Otherwise, returns the total number of coins it would cost the player at minimum to purchase the
        //required resources to meet the cost
        public static int constructCost(Player player, Player west, Player east, Dictionary<Resource, int> cost)
        {
            //check if cost is in coins
            if (cost.ContainsKey(Resource.COIN))
                return (cost[Resource.COIN] > player.getResourceNum(Resource.COIN)) ? -1 : cost[Resource.COIN];
            //split the cost into raw and manufactured goods to deal with them separately, as they do not affect each other
            Dictionary<Resource, int> rawCost = new Dictionary<Resource, int>();
            foreach (Resource r in rawGoods)
                if (cost.ContainsKey(r)) rawCost.Add(r, cost[r]);
            Dictionary<Resource, int> manCost = new Dictionary<Resource, int>();
            foreach (Resource r in manGoods)
                if (cost.ContainsKey(r)) manCost.Add(r, cost[r]);
            //get resource lists
            List<List<Resource>> playerRaw = buildResourceList(player, rawGoods, true);
            List<List<Resource>> playerMan = buildResourceList(player, manGoods, true);
            List<List<Resource>> eastRaw = buildResourceList(east, rawGoods, false);
            List<List<Resource>> westRaw = buildResourceList(west, rawGoods, false);
            List<List<Resource>> neighbourMan = buildResourceList(east, manGoods, false);
            neighbourMan.AddRange(buildResourceList(west, manGoods, false));
            //calculate cost of manufactured goods
            int numManPurchased = countPurchases(manCost, playerMan, neighbourMan);
            int totalCoinCost = numManPurchased * player.mcost;
            //calculate cost of raw goods
            if (player.rcostEast == player.rcostWest)
            {
                //All neighbour resources can be grouped together, since they cost the same amount
                List<List<Resource>> neighbourRaw = eastRaw;
                neighbourRaw.AddRange(westRaw);
                int numRawPurchased = countPurchases(rawCost, playerRaw, neighbourRaw);
                totalCoinCost += numRawPurchased * player.rcostWest;
            }
            else
            {
                //east and west neighbour resorces must be considered separately, as they cost different amounts
                //countPurchases() will return the coin cost, not just the number of resources purchased
                int numRawPurchased;
                if (player.rcostEast < player.rcostWest)
                    numRawPurchased = countPurchases(rawCost, playerRaw, eastRaw, westRaw);
                else
                    numRawPurchased = countPurchases(rawCost, playerRaw, westRaw, eastRaw);
                totalCoinCost += numRawPurchased;
            }

            return totalCoinCost>player.getResourceNum(Resource.COIN)?-1:totalCoinCost;
        }
Example #2
0
 //OLD CODE
 //Returns the part of the given cost that the player cannot meet with his own single resources
 //Does not consider the player's resource choices
 private static Dictionary<Resource, int> outsourcedCosts(Player player, Dictionary<Resource, int> cost, List<List<Resource>> remainingPlayerChoices, bool self)
 {
     Dictionary<Resource, int> remaining = new Dictionary<Resource, int>();
     Dictionary<Resource, int> coveredByChoices = new Dictionary<Resource, int>(); //Costs that are covered by choices (each item in here is the only relevant application of the choice used)
     foreach (Resource r in cost.Keys) coveredByChoices.Add(r, 0);
     if (remainingPlayerChoices != null)
     {
         foreach (List<Resource> choice in self ? player.getTotalChoices() : player.getPublicChoices())
         {
             int numRelevant = 0;
             Resource coveredResource = Resource.COIN;
             foreach (Resource r in choice)
                 if (cost.ContainsKey(r))
                 {
                     numRelevant++;
                     coveredResource = r;
                 }
             if (numRelevant == 1)
                 coveredByChoices[coveredResource]++;
             else
                 remainingPlayerChoices.Add(choice);
         }
     }
     foreach (Resource r in cost.Keys)
     {
         if (cost[r] > player.getResourceNum(r) + coveredByChoices[r] && r != Resource.COIN)
             remaining.Add(r, cost[r] - player.getResourceNum(r));
     }
     return remaining;
 }
Example #3
0
        public TradeInterface()
            : base("bg", new Vector2(Game1.WIDTH / 3, Game1.HEIGHT / 6), Game1.WIDTH * 2 / 3, Game1.HEIGHT * 2 / 3)
        {
            CARDHEIGHT = height - MARGIN * 2;
            CARDWIDTH = (int) (CARDHEIGHT / CARDRATIO) - MARGIN * 2;
            SECTIONWIDTH = (width - MARGIN * 4) / 3;
            RSIZE = (int)(height * 0.054f);

            self = Game1.client.getSelf();
            west = Game1.client.westPlayer(self);
            east = Game1.client.eastPlayer(self);

            visuals1 = new Dictionary<string, Visual>();
            trade = new Dictionary<string, Visual>();
            requirements = new Dictionary<Visual, Resource>();
            selfChoices = new List<TradeChoice>();
            eastChoices = new List<TradeChoice>();
            westChoices = new List<TradeChoice>();

            card = new Visual(new Vector2(pos.X + MARGIN, pos.Y + MARGIN), CARDWIDTH, CARDHEIGHT, null);
            buildCard = new Button(new Vector2(pos.X + width - 150, pos.Y + MARGIN + height * 0 / 4), 100, 50, "Card", "Font1");
            buildStage = new Button(new Vector2(pos.X + width - 150, pos.Y + MARGIN * 2 + height * 1 / 4), 100, 50, "Stage", "Font1");
            sellCard = new Button(new Vector2(pos.X + width - 150, pos.Y + MARGIN * 3 + height * 2 / 4), 100, 50, "Sell", "Font1");
            close = new Button(new Vector2(pos.X + width - 150, pos.Y + MARGIN * 4 + height * 3 / 4), 100, 50, "Close", "Font1");

            back = new Button(new Vector2(pos.X + width / 5, pos.Y + height * 9 / 10), 100, 40, "Back", "Font1");
            build = new Button(new Vector2(pos.X + width * 3 / 5, pos.Y + height * 9 / 10), 100, 40, "Build", "Font1");

            visuals1.Add("buildcard", buildCard);
            visuals1.Add("buildstage", buildStage);
            visuals1.Add("sellCard", sellCard);
            visuals1.Add("card", card);
            visuals1.Add("close", close);

            trade.Add("discount", new Visual(new Vector2(pos.X + MARGIN * 2, pos.Y + MARGIN), "Requirements:", "Font1", Color.Black));
            trade.Add("costborder", new Visual(new Vector2(pos.X + MARGIN - 1, pos.Y + MARGIN - 1), SECTIONWIDTH + 2, (int)(RSIZE * 2.5f) + 2, "border").setBorder(false));
            trade.Add("label1", new Visual(new Vector2(pos.X + MARGIN * 2, pos.Y + (int)(RSIZE * 2.5) + MARGIN * 2), "West", "Font1", Color.Black));
            trade.Add("border1", new Visual(new Vector2(pos.X + MARGIN - 1, pos.Y + (int)(RSIZE * 2.5) + MARGIN * 2 - 1), SECTIONWIDTH + 2, (int)(RSIZE * 1.5f) + 2, "border").setBorder(false));
            trade.Add("label2", new Visual(new Vector2(pos.X + SECTIONWIDTH + MARGIN * 3, pos.Y + (int)(RSIZE * 2.5) + MARGIN * 2), "Self", "Font1", Color.Black));
            trade.Add("border2", new Visual(new Vector2(pos.X + SECTIONWIDTH + MARGIN * 2 - 1, pos.Y + (int)(RSIZE * 2.5) + MARGIN * 2 - 1), SECTIONWIDTH + 2, (int)(RSIZE * 1.5f) + 2, "border").setBorder(false));
            trade.Add("label3", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 2 + MARGIN * 2, pos.Y + (int)(RSIZE * 2.5) + MARGIN * 2), "East", "Font1", Color.Black));
            trade.Add("border3", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 2 + MARGIN - 1, pos.Y + (int)(RSIZE * 2.5) + MARGIN * 2 - 1), SECTIONWIDTH + 2, (int)(RSIZE * 1.5f) + 2, "border").setBorder(false));

            trade.Add("border4", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 0 + MARGIN - 1, pos.Y + RSIZE * 4 + MARGIN * 3 - 1), SECTIONWIDTH + 2, RSIZE * 6 + 2, "border").setBorder(false));
            trade.Add("border5", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 1 + MARGIN - 1, pos.Y + RSIZE * 4 + MARGIN * 3 - 1), SECTIONWIDTH + 2, RSIZE * 9 + 2, "border").setBorder(false));
            trade.Add("border6", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 2 + MARGIN - 1, pos.Y + RSIZE * 4 + MARGIN * 3 - 1), SECTIONWIDTH + 2, RSIZE * 6 + 2, "border").setBorder(false));

            trade.Add("border7", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 0 + MARGIN - 1, pos.Y + RSIZE * 10 + MARGIN * 3 - 1), SECTIONWIDTH + 2, RSIZE * 3 + 2, "border").setBorder(false));
            trade.Add("border8", new Visual(new Vector2(pos.X + (SECTIONWIDTH + MARGIN) * 2 + MARGIN - 1, pos.Y + RSIZE * 10 + MARGIN * 3 - 1), SECTIONWIDTH + 2, RSIZE * 3 + 2, "border").setBorder(false));

            westHelpers = new Dictionary<Resource, TradeHelper>();
            eastHelpers = new Dictionary<Resource, TradeHelper>();
            foreach (Resource r in Enum.GetValues(typeof(Resource))){
                if (r != Resource.COIN)
                {
                    westHelpers.Add(r, new TradeHelper(r, 3, new Vector2(pos.X + MARGIN * 2, pos.Y + ((int)r + 4) * RSIZE + MARGIN * 3)));
                    eastHelpers.Add(r, new TradeHelper(r, 3, new Vector2(pos.X + SECTIONWIDTH * 2 + MARGIN * 4, pos.Y + ((int)r + 4) * RSIZE + MARGIN * 3)));
                }

            }

            trade.Add("back", back);
            trade.Add("build", build);

            trade.Add("rwest", new Visual(new Vector2(pos.X + width * 1 / 3 + MARGIN, pos.Y + MARGIN), 110, 45, "rwest"));
            trade.Add("reast", new Visual(new Vector2(pos.X + width * 1 / 3 + MARGIN, pos.Y + MARGIN), 110, 45, "reast"));
            trade.Add("rboth", new Visual(new Vector2(pos.X + width * 1 / 3 + MARGIN, pos.Y + MARGIN), 110, 45, "rboth"));
            trade.Add("mboth", new Visual(new Vector2(pos.X + width * 2 / 3 + MARGIN * 2, pos.Y + MARGIN), 110, 45, "mboth"));

            trade.Add("westCoin", new Visual(new Vector2(pos.X + SECTIONWIDTH/3 + MARGIN - 1, pos.Y + (int)(RSIZE * 13) + MARGIN * 5 - 1), RSIZE * 2, RSIZE * 2, westCoin.ToString(), "Font1", Color.Black, Color.White, "coin", Game1.HEIGHT / 70).setBorder(false));
            trade.Add("selfCoin", new Visual(new Vector2(pos.X + SECTIONWIDTH / 3 + (SECTIONWIDTH + MARGIN) * 1 + MARGIN - 1, pos.Y + (int)(RSIZE * 13) + MARGIN * 5 - 1), RSIZE * 2, RSIZE * 2, (self.getResourceNum(Resource.COIN) - westCoin - eastCoin).ToString(), "Font1", Color.Black, Color.White, "coin", Game1.HEIGHT / 70).setBorder(false));
            trade.Add("eastCoin", new Visual(new Vector2(pos.X + SECTIONWIDTH / 3 + (SECTIONWIDTH + MARGIN) * 2 + MARGIN - 1, pos.Y + (int)(RSIZE * 13) + MARGIN * 5 - 1), RSIZE * 2, RSIZE * 2, eastCoin.ToString(), "Font1", Color.Black, Color.White, "coin", Game1.HEIGHT / 70).setBorder(false));

            for (int i = 0; i < 7; i++)
            {
                requirements.Add(new Visual(new Vector2(pos.X + MARGIN * 2 + RSIZE * i, pos.Y + MARGIN + 30), RSIZE, RSIZE, null).setVisible(false), Resource.CLAY);
            }

            activeVisuals = visuals1;
            hideTrade();
        }
Example #4
0
        private void Initialize()
        {
            lock (this)
            {
                if (init) return;
                trade = new TradeInterface();
                player = Game1.client.getSelf();
                int westSeat = (player.getSeat() - 1 < 0) ? Game1.client.getState().getPlayers().Count - 1 : player.getSeat() - 1;
                int eastSeat = (player.getSeat() + 1 > Game1.client.getState().getPlayers().Count - 1) ? 0 : player.getSeat() + 1;
                east = Game1.client.getState().getPlayers().Values.ElementAt(eastSeat);
                west = Game1.client.getState().getPlayers().Values.ElementAt(westSeat);
                foreach (Player p in Game1.client.getState().getPlayers().Values)
                {
                    Visual conflict = new Visual(new Vector2(Game1.WIDTH - MARGIN - 60, MARGIN * 2 + 75), 60, 60, "0", "Font1", null, Color.White, "conflict");
                    conflict.setLeftMargin(19);
                    conflict.setTopMargin(20);
                    conflict.LoadContent();//BAD HACKS
                    Visual stages = new Visual(new Vector2(Game1.WIDTH - 100, Game1.HEIGHT - 150), 100, 100, "stage13").setVisible(false);
                    Game1.wonders[p.getBoard().getName()].setPosition(new Vector2(5 + SEC1WIDTH, 5 + SEC1HEIGHT)).setWidth(WONDERWIDTH * 2 + 10).setHeight(WONDERHEIGHT * 2).setTexture(p.getBoard().getImageName());
                    seatVisuals.Add(p.getSeat(), new Dictionary<string, Visual>() { { "wonder", Game1.wonders[p.getBoard().getName()] }, { "conflict", conflict }, { "stages", stages } });
                    baseVisuals.Add("player" + p.getSeat(), new Visual(new Vector2(MARGIN, MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), DROPDOWNWIDTH, LABELHEIGHT, (p.getSeat() + 1) + "|" + p.getName(), "Font1", Color.White, (p.getSeat() == player.getSeat()) ? Color.Orange : Color.Gray, "grayback"));
                    baseVisuals.Add("status" + p.getSeat(), new Visual(new Vector2(MARGIN + LABELWIDTH, MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), LABELWIDTH, LABELHEIGHT, "blank"));
                    baseVisuals.Add("gear" + p.getSeat(), new Visual(new Vector2(MARGIN + LABELWIDTH + (LABELWIDTH * 1 / 24), MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), p.getScoreNum(Score.GEAR).ToString(), "Font1"));
                    baseVisuals.Add("tablet" + p.getSeat(), new Visual(new Vector2(MARGIN + LABELWIDTH + (LABELWIDTH * 5 / 24), MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), p.getScoreNum(Score.TABLET).ToString(), "Font1"));
                    baseVisuals.Add("compas" + p.getSeat(), new Visual(new Vector2(MARGIN + LABELWIDTH + (LABELWIDTH * 9 / 24), MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), p.getScoreNum(Score.COMPASS).ToString(), "Font1"));
                    baseVisuals.Add("victory" + p.getSeat(), new Visual(new Vector2(MARGIN + LABELWIDTH + (LABELWIDTH * 13 / 24), MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), p.getScoreNum(Score.VICTORY_BLUE).ToString(), "Font1"));
                    baseVisuals.Add("army" + p.getSeat(), new Visual(new Vector2(MARGIN + LABELWIDTH + (LABELWIDTH * 19 / 24), MARGIN * 2 + (MARGIN + LABELHEIGHT) * (p.getSeat() + 1)), p.getScoreNum(Score.ARMY).ToString(), "Font1"));
                }
                baseVisuals.Add("resources", new Visual(new Vector2(LABELLENGTH + MARGIN * 2, SEC1HEIGHT + MARGIN * 2), RESOURCELENGTH, LABELHEIGHT, "resourceBar"));
                baseVisuals.Add("west", new Visual(new Vector2(MARGIN, SEC1HEIGHT + LABELHEIGHT + MARGIN * 3), LABELLENGTH, LABELHEIGHT, (westSeat + 1) + "|" + "West", "Font1", null, null, "grayback"));
                baseVisuals.Add("east", new Visual(new Vector2(MARGIN, SEC1HEIGHT + LABELHEIGHT * 2 + MARGIN * 4), LABELLENGTH, LABELHEIGHT, (eastSeat + 1) + "|" + "East", "Font1", null, null, "grayback"));
                baseVisuals.Add("self", new Visual(new Vector2(MARGIN, Game1.HEIGHT - (MARGIN + LABELHEIGHT)), LABELLENGTH, LABELHEIGHT, "Self", "Font1", null, null, "grayback"));
                baseVisuals.Add("westresources", new Visual(new Vector2(LABELLENGTH + MARGIN * 2, SEC1HEIGHT + LABELHEIGHT + MARGIN * 3), RESOURCELENGTH, LABELHEIGHT, "emptyResourceBar"));
                baseVisuals.Add("eastresources", new Visual(new Vector2(LABELLENGTH + MARGIN * 2, SEC1HEIGHT + LABELHEIGHT * 2 + MARGIN * 4), RESOURCELENGTH, LABELHEIGHT, "emptyResourceBar"));
                baseVisuals.Add("selfresources", new Visual(new Vector2(LABELLENGTH + MARGIN * 2, Game1.HEIGHT - (MARGIN + LABELHEIGHT)), RESOURCELENGTH, LABELHEIGHT, "emptyResourceBar"));

                int RESOURCEHEIGHT = SEC1HEIGHT + LABELHEIGHT + MARGIN * 3;

                for (int i = 0; i < NUMRESOURCES; i++)
                {
                    baseVisuals.Add("west" + i, new Visual(new Vector2(LABELLENGTH + MARGIN * 2 + RESOURCELENGTH * i / 8 + 5, RESOURCEHEIGHT), west.getResourceNum((Resource)i) + "", "Font1"));

                    baseVisuals.Add("east" + i, new Visual(new Vector2(LABELLENGTH + MARGIN * 2 + RESOURCELENGTH * i / 8 + 5, RESOURCEHEIGHT + LABELHEIGHT + MARGIN), east.getResourceNum((Resource)i) + "", "Font1"));

                    baseVisuals.Add("self" + i, new Visual(new Vector2(LABELLENGTH + MARGIN * 2 + RESOURCELENGTH * i / 8 + 5, Game1.HEIGHT - (MARGIN + LABELHEIGHT)), player.getResourceNum((Resource)i) + "", "Font1"));

                    if ((Resource)i == Resource.COIN)
                    {
                        baseVisuals["east" + i].setLeftMargin(-2);
                        baseVisuals["west" + i].setLeftMargin(-2);
                        baseVisuals["self" + i].setLeftMargin(-2);
                    }
                }
                hand.Add("papermiddle", new Visual(new Vector2(MARGIN + 30 + (CARDWIDTH / 2 + MARGIN) * (7 - player.getHand().Count) + 1, 190), Game1.WIDTH - (MARGIN + 30 + (CARDWIDTH / 2 + MARGIN) * (7 - player.getHand().Count)), CARDHEIGHT + 25, "papermiddle"));

                //updatePlayed();
                updateHands();
                updateScroll();
                //updatePlayers();

                baseVisuals.Add("Scorehead", new Visual(new Vector2(Game1.WIDTH / 4, Game1.HEIGHT / 4), Game1.WIDTH / 2, 50, "scorehead").setVisible(false));
                int n = 1;
                foreach (Player p in Game1.client.getState().getPlayers().Values)
                {
                    baseVisuals.Add("name" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4, Game1.HEIGHT / 4 + 40 * n), (int)(Game1.WIDTH / 2 * 0.296f), 40, p.getName(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("conflict" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f), Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.CONFLICT).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("coin" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.COIN).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("stages" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH * 2, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.STAGES).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("blue" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH * 3, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.VICTORY_BLUE).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("commerce" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH * 4, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.COMMERCE).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("guild" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH * 5, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.GUILD).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("science" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH * 6, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.SCIENCE).ToString(), "Font1", null, null, "line").setVisible(false));
                    baseVisuals.Add("sum" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH / 4 + (int)(Game1.WIDTH / 2 * 0.296f) + SCOREWIDTH * 7, Game1.HEIGHT / 4 + 40 * n), SCOREWIDTH, 40, p.getScoreNum(Score.VICTORY).ToString(), "Font1", null, null, "line").setVisible(false));
                    lastPlayed.Add("player" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH * ((n - 1) % 4 + 2) / 6 + MARGIN, Game1.HEIGHT * ((int)(n / 5) * 2 + 1) / 6 + MARGIN), Game1.WIDTH / 6 - MARGIN * 5, LABELHEIGHT, (p.getSeat() +1) + "|" + p.getName(), "Font1", null, null, "grayback"));
                    lastPlayed.Add("action" + p.getSeat(), new Visual(new Vector2(Game1.WIDTH * ((n - 1) % 4 + 2) / 6 + MARGIN, Game1.HEIGHT * ((int)(n / 5) * 2 + 1) / 6 + LABELHEIGHT + MARGIN * 2), Game1.WIDTH / 6 - MARGIN * 6, Game1.HEIGHT / 3 - MARGIN * 3 - LABELHEIGHT, "coin"));
                    n++;
                }
                quit = new Button(new Vector2(Game1.WIDTH / 2 - 70, Game1.HEIGHT / 4 + 40 * n + MARGIN), 140, 50, "Quit", "Font1");
                baseVisuals.Add("quit", quit.setVisible(false));

                seatViewed = player.getSeat();
                activeVisuals = seatVisuals[seatViewed];
                LoadContent();
                init = true;
            }
        }
Example #5
0
 // Add a certain number of x Resource r to Player p
 // "w", "o", "l", "p" etc
 private static void AddResource(Player p, Resource r, int x)
 {
     int resourceNum = p.getResourceNum(r) + x;
     p.setResourceNum(r, resourceNum);
 }
Example #6
0
 // Treasury contents
 // For every 3 coins in their possesion at the end of the game, players score
 // 1 victory point. Leftover coins score no points.
 public static int GetTreasuryScore(Player p)
 {
     int treasury = p.getResourceNum(Resource.COIN) / 3;
     return treasury;
 }