Пример #1
0
        private void UpdateShapes(CharacterSprite charSprite, Sprite sprite)
        {
            bool oldIgnoreChanges = ignoreChanges;

            ignoreChanges = true;
            if (charSprite == null)
            {
                tabControl1.Enabled = false;
                if (sprite.ToString() == "WEP1" || sprite.ToString() == "WEP2" ||
                    sprite.ToString() == "EFF1" || sprite.ToString() == "EFF2")
                {
                    tabControl1.Enabled = true;
                    if (sprite.ToString() == "WEP1")
                    {
                        currentShape = Shape.Shapes[SpriteType.WEP1];
                    }
                    else if (sprite.ToString() == "WEP2")
                    {
                        currentShape = Shape.Shapes[SpriteType.WEP2];
                    }
                    else if (sprite.ToString() == "EFF1")
                    {
                        currentShape = Shape.Shapes[SpriteType.EFF1];
                    }
                    else if (sprite.ToString() == "EFF2")
                    {
                        currentShape = Shape.Shapes[SpriteType.EFF2];
                    }
                    numericUpDown1.Maximum = currentShape.Frames.Count - 1;
                    UpdatePictureBox();
                }
            }
            else
            {
                tabControl1.Enabled = true;
                if (Shape.Shapes.ContainsKey(charSprite.SHP))
                {
                    numericUpDown1.Enabled = true;
                    pictureBox1.Enabled    = true;

                    currentShape = Shape.Shapes[charSprite.SHP];
                    //numericUpDown1.Value = 1;
                    numericUpDown1.Maximum = currentShape.Frames.Count - 1;
                }
                else
                {
                    numericUpDown1.Enabled = false;
                    pictureBox1.Enabled    = false;
                    currentShape           = null;
                }
                UpdatePictureBox();
            }
            ignoreChanges = oldIgnoreChanges;
        }
Пример #2
0
        private AllSprites(Context context, AllSpriteAttributes attrs, SpriteFileLocations locs, IList <Sprite> otherSprites)
        {
            Count   = attrs.Count + otherSprites.Count;
            sprites = new Sprite[Count];
            IList <string> spriteNames = context == Context.US_PSP ? PSPResources.Lists.SpriteFiles : PSXResources.Lists.SpriteFiles;

            for (int i = 0; i < attrs.Count; i++)
            {
                sprites[i] = new CharacterSprite(
                    context,
                    string.Format("{0:X2} - {1}", i + 1, spriteNames[i]),
                    attrs[i],
                    locs[i]);
            }
            otherSprites.CopyTo(sprites, attrs.Count);

            this.attrs = attrs;
            this.locs  = locs;

            Dictionary <Sprite, IList <int> > sharedSPRs = new Dictionary <Sprite, IList <int> >();

            for (int i = 0; i < sprites.Count; i++)
            {
                sharedSPRs.Add(sprites[i], new List <int>());
            }

            for (int i = 0; i < attrs.Count; i++)
            {
                for (int j = i + 1; j < attrs.Count; j++)
                {
                    if (locs[i].Sector == locs[j].Sector)
                    {
                        sharedSPRs[sprites[i]].Add(j);
                        sharedSPRs[sprites[j]].Add(i);
                    }
                }
            }

            for (int i = 0; i < sprites.Count; i++)
            {
                sharedSPRs[sprites[i]].Sort();
                sharedSPRs[sprites[i]] = sharedSPRs[sprites[i]].AsReadOnly();
            }

            SharedSPRs = new ReadOnlyDictionary <Sprite, IList <int> >(sharedSPRs);
        }
Пример #3
0
        private AllSprites( Context context, AllSpriteAttributes attrs, SpriteFileLocations locs, IList<Sprite> otherSprites )
        {
            Count = attrs.Count + otherSprites.Count;
            sprites = new Sprite[Count];
            IList<string> spriteNames = context == Context.US_PSP ? PSPResources.Lists.SpriteFiles : PSXResources.Lists.SpriteFiles;
            for (int i = 0; i < attrs.Count; i++)
            {
                sprites[i] = new CharacterSprite(
                    context,
                    string.Format( "{0:X2} - {1}", i+1, spriteNames[i] ),
                    attrs[i],
                    locs[i] );
            }
            otherSprites.CopyTo( sprites, attrs.Count );

            this.attrs = attrs;
            this.locs = locs;

            Dictionary<Sprite, IList<int>> sharedSPRs = new Dictionary<Sprite, IList<int>>();
            for (int i = 0; i < sprites.Count; i++)
            {
                sharedSPRs.Add( sprites[i], new List<int>() );
            }

            for (int i = 0; i < attrs.Count; i++)
            {
                for (int j = i + 1; j < attrs.Count; j++)
                {
                    if (locs[i].Sector == locs[j].Sector)
                    {
                        sharedSPRs[sprites[i]].Add( j );
                        sharedSPRs[sprites[j]].Add( i );
                    }
                }
            }

            for (int i = 0; i < sprites.Count; i++)
            {
                sharedSPRs[sprites[i]].Sort();
                sharedSPRs[sprites[i]] = sharedSPRs[sprites[i]].AsReadOnly();
            }

            SharedSPRs = new ReadOnlyDictionary<Sprite, IList<int>>( sharedSPRs );
        }
Пример #4
0
        private void UpdateAnimationTab(CharacterSprite charSprite, Sprite sprite)
        {
            if (sprite.ToString() == "WEP1")
            {
                seqComboBox.SelectedItem = SpriteType.WEP1;         //seqComboBox.Items[7];
            }
            else if (sprite.ToString() == "WEP2")
            {
                seqComboBox.SelectedItem = SpriteType.WEP2;         //seqComboBox.Items[8];
            }
            else if (sprite.ToString() == "EFF1")
            {
                seqComboBox.SelectedItem = SpriteType.EFF1;         //seqComboBox.Items[9];
            }
            else if (sprite.ToString() == "EFF2")
            {
                seqComboBox.SelectedItem = SpriteType.EFF2;         //seqComboBox.Items[10];
            }

            if (charSprite != null &&
                seqComboBox.SelectedItem != null)
            {
                if (Sequence.Sequences.ContainsKey((SpriteType)seqComboBox.SelectedItem))
                {
                    IList <Sequence> sequences = Sequence.Sequences[(SpriteType)seqComboBox.SelectedItem];
                    currentSequences         = sequences;
                    numericUpDown2.Minimum   = 0;
                    numericUpDown2.Maximum   = sequences.Count - 1;
                    numericUpDown2.Value     = 0;
                    numericUpDown2.Enabled   = true;
                    animationViewer1.Enabled = true;
                }
                else
                {
                    animationViewer1.Pause();
                    animationViewer1.Enabled = false;
                    numericUpDown2.Enabled   = false;
                }
            }
        }
Пример #5
0
 private void UpdateCheckBoxesEtc(CharacterSprite charSprite)
 {
     if (charSprite == null)
     {
         shpComboBox.Enabled         = false;
         shpComboBox.SelectedItem    = null;
         seqComboBox.Enabled         = false;
         seqComboBox.SelectedItem    = null;
         flyingCheckbox.Enabled      = false;
         flyingCheckbox.Checked      = false;
         flagsCheckedListBox.Enabled = false;
         flagsCheckedListBox.BeginUpdate();
         for (int i = 0; i < flagsCheckedListBox.Items.Count; i++)
         {
             flagsCheckedListBox.SetItemChecked(i, false);
         }
         flagsCheckedListBox.EndUpdate();
     }
     else
     {
         shpComboBox.Enabled         = true;
         shpComboBox.SelectedItem    = charSprite.SHP;
         seqComboBox.Enabled         = true;
         seqComboBox.SelectedItem    = charSprite.SEQ;
         flyingCheckbox.Enabled      = true;
         flyingCheckbox.Checked      = charSprite.Flying;
         flagsCheckedListBox.Enabled = true;
         var flags = new bool[] {
             charSprite.Flag1, charSprite.Flag2, charSprite.Flag3, charSprite.Flag4,
             charSprite.Flag5, charSprite.Flag6, charSprite.Flag7, charSprite.Flag8
         };
         flagsCheckedListBox.BeginUpdate();
         for (int i = 0; i < flagsCheckedListBox.Items.Count; i++)
         {
             flagsCheckedListBox.SetItemChecked(i, flags[i]);
         }
         flagsCheckedListBox.EndUpdate();
     }
 }
Пример #6
0
        private void UpdateShapes(CharacterSprite charSprite,Sprite sprite)
        {
            bool oldIgnoreChanges = ignoreChanges;
            ignoreChanges = true;
            if (charSprite == null )
            {
                tabControl1.Enabled = false;
                if ( sprite.ToString() == "WEP1" || sprite.ToString() == "WEP2" ||
                     sprite.ToString() == "EFF1" || sprite.ToString() == "EFF2")
                {
                     tabControl1.Enabled = true;
                     if (sprite.ToString() == "WEP1")
                     {
                         currentShape = Shape.Shapes[SpriteType.WEP1];
                     }
                     else if (sprite.ToString() == "WEP2")
                     {
                         currentShape = Shape.Shapes[SpriteType.WEP2];
                     }
                     else if (sprite.ToString() == "EFF1")
                     {
                         currentShape = Shape.Shapes[SpriteType.EFF1];
                     }
                     else if (sprite.ToString() == "EFF2")
                     {
                         currentShape = Shape.Shapes[SpriteType.EFF2];
                     }
                     numericUpDown1.Maximum = currentShape.Frames.Count - 1;
                     UpdatePictureBox();

                }
            }
            else
            {

                tabControl1.Enabled = true;
                if (Shape.Shapes.ContainsKey(charSprite.SHP))
                {
                    numericUpDown1.Enabled = true;
                    pictureBox1.Enabled = true;

                    currentShape = Shape.Shapes[charSprite.SHP];
                    //numericUpDown1.Value = 1;
                    numericUpDown1.Maximum = currentShape.Frames.Count - 1;
                }
                else
                {
                    numericUpDown1.Enabled = false;
                    pictureBox1.Enabled = false;
                    currentShape = null;
                }
                UpdatePictureBox();
            }
            ignoreChanges = oldIgnoreChanges;
        }
Пример #7
0
 private void UpdateCheckBoxesEtc(CharacterSprite charSprite)
 {
     if (charSprite == null)
     {
         shpComboBox.Enabled = false;
         shpComboBox.SelectedItem = null;
         seqComboBox.Enabled = false;
         seqComboBox.SelectedItem = null;
         flyingCheckbox.Enabled = false;
         flyingCheckbox.Checked = false;
         flagsCheckedListBox.Enabled = false;
         flagsCheckedListBox.BeginUpdate();
         for (int i = 0; i < flagsCheckedListBox.Items.Count; i++)
         {
             flagsCheckedListBox.SetItemChecked(i, false);
         }
         flagsCheckedListBox.EndUpdate();
     }
     else
     {
         shpComboBox.Enabled = true;
         shpComboBox.SelectedItem = charSprite.SHP;
         seqComboBox.Enabled = true;
         seqComboBox.SelectedItem = charSprite.SEQ;
         flyingCheckbox.Enabled = true;
         flyingCheckbox.Checked = charSprite.Flying;
         flagsCheckedListBox.Enabled = true;
         var flags = new bool[] {
             charSprite.Flag1, charSprite.Flag2, charSprite.Flag3, charSprite.Flag4,
             charSprite.Flag5, charSprite.Flag6, charSprite.Flag7, charSprite.Flag8 };
         flagsCheckedListBox.BeginUpdate();
         for (int i = 0; i < flagsCheckedListBox.Items.Count; i++)
         {
             flagsCheckedListBox.SetItemChecked(i, flags[i]);
         }
         flagsCheckedListBox.EndUpdate();
     }
 }
Пример #8
0
        private void UpdateAnimationTab(CharacterSprite charSprite, Sprite sprite)
        {
            if(sprite.ToString() == "WEP1")
            {
                seqComboBox.SelectedItem = seqComboBox.Items[7];
            }
            else if (sprite.ToString() == "WEP2")
            {
                seqComboBox.SelectedItem = seqComboBox.Items[8];
            }
            else if (sprite.ToString() == "EFF1")
            {
                seqComboBox.SelectedItem = seqComboBox.Items[9];
            }
            else if (sprite.ToString() == "EFF2")
            {
                seqComboBox.SelectedItem = seqComboBox.Items[10];
            }

            if (charSprite != null &&
                seqComboBox.SelectedItem != null)
            {
                if (Sequence.Sequences.ContainsKey((SpriteType)seqComboBox.SelectedItem))
                {
                    IList<Sequence> sequences = Sequence.Sequences[(SpriteType)seqComboBox.SelectedItem];
                    currentSequences = sequences;
                    numericUpDown2.Minimum = 0;
                    numericUpDown2.Maximum = sequences.Count - 1;
                    numericUpDown2.Value = 0;
                    numericUpDown2.Enabled = true;
                    animationViewer1.Enabled = true;
                }
                else
                {
                    animationViewer1.Pause();
                    animationViewer1.Enabled = false;
                    numericUpDown2.Enabled = false;
                }
            }
        }