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

C# model类代码示例

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

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



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

示例1: DoHit

        public bool DoHit(model.Player a_dealer)
        {
            int[] cardScores = a_dealer.getCardScoreArray();
            total = 0;

            if (a_dealer.CalcScore() < 17)
            {
                return true;
            }

            if (a_dealer.CalcScore() == 17){

                foreach (Card c in a_dealer.GetHand())
                {
                    if (c.GetValue() != Card.Value.Ace)
                    {
                        total += cardScores[(int)c.GetValue()];
                    }
                }
                //if this is true a soft 17 is active.
                if (total <= 6)
                {
                    return true;
                }
            }

            return false;
        }
开发者ID:MartinArvidsson,项目名称:UML,代码行数:28,代码来源:Soft17RuleStratergy.cs


示例2: PlayGame

 public PlayGame(model.Game a_game, view.IView a_view)
 {
     m_game = a_game;
     m_view = a_view;
     m_view.DisplayWelcomeMessage();
     m_game.Subsribe(this);
 }
开发者ID:ad222kr,项目名称:1dv607,代码行数:7,代码来源:PlayGame.cs


示例3: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            //Initialize fields
            m_view = a_view;
            m_game = a_game;

            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            view.Input input = a_view.GetInput();

            if (input == view.Input.Play)
            {
                a_game.NewGame();
            }
            else if (input == view.Input.Hit)
            {
                a_game.Hit();
            }
            else if (input == view.Input.Stand)
            {
                a_game.Stand();
            }

            return input != view.Input.Quit;
        }
开发者ID:kk222hk,项目名称:1dv607-kk222hk-Portfolio,代码行数:33,代码来源:PlayGame.cs


示例4: PlayGame

 public PlayGame(model.Game A_game,
     view.IView A_view)
 {
     a_game = A_game;
       a_view = A_view;
       a_game.addSub(this);
 }
开发者ID:jt222ic,项目名称:Blackjack_jt22ic,代码行数:7,代码来源:PlayGame.cs


示例5: BoatMenu

        public int BoatMenu(model.Boat a_boat)
        {
            Console.Clear();
            Console.WriteLine("");
            Console.WriteLine("-----Boat specifics-----");
            Console.WriteLine("Type: {0}", a_boat.GetType());
            Console.WriteLine("Length: {0}", a_boat.GetLength());

            Console.WriteLine("");
            Console.WriteLine("---------------");
            Console.WriteLine("");
            Console.WriteLine("(D) to Delete boat (U) to Update boat");
            ConsoleKeyInfo input = Console.ReadKey();
            if (input.Key == ConsoleKey.D)
            {
                return 1;
            }

            else if (input.Key == ConsoleKey.U)
            {
                return 2;
            }

            else return 0;          //returnera nåt annat
        }
开发者ID:fh222dt,项目名称:OOAD,代码行数:25,代码来源:BoatView.cs


示例6: DrawCard

 public void DrawCard(model.Card card)
 {
     m_view.DisplayWelcomeMessage();
     m_view.DisplayDealerHand(m_game.GetDealerHand(), m_game.GetDealerScore());
     m_view.DisplayPlayerHand(m_game.GetPlayerHand(), m_game.GetPlayerScore());
     Thread.Sleep(750);
 }
开发者ID:jt222ii,项目名称:Workshop3Blackjack,代码行数:7,代码来源:PlayGame.cs


示例7: PlayGame

        public PlayGame(model.Game a_game, view.IView a_view)
        {
            this.a_game = a_game;
            this.m_view = a_view;

            a_game.AddSubscriber(this);
        }
开发者ID:AndreasAnemyrLNU,项目名称:1dv607,代码行数:7,代码来源:PlayGame.cs


示例8: DoHit

        public bool DoHit(model.Player a_dealer)
        {
            int score = a_dealer.CalcScore();

            if (score < g_hitLimit)
            {
                return true;
            }

            if (score == g_hitLimit)
            {
                foreach (Card c in a_dealer.GetHand())
                {
                    //If Ace is in the hand, checks if score without Ace is 6
                    if ((c.GetValue() == Card.Value.Ace) && (score - 11 == 6))
                    {
                        score -= 10;
                    }
                }

                return score < g_hitLimit;
            }

            return false;
        }
开发者ID:jb223cp,项目名称:1dv607Workshop3,代码行数:25,代码来源:SoftSeventeenGameRule.cs


示例9: DoHit

        public bool DoHit(model.Player a_dealer)
        {
            int[] cardScores = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11 };
            var score = 0;
            var cards = a_dealer.GetHand();
            var numberOfAces = 0;
            foreach (var c in cards)
            {
                
                if (c.GetValue() != Card.Value.Hidden)
                {
                    score += cardScores[(int)c.GetValue()];

                    if (c.GetValue() == Card.Value.Ace)
                    {
                        numberOfAces++;
                    }
                }
            }

            while ((score == g_hitLimit || score > 21) && numberOfAces > 0)
            {
                numberOfAces--;
                score -= 10;
            }

            return score < g_hitLimit;
        }
开发者ID:kristofferlind,项目名称:1dv407-ooad,代码行数:28,代码来源:Soft17HitStrategy.cs


示例10: AddBoat

 /// <summary>
 /// Add a boat menu
 /// </summary>
 /// <param name="a_member">model.Member, the member who owns the new boat</param>
 private void AddBoat(model.Member a_member)
 {
     m_console.AddBoat(a_member);
     for (int i = 0; i < (int)model.Boat.Type.Count; i += 1)
     {
         string message = string.Format("{0}: {1}", i, (model.Boat.Type)i);
         m_console.WriteMessage(message);
     }
     int type;
     while (true)
     {
         m_console.WriteMessage("Type: ");
         bool isNumeric = int.TryParse(m_console.ReadResponse(), out type);
         if (isNumeric && type >= 0 && type < (int)model.Boat.Type.Count)
         {
             break;
         }
         m_console.WriteMessage("Invalid type, type must be a number choosen from the list above");
     }
     double length;
     while (true)
     {
         m_console.WriteMessage("Length: ");
         bool isDouble = double.TryParse(m_console.ReadResponse(), out length);
         if (isDouble && length > 0)
         {
             break;
         }
         m_console.WriteMessage("Invalid length. Length must be of the format XX or XX,XX");
     }
     a_member.GetBoatList().AddBoat((model.Boat.Type)type, length);
     m_console.SetCurrentMenu(view.Console.CurrentMenu.Member);
     GoToCurrentMenu(a_member);
 }
开发者ID:dv222bk,项目名称:1DV607_Portfolio,代码行数:38,代码来源:User.cs


示例11: DoHit

        public bool DoHit(model.Player a_dealer)
        {
            var cards = a_dealer.GetHand();

            // Check if limit has reached....
            if (a_dealer.CalcScore() == g_hitLimit)
            {
                foreach (var card in cards)
                {
                    // Must hit if ace in hand. Because score IS 17!
                    //Ace turns into 1 score instead
                    if (card.GetValue() == Card.Value.Ace)
                    {
                        return true;
                    }
                }
            }

            // No special circumstances....
            if (a_dealer.CalcScore() < g_hitLimit)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
开发者ID:AndreasAnemyrLNU,项目名称:1dv607,代码行数:28,代码来源:Soft17Strategy.cs


示例12: PlayGame

 public PlayGame(model.Game g, view.IView v)
 {
     a_game = g;
     a_view = v;
     a_view.DisplayWelcomeMessage();
     a_game.Subscribe(this);
 }
开发者ID:sk222sw,项目名称:blackjack,代码行数:7,代码来源:PlayGame.cs


示例13: SensorDataUpdated

        public void SensorDataUpdated(model.SensorData data)
        {
            lock (_lock)
            {
                List<TcpClient> clientsToDelete = new List<TcpClient>();

                foreach (TcpClient client in _clients)
                {
                    try
                    {
                        NetworkStream stream = client.GetStream();
                        BinaryFormatter formatter = new BinaryFormatter();

                        formatter.Serialize(stream, data);
                    }
                    catch (Exception)
                    {
                        clientsToDelete.Add(client);
                    }
                }

                foreach (TcpClient c in clientsToDelete)
                {
                    _clients.Remove(c);
                }
            }
        }
开发者ID:simonmoosbrugger,项目名称:SmartChair,代码行数:27,代码来源:GameController.cs


示例14: AddBoat

 // Which member to add the boat to
 // Display views, get inputs to create/save boat to a member
 private void AddBoat(model.Member member)
 {
     try
     {
         _memberView.DisplayMember(member);
         model.Boat.BoatType type = _boatView.GetTypeFromUser();
         double length = _boatView.GetLengthFromUser();
         DateTime registrationDate = _boatView.GetRegistrationDate();
         model.Boat boat = new model.Boat(type, length, registrationDate);
         member.AddBoat(boat);
         _list.SaveMemberList();
         DoMemberView(member);
     }
     catch (Exception ex)
     {
         _memberView.DisplayMember(member);
         _boatView.DisplayErrorMessage(ex.Message);
         if (_boatView.DoesUserWantsToQuit() == true)
         {
             DoMemberView(member);
         }
         else
         {
             AddBoat(member);
         }
     }
 }
开发者ID:dt222cc,项目名称:1dv607-dt222cc,代码行数:29,代码来源:RegistryController.cs


示例15: Play

        public bool Play(model.Game a_game)
        {
            m_view.DisplayWelcomeMessage();

            m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                m_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            switch((view.Choices)m_view.GetInput())
            {
                case view.Choices.Play:
                    a_game.NewGame();
                    break;
                case view.Choices.Hit:
                    a_game.Hit();
                    break;
                case view.Choices.Stand:
                    a_game.Stand();
                    break;
                case view.Choices.Quit:
                    return false;

                default:
                    break;
            }

            return true;
        }
开发者ID:fr222cy,项目名称:IDV607-Black-Jack,代码行数:32,代码来源:PlayGame.cs


示例16: Play

        public bool Play(model.Game a_game)
        {
            //a_game.AddSubscriber(this);
            m_view.DisplayWelcomeMessage();

               // m_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            //m_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());//

            if (a_game.IsGameOver())
            {
                m_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            model.Game.Status input = m_view.GetInput();

            if (input == model.Game.Status.NewGame)
            {
                a_game.NewGame();
            }
            else if (input == model.Game.Status.Hit)
            {
                a_game.Hit();
            }
            else if (input == model.Game.Status.Stand)
            {
                a_game.Stand();
            }

            return input != model.Game.Status.Quit;
        }
开发者ID:henceee,项目名称:1DV607,代码行数:30,代码来源:PlayGame.cs


示例17: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            a_view.DisplayWelcomeMessage();
            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            //int input = a_view.GetInput(); removed due to hidden depencendy.
            int input = System.Console.In.Read();

            if (input == 'p')
            {
                a_game.NewGame();
            }
            else if (input == 'h')
            {
                a_game.Hit();
            }
            else if (input == 's')
            {
                a_game.Stand();
            }

            return input != 'q';
        }
开发者ID:henceee,项目名称:1DV607,代码行数:29,代码来源:PlayGame.cs


示例18: Play

        public bool Play(model.Game a_game, view.IView a_view)
        {
            a_view.DisplayWelcomeMessage();

            a_view.DisplayDealerHand(a_game.GetDealerHand(), a_game.GetDealerScore());
            a_view.DisplayPlayerHand(a_game.GetPlayerHand(), a_game.GetPlayerScore());

            if (a_game.IsGameOver())
            {
                a_view.DisplayGameOver(a_game.IsDealerWinner());
            }

            int input = a_view.GetInput();

            if (input == 'p')
            {
                a_game.NewGame();
            }
            else if (input == 'h')
            {
                a_game.Hit();
            }
            else if (input == 's')
            {
                a_game.Stand();
            }

            return input != 'q';
        }
开发者ID:kk222hk,项目名称:blackjack_csharp,代码行数:29,代码来源:PlayGame.cs


示例19: R_InitSky

        int r_skydirect; // not used?

        #endregion Fields

        #region Methods

        //  of newsky on the left of each scan, 128 bytes
        //  of topsky on the right, because the low-level
        //  drawers need 256-byte scan widths
        /*
        =============
        R_InitSky

        A sky texture is 256*128, with the right side being a masked overlay
        ==============
        */
        public static void R_InitSky(model.texture_t mt)
        {
            int     i, j;
            int     src;

            src = (int)mt.offsets[0];

            for (i = 0; i < 128; i++)
            {
                for (j = 0; j < 128; j++)
                {
                    newsky[(i * 256) + j + 128] = mt.pixels[src+i * 256 + j + 128];
                }
            }

            for (i = 0; i < 128; i++)
            {
                for (j = 0; j < 131; j++)
                {
                    if (mt.pixels[src + i * 256 + (j & 0x7F)] != 0)
                    {
                        bottomsky[(i * 131) + j] = mt.pixels[src + i * 256 + (j & 0x7F)];
                        bottommask[(i * 131) + j] = 0;
                    }
                    else
                    {
                        bottomsky[(i * 131) + j] = 0;
                        bottommask[(i * 131) + j] = 0xff;
                    }
                }
            }

            r_skysource = newsky;
        }
开发者ID:sbrown345,项目名称:quakejs,代码行数:50,代码来源:r_sky.cs


示例20: ShowCard

        public void ShowCard(model.Card a_card)
        {
            //first do some randomize
            RandomizeCard();

            DoShowCard(a_card);
        }
开发者ID:of222au,项目名称:1DV607-Objektorienterad-analys-och-design-med-UML,代码行数:7,代码来源:UserControlPlayerCard.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# mshtml类代码示例发布时间:2022-05-24
下一篇:
C# mlptrainer类代码示例发布时间: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