Beispiel #1
0
 void Pic_SaveEvent(object sender, EventArgs e)
 {
     if (SaveEvent != null)
     {
         WavePanel pnl = (WavePanel)sender;
         SaveEvent(this, new SaveWavEventArgs(pnl.Name, pnl.GetSelectedWave()));
     }
 }
Beispiel #2
0
 private void Start()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     instance = this;
     EnemyManager.instance.SubscribeWaveStart(WaveStart);
 }
Beispiel #3
0
 private void Wave_WantBeRemoved(WavePanel wave)
 {
     _waves.Remove(wave);
     Destroy(wave.gameObject);
     for (int i = 0; i < _waves.Count; i++)
     {
         _waves[i].SetWaveIndex(i + 1);
     }
 }
Beispiel #4
0
        void part_DeleteEvent(object sender, EventArgs e)
        {
            WavePanel part = (WavePanel)sender;

            _storedParts.Remove(part);
            if (_storedParts.Count == 0)
            {
                info1.Visible = true;
                info2.Visible = true;
            }
            updatePartsView();
            part.Dispose();
        }
Beispiel #5
0
        void part_SizeChanged(object sender, EventArgs e)
        {
            WavePanel part = (WavePanel)sender;

            for (int i = (int)(part.Tag); i < _storedParts.Count; i++)
            {
                if (i > 0)
                {
                    WavePanel wp     = _storedParts[i];
                    WavePanel wpPrev = _storedParts[i - 1];
                    wp.Left = wpPrev.Left + wpPrev.Width + 6;
                }
            }
            PartsPanel.Refresh();
        }
Beispiel #6
0
 void updatePartsView()
 {
     for (int i = 0; i < _storedParts.Count; i++)
     {
         WavePanel wp = _storedParts[i];
         wp.Tag = i;
         if (i > 0)
         {
             WavePanel wpPrev = _storedParts[i - 1];
             wp.Left = wpPrev.Left + wpPrev.Width + 8;
         }
         else
         {
             wp.Left = 8;
         }
     }
     PartsPanel.Refresh();
 }
Beispiel #7
0
        private void addPart(byte [] bytes, Color color, int x, string name)
        {
            int idx     = getPartIndex(x);
            int lastPos = (idx >= 0) ? _storedParts[idx].Left - 8 :
                          (_storedParts.Count > 0) ?
                          _storedParts[_storedParts.Count - 1].Location.X +
                          _storedParts[_storedParts.Count - 1].Width : 0;
            WavePanel part = new WavePanel();

            part.Name = "";
            part.Init(this);
            part.Color          = color;
            part.Location       = new Point(lastPos + 8, 3);
            part.Height         = SrcPanel.Height - 27;
            part.Parent         = PartsPanel;
            part.Tag            = _storedParts.Count;
            part.RememberEvent += new EventHandler(OnRememberEvent);
            part.DeleteEvent   += new EventHandler(part_DeleteEvent);
            part.SaveEvent     += new EventHandler(Pic_SaveEvent);
            part.BringToFront();
            part.Resolution = _resolution;
            part.SetWave(bytes, false);
            part.SizeChanged += new EventHandler(part_SizeChanged);
            PartsPanel.Refresh();

            if (idx >= 0)
            {
                _storedParts.Insert(idx, part);
            }
            else
            {
                _storedParts.Add(part);
            }
            updatePartsView();
            info1.Visible = false;
            info2.Visible = false;
        }
Beispiel #8
0
        public void OnRememberEvent(object sender, EventArgs e)
        {
            WavePanel pnl = (WavePanel)sender;

            addPart(pnl.GetSelectedWave(), pnl.Color, pnl.Name);
        }