Ejemplo n.º 1
0
        private Model.Wheel EncodeWheel(int width, int height, int[] wheelValues)
        {
            var currentIndex = 0;
            var wheel        = new Model.Wheel(new List <int>()
            {
                3, 3, 3
            });

            for (int i = 0; i < width; ++i)
            {
                for (int j = 0; j < wheel.Rows[i]; ++j)
                {
                    if (i > 0)
                    {
                        wheel[i].Add(wheelValues[currentIndex + j]);
                    }
                    else
                    {
                        wheel[i].Add(wheelValues[j]);
                    }
                }

                currentIndex = currentIndex + wheel.Rows[i];
            }

            return(wheel);
        }
Ejemplo n.º 2
0
        private void btnClearOrStop_Click(object sender, EventArgs e)
        {
            if (animation == DEFINE.EAnimation.Stop)
            {
                // xoa
                w.Erase();

                w = new Model.Wheel(new Point(200, 200), 50, Color.Red, new Point(speedMoveBase * tbVelocity.Value, 0), speedRotateBase, ref bm);
                w.Draw();
                pbDraw.Image = bm;

                animation               = DEFINE.EAnimation.Start;
                btnStartOrPause.Text    = "Start";
                btnClearOrStop.Text     = "Stop";
                btnClearOrStop.Enabled  = false;
                btnStartOrPause.Enabled = true;
                pnlRotate.Enabled       = true;
                tbRotate.Value          = 1;
                tbVelocity.Value        = 1;
            }
            if (animation == DEFINE.EAnimation.Running || animation == DEFINE.EAnimation.Pause)
            {
                animation               = DEFINE.EAnimation.Stop;
                btnClearOrStop.Text     = "Clear";
                btnStartOrPause.Enabled = false;
            }
        }
Ejemplo n.º 3
0
        private void GeneratePreview(int count, string previewLabel = "", T previewContent = default)
        {
            DestroyPreviews();

            clone      = Instantiate(renderer.gameObject, renderer.transform.parent);
            clone.name = $"{renderer.gameObject.name} Preview";

            if (disposablePreview)
            {
                clone.hideFlags = HideFlags.HideInHierarchy;
            }

            DiskBase <T> cloneRenderer = clone.GetComponent <DiskBase <T> >();

            cloneRenderer.SetContentDictionary(new UnitContentDictionary <T>(previewContent));

            Model.Wheel wheel = Model.Wheel.Create();
            for (int i = 0; i < count; i++)
            {
                string label = previewLabel == "" ? Lipsum.Next : previewLabel;
                wheel.AddSlot(Model.Wheel.Create(name: label));
            }

            cloneRenderer.SetWheel(wheel);
        }
Ejemplo n.º 4
0
        public ucWheelMove()
        {
            InitializeComponent();
            bm = new Bitmap(pbDraw.Size.Width, pbDraw.Size.Height);
            w  = new Model.Wheel(new Point(200, 200), 50, Color.Red, new Point(speedMoveBase * tbVelocity.Value, 0), speedRotateBase, ref bm);
            w.Draw();

            pbDraw.Image = bm;
        }