Beispiel #1
0
 void AddEvent(ObjectEvent ev, bool select)
 {
     for (int i = 0; i < listBox2.Items.Count; i++)
     {
         ObjectEvent e2 = listBox2.Items[i] as ObjectEvent;
         if ((e2.EventType > ev.EventType) ||
             (e2.EventType == ev.EventType && e2.EventNumber > ev.EventNumber))
         {
             listBox2.Items.Insert(i, ev);
             if (select)
             {
                 listBox2.SelectedIndex = i;
             }
             return;
         }
         else if (e2.EventType == ev.EventType && e2.EventNumber == ev.EventNumber)
         {
             if (select)
             {
                 listBox2.SelectedIndex = i;
             }
             return;
         }
     }
     listBox2.Items.Add(ev);
     if (select)
     {
         listBox2.SelectedIndex = listBox2.Items.Count - 1;
     }
 }
Beispiel #2
0
        private void actionPanel1_ActionDrop(object sender, EventArgs e)
        {
            ObjectEvent ev = listBox2.SelectedItem as ObjectEvent;

            ev.Actions = new List <ActionDeclaration>(actionPanel1.Actions);
            Saved      = false;
        }
 private void button3_Click(object sender, EventArgs e)
 {
     EventForm ef = new EventForm();
     if (ef.ShowDialog() == DialogResult.OK)
     {
         ObjectEvent ev = new ObjectEvent(ef.EventType, ef.EventNumber);
         AddEvent(ev, true);
     }
 }
Beispiel #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            EventForm ef = new EventForm();

            if (ef.ShowDialog() == DialogResult.OK)
            {
                ObjectEvent ev = new ObjectEvent(ef.EventType, ef.EventNumber);
                AddEvent(ev, true);
            }
        }
Beispiel #5
0
 private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox2.SelectedIndex == -1)
     {
         actionPanel1.Actions = new ActionDeclaration[0];
     }
     else
     {
         ObjectEvent ev = listBox2.SelectedItem as ObjectEvent;
         actionPanel1.Actions = ev.Actions;
     }
 }
Beispiel #6
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex == -1)
            {
                return;
            }
            EventForm ef = new EventForm();
            List <ActionDeclaration> actions = (listBox2.SelectedItem as ObjectEvent).Actions;

            if (ef.ShowDialog() == DialogResult.OK)
            {
                listBox2.BeginUpdate();
                listBox2.Items.RemoveAt(listBox2.SelectedIndex);
                ObjectEvent ev = new ObjectEvent(ef.EventType, ef.EventNumber);
                ev.Actions = actions;
                AddEvent(ev, true);
                listBox2.EndUpdate();
            }
        }
 void AddEvent(ObjectEvent ev, bool select)
 {
     for (int i = 0; i < listBox2.Items.Count; i++)
     {
         ObjectEvent e2 = listBox2.Items[i] as ObjectEvent;
         if ((e2.EventType > ev.EventType) ||
             (e2.EventType == ev.EventType && e2.EventNumber > ev.EventNumber))
         {
             listBox2.Items.Insert(i, ev);
             if (select) listBox2.SelectedIndex = i;
             return;
         }
         else if (e2.EventType == ev.EventType && e2.EventNumber == ev.EventNumber)
         {
             if (select) listBox2.SelectedIndex = i;
             return;
         }
     }
     listBox2.Items.Add(ev);
     if (select) listBox2.SelectedIndex = listBox2.Items.Count - 1;
 }
Beispiel #8
0
        private void listBox2_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();
            Rectangle textrect = e.Bounds;

            textrect.Offset(18, 0);
            ObjectEvent ev  = listBox2.Items[e.Index] as ObjectEvent;
            string      str = EventToString(ev.EventType, ev.EventNumber);

            System.Drawing.Bitmap bmp = null;
            switch (ev.EventType)
            {
            case EventType.Create:
                bmp = Properties.Resources.Create;
                break;

            case EventType.Destroy:
                bmp = Properties.Resources.Destroy;
                break;

            case EventType.Alarm:
                bmp = Properties.Resources.Alarm;
                break;

            case EventType.Step:
                bmp = Properties.Resources.Step;
                break;

            case EventType.Collision:
                bmp = Properties.Resources.Collision;
                break;

            case EventType.Keyboard:
                bmp = Properties.Resources.Keyboard;
                break;

            case EventType.Mouse:
                bmp = Properties.Resources.Mouse;
                break;

            case EventType.Draw:
                bmp = Properties.Resources.Sprite;
                break;

            case EventType.KeyPress:
                bmp = Properties.Resources.KeyPress;
                break;

            case EventType.KeyRelease:
                bmp = Properties.Resources.KeyRelease;
                break;

            case EventType.Other:
                bmp = Properties.Resources.GreenCube;
                break;
            }
            if (bmp != null)
            {
                e.Graphics.DrawImage(bmp, new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1, 16, 16));
            }
            e.Graphics.DrawString(str, e.Font, new SolidBrush(e.ForeColor), (float)e.Bounds.X + 20f, (float)e.Bounds.Y + ((float)e.Bounds.Height - e.Graphics.MeasureString(str, e.Font).Height) / 2);
            e.DrawFocusRectangle();
        }
Beispiel #9
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (listBox2.SelectedIndex == -1)
         return;
     EventForm ef = new EventForm();
     List<ActionDeclaration> actions = (listBox2.SelectedItem as ObjectEvent).Actions;
     if (ef.ShowDialog() == DialogResult.OK)
     {
         listBox2.BeginUpdate();
         listBox2.Items.RemoveAt(listBox2.SelectedIndex);
         ObjectEvent ev = new ObjectEvent(ef.EventType, ef.EventNumber);
         ev.Actions = actions;
         AddEvent(ev, true);
         listBox2.EndUpdate();
     }
 }