public void Render(ILayer mainLayer)
        {
            mainLayer.Save();

            if (BackgroundAnimation != null)
            {
                BackgroundAnimation.Render(mainLayer);
            }
            else
            {
                switch (BgSlidingState)
                {
                case BgSlidingState.Left:
                    mainLayer.Translate(0, 0);
                    mainLayer.DrawImage(Assets.Images.Layouts.CloudlessMainBg, 0, 0);
                    break;

                case BgSlidingState.Right:
                    mainLayer.Translate(-384, 0);
                    mainLayer.DrawImage(Assets.Images.Layouts.CloudlessMainBg, 0, 0);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }


            Cloud1Path.Animation.Render(mainLayer);
            Cloud2Path.Animation.Render(mainLayer);
            Cloud3Path.Animation.Render(mainLayer);

            mainLayer.Restore();
        }
Ejemplo n.º 2
0
        private void aboutBoxRender(ILayer layer)
        {
            layer.Save();
            layer.Translate(Positions.AboutBubblePosition);

            layer.DrawImage(Assets.Images.About.AboutBubble);
            layer.DrawImage(Assets.Images.About.AboutContact, Positions.AboutContactUsPosition);
            layer.DrawImage(Assets.Images.About.AboutRate, Positions.AboutRatePosition);

            layer.Restore();
        }
Ejemplo n.º 3
0
        private void createRoomButtonGroup(ILayer layer)
        {
            layer.Save();
            layer.Translate(CreateRoomPosition.X, CreateRoomPosition.Y);

            layer.DrawImage(OrangeButtonOverlay, 0, 0);

            layer.DrawImage(PlusOverlay, CreateRoomIconOffset.X, CreateRoomIconOffset.Y, true);

            layer.DrawImage(CreateRoomTextOverlay, CreateRoomTextOffset.X, CreateRoomTextOffset.Y, true);

            layer.Restore();
        }
        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";
             */

/*
 * todo            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();
        }
Ejemplo n.º 5
0
        public void Render(ILayer layer)
        {
            int val = 0;

            val += (Board.getItemsOnBoard(null, Position.X - 1, Position.Y).Any(a => a is SolidWallPiece)
                ? (int)Engine.Interfaces.Direction.Left
                : 0);
            val += Board.getItemsOnBoard(null, Position.X + 1, Position.Y).Any(a => a is SolidWallPiece)
                ? (int)Engine.Interfaces.Direction.Right
                : 0;
            val += Board.getItemsOnBoard(null, Position.X, Position.Y - 1).Any(a => a is SolidWallPiece)
                ? (int)Engine.Interfaces.Direction.Up
                : 0;
            val += Board.getItemsOnBoard(null, Position.X, Position.Y + 1).Any(a => a is SolidWallPiece)
                ? (int)Engine.Interfaces.Direction.Down
                : 0;

//            IImage image = SolidWallImages[val == 0 ? 15 : val];
            IImage image = Assets.Images.Tiles.WallSolid;

            layer.DrawImage(image, Position.X * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d,
                            Position.Y * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d,
                            BoardConstants.SquareSize,
                            BoardConstants.SquareSize, true);
        }
Ejemplo n.º 6
0
        public void Render(ILayer mainLayer)
        {
            mainLayer.Save();
            mainLayer.DrawImage(client.SoundEnabled ? Assets.Images.Layouts.SoundOnButton : Assets.Images.Layouts.SoundOffButton, SoundToggleButtonPosition, true);

            mainLayer.Restore();
        }
        public void Render(TimeSpan elapsedGameTime)
        {
            mainLayer.Begin();

            mainLayer.Clear();
            mainLayer.Save();
            mainLayer.Translate(0, 61);
            mainLayer.DrawImage(Barrier, BarrierPosition);
            mainLayer.DrawImage(RedWalkway, WalkwayPosition);



            this.ticking += 2;

            mainLayer.Save();

            var person = _renderer.GetImage("female.blonde.front");

            mainLayer.Translate((-this.ticking + (_width * 100)) % _width, 50);


            double rotate;

            rotate = this.ticking % 30 < 15 ? .07 : -.07;
            mainLayer.DrawImage(person, -person.Width / 2, -person.Height / 2, rotate, person.Center);

            mainLayer.Restore();


            mainLayer.Save();

            person = _renderer.GetImage("male.hat.front");
            mainLayer.Translate((this.ticking + (_width * 100)) % _width, 100);

            rotate = this.ticking % 30 < 15 ? .07 : -.07;



            mainLayer.SetDrawingEffects(DrawingEffects.FlipHorizontally);
            mainLayer.DrawImage(person, -person.Width / 2, -person.Height / 2, rotate, person.Center);
            mainLayer.Restore();



            mainLayer.Restore();
            mainLayer.End();
        }
Ejemplo n.º 8
0
        public void Render(TimeSpan elapsedGameTime)
        {
            mainLayer.Begin();


            mainLayer.Save();
            mainLayer.DrawRectangle(new Color(0, 0, 0), 0, 0, _width, _height);

            mainLayer.DrawImage(LobbyOverlay, LobbyOverlayPosition.X, LobbyOverlayPosition.Y);
            mainLayer.DrawImage(ProfileOverlay, ProfileOverlayPosition.X, ProfileOverlayPosition.Y);
            mainLayer.DrawImage(GoldCoinOverlay, GoldCoinOverlayPosition.X, GoldCoinOverlayPosition.Y);
            mainLayer.DrawImage(SilverCoinOverlay, SilverCoinOverlayPosition.X, SilverCoinOverlayPosition.Y);

            mainLayer.DrawImage(LobbyBackground, LobbyBackgroundPosition.X, LobbyBackgroundPosition.Y);


            headerButtonGroup(mainLayer, HeaderButtonTop.AllRooms, SelectedHeaderButton == HeaderButtonTop.AllRooms);
            headerButtonGroup(mainLayer, HeaderButtonTop.Featured, SelectedHeaderButton == HeaderButtonTop.Featured);
            headerButtonGroup(mainLayer, HeaderButtonTop.Favorites, SelectedHeaderButton == HeaderButtonTop.Favorites);

            createRoomButtonGroup(mainLayer);
            rooms(mainLayer, RoomButtonSize.Width, RoomButtonSize.Height);

            mainLayer.DrawImage(ScrollBarOverlay, ScrollBarPosition.X, ScrollBarPosition.Y);
            mainLayer.DrawImage(ScrollBarButtonOverlay, ScrollBarPosition.X + 4, ScrollBarPosition.Y + (ScrollBarButtonPosition));

            mainLayer.Restore();
            mainLayer.End();
        }
Ejemplo n.º 9
0
        private void headerButtonGroup(ILayer layer, HeaderButtonTop buttonType, bool selected)
        {
            Point  buttonLoc;
            IImage icon;
            IImage text;

            switch (buttonType)
            {
            case HeaderButtonTop.AllRooms:
                buttonLoc = AllRoomsButtonPosition;
                icon      = EyeOverlay;
                text      = AllRoomsOverlay;
                break;

            case HeaderButtonTop.Featured:
                buttonLoc = FeaturedButtonPosition;
                icon      = DollarOverlay;
                text      = FeaturedOverlay;
                break;

            case HeaderButtonTop.Favorites:
                buttonLoc = FavoritesButtonPosition;
                icon      = StarOverlay;
                text      = FavoritesOverlay;
                break;

            default:
                throw new ArgumentOutOfRangeException("buttonType");
            }

            layer.Save();
            layer.Translate(buttonLoc.X, buttonLoc.Y);

            if (selected)
            {
                layer.DrawImage(SelectedOverlay, 0, 0);
            }

            layer.DrawImage(icon, ButtonIconOffset.X, ButtonIconOffset.Y, true);

            layer.DrawImage(text, ButtonTextOffset.X, ButtonTextOffset.Y, true);
            layer.Restore();
        }
Ejemplo n.º 10
0
        public void Render(TimeSpan elapsedGameTime, ILayer layer, Action <ILayer, int, int> boxDrawn = null, bool disabled = false)
        {
            //            layer.Clear();
            layer.Save();


            var bg = Assets.Images.Layouts.GameBackground;

            layer.Translate(BoardConstants.SideOffset, BoardConstants.TopOffset);
            layer.DrawImage(bg, 0, 0, BoardConstants.SquareSize * BoardConstants.SquareWidth, BoardConstants.SquareSize * BoardConstants.SquareHeight);

            var image = Assets.Images.Board.Box;

            for (var x = 0; x < BoardConstants.SquareWidth; x++)
            {
                for (var y = 0; y < BoardConstants.SquareHeight; y++)
                {
                    if (boxDrawn != null)
                    {
                        boxDrawn(layer, x, y);
                    }

                    layer.DrawImage(image, x * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d, y * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d, BoardConstants.SquareSize, BoardConstants.SquareSize, true);
                }
            }


            foreach (var squarePiece in SquarePieces)
            {
                squarePiece.Render(layer);
            }
            if (!disabled)
            {
                foreach (var player in Players)
                {
                    player.Render(layer);
                }
            }

            layer.Restore();
        }
Ejemplo n.º 11
0
        public void Render(ILayer context)
        {
            if (this.BallDead)
            {
                return;
            }
            var position = this.Body.Position;

            var x               = this.GameBoard.PegPhysicsManager.MeterToPixel(position.X);
            var y               = this.GameBoard.PegPhysicsManager.MeterToPixel(position.Y);
            var cannonBall      = GameBoard.Client().Renderer.GetImage("cannonBall");
            var cannonBallShine = GameBoard.Client().Renderer.GetImage("cannonBallShine");


            context.Save();
            context.Translate((int)x, (int)y);
            context.Translate(-cannonBall.Width / 2, -cannonBall.Height / 2);
            context.DrawImage(cannonBall, 0, 0, this.Body.Rotation, cannonBall.Width / 2, cannonBall.Height / 2);
            context.DrawImage(cannonBallShine, 0, 0);
            context.Restore();
        }
        private void render(ILayer layer, double posx, double posy, int animationindex, double percent)
        {
            IImage frame;

            if (animationindex == 0)
            {
                animationindex = 1;
            }

            frame = Assets.Images.Character.Animations.CharactersAnimated[CharacterIndex][animationindex];


            if (Selected)
            {
                layer.DrawImage(frame, 0, 0, (int)(frame.Width * 1.2), (int)(frame.Height * 1.2), true);
            }
            else
            {
                layer.DrawImage(frame, 0, 0, true);
            }
        }
Ejemplo n.º 13
0
        public void Render(ILayer layer)
        {
            IImage wall;

            double xPos = 0d;
            double yPos = 0d;


            double width, height;

            switch (Direction)
            {
            case Direction.Left:
                wall   = Assets.Images.Tiles.WallVertical;
                xPos   = -BoardConstants.SquareSize / 2d;
                width  = wall.Width;
                height = BoardConstants.SquareSize;
                break;

            case Direction.Right:
                wall   = Assets.Images.Tiles.WallVertical;
                xPos   = +BoardConstants.SquareSize / 2d;
                width  = wall.Width;
                height = BoardConstants.SquareSize;
                break;

            case Direction.Top:
                wall   = Assets.Images.Tiles.WallHorizontal;
                yPos   = -BoardConstants.SquareSize / 2d;
                width  = BoardConstants.SquareSize;
                height = wall.Height;
                break;

            case Direction.Bottom:
                wall   = Assets.Images.Tiles.WallHorizontal;
                yPos   = +BoardConstants.SquareSize / 2d;
                width  = BoardConstants.SquareSize;
                height = wall.Height;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            layer.DrawImage(wall, Position.X * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d + xPos,
                            Position.Y * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d + yPos,
                            width,
                            height, true);
        }
Ejemplo n.º 14
0
        public void Render(ILayer context)
        {
            var cannonLocation = this.GameBoard.GameModel.CannonLocation;

            var cannonImage = this.CannonAsset;


            context.Save();
            context.Translate(cannonLocation.X - cannonImage.Width / 2, cannonLocation.Y);


            context.DrawImage(cannonImage, 0, 0, (this.GameBoard.GameModel.CannonAngle * Math.PI / 180), cannonImage.Width / 2, 0);

            context.Restore();
        }
Ejemplo n.º 15
0
        public void Render(ILayer context)
        {
            this.Tocking++;
            context.Save();
            context.Translate(this.X, this.Y);
            IImage image;
            string pegAssetName;

            if (this.Blinking)
            {
                if ((this.Tocking % 20 < 10))
                {
                    pegAssetName = "peg.hit";
                }
                else
                {
                    pegAssetName = "peg";
                }
            }
            else
            {
                if (this.Hit)
                {
                    pegAssetName = "peg.hit";
                }
                else
                {
                    pegAssetName = "peg";
                }
            }

            pegAssetName += "." + PegName;
            image         = GameBoard.Client().Renderer.GetImage(pegAssetName);

            context.Translate(-image.Center.X, -image.Center.Y);
            context.DrawImage(image, 0, 0);
            context.Restore();
        }
        private void renderPullBox(ILayer context)
        {
            context.Save();
            context.Translate(this.PullBoxOverlayPosition.X, this.PullBoxOverlayPosition.Y);
            context.Translate(-this.PullBoxOverlay.Width / 2, 0);
            context.DrawImage(this.PullBoxOverlay, 0, 0);
            context.Restore();


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

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

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

            context.DrawString("lobby.font", this.GameBoard.GameModel.NumberOfPulls.ToString(), (int)-size / 2, -fontSize / 2);
            context.Restore();
        }
Ejemplo n.º 17
0
        public void Render(ILayer layer)
        {
            IImage goal;

            if (Goal.IsExtra)
            {
                goal = Assets.Images.Tiles.FishTilesExtra;
            }
            else
            {
                if (Goal.GoalSize == GoalSize.Small)
                {
                    goal = Assets.Images.Tiles.Small.FishTiles[Goal.PlayerNumber + 1];
                }
                else
                {
                    goal = Assets.Images.Tiles.Big.FishTiles[Goal.PlayerNumber + 1];
                }
            }

            layer.DrawImage(goal, Position.X * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d, Position.Y * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d,
                            BoardConstants.SquareSize,
                            BoardConstants.SquareSize, true);
        }
Ejemplo n.º 18
0
        public void Init()
        {
            State = new LandingAreaLayoutState();
            State.SoundSubLayout = new SoundSubLayout(Client);

            setNextHop();
            GameService.CloudSubLayout.InitLayoutView(TouchManager);
            GameService.CloudSubLayout.SlideLeft();
            mainLayer = Renderer.CreateLayer(Layout.Width, Layout.Height, Layout);
            Renderer.AddLayer(mainLayer);


            TouchManager.PushClickRect(new TouchRect(Positions.StartLocation.X, Positions.StartLocation.Y, 1300, 324, startGame, true));
            TouchManager.PushClickRect(new TouchRect(Positions.TutorialButtonPosition.X, Positions.TutorialButtonPosition.Y, 200, 200, tutorialTrigger, true));

            TouchManager.PushClickRect(new TouchRect(Positions.AboutBubblePosition + Positions.AboutContactUsPosition, Positions.AboutButtonSize, aboutContactTouch));
            TouchManager.PushClickRect(new TouchRect(Positions.AboutBubblePosition + Positions.AboutRatePosition, Positions.AboutButtonSize, aboutRateTouch));

            TouchManager.PushClickRect(new TouchRect(Positions.AboutOpenPenguinPosition, 533, 512, toggleOpening, true));


            TouchManager.PushClickRect(new TouchRect(0, 0, 1536, 2048, closeBox));

            IImage logoImage    = Assets.Images.Layouts.PenguinLogo;
            IImage shuffleImage = Assets.Images.Layouts.ShuffleLogo;

            PenguinLogoAnimation = MotionManager.StartMotion(-1000, Positions.PenguinLogoLocation.Y)
                                   .Motion(new WaitMotion(300))
                                   .Motion(new AnimationMotion(Positions.PenguinLogoLocation.X, Positions.PenguinLogoLocation.Y, 500, AnimationEasing.SineEaseIn))
                                   .OnRender((layer, posX, posY, animationIndex, percentDone) => mainLayer.DrawImage(logoImage, posX, posY, true))
                                   .OnComplete(() => { });

            ShuffleLogoAnimation = MotionManager.StartMotion(-1000, Positions.ShuffleLogoLocation.Y)
                                   .Motion(new WaitMotion(300))
                                   .Motion(new AnimationMotion(Positions.ShuffleLogoLocation.X, Positions.ShuffleLogoLocation.Y, 600, AnimationEasing.SineEaseIn))
                                   .OnRender((layer, posX, posY, animationIndex, percentDone) => mainLayer.DrawImage(shuffleImage, posX, posY, true))
                                   .OnComplete(() => { });

            PlayButtonAnimation = MotionManager.StartMotion(-1000, Positions.StartLocation.Y)
                                  .Motion(new WaitMotion(300))
                                  .Motion(new AnimationMotion(Positions.StartLocation, 700, AnimationEasing.SineEaseIn))
                                  .OnRender((layer, posX, posY, animationIndex, percentDone) => mainLayer.DrawImage(Assets.Images.Layouts.PlayButton, posX, posY, true))
                                  .OnComplete(() => { });


            State.AboutState = AboutState.Closed;


            IImage penguinImage = Assets.Images.About.MainPenguin;

            AboutOpenDialogAnimation = MotionManager.StartMotion(0, 0)
                                       .Motion(new AnimationMotion(0, 100, 600, AnimationEasing.Linear))
                                       .OnRender((layer, posX, posY, animationIndex, percentDone) =>
            {
                layer.Save();
                layer.SetDrawingTransparency(posY / 100f);
                aboutBoxRender(layer);
                layer.Restore();
            });

            RandomPenguinHop = MotionManager.StartMotion(Positions.AboutPenguinPosition)
                               .Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y - 25, 200, AnimationEasing.CubicEaseOut))
                               .Motion(new AnimationMotion(Positions.AboutPenguinPosition, 150, AnimationEasing.CubicEaseIn))
                               .Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y - 50, 200, AnimationEasing.CubicEaseOut))
                               .Motion(new AnimationMotion(Positions.AboutPenguinPosition, 150, AnimationEasing.CubicEaseIn))
                               .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(penguinImage, posX, posY, true); })
                               .DontStart();


            InitialPenguinHop = MotionManager.StartMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y + 1000)
                                .Motion(new WaitMotion(300))
                                .Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y - 25, 1000, AnimationEasing.CubicEaseOut))
                                .Motion(new AnimationMotion(Positions.AboutPenguinPosition, 150, AnimationEasing.CubicEaseIn))
                                .Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y - 50, 200, AnimationEasing.CubicEaseOut))
                                .Motion(new AnimationMotion(Positions.AboutPenguinPosition, 150, AnimationEasing.CubicEaseIn))
                                .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(penguinImage, posX, posY, true); });

            AboutCloseDialogAnimation = MotionManager.StartMotion(0, 100)
                                        .Motion(new AnimationMotion(0, 0, 600, AnimationEasing.Linear))
                                        .OnRender((layer, posX, posY, animationIndex, percentDone) =>
            {
                layer.Save();
                layer.SetDrawingTransparency(posY / 100f);
                aboutBoxRender(layer);
                layer.Restore();
            });

            AboutOpenAnimation = MotionManager.StartMotion(Positions.AboutPenguinPosition,
                                                           new AnimationMotion(Positions.AboutOpenPenguinPosition, 600, AnimationEasing.BounceEaseOut))
                                 .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(penguinImage, posX, posY, true); }).OnComplete(() =>
            {
                setNextHop();
                State.AboutState = AboutState.Opened;
            });

            AboutCloseAnimation = MotionManager.StartMotion(Positions.AboutOpenPenguinPosition,
                                                            new AnimationMotion(Positions.AboutPenguinPosition, 400, AnimationEasing.CubicEaseIn))
                                  .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(penguinImage, posX, posY, true); }).OnComplete(() =>
            {
                setNextHop();
                State.AboutState = AboutState.Closed;
            });

            StartGameAnimation = MotionManager.StartMotion(Positions.AboutPenguinPosition).
                                 Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, 1300, 400, AnimationEasing.QuadEaseOut)).
                                 Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y + 100, 350, AnimationEasing.QuadEaseIn)).
                                 Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, 700, 400, AnimationEasing.QuadEaseOut)).
                                 Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, Positions.AboutPenguinPosition.Y + 200, 350, AnimationEasing.QuadEaseIn)).
                                 Motion(new AnimationMotion(Positions.AboutPenguinPosition.X, -500, 500, AnimationEasing.QuadEaseOut))
                                 .OnRender((layer, posX, posY, animationIndex, percentDone) => { mainLayer.DrawImage(penguinImage, posX, posY, true); }).OnComplete(() =>
            {
                GameService.CloudSubLayout.SlideRight();
                _screenTransitioner.ChangeToSettingsScreen();
            });


            State.SoundSubLayout.InitLayoutView(TouchManager);
        }
Ejemplo n.º 19
0
        public override void Render(TimeSpan elapsedGameTime)
        {
            mainLayer.Begin();


            GameService.CloudSubLayout.Render(mainLayer);
            State.SoundSubLayout.Render(mainLayer);

            mainLayer.Save();

            IImage logoImage    = Assets.Images.Layouts.PenguinLogo;
            IImage shuffleImage = Assets.Images.Layouts.ShuffleLogo;

            if (PenguinLogoAnimation.Completed)
            {
                mainLayer.DrawImage(logoImage, Positions.PenguinLogoLocation, true);
            }
            else
            {
                PenguinLogoAnimation.Render(mainLayer);
            }

            if (ShuffleLogoAnimation.Completed)
            {
                mainLayer.DrawImage(shuffleImage, Positions.ShuffleLogoLocation, true);
            }
            else
            {
                ShuffleLogoAnimation.Render(mainLayer);
            }


            if (!PlayButtonAnimation.Completed)
            {
                PlayButtonAnimation.Render(mainLayer);
            }

            else
            {
                if (State.ShowingTutorial > 0)
                {
                    mainLayer.DrawImage(Assets.Images.Layouts.Tutorials.Tutorial[State.ShowingTutorial], Positions.TutorialPosition, true);
                }
                else
                {
                    if (!State.StartClicked)
                    {
                        mainLayer.DrawImage(Assets.Images.Layouts.PlayButton, Positions.StartLocation, true);
                    }
                }
            }

            if (State.ShowingTutorial > 0)
            {
                mainLayer.DrawImage(Assets.Images.Layouts.Tutorials.Tutorial[State.ShowingTutorial], Positions.TutorialPosition, true);
            }
            else
            {
                mainLayer.DrawImage(Assets.Images.Layouts.AboutButton, Positions.TutorialButtonPosition, true);

                if (State.StartClicked)
                {
                    StartGameAnimation.Render(mainLayer);
                }
                else
                {
                    renderAbout();
                }
            }

            mainLayer.Restore();


            //            TouchManager.Render(mainLayer);
            mainLayer.End();
        }
Ejemplo n.º 20
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();
        }
Ejemplo n.º 21
0
        public void Render(ILayer layer)
        {
            if (AnimateToPosition != null)
            {
                animationVelocity = Math.Max(animationMinVelocity, animationVelocity - animationCoolDown);
                switch (AnimateToPosition.Direction)
                {
                case Direction.Left:
                    CurrentAnimatedOffset.X += -animationVelocity;
                    break;

                case Direction.Right:
                    CurrentAnimatedOffset.X += +animationVelocity;
                    break;

                case Direction.Top:
                    CurrentAnimatedOffset.Y += -animationVelocity;
                    break;

                case Direction.Bottom:
                    CurrentAnimatedOffset.Y += +animationVelocity;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                if (Position.X + (int)(CurrentAnimatedOffset.X / BoardConstants.SquareSize) == AnimateToPosition.X &&
                    Position.Y + (int)(CurrentAnimatedOffset.Y / BoardConstants.SquareSize) == AnimateToPosition.Y)
                {
                    Position.X            = AnimateToPosition.X;
                    Position.Y            = AnimateToPosition.Y;
                    Direction             = AnimateToPosition.Direction;
                    CurrentAnimatedOffset = new PointF(0, 0);
                    _board.MoveToPosition = null;
                    AnimateToPosition     = null;
                }
            }


            var posX = (int)(CurrentAnimatedOffset.X + Position.X * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d);
            var posY = (int)(CurrentAnimatedOffset.Y + Position.Y * BoardConstants.SquareSize + BoardConstants.SquareSize / 2d);

            IImage image;

            switch (AnimateToPosition != null ? AnimateToPosition.Direction : Direction)
            {
            case Direction.Left:
                image = Assets.Images.Character.Stationary.Small.StationaryCharacters[PlayerNumber];
                layer.DrawImage(image, posX, posY, 90 * Math.PI / 180, BoardConstants.SquareSize, BoardConstants.SquareSize, true);
                break;

            case Direction.Right:
                image = Assets.Images.Character.Stationary.Small.StationaryCharacters[PlayerNumber];
                layer.DrawImage(image, posX, posY, 270 * Math.PI / 180, BoardConstants.SquareSize, BoardConstants.SquareSize, true);
                break;

            case Direction.Top:
                image = Assets.Images.Character.Sliding.SlidingCharacters[PlayerNumber];
                layer.DrawImage(image, posX, posY, BoardConstants.SquareSize, BoardConstants.SquareSize, true);
                break;

            case Direction.Bottom:
                image = Assets.Images.Character.Stationary.Small.StationaryCharacters[PlayerNumber];
                layer.DrawImage(image, posX, posY, BoardConstants.SquareSize, BoardConstants.SquareSize, true);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 22
0
        private void renderPurchaseCards()
        {
            mainLayer.Save();
            mainLayer.Translate(LightBoardPosition);
            mainLayer.DrawImage(LightBoard, 0, 0);
            mainLayer.DrawImage(ChooseYourCards, ChooseYourCardsPosition);


            drawPurchaseBingoCard(100, 1, PurchaseBingoCardPosition1);
            drawPurchaseBingoCard(200, 2, PurchaseBingoCardPosition2);
            drawPurchaseBingoCard(300, 3, PurchaseBingoCardPosition3);
            drawPurchaseBingoCard(400, 4, PurchaseBingoCardPosition4);


            mainLayer.Restore();
            mainLayer.DrawImage(PreviousCalledBalls, PreviousCalledBallsPosition);
        }