private void listBoxPatterns_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (programIsChangingStuff | listBoxPatterns.SelectedItem == null)
            {
                return;
            }

            programIsChangingStuff = true;

            patternSystem.Deselect();

            PatternEntry selected = patternSystem.GetPatternAt(listBoxPatterns.SelectedIndex);

            selected.isSelected = true;

            textBoxTextureName.Text   = selected.TextureName;
            textBoxAnimationName.Text = selected.AnimationName;
            numericFrameCount.Value   = selected.FrameCount;

            listBoxFrames.Items.Clear();

            foreach (Frame f in selected.frames)
            {
                listBoxFrames.Items.Add(f.ToString());
            }

            programIsChangingStuff = false;
        }
 private void buttonAddFrame_Click(object sender, EventArgs e)
 {
     if (listBoxPatterns.SelectedItem != null)
     {
         Frame        f = new Frame();
         PatternEntry p = patternSystem.GetPatternAt(listBoxPatterns.SelectedIndex);
         p.frames.Add(f);
         listBoxFrames.Items.Add(f.ToString());
     }
 }
Exemplo n.º 3
0
        public PatternEntry(PatternEntry p)
        {
            FrameCount    = p.FrameCount;
            TextureName   = p.TextureName;
            AnimationName = p.AnimationName;

            frames = new List <Frame>();
            foreach (Frame f in p.frames)
            {
                frames.Add(new Frame(f));
            }
        }
 private void buttonRemoveFrame_Click(object sender, EventArgs e)
 {
     if (listBoxPatterns.SelectedItem != null)
     {
         if (listBoxFrames.SelectedItem != null)
         {
             PatternEntry p     = patternSystem.GetPatternAt(listBoxPatterns.SelectedIndex);
             int          index = listBoxFrames.SelectedIndex;
             p.frames.RemoveAt(index);
             listBoxFrames.Items.RemoveAt(index);
         }
     }
 }
        private void listBoxFrames_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (programIsChangingStuff | listBoxPatterns.SelectedItem == null | listBoxFrames.SelectedItem == null)
            {
                return;
            }

            if (listBoxFrames.SelectedItem != null)
            {
                programIsChangingStuff = true;

                // ugly code
                PatternEntry p = patternSystem.GetPatternAt(listBoxPatterns.SelectedIndex);
                Frame        f = p.frames[listBoxFrames.SelectedIndex];

                numericFrameOffset.Value   = f.FrameOffset;
                numericTextureNumber.Value = f.TextureNumber;

                programIsChangingStuff = false;
            }
        }
        private void numericTextureNumber_ValueChanged(object sender, EventArgs e)
        {
            if (programIsChangingStuff)
            {
                return;
            }

            if (listBoxPatterns.SelectedItem != null)
            {
                if (listBoxFrames.SelectedItem != null)
                {
                    PatternEntry p = patternSystem.GetPatternAt(listBoxPatterns.SelectedIndex);

                    Frame f = p.frames[listBoxFrames.SelectedIndex];
                    f.TextureNumber = (ushort)numericTextureNumber.Value;
                    p.frames[listBoxFrames.SelectedIndex] = f;

                    programIsChangingStuff = true;
                    listBoxFrames.Items[listBoxFrames.SelectedIndex] = f.ToString();
                    programIsChangingStuff = false;
                }
            }
        }