Exemplo n.º 1
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;
            }
        }