Beispiel #1
0
        private BangButton MakeNewBubbleButtonLocked()
        {
            ++NextButtonID;

            const int  height  = 30;
            BangButton button1 = new BangButton(Util);

            button1.Id = NextButtonID;

            button1.Location = new System.Drawing.Point(1, 1);
            button1.Name     = string.Format("{0}", NextButtonID);
            button1.Font     = new Font(FontFamily.GenericSansSerif, 8.0f);
            button1.Size     = new System.Drawing.Size(height, height);
            button1.TabIndex = (int)NextButtonID;
            button1.Text     = button1.Name;
            button1.Visible  = true;
            button1.Tag      = new Point(GetRandomish(), GetRandomish()); // this is its direction
            button1.Click   += new EventHandler(button1_Click);

            bool result;

            /* while */
            {
                uint allocatedEngineId = EngineIdAddHelper;
                button1.EngineId = allocatedEngineId;
                result           = myBubbles.AddBubble(allocatedEngineId, NextButtonID, (float)height, GetCoords);
                if (result)
                {
                    Controls.Add(button1);
                    ButtonList.Add(button1);
                }
            } while (result == false)
            {
                ;
            }

            string text = string.Format("group count={0}, engine count={1}, bubble count1={2}, bubble count2={3}",
                                        myBubbles.GetGroupCount(),
                                        myBubbles.GetEngineCount().ToString(),
                                        myBubbles.GetBubbleCount(EngineId1).ToString(),
                                        myBubbles.GetBubbleCount(EngineId2).ToString());

            Text = text;
            return(button1);
        }
Beispiel #2
0
        void Util_ShowBang(object sender, ShowBangEventArgs e)
        {
            BangButton found = ButtonList.Find(but => but.Id == (int)e.Bang.mCenterID);

            if (e.Util.IsHit(found.EngineId, e.Bang.mCenterID))
            {
                return;
            }

            // big breath then CrashPlayer.Play()
            //////Thread.SpinWait(20);
            //////CrashPlayer.Stop();
            //////Thread.SpinWait(20);
            //////CrashPlayer.Play(); // hog
            //////Thread.SpinWait(20);

            e.Util.SetHit(found.EngineId, e.Bang.mCenterID, true);
            e.Util.SetHit(found.EngineId, e.Bang.mDistanceUnit1.id, true);
        }