示例#1
0
        void frm_Shown(object sender, EventArgs e)
        {
            panel.Height = this.ClientSize.Height;
            panel.Width  = panel.Height + 20;
            panel.Top    = (this.ClientSize.Height - panel.Height) / 2;
            panel.Left   = (this.ClientSize.Width - panel.Width) / 2;
            Point panelCenter = new Point(panel.Width / 2, panel.Height / 2);

            int radius = (this.ClientSize.Height - 20) / 2;

            wheel = new GameWheel(panelCenter, radius, 50, 1000, 25);
            wheel.SetGraphics(panel.CreateGraphics());
            wheel.Draw();
        }
示例#2
0
        void frm_Shown(object sender, EventArgs e)
        {
            panel.Height = this.ClientSize.Height;
            panel.Width  = panel.Height + 60;
            panel.Top    = (this.ClientSize.Height - panel.Height) / 2;
            panel.Left   = (this.ClientSize.Width - panel.Width) / 2;
            Point panelCenter = new Point(panel.Width / 2, panel.Height / 2);

            int radius = (this.ClientSize.Height - 20) / 2;

            string[] values = new String[] { "A1", "B2", "C1", "D2", "E1", "F2", "G1" };
            wheel = new GameWheel(panelCenter, radius, values);

            wheel.SetGraphics(panel.CreateGraphics());
            wheel.Draw();
        }
示例#3
0
        // calculate the answer by simulating the whole spin
        string Simulate()
        {
            GameWheel simulation = new GameWheel();

            simulation.sectorAngle      = this.sectorAngle;
            simulation.rotateAngle      = this.rotateAngle;
            simulation.initialRotations = this.initialRotations;
            simulation.repaintCounter   = 0;

            simulation.wheel = new Sector[this.wheel.Length];
            for (int i = 0; i < this.wheel.Length; i++)
            {
                simulation.wheel[i] = new Sector(i, this.wheel[i].value, this.sectorAngle, Color.Blue);
            }

            simulation.state = STATE_INITIAL_SPIN;
            while (simulation.state != STATE_HIGHLIGHTING)
            {
                simulation.Refresh(false);
            }
            return(simulation.result);
        }