예제 #1
0
        public PatchField(int labelWidth, int textWidth, Vector2 position, int scale, string label, string text, string prompt, bool editable)
        {
            labelPatch = ContentStore.fieldLabelPatch;
            textPatch  = ContentStore.fieldTextPatch;

            Point charBounds = ScaleManager.LargeFont.charSize();

            labelDim    = charBounds;
            labelDim.X *= labelWidth;
            labelDim    = labelPatch.wrap(labelDim, scale);

            textDim    = charBounds;
            textDim.X *= textWidth;
            textDim    = textPatch.wrap(textDim, scale);

            Point totalSize = new Point(labelDim.X + textDim.X, labelDim.Y);
            Point pointPos  = position.ToPoint();

            this.hitbox   = new Rectangle(pointPos.X - (totalSize.X / 2), pointPos.Y - (totalSize.Y / 2), totalSize.X, totalSize.Y);
            this.position = hitbox.Location.ToVector2();

            this.scale     = scale;
            this.label     = label;
            this.text      = text;
            this.textWidth = textWidth;
            this.prompt    = prompt;
            this.editable  = editable;
            calculateBounds();
        }
예제 #2
0
        public FrameTable(Vector2 position) : base(position)
        {
            snap        = new CircleSnap(Arranger.staticPoint(0.5f, 0.5f), (ScaleManager.CardScale * 64f / 2f) + (ScaleManager.CardScaleSmall * (64f / 2f + 13f)));
            trumpOffset = Arranger.staticPoint(0.5f, 0.5f);
            LinePoly tableTabPoly = new LinePoly(
                Vector2.Zero,
                new Vector2(29, 0),
                new Vector2(29, 5),
                new Vector2(20, 16),
                new Vector2(-20, 16),
                new Vector2(-29, 5),
                new Vector2(-29, 0)
                );

            tableTab = new PolyButton(Arranger.staticPoint(3 / 4f, 1f), tableTabPoly, ContentStore.tableTab, new Vector2(27, 0), ScaleManager.CardScale, 0f);
            LinePoly handTabPoly = new LinePoly(
                Vector2.Zero,
                new Vector2(29, 0),
                new Vector2(29, -5),
                new Vector2(20, -16),
                new Vector2(-20, -16),
                new Vector2(-29, -5),
                new Vector2(-29, -0)
                );

            handTab    = new PolyButton(Arranger.staticPoint(3 / 4f, 1f), handTabPoly, ContentStore.handTab, new Vector2(27, 14), ScaleManager.CardScale, 0f);
            tablePatch = ContentStore.tablePatch;
            namePlates = new List <NamePlate>();
        }
예제 #3
0
        public PatchButton(int charWidths, Vector2 position, NinePatch patch, int scale, string text, Action action = null)
        {
            Point charBounds = ScaleManager.LargeFont.charSize();

            charBounds.X *= charWidths;
            this.patch    = patch;
            Point wrapBounds = patch.wrap(charBounds, scale);
            Point pointPos   = position.ToPoint();

            this.hitbox   = new Rectangle(pointPos.X - (wrapBounds.X / 2), pointPos.Y - (wrapBounds.Y / 2), wrapBounds.X, wrapBounds.Y);
            this.position = hitbox.Location.ToVector2();
            this.scale    = scale;
            this.text     = text;
            this.action   = action;
            calculateBounds();
        }
예제 #4
0
파일: FrameBid.cs 프로젝트: liangyee/Wizard
        public FrameBid(Vector2 position) : base(position)
        {
            ticker = new Ticker(new Vector2(screenSize.X * 3f / 5f, screenSize.Y * 1f / 3f), ScaleManager.InterfaceScale);
            ticker.setRange(0, 0);
            button = new PatchButton(9, new Vector2(screenSize.X * 4f / 5f, screenSize.Y * 1f / 3f), ContentStore.standardPatch, ScaleManager.InterfaceScale, "Place Bid", () => {
                UltraClient.Instance.network.SendBid(new Bid(ticker.Value, ClientDataStore.Instance.CurrentPlayer.ID), null);
                Console.WriteLine("SENT BID");
                GameClient.Instance.frameController.stow(this);
            });
            patch = ContentStore.bidPatch;
            int      padding  = ScaleManager.InterfaceScale * 2;
            Arranger arranger = new Arranger(false, 1, 'R', padding);

            arranger.addObject(ticker, 0);
            arranger.addObject(button, 0);
            arranger.performArrangements();
            Point topLeft = new Vector2(ticker.Position.X - ((ticker.Width / 2) + padding), ticker.Position.Y - ((ticker.Height / 2) + padding)).ToPoint();

            patchSize = patch.wrap(new Point(ScaleManager.ScreenSize.X - topLeft.X, ticker.Height + 2 * padding), ScaleManager.InterfaceScale);
            patchPos  = new Point(ScaleManager.ScreenSize.X - patchSize.X, (ScaleManager.ScreenSize.Y - patchSize.Y) / 2);
        }
예제 #5
0
        public FrameScoreboard(Vector2 position) : base(position)
        {
            scoreboard = new NineGrid(Vector2.Zero, ScaleManager.InterfaceScale, ScaleManager.LargeFont, new string[] { "player", "score", "bid", "tricks" }, new int[] { 12, 6, 4, 4 });
            NineGridRow header     = scoreboard.addRow("header");
            NineCell    playerCell = header.getCell("player");

            playerCell.Text      = "Player";
            playerCell.Alignment = 'C';
            NineCell scoreCell = header.getCell("score");

            scoreCell.Text      = "Score";
            scoreCell.Alignment = 'C';
            NineCell bidCell = header.getCell("bid");

            bidCell.Text      = "Bid";
            bidCell.Alignment = 'C';
            NineCell trickCell = header.getCell("tricks");

            trickCell.Text      = "Won";
            trickCell.Alignment = 'C';
            LinePoly scoreTabPoly = new LinePoly(
                Vector2.Zero,
                new Vector2(34.5f, 0),
                new Vector2(34.5f, 5),
                new Vector2(25.5f, 16),
                new Vector2(-25.5f, 16),
                new Vector2(-34.5f, 5),
                new Vector2(-34.5f, 0)
                );

            scoreTab = new PolyButton(Arranger.staticPoint(1 / 4f, 0f), scoreTabPoly, ContentStore.scoreTab, new Vector2(32.5f, 0), ScaleManager.CardScale, 0f);
            Arranger arranger = new Arranger(true, 1, 'L', 0);

            arranger.addObject(scoreboard, 0);
            arranger.performArrangements();
            trayPatch = ContentStore.scorePatch;
            patchPos  = Point.Zero;
            patchSize = Point.Zero;
        }
예제 #6
0
        public static void load(ContentManager contentManager)
        {
            ContentStore.contentManager = contentManager;

            standardButton = contentManager.Load <Texture2D>("button.9.png");
            standardPatch  = new NinePatch(standardButton);
            gameLogo       = contentManager.Load <Texture2D>("logo.png");
            cardAtlas      = contentManager.Load <Texture2D>("cards.png");
            cardGlow       = contentManager.Load <Texture2D>("cardGlow.png");
            universalNo    = contentManager.Load <Texture2D>("universalNo.png");
            grid1          = contentManager.Load <Texture2D>("grid.1.9.png");
            grid2          = contentManager.Load <Texture2D>("grid.2.9.png");
            grid3          = contentManager.Load <Texture2D>("grid.3.9.png");
            grid4          = contentManager.Load <Texture2D>("grid.4.9.png");
            grid5          = contentManager.Load <Texture2D>("grid.5.9.png");
            setGridPatches();

            font11pt = contentManager.Load <SpriteFont>("mgcb\\fonts\\V5Extender11");
            font22pt = contentManager.Load <SpriteFont>("mgcb\\fonts\\V5Extender22");
            font33pt = contentManager.Load <SpriteFont>("mgcb\\fonts\\V5Extender33");
            font44pt = contentManager.Load <SpriteFont>("mgcb\\fonts\\V5Extender44");
            font55pt = contentManager.Load <SpriteFont>("mgcb\\fonts\\V5Extender55");

            soundPlace1  = contentManager.Load <SoundEffect>("mgcb\\audio\\cardPlace1");
            soundPlace2  = contentManager.Load <SoundEffect>("mgcb\\audio\\cardPlace2");
            soundPlace3  = contentManager.Load <SoundEffect>("mgcb\\audio\\cardPlace3");
            soundPlace4  = contentManager.Load <SoundEffect>("mgcb\\audio\\cardPlace4");
            soundBad     = contentManager.Load <SoundEffect>("mgcb\\audio\\bad");
            soundDrop    = contentManager.Load <SoundEffect>("mgcb\\audio\\drop");
            soundGood    = contentManager.Load <SoundEffect>("mgcb\\audio\\good");
            soundNeutral = contentManager.Load <SoundEffect>("mgcb\\audio\\neutral");
            soundPop     = contentManager.Load <SoundEffect>("mgcb\\audio\\pop");
            soundSlide   = contentManager.Load <SoundEffect>("mgcb\\audio\\slide");
            soundRoll    = contentManager.Load <SoundEffect>("mgcb\\audio\\roll");
            soundVictory = contentManager.Load <SoundEffect>("mgcb\\audio\\victory");

            tickerDisplay   = contentManager.Load <Texture2D>("tickerDisplay.png");
            tickerArrowUp   = contentManager.Load <Texture2D>("tickerArrowUp.png");
            tickerArrowDown = contentManager.Load <Texture2D>("tickerArrowDown.png");

            scoreTab        = contentManager.Load <Texture2D>("scoresTab.png");
            tableTab        = contentManager.Load <Texture2D>("tableTab.png");
            handTab         = contentManager.Load <Texture2D>("handTab.png");
            tableCardPlace  = contentManager.Load <Texture2D>("tableCardPlace.png");
            tableTrumpPlace = contentManager.Load <Texture2D>("tableTrumpPlace.png");
            tableBack       = contentManager.Load <Texture2D>("table.9.png");
            tablePatch      = new NinePatch(tableBack);
            messageBanner   = contentManager.Load <Texture2D>("messageBanner.9.png");
            bannerPatch     = new NinePatch(messageBanner);
            bidTray         = contentManager.Load <Texture2D>("bidTray.9.png");
            bidPatch        = new NinePatch(bidTray);
            scoreTray       = contentManager.Load <Texture2D>("scoresTray.9.png");
            scorePatch      = new NinePatch(scoreTray);
            fieldLabel      = contentManager.Load <Texture2D>("fieldLabel.9.png");
            fieldText       = contentManager.Load <Texture2D>("fieldText.9.png");
            fieldLabelPatch = new NinePatch(fieldLabel);
            fieldTextPatch  = new NinePatch(fieldText);

            pTable = contentManager.Load <Texture2D>("parallax\\ParallaxTable.png");
            pCouch = contentManager.Load <Texture2D>("parallax\\ParallaxCouch.png");
            pLegL  = contentManager.Load <Texture2D>("parallax\\ParallaxLegLeft.png");
            pLegR  = contentManager.Load <Texture2D>("parallax\\ParallaxLegRight.png");
            pArmL  = contentManager.Load <Texture2D>("parallax\\ParallaxArmLeft.png");
            pArmR  = contentManager.Load <Texture2D>("parallax\\ParallaxArmRight.png");

            playerIndicator     = contentManager.Load <Texture2D>("playerIndicator.png");
            playerIndicatorGlow = contentManager.Load <Texture2D>("playerIndicatorGlow.png");

            pipScore = contentManager.Load <Texture2D>("pipScore.png");
            pipBid   = contentManager.Load <Texture2D>("pipBid.png");
            pipWon   = contentManager.Load <Texture2D>("pipWon.png");
        }