• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# GameLogic.Snap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CardGames.GameLogic.Snap的典型用法代码示例。如果您正苦于以下问题:C# Snap类的具体用法?C# Snap怎么用?C# Snap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Snap类属于CardGames.GameLogic命名空间,在下文中一共展示了Snap类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: HandleUserInput

        /// <summary>
        /// Respond to the user input -- with requests affecting myGame
        /// </summary>
        /// <param name="myGame">The game object to update in response to events.</param>
        private static void HandleUserInput(Snap myGame)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
            {
                myGame.FlipNextCard ();
            }

            if (myGame.IsStarted)
            {
                if ( SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&
                    SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
            {
            //TODO: add sound effects
            }
            else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
            {
            myGame.PlayerHit (0);
            }
            else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
            {
                myGame.PlayerHit (1);
            }
            }
        }
开发者ID:thomasklash,项目名称:QuickSnap,代码行数:31,代码来源:SnapGame.cs


示例2: DrawGame

        /// <summary>
        /// Draws the game to the Window.
        /// </summary>
        /// <param name="myGame">The details of the game -- mostly top card and scores.</param>
        private static void DrawGame(Snap myGame)
        {
            SwinGame.DrawBitmap("cardsBoard.png",0, 0);

            // Draw the top card
            Card top = myGame.TopCard;
            if (top != null)
            {

                SwinGame.DrawText ("Top Card is " + top.ToString (), Color.RoyalBlue, 0, 20);
                SwinGame.DrawText ("Player 1 score: " + myGame.Score(0), Color.RoyalBlue, 0, 30);
                SwinGame.DrawText ("Player 2 score: " + myGame.Score(1), Color.RoyalBlue, 0, 40);
                SwinGame.DrawCell (SwinGame.BitmapNamed ("Cards"), top.CardIndex, 521, 153);
                SwinGame.DrawText (""+ myGame.Score(0), Color.White,"GameFont",0,30);
            }
            else
            {
                SwinGame.DrawText ("No card played yet...", Color.RoyalBlue, 0, 20);
            }

            // Draw the back of the cards... to represent the deck
            SwinGame.DrawCell (SwinGame.BitmapNamed ("Cards"), 52, 155, 153);

            //Draw onto the screen
            SwinGame.RefreshScreen(60);
        }
开发者ID:woichong,项目名称:QuickSnap,代码行数:30,代码来源:SnapGame.cs


示例3: HandleUserInput

        /// <summary>
        /// Respond to the user input -- with requests affecting myGame
        /// </summary>
        /// <param name="myGame">The game object to update in response to events.</param>
        private static void HandleUserInput(Snap myGame)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
            {
                myGame.Start ();
            }
            if(myGame.IsStarted)
            {
                if(SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
                {
                    SwinGame.PlaySoundEffect ("Slap");
                }
                else if(SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
                {
                    myGame.PlayerHit (0);
                }
                else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
                {
                    myGame.PlayerHit (1);
                }
            }
        }
开发者ID:9983341,项目名称:QuickSnap,代码行数:29,代码来源:SnapGame.cs


示例4: HandleUserInput

        /// <summary>
        /// Respond to the user input -- with requests affecting myGame
        /// </summary>
        /// <param name="myGame">The game object to update in response to events.</param>
        private static void HandleUserInput(Snap myGame)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
            {
                myGame.Start ();
            }

            if (myGame.IsStarted)
            {
                if ( SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&
                    SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
                {
                    //TODO: add sound effects
                    SwinGame.LoadSoundEffectNamed("Buzz","Buzz.wav");
                    SwinGame.PlaySoundEffect("Buzz");
                }
                else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
                {
                    myGame.PlayerHit (0);
                    SwinGame.LoadSoundEffectNamed("Slap","Slap.wav");
                    SwinGame.PlaySoundEffect("Slap");
                }
                else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
                {
                    myGame.PlayerHit (1);
                    SwinGame.LoadSoundEffectNamed("Slap2","Slap2.wav");
                    SwinGame.PlaySoundEffect("Slap2");
                }
            }
        }
开发者ID:cngu8904,项目名称:QuickSnap,代码行数:37,代码来源:SnapGame.cs


示例5: HandleUserInput

        /// <summary>
        /// Respond to the user input -- with requests affecting myGame
        /// </summary>
        /// <param name="myGame">The game object to update in response to events.</param>
        private static void HandleUserInput(Snap myGame)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
            {
                myGame.Start ();
            }
            <<<<<<< HEAD

            =======

            if (myGame.IsStarted)
            {
                if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT) &&
                    SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
                {
                    //Insert sound here
                    //Personal note: Pretty sure sound here will never play unless both
                }
                else if (SwinGame.KeyTyped (KeyCode.vk_LSHIFT))
                {
                    myGame.PlayerHit (0);
                }
                else if (SwinGame.KeyTyped (KeyCode.vk_RSHIFT))
                {
                    myGame.PlayerHit (1);
                }
            }

            >>>>>>> add-player-hit
        }
开发者ID:Gemore,项目名称:QuickSnap,代码行数:37,代码来源:SnapGame.cs


示例6: HandleUserInput

        /// <summary>
        /// Respond to the user input -- with requests affecting myGame
        /// </summary>
        /// <param name="myGame">The game object to update in response to events.</param>
        private static void HandleUserInput(Snap myGame)
        {
            //Fetch the next batch of UI interaction
            SwinGame.ProcessEvents();

            if (SwinGame.KeyTyped (KeyCode.vk_SPACE))
            {
                myGame.Start ();
            }
        }
开发者ID:akmaltt,项目名称:QuickSnap,代码行数:14,代码来源:SnapGame.cs


示例7: Main

        public static void Main()
        {
            //Open the game window
            SwinGame.OpenGraphicsWindow("Snap!", 860, 500);

            //Load the card images and set their cell details
            LoadResources();

            // Create the game!
            Snap myGame = new Snap ();

            //Run the game loop
            while(false == SwinGame.WindowCloseRequested())
            {
                HandleUserInput (myGame);
                DrawGame (myGame);
                UpdateGame (myGame);
            }
        }
开发者ID:thomasklash,项目名称:QuickSnap,代码行数:19,代码来源:SnapGame.cs


示例8: UpdateGame

 /// <summary>
 /// Updates the game -- it should flip the cards itself once started!
 /// </summary>
 /// <param name="myGame">The game to be updated...</param>
 private static void UpdateGame(Snap myGame)
 {
     myGame.Update(); // just ask the game to do this...
 }
开发者ID:thomasklash,项目名称:QuickSnap,代码行数:8,代码来源:SnapGame.cs


示例9: TestSnapCreation

            public void TestSnapCreation()
            {
                Snap s = new Snap();

                Assert.IsTrue(s.CardsRemain);
                Assert.IsNull (s.TopCard);
            }
开发者ID:jack101989,项目名称:QuickSnap,代码行数:7,代码来源:Snap.cs


示例10: TestFlipNextCard

            public void TestFlipNextCard()
            {
                Snap s = new Snap();

                Assert.IsTrue(s.CardsRemain);
                Assert.IsNull (s.TopCard);

                s.FlipNextCard ();

                Assert.IsNull (s._topCards [0]);
                Assert.IsNotNull (s._topCards [1]);
            }
开发者ID:jack101989,项目名称:QuickSnap,代码行数:12,代码来源:Snap.cs


示例11: DrawGame

 /// <summary>
 /// Draws the game to the Window.
 /// </summary>
 /// <param name="myGame">The details of the game -- mostly top card and scores.</param>
 private static void DrawGame(Snap myGame)
 {
开发者ID:ZeEskimo,项目名称:QuickSnap,代码行数:6,代码来源:SnapGame.cs


示例12: Sheffle

 //shuffle
 private static void Sheffle(Snap myGame)
 {
 myGame.shuffle(); // just ask the game to do this...
 }
开发者ID:conradhengstler,项目名称:QuickSnap,代码行数:5,代码来源:SnapGame.cs



注:本文中的CardGames.GameLogic.Snap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# XML.ProjectLayoutElement类代码示例发布时间:2022-05-24
下一篇:
C# CardDesign.Gesture_Event_Args类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap