Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(json) && !string.IsNullOrWhiteSpace(code.Text))
            {
                File.WriteAllText(json, code.Text);
                if (sprite != null)
                {
                    sprite.AnimationModule.ClearAnimations();
                }
            }

            json  = json_path.Text;
            image = sheet_path.Text;

            if (sprite == null)
            {
                sprite = new TempSprite();
            }
            if (world == null)
            {
                world = new EmptyWorld();
                world.Load();
                world.Display();
            }
            if (watcher == null)
            {
                WatchImageFile(image);
            }

            sprite.TexPath          = image;
            sprite.JsonPath         = json;
            sprite.HitboxConfigPath = hitbox_path.Text;

            original_texture = null;

            if (world.Sprites.Contains(sprite))
            {
                world.RemoveSprite(sprite);
            }
            world.AddSprite(sprite);

            Screen.Camera.Z = 200;

            code.Text = File.ReadAllText(json);
        }