//game create
        private void menuItem1_Click(object sender, EventArgs e)
        {
            // Первый сдающий
            FirstDealer = Quarters.NotDefinedYet;
            if (radioButton3.Checked)
                FirstDealer = Quarters.N;
            else if (radioButton5.Checked)
                FirstDealer = Quarters.W;
            else if (radioButton6.Checked)
                FirstDealer = Quarters.E;
            else if (radioButton4.Checked)
                FirstDealer = Quarters.S;

            // Премия за онеры
            bool BonusForOners = checkBox1.Checked;

            // Премия за геймы сразу, или после роббера
            bool BonusForWholeRobber = radioButton1.Checked;

            // Создать GameOptions
            GameOptions = 0;
            if(BonusForOners)
                GameOptions |= 1;
            if(BonusForWholeRobber)
                GameOptions |= 2;

            accepted = true;
            this.DialogResult = DialogResult.OK;
        }
 private void InitialShocks()
 {
     var r = _rng.Next(0, 2);
     if (r == 0)
         _shockQ = Quarters.Q4;
     for (var i = 1; i < 4; i++)
         _shocks.Add(i);
 }
Пример #3
0
    private void set(Quarters q_, bool selected_)
    {
      if (selected_ && m_quarters.Has(q_))
        return;

      if (!selected_ && !m_quarters.Has(q_))
        return;

      m_quarters = selected_
        ? m_quarters.Add(q_)
        : m_quarters.Remove(q_);

      adjustDisplay();
    }
Пример #4
0
        // create game
        private void menuItem1_Click(object sender, EventArgs e)
        {
            // Первый сдающий
            FirstDealer = Quarters.NotDefinedYet;
            if (radioButton3.Checked)
                FirstDealer = Quarters.N;
            else if (radioButton5.Checked)
                FirstDealer = Quarters.W;
            else if (radioButton6.Checked)
                FirstDealer = Quarters.E;
            else if (radioButton4.Checked)
                FirstDealer = Quarters.S;

            // Кол-во сдач в каждом матче
            DealsCount = (byte)(int) combo1.Items[combo1.SelectedIndex];

            // Плавает зона?
            ZoneSwims = radioButton2.Checked;

            // Опции
            BridgeGameScoring.TypeOfCompensation CompType = BridgeGameScoring.TypeOfCompensation.Moscow;
            if (radioButton8.Checked)
                CompType = BridgeGameScoring.TypeOfCompensation.Moscow;
            else if (radioButton1.Checked)
                CompType = BridgeGameScoring.TypeOfCompensation.Europe;
            else if (radioButton9.Checked)
                CompType = BridgeGameScoring.TypeOfCompensation.Milton_York;
            else if (radioButton10.Checked)
                CompType = BridgeGameScoring.TypeOfCompensation.Chicago;
            bool Europe_10_is_2 = checkBox1.Checked;
            bool Europe_less_23_2 = checkBox2.Checked;

            // Создать GameOptions
            GameOptions = 0;
            GameOptions |= (byte)CompType; //2 bits
            if (Europe_10_is_2)
                GameOptions |= 4; //3rd bit
            if (Europe_less_23_2)
                GameOptions |= 8; //4th bit

            accepted = true;
            this.DialogResult = DialogResult.OK;
        }
        // create game
        private void menuItem1_Click(object sender, EventArgs e)
        {
            // Первый сдающий
            FirstDealer = Quarters.NotDefinedYet;
            if (radioButton3.Checked)
                FirstDealer = Quarters.N;
            else if (radioButton5.Checked)
                FirstDealer = Quarters.W;
            else if (radioButton6.Checked)
                FirstDealer = Quarters.E;
            else if (radioButton4.Checked)
                FirstDealer = Quarters.S;

            // Кол-во сдач в каждом матче
            DealsCount = (byte)(int)combo1.Items[combo1.SelectedIndex];

            // Плавает зона?
            ZoneSwims = radioButton2.Checked;

            // Опций нет

            accepted = true;
            this.DialogResult = DialogResult.OK;
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (trackBarTime.Value < 15)
            {
                trackBarTime.Value++;
                CheckForShock();
                UpdateConsumption();
                UpdateInvestment();
                UpdateNetExports();
                UpdateExpenditure();
                UpdateTaxes();
                UpdateGovSpending();
                UpdateGrowth();
                UpdateDeficit();
                UpdateFreakonomist();
                UpdateFiscalTimes();

                if (_quarter != Quarters.Q4)
                    _quarter++;
                else
                    _quarter = Quarters.Q1;
            }
            if (trackBarTime.Value == 15)
                DisplayScoreboard();
        }
Пример #7
0
        void DB_LoadGameParameters()
        {
            System.Data.SqlServerCe.SqlCeCommand sqlQuery = DB.CreateQuery();
            sqlQuery.CommandText = "SELECT * FROM Games WHERE id=" + DB_Game_Id + "";
            System.Data.SqlServerCe.SqlCeDataReader sqlReader = DB.ExecuteReader(sqlQuery);
            sqlReader.Read();

            GameSettings_GameType = (GameType)sqlReader.GetByte(sqlReader.GetOrdinal("Type"));

            if (sqlReader.IsDBNull(sqlReader.GetOrdinal("FirstDealer")))
                GameSettings_FirstDealer = Quarters.NotDefinedYet;
            else
                GameSettings_FirstDealer = (Quarters)(sqlReader.GetByte(sqlReader.GetOrdinal("FirstDealer")));
            if (GameSettings_FirstDealer == Quarters.NotDefinedYet)
                GameSettings_FirstDealer = Quarters.N;

            if (sqlReader.IsDBNull(sqlReader.GetOrdinal("ZoneSwims")))
                GameSettings_3Sports_ZoneSwims = true;
            else
                GameSettings_3Sports_ZoneSwims = sqlReader.GetBoolean(sqlReader.GetOrdinal("ZoneSwims"));

            if (sqlReader.IsDBNull(sqlReader.GetOrdinal("GameOptions")))
                GameSettings_Options = 0;
            else
                GameSettings_Options = sqlReader.GetByte(sqlReader.GetOrdinal("GameOptions"));

            if (sqlReader.IsDBNull(sqlReader.GetOrdinal("DealsInMatch")))
                GameSettings_DealsInMatch = 0;
            else
                GameSettings_DealsInMatch = sqlReader.GetByte(sqlReader.GetOrdinal("DealsInMatch"));

            sqlReader.Close();
        }
Пример #8
0
 private bool checkIsSelectedAndAdjustAppearance(Quarters q1_, SI.Controls.Button btn_)
 {
   bool isSelected = m_quarters.Has(q1_);
   setButtonSelectedAppearance(btn_, isSelected);
   return isSelected;
 }
Пример #9
0
 private void toggle(Quarters q_)
 {
   m_quarters = m_quarters.Toggle(q_); 
   adjustDisplay();
 }
Пример #10
0
        public static void DefineSportDealer(QuarterSwitcher out_dealer, int fulldealNo, int matchNo, int mdealNo, Quarters firstdealer, bool bZoneSwims)
        {
            QuartersFollow first_ = Q_ToFollow(firstdealer);
            QuartersFollow now_;
            if (bZoneSwims)
                now_ = (QuartersFollow) (((int)first_ + mdealNo) % 4);
            else
                now_ = (QuartersFollow) (((int)first_ + mdealNo + (int)(mdealNo / 4) + matchNo) % 4);

            /*** было ***
            if (bZoneSwims)
                now_ = (QuartersFollow)(((int)first_ + fulldealNo) % 4);
            else
                now_ = (QuartersFollow)(((int)first_ + fulldealNo + (int)(fulldealNo / 4)) % 4);
            *************/

            out_dealer.Quarter = Q_FromFollow(now_);
        }
Пример #11
0
 // Определение зоны/сдающего для роббера
 public static void DefineRobberDealer(QuarterSwitcher out_dealer, int fulldealNo, int robNo, int rdealNo, Quarters firstdealer)
 {
     QuartersFollow first_ = Q_ToFollow(firstdealer);
     QuartersFollow now_ = (QuartersFollow)(((int)first_ + fulldealNo) % 4);
     out_dealer.Quarter = Q_FromFollow(now_);
 }
Пример #12
0
 static QuartersFollow Q_ToFollow(Quarters q)
 {
     switch (q)
     {
         case Quarters.N:
             return QuartersFollow.N;
         case Quarters.E:
             return QuartersFollow.E;
         case Quarters.S:
             return QuartersFollow.S;
         case Quarters.W:
             return QuartersFollow.W;
         default:
             return QuartersFollow.N;
     }
 }