예제 #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 MessageBanner(Vector2 position, string text, float enterTime, float holdTime, float exitTime, int scale)
        {
            blink(position);
            this.text      = text;
            this.enterTime = enterTime;
            this.holdTime  = holdTime;
            this.exitTime  = exitTime;
            this.scale     = scale;

            maxChars    = text.Length;
            charSize    = ScaleManager.LargeFont.charSize();
            charsToDraw = 0;
            dimensions  = patch.wrap(new Point(charSize.X * charsToDraw, charSize.Y), scale);
            patchOffset = dimensions.ToVector2() / -2f;

            Expired = false;
        }
예제 #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);
        }