Ejemplo n.º 1
0
        private void ShapeBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (ShapeBox.SelectedIndex)
            {
            case 0:     //rectangle
                ClearContext();
                RedTextBox.Select();
                WidthLabel.Show();
                HeightLabel.Show();
                WidthTextBox_Rectangle.Show();
                HeightTextBox_Rectangle.Show();
                break;

            case 1:     //square
                ClearContext();
                RedTextBox.Select();
                WidthLabel.Show();
                WidthTextBox_Square.Show();
                break;

            case 2:     //circle
                ClearContext();
                RedTextBox.Select();
                RadiusLabel.Show();
                RadiusTextBox_Circle.Show();
                break;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (WidthLabel != null)
            {
                WidthLabel.Dispose();
                WidthLabel = null;
            }

            if (HeightLabel != null)
            {
                HeightLabel.Dispose();
                HeightLabel = null;
            }

            if (DownloadButton != null)
            {
                DownloadButton.Dispose();
                DownloadButton = null;
            }

            if (HeightTextField != null)
            {
                HeightTextField.Dispose();
                HeightTextField = null;
            }

            if (ImageView != null)
            {
                ImageView.Dispose();
                ImageView = null;
            }

            if (MediaPathTextField != null)
            {
                MediaPathTextField.Dispose();
                MediaPathTextField = null;
            }

            if (WidthTextField != null)
            {
                WidthTextField.Dispose();
                WidthTextField = null;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Resets and refreshes the labels during gameplay
        /// </summary>
        private void ResetLabels()
        {
            // Set label values
            if (world.cubes.ContainsKey(playerId))
            {
                FPSValue.Text   = "" + fps[0];
                FoodValue.Text  = "" + world.foodCount;
                MassValue.Text  = "" + (int)world.cubes[playerId].Mass;
                WidthValue.Text = "" + (int)world.cubes[playerId].width;
            }

            // Refresh all the labels
            FPSLabel.Refresh();
            FPSValue.Refresh();

            FoodLabel.Refresh();
            FoodValue.Refresh();

            MassLabel.Refresh();
            MassValue.Refresh();

            WidthLabel.Refresh();
            WidthValue.Refresh();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// <div class="ui-widget ecl-appliedfilters">
        ///    <div class="ui-widget-header">
        ///    Applied Filters
        ///    </div>
        ///    <div class="ui-widget-content">
        ///      <table>
        ///        <tr>
        ///          <td>Friendly Name</td>
        ///          <td>Value</td>
        ///        </tr>
        ///        ...
        ///      </table>
        ///    </div>
        /// </div>
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            EnsureFilterList();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-widget-header");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.Write("Applied Filters");
            writer.RenderEndTag();      // div
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "ui-widget-content");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.RenderBeginTag(HtmlTextWriterTag.Em);
            // Need to show seconds along with time
            writer.Write("Query executed on {0:F}", DateTime.Now);
            writer.RenderEndTag();

            //Only controls that have either the display value or having some querystring value
            //will be considered to be displayed.
            FilterItem[] filterItems;
            if (this.DisplayEmptyValues)
            {
                filterItems = (from p in _usedParams
                               where !string.IsNullOrEmpty(p.DisplayValue) || !string.IsNullOrEmpty(p.QueryStringValue)
                               select p).ToArray();
            }
            else
            {
                filterItems = (from p in _usedParams
                               where !string.IsNullOrEmpty(p.DisplayValue) && !string.IsNullOrEmpty(p.QueryStringValue)
                               select p).ToArray();
            }

            if (filterItems.Length > 0)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Table);
                writer.RenderBeginTag(HtmlTextWriterTag.Tbody);
                // Render a filter in Applied Filters if either query string or Display value is available
                foreach (FilterItem li in filterItems)
                {
                    writer.RenderBeginTag(HtmlTextWriterTag.Tr);
                    if (this.WidthLabel != Unit.Empty)
                    {
                        writer.AddStyleAttribute(HtmlTextWriterStyle.Width, WidthLabel.ToString());
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Td);
                    if (string.IsNullOrEmpty(li.FriendlyName))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "2");
                        writer.Write(li.DisplayValue);
                    }
                    else
                    {
                        writer.Write(li.FriendlyName);
                        writer.RenderEndTag();      //td
                        writer.RenderBeginTag(HtmlTextWriterTag.Td);
                        writer.Write(li.DisplayValue);
                    }
                    writer.RenderEndTag();  //td
                    writer.RenderEndTag();  // tr
                }
                writer.RenderEndTag();      // tbody
                writer.RenderEndTag();      // table
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "ecl-appliedfilters_nofilters");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.Write("No filters applied");
                writer.RenderEndTag();
            }
            writer.RenderEndTag();      //div
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Called to draw background
        /// </summary>
        private void AdCubioForm_Paint(object sender, PaintEventArgs e)
        {
            if (GameState == 1)
            {
                List <Cube> PlayerList = null;
                List <Cube> CubeList   = null;

                lock (TheWorld)
                {
                    PlayerList = TheWorld.PlayerCubes.Values.ToList <Cube>();
                    CubeList   = TheWorld.DictionaryOfCubes.Values.ToList <Cube>();
                }

                int NumOfFood = 0;

                //// Draw all other cubes
                foreach (Cube cube in CubeList)
                {
                    if (cube.FoodStatus == true)
                    {
                        NumOfFood += 1;
                    }
                    // Set brush color
                    myBrush = new SolidBrush(Color.FromArgb(cube.argb_color));
                    // Draw cube
                    e.Graphics.FillRectangle(myBrush, cube.X - (cube.getWidth() / 2), cube.Y - (cube.getWidth() / 2), cube.getWidth() + 3, cube.getWidth() + 3);

                    // Draw player name
                    myBrush = new SolidBrush(Color.Black);
                    e.Graphics.DrawString(cube.Name, new Font("Times New Roman", 15.0f), myBrush, new PointF(cube.X - 20, cube.Y));
                }
                // Update food label
                FoodLabel.Text = NumOfFood.ToString();
                FoodLabel.Refresh();

                // Used to display current player mass
                int mass = 0;

                // Draw all player cubes
                foreach (Cube cube in PlayerList)
                {
                    // Update width and masses
                    mass       += (int)cube.Mass;
                    PlayerMass += cube.Mass;
                    PlayerWidth = cube.getWidth();
                    if (cube.Mass != 0)
                    {
                        // Set brush to cube color
                        myBrush = new SolidBrush(Color.FromArgb(cube.argb_color));
                        // Draw cube
                        float width = cube.getWidth();
                        e.Graphics.FillRectangle(myBrush, cube.X - (cube.getWidth() / 2), cube.Y - (cube.getWidth() / 2), cube.getWidth(), cube.getWidth());

                        // Draw player name
                        myBrush = new SolidBrush(Color.Black);
                        e.Graphics.DrawString(cube.Name, new Font("Times New Roman", 15.0f), myBrush, new PointF(cube.X, cube.Y - 5));
                    }
                }

                // Player has died
                if (mass == 0 && GameState == 1 && PlayerMass != 0)
                {
                    MessageBox.Show("You died!\n Your final mass was: " + PlayerMass);
                    Close();
                }

                // Update width label
                WidthLabel.Text = "Width: " + PlayerWidth;
                WidthLabel.Refresh();

                // Update mass label
                MassLabel.Text = "Mass: " + mass;
                MassLabel.Refresh();

                // Send move request
                sendRequest("move", Mousex, Mousey);
                // Calculate FPS then paint
                CalcFrames();
                Invalidate();
            }
        }