Ejemplo n.º 1
0
        InsertItemIntoVertexComboBox
        (
            ObjectWithText oItemToInsert,
            ComboBox cbxVertex
        )
        {
            Debug.Assert(cbxVertex != null);
            AssertValid();

            ComboBox.ObjectCollection oItems = cbxVertex.Items;
            Int32 iItems = oItems.Count;

            Int32 iColumnToInsertOneBased =
                ObjectWithTextToColumnNumberOneBased(oItemToInsert);

            Int32 i;

            for (i = 0; i < iItems; i++)
            {
                Debug.Assert(oItems[i] is ObjectWithText);

                ObjectWithText oItem = (ObjectWithText)oItems[i];

                if (iColumnToInsertOneBased <
                    ObjectWithTextToColumnNumberOneBased(oItem))
                {
                    break;
                }
            }

            oItems.Insert(i, oItemToInsert);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            tapis             = new Core.GameObject();
            tapisParis        = new Core.GameObject();
            tableauPoints     = new Core.GameObject();
            newGameBtn        = new Core.GameObject();
            validerBtn        = new Core.GameObject();
            nbPlayerWindow    = new Core.GameObject();
            nbPlayersTextbox  = new Core.Textbox();
            namePlayersWindow = new Core.GameObject();
            dialogueBox       = new Core.ObjectWithText();
            numManche         = new Core.Textbox();
            numTour           = new Core.Textbox();
            pariTextbox       = new Core.ObjectWithText();

            joueurs    = new List <Joueur>();
            manche     = 0;
            tour       = 1;
            nbJoueurs  = 0;
            nbCartes   = 5;
            IsGameOver = false;

            this.IsMouseVisible = true;
            base.Initialize();
            pl = new InterfacePl();
        }
        PopulateVertexComboBox
        (
            ComboBox cbxVertex
        )
        {
            Debug.Assert(cbxVertex != null);
            AssertValid();

            // Save the ObjectWithText that is selected in the vertex ComboBox, if
            // there is one.

            ObjectWithText oOldSelectedObjectWithText =
                (ObjectWithText)cbxVertex.SelectedItem;

            ComboBox.ObjectCollection oItems = cbxVertex.Items;
            oItems.Clear();

            foreach (DataGridViewRow oDataGridViewRow in dgvSourceColumns.Rows)
            {
                if ((Boolean)oDataGridViewRow.Cells[IsEdgeColumnIndex].Value)
                {
                    oItems.Add((ObjectWithText)oDataGridViewRow.Cells[
                                   ColumnNameIndex].Value);
                }
            }

            cbxVertex.SelectedItem = oOldSelectedObjectWithText;
        }
Ejemplo n.º 4
0
        ObjectWithTextToColumnNumberOneBased
        (
            ObjectWithText oObjectWithText
        )
        {
            Debug.Assert(oObjectWithText != null);
            AssertValid();

            Debug.Assert(oObjectWithText.Object is Int32);

            return((Int32)oObjectWithText.Object);
        }
Ejemplo n.º 5
0
        UpdateVertexComboBox
        (
            ItemCheckEventArgs e,
            ComboBox cbxVertex
        )
        {
            AssertValid();

            // Save the ObjectWithText that is selected in the vertex ComboBox, if
            // there is one.

            ObjectWithText oOldSelectedObjectWithText =
                (ObjectWithText)cbxVertex.SelectedItem;

            // Get the ObjectWithText that was checked or unchecked in
            // clbSourceColumns.

            ObjectWithText oCheckedOrUncheckedObjectWithText =
                (ObjectWithText)clbSourceColumns.Items[e.Index];

            if (e.NewValue == CheckState.Checked)
            {
                // Insert it into the vertex ComboBox.

                InsertItemIntoVertexComboBox(oCheckedOrUncheckedObjectWithText,
                                             cbxVertex);
            }
            else
            {
                // Remove it from the vertex ComboBox.

                if (oCheckedOrUncheckedObjectWithText ==
                    oOldSelectedObjectWithText)
                {
                    cbxVertex.SelectedIndex = -1;
                }

                cbxVertex.Items.Remove(oCheckedOrUncheckedObjectWithText);
            }
        }