コード例 #1
0
        public void RenderText(ILayer context)
        {
            if (this.DrawText)
            {
                this.Ticking--;
                var posY = (int)(this.Ticking / 4);


                context.Save();
                context.Translate(this.X, this.Y);


                context.Translate(0, -25 + posY);


                var fontSize = 17;

/*
 *              context.FillStyle = "white";
 *              context.Font = "bold " + fontSize + "px Arial";
 *
 *
 *              context.ShadowColor = "#72C9FC";
 *              context.ShadowOffsetX = 0;
 *              context.ShadowOffsetY = 0;
 *              context.ShadowBlur = 5;
 */

                var bonusText = "+$" + this.Bonus.ToString();
                var size      = context.MeasureString(bonusText);
                context.DrawString("lobby.font", bonusText, (int)-size / 2, -fontSize / 2);


                context.Restore();

                if (this.Ticking == 0)
                {
                    this.DrawText = false;
                }
            }
        }
コード例 #2
0
        private void rooms(ILayer layer, int buttonWidth, int buttonHeight)
        {
            layer.Save();
            layer.Translate(RoomsPosition.X, RoomsPosition.Y);



            for (int i = 0; i < NumberOfRoomsVisible; i++)
            {
                layer.Save();
                layer.Translate(0, buttonHeight * i);
                layer.DrawRectangle(i % 2 == 0 ? RoomButtonColor : AlternateRoomButtonColor, 0, 0, buttonWidth, buttonHeight);

                if ((i + TopRoomIndex) < Rooms.Count)
                {
                    var currentRoom = Rooms[i + TopRoomIndex];
                    layer.DrawString("lobby.font", "Hello " + currentRoom.Name, 50, 50);
                }
                layer.Restore();
            }

            layer.Restore();
        }
コード例 #3
0
        private void renderJackpot(ILayer context)
        {
            context.Save();
            context.Translate(this.JackpotOverlayPosition.X, this.JackpotOverlayPosition.Y);
            context.Translate(-this.JackpotOverlay.Width / 2, 0);
            context.DrawImage(this.JackpotOverlay, 0, 0);
            context.Restore();


            context.Save();
            context.Translate(this.JackpotOverlayPosition.X, this.JackpotOverlayPosition.Y);
            context.Translate(0, 46);
            var fontSize = 15;

            /*
             *          context.FillStyle = "white";
             *          context.Font = "bold " + fontSize + "px Arial";
             */

            var size = context.MeasureString(this.GameBoard.GameModel.JackpotScore.ToString());

            context.DrawString("lobby.font", this.GameBoard.GameModel.JackpotScore.ToString(), (int)(-size / 2), (int)-fontSize / 2);
            context.Restore();
        }
コード例 #4
0
        public void Render(ILayer context)
        {
            this.Ticking++;
            var chuteLocation = this.ChuteLocation;


            bool lit;

            if (this.Blinking)
            {
                lit = !((this.Ticking % 10) < 4);
            }
            else
            {
                lit = (this.Ticking % 50) < (this.ChuteIndex + 1) * 10 && (this.Ticking % 50) > (this.ChuteIndex) * 10;

                for (var i = 0; i < this.ChutesPlane.Chutes.Count; i++)
                {
                    var chute = this.ChutesPlane.Chutes[i];
                    if (chute.Client().Blinking)
                    {
                        lit = false;
                        break;
                    }
                }
            }


            var chuteImage = (lit ? this.ChuteAssetsLit : this.ChuteAssets)[this.ChuteIndex];

            context.Save();
            context.Translate(chuteLocation.X, chuteLocation.Y);
            if (lit)
            {
                var offX = (this.ChuteAssetsLit[this.ChuteIndex].Width - this.ChuteAssets[this.ChuteIndex].Width) / 2;
                var offY = (this.ChuteAssetsLit[this.ChuteIndex].Height - this.ChuteAssets[this.ChuteIndex].Height) / 2;

                context.Translate(-offX, -offY);
            }
            context.DrawImage(chuteImage, 0, 0);
            context.Restore();


            context.Save();
            context.Translate(chuteLocation.X, chuteLocation.Y);
            context.Translate(this.ChuteAssets[this.ChuteIndex].Width / 2, this.ChuteAssets[this.ChuteIndex].Height / 2);


            var fontSize = 25;

            /*context.FillStyle = "white";
             * context.Font = "bold " + fontSize + "px Arial";
             * context.ShadowColor = "#72C9FC";
             * context.ShadowOffsetX = 0;
             * context.ShadowOffsetY = 0;
             * context.ShadowBlur = 5;
             */
            var bonusText = this.ChuteNumber.ToString();
            var size      = context.MeasureString(bonusText);

            context.DrawString("lobby.font", bonusText, (int)-size / 2, 8);

            context.Restore();
        }