Example #1
0
 /// <summary>
 /// Transfers sprites either from or to the listbox
 /// </summary>
 /// <param name="fromListBox">Specifies whether to transfer the sprites from the listbox or to the listbox.</param>
 protected virtual void TransferSprites(bool fromListBox = true)
 {
     if (fromListBox)
     {
         Sprites.Clear();
         foreach (Sprite o in edittingBuff)
         {
             Sprites.Add((Sprite)o);
         }
     }
     else
     {
         listBoxSprites.Items.Clear();
         foreach (Sprite s in Sprites)
         {
             listBoxSprites.Items.Add(s.ToString());
             edittingBuff.Add(s.Clone());
         }
         if (Sprites.Count > 0)
         {
             listBoxSprites.SelectedIndex = 0;
             spriteControl1.Value         = edittingBuff[0];
         }
     }
 }
Example #2
0
 public void Dispose()
 {
     foreach (Sprite spr in Sprites)
     {
         spr.Remove();
     }
     Sprites.Clear();
 }
Example #3
0
 public void Clear()
 {
     foreach (var s in Sprites.Values)
     {
         s.Sprite.DeleteTexture();
     }
     Sprites.Clear();
     sizes.Clear();
 }
Example #4
0
 public void Dispose()
 {
     GC.SuppressFinalize(this);
     tilesheet.Dispose();
     matrixes.Dispose();
     surface.Dispose();
     Sprites.Clear();
     Sprites.SpriteMovementStarted -= delMoveStart;
     Sprites.SpriteMovementStopped -= delMoveStop;
 }
Example #5
0
 private static void HSceneProc_OnDestroy_Prefix()
 {
     OnHSceneExiting?.Invoke(null, null);
     Inside  = false;
     Loaded  = false;
     Heroine = null;
     Sprites.Clear();
     _hookInstance.UnpatchAll(_hookInstance.Id);
     _hookInstance = null;
 }
            public Node(BinaryReader r)
            {
                OffsetX  = r.ReadSingle();
                OffsetY  = r.ReadSingle();
                MainNode = r.ReadInt32();

                Sprites.Clear();
                Sprites.Capacity = r.ReadInt32();
                for (int i = 0; i < Sprites.Capacity; i++)
                {
                    Sprites.Add(new Subresource <SpriteResource>(r));
                }
            }
Example #7
0
 public void Clear()
 {
     DrawNode.Clear();
     foreach (var sprite in Sprites)
     {
         RemoveChild(sprite, false);
     }
     Cleanup();
     Sprites.Clear();
     foreach (var label in Labels.Keys)
     {
         label.Visible = false;
     }
     UsageIndex = 0;
 }
Example #8
0
        protected void ResetStage(string stagePath)
        {
            foreach (var sprite in Sprites.Values)
            {
                sprite.Dispose();
            }
            Sprites.Clear();
            World.ProcessChanges();
            Debug.Assert(World.BodyList.Count == 0);

            AddSprites(
                _loader.CreateSprites(stagePath, this)
                .ToArray());

            OnSpriteCreated();
        }
Example #9
0
 protected override void UpdateSpritesCache()
 {
     Sprites.Clear();
     SpritesLeft.Clear();
     for (var i = 0; i < Cels.arraySize; i++)
     {
         var frameProp = Cels.GetArrayElementAtIndex(i);
         var sprite    = frameProp.FindPropertyRelative("sprite").objectReferenceValue as Sprite;
         if (sprite != null)
         {
             Sprites.Add(sprite);
         }
         var spriteLeft = frameProp.FindPropertyRelative("spriteLeft").objectReferenceValue as Sprite;
         if (spriteLeft != null)
         {
             SpritesLeft.Add(spriteLeft);
         }
     }
 }
        private void FindSprites(object sender, RoutedEventArgs e)
        {
            var directory = Path.Combine(Path.GetDirectoryName(ApplicationSettings.Instance.ActiveProject.ProjectPath), "sprites");

            Sprites.Clear();
            foreach (var spriteFile in Directory.GetFiles(directory))
            {
                var shortname = Path.GetFileNameWithoutExtension(spriteFile);
                var match     = Regex.Match(shortname, "_strip\\d+");
                if (match.Success)
                {
                    shortname = shortname.Remove(match.Index);
                }
                if (!RoomEditor.Instance.LoadedImages.ContainsKey(shortname))
                {
                    WindowAPI.LoadImage(shortname, RoomEditor.Instance.renderer, out TexData data);
                    RoomEditor.Instance.LoadedImages.Add(shortname, data);
                }
                Sprites.Add(shortname);
            }
        }
Example #11
0
        private void InitializeSprites(int tileWidth, int tileHeight)
        {
            Sprites.Clear();

            for (int x = 0; x < numColumns; x++)
            {
                for (int y = 0; y < numRows; y++)
                {
                    Sprite sprite = Sprites.CreateSprite(matrixes[0], new Frame(tilesheet, x, y),
                                                         x.ToString() + "-" + y.ToString());
                    sprite.MoveSprite((float)x, (float)y);
                    sprite.Visible = true;
                }
            }

            // remove the bottom-right tile; this will be the space for sliding
            int maxX = numColumns - 1;
            int maxY = numRows - 1;

            Sprites.GetSpriteByID(maxX.ToString() + "-" + maxY.ToString()).Dispose();
            openSpace = new Point(maxX, maxY);
        }
Example #12
0
        /// <summary>
        /// Start the title screen
        /// This happens at the beginning of the game, and when you're done playing
        /// </summary>
        public override void StartScene()
        {
            Texts.Clear();
            Sprites.Clear();

            // Add the title text
            AddText(new Text
            {
                Value            = "Space Invaders",
                Position         = new Vector2(0f, 80f),
                Alignment        = HorizontalAlignments.Center,
                AnimationType    = TextAnimations.Typewriter,
                AnimationSeconds = 0.15,
                Scale            = 1f,
                //Font = FancyFont,
                OnAnimationComplete = (Text text) =>
                {
                    // When the title text is done typing, show the high score
                    HighScoreText = AddText(new Text
                    {
                        Value              = "High Score:",
                        Position           = new Vector2(80f, 90f),
                        Alignment          = HorizontalAlignments.Center,
                        VerticalAlign      = VerticalAlignments.Top,
                        AnimationType      = TextAnimations.SeeSaw,
                        AnimationSeconds   = 0.2,
                        AnimationIntensity = 0.15,
                        Scale              = 0.4f,
                    });

                    UfoSprite ufo = AddSprite <UfoSprite>();
                    ufo.X         = -49;
                    ufo.Y         = 45;

                    Wait(2.3f, () =>
                    {
                        AlienSprite alien = AddSprite <AlienSprite>();
                        alien.X           = -40;
                        alien.Y           = 13;
                        alien.Setup(1);
                    });
                    Wait(5.2f, () =>
                    {
                        AlienSprite alien = AddSprite <AlienSprite>();
                        alien.X           = -40;
                        alien.Y           = -13;
                        alien.Setup(2);
                    });
                    Wait(8.7, () =>
                    {
                        AlienSprite alien = AddSprite <AlienSprite>();
                        alien.X           = -40;
                        alien.Y           = -43;
                        alien.Setup(3);
                    });


                    AlienScoreText = AddText(new Text
                    {
                        Value = "= ? POINTS" + Text.NewLine + Text.NewLine +
                                "= 10 POINTS" + Text.NewLine + Text.NewLine +
                                "= 20 POINTS" + Text.NewLine + Text.NewLine +
                                "= 30 POINTS",
                        Position         = new Vector2(0, 0),
                        Alignment        = HorizontalAlignments.Center,
                        VerticalAlign    = VerticalAlignments.Center,
                        AnimationType    = TextAnimations.Typewriter,
                        AnimationSeconds = 0.2,
                        Scale            = 0.8f,
                        Color            = Color.White
                    });
                }
            });

            // Add the 1p start key text
            Player1StartText = AddText(new Text
            {
                Value              = "1 Player Start",
                Position           = new Vector2(-65f, -85f),
                Alignment          = HorizontalAlignments.Center,
                VerticalAlign      = VerticalAlignments.Center,
                AnimationType      = TextAnimations.None,
                AnimationIntensity = 0.2,
                Scale              = 0.6f,
                Color              = Color.Lime
            });

            // Add the 2p start key text
            Player2StartText = AddText(new Text
            {
                Value              = "2 Player Start",
                Position           = new Vector2(65f, -85f),
                Alignment          = HorizontalAlignments.Center,
                VerticalAlign      = VerticalAlignments.Center,
                AnimationType      = TextAnimations.None,
                AnimationIntensity = 0.2,
                Scale              = 0.6f,
                Color              = Color.Lime
            });

            if (SpaceInvaders.NumberOfPlayers == 1)
            {
                Player1StartText.AnimationType = TextAnimations.Throb;
                Player1StartText.Scale         = 0.6f;
                Player1StartText.Start();
            }
            else
            {
                Player2StartText.AnimationType = TextAnimations.Throb;
                Player2StartText.Scale         = 0.6f;
                Player2StartText.Start();
            }
        }
Example #13
0
 public virtual void ClearSprites()
 {
     Sprites.Clear();
 }
Example #14
0
 public virtual void ClearAssets()
 {
     Sprites.Clear();
 }
Example #15
0
 public void Clear()
 {
     Sprites.Clear();
     Instances.Clear();
     Variables.Clear();
 }