Example #1
0
        public static JGPartyTable CreateTable(int Mise, JGGameTablePlayerProfile human, params JGGameTablePlayerProfile[] players)
        {
            if (Mise <= 0)
            {
                return(null);
            }
            if ((human == null) || (players == null) || (players.Length <= 0))
            {
                return(null);
            }

            var t = from s in players where (s != null) select s.Player;

            JGPlayer[] tp = t.ToArray();

            ArrayList st = new ArrayList();

            st.Add(human);
            st.AddRange(players);
            int v_pot = 0;

            foreach (JGGameTablePlayerProfile item in st)
            {
                if (!item.RemoveFromBalance(Mise))
                {
                    //party.EjectPlayer(item.Player, enuEjectReason.CanRemoveBalance);

                    return(null);
                }
                else
                {
                    v_pot += Mise;
                }
            }



            JGParty party = JGParty.CreateParty(human.Player, tp);

            if (party == null)
            {
                return(null);
            }



            JGPartyTable p = new JGPartyTable();

            //p.Register(human, players);
            p.m_party           = party;
            p.m_party.PartyEnd += p.m_party_PartyBetEnd;
            p.m_profiles        = (JGGameTablePlayerProfile[])st.ToArray(typeof(JGGameTablePlayerProfile));
            p.m_Pot             = v_pot;
            return(p);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="player1"></param>
        /// <param name="player2">list des player additionel seul 3 seront considéré</param>
        /// <returns>un nouvelle party</returns>
        public static JGParty CreateParty(JGPlayer player1, params JGPlayer[] player2)
        {
            if ((player2 == null) || (player2.Length == 0))
            {
                return(null);
            }
            JGParty v_p = new JGParty();

            v_p.m_players.Add(player1);
            for (int i = 0; i < player2.Length; i++)
            {
                if (!v_p.AddPlayer(player2[i]))
                {
                    break;
                }
            }

            return(v_p);
        }
Example #3
0
        public static void Main(params string[] args)
        {
            try
            {
#if WINDOWS
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                StartForm v_start = new StartForm();
                v_start.Show();
                while (v_start.Created)
                {
                    Application.DoEvents();
                }
#elif ANDROID
#elif LINUX
#elif CONSOLE
                //   JGDB db = null;
                JGDB.StoreDb();

                Console.WriteLine("Demonstration : Welcome to JAMBO GAME");
                JGHumanPlayer player1 = new JGHumanPlayer();
                player1.Name    = "Bertrand";
                player1.Profile = JGDB.GetProfile("*****@*****.**");

                JGGameTablePlayerProfile prof1 = player1.CreateGameProfile(180);
                JGGameTablePlayerProfile prof2 =
                    new JGComputerPlayer()
                {
                    Name    = "Comp2",
                    Profile = JGDB.GetProfile("*****@*****.**")
                }.CreateGameProfile(60);

                JGPartyTable table = JGPartyTable.CreateTable(50, prof1, prof2);
                if (table != null)
                {
                    table.Party.Start();
                    JGParty party = table.Party;
                    JGHand  hand  = null;
                    while (!party.End)
                    {
                        hand = party.Hands.GetHand(party.SelectedPlayer);


                        Console.WriteLine("Tour: " + party.Tour);
                        Console.WriteLine("Jeu: " + party.SelectedPlayer);
                        if (party.Tour == 0)
                        {
                            if ((hand.IsSevenRule() | hand.IsTweentyOneRule()) != enuJGExceptionRule.None)
                            {
                                //Console.WriteLine (" REGLE DES 7 : "+ hand.IsSevenRule ());
                                party.CheckMyRules(party.SelectedPlayer);
                            }
                        }
                        if ((party.ControlCard == null) || (party.ControlUser == party.SelectedPlayer))
                        {
                            party.SelectedPlayer.Play(party, hand[0]);
                        }
                        else if (hand.ContainsCardType(party.ControlCard.CardType))
                        {
                            hand.SortByType();
                            party.SelectedPlayer.Play(party, hand.GetFirstCard(party.ControlCard.CardType));
                        }
                        else
                        {
                            party.SelectedPlayer.Play(party, hand[0]);
                        }
                    }
                }
                else
                {
                    Console.WriteLine("can't create a table .table mis error");
                }
                JGDB.Restore(prof1, prof2);
                Console.WriteLine("Party end");


                /*
                 *
                 * JGComputerPlayer player1 = new JGComputerPlayer();
                 * player1.Name = "Comp1";
                 * JGParty party = JGParty.CreateParty(player1,
                 *  new JGComputerPlayer[]{
                 *  new JGComputerPlayer(){
                 *      Name = "Comp2"
                 *  }
                 *  ,
                 *  new JGComputerPlayer(){
                 *      Name = "Comp3"
                 *  }
                 *  });
                 *
                 * Console.WriteLine("nouvelle party " + party.Players.Count);
                 *
                 * party.MixCard();
                 * party.CutAt(21);
                 *
                 * party.Start();
                 * JGHand hand = null;// party.Hands.GetHand(party.SelectedPlayer);
                 *
                 *
                 *
                 * while (!party.End)
                 * {
                 *  hand = party.Hands.GetHand(party.SelectedPlayer);
                 *
                 *
                 *  Console.WriteLine("Tour: " + party.Tour);
                 *  Console.WriteLine("Jeu: "+party.SelectedPlayer);
                 *  if (party.Tour== 0)
                 *  {
                 *      if ((hand.IsSevenRule() | hand.IsTweentyOneRule ()) != enuJGExceptionRule.None)
                 *      {
                 *          //Console.WriteLine (" REGLE DES 7 : "+ hand.IsSevenRule ());
                 *          party.CheckMyRules(party.SelectedPlayer );
                 *      }
                 *  }
                 *  if ((party.ControlCard == null) || (party.ControlUser == party.SelectedPlayer ))
                 *  {
                 *      party.SelectedPlayer.Play(party, hand[0]);
                 *  }
                 *  else if (hand.ContainsCardType (party.ControlCard.CardType))
                 *  {
                 *      hand.SortByType();
                 *      party.SelectedPlayer.Play(party, hand.GetFirstCard(party.ControlCard.CardType));
                 *  }
                 *  else {
                 *          party.SelectedPlayer.Play(party, hand[0]);
                 *  }
                 *
                 * }
                 * Console.WriteLine("party teminer:  ");
                 * Console.WriteLine ("Winner : "+ party.Winner);
                 * Console.WriteLine ("Card : "+ party.ControlCard );
                 *
                 *
                 *
                 * if ((party.Tour == 5))
                 * {
                 *  party.CheckCoraRule(party.Winner);
                 * }
                 */

                //Console.WriteLine("party teminer " + party.Winner);


                //  JGHand hand = party.Hands.GetHand(player1);

                // Console.WriteLine ("jour 1 jouer");

                //player1.Play(party, hand[0]);



                //Console.WriteLine("Couleur Rouge : " + GetColor(hand, enuJGCardColor.Red ));
                //Console.WriteLine("Couleur Black : " + GetColor(hand, enuJGCardColor.Black));

                //foreach (enuJGCardType item in Enum.GetValues (typeof (enuJGCardType)))
                //{
                //    Console.WriteLine("Carte " + item.ToString() + " " + GetCardType(hand, item));
                //}



                //party.Hands.SortHand(player1, enuJGSortType.Color   );
                //hand.SortByValue();



                Console.ReadLine();
#endif
            }
            catch (Exception ex) {
                MessageBox.Show("L'application s'est malheureusement arrêter : " + ex.Message);
            }
        }
Example #4
0
 internal JGHand(JGParty party, JGPlayer player)
 {
     m_cards       = new List <JGCard>();
     this.m_party  = party;
     this.m_player = player;
 }
Example #5
0
 internal JGGameHand(JGParty jGParty)
 {
     this.jGParty = jGParty;
     this.m_tour  = 0;
     this.m_dic   = new Dictionary <int, List <JGGameHandInfo> >();
 }
Example #6
0
 public void Play(JGParty party, JGCard jGCard)
 {
     party.Play(this, jGCard);
 }
Example #7
0
 internal JGHands(JGParty jGParty)
 {
     this.jGParty       = jGParty;
     this.m_playerHands = new Dictionary <JGPlayer, JGHand>();
 }
Example #8
0
 public JGPartyPlayerCollections(JGParty jGParty)
 {
     this.jGParty   = jGParty;
     this.m_players = new List <JGPlayer>();
 }
Example #9
0
        public void Register(JGHumanPlayer human, params JGPlayer[] players)
        {
            JGParty p = JGParty.CreateParty(human, players);

            this.m_party = p;
        }
Example #10
0
 internal JGBank(JGParty jGParty)
 {
     this.jGParty = jGParty;
     this.m_cards = new List <JGCard>();
     this.InitCardList();
 }