from dataclasses import dataclass
import pygame
import math
import data
import json

class NotFoundPositionError(Exception): ...

class AnimationSprite:
    """
        This class is a parent class provided by the 2D-Animation-lib. 
        Only by inheriting this class can an object be controlled by the camera.
        # It is recommended to write:
        class Player(pygame.sprite.Sprite, AnimationSprite):
            def __init__(self, x, y):
                AnimationSprite.__init__(self, x, y, 50, 50)
                pygame.sprite.Sprite.__init__(self)

                
                self.original_image = pygame.Surface((50, 50))
                self.original_image.fill((0, 255, 0))
                self.image = self.original_image.copy()
                self.rect = self.image.get_rect(center=(x, y))


        这个类是 2D-Animation-lib 提供的父类，只有继承这个类才能被摄像机操控
        # 建议这么写：
        class Player(pygame.sprite.Sprite, AnimationSprite):
            def __init__(self, x, y):
                AnimationSprite.__init__(self, x, y, 50, 50) 
                pygame.sprite.Sprite.__init__(self)

                self.original_image = pygame.Surface((50, 50))
                self.original_image.fill((0, 255, 0))
                self.image = self.original_image.copy()
                self.rect = self.image.get_rect(center=(x, y))
        """
    def __init__(self) -> None: ...
    
    def move_to_position_in(self, target_x : int, target_y : int, time : int) -> None:
        """
        This function is the "glide to x:(), y:() within () seconds" function in the Scratch class.
        It is a smooth movement method.

        
        这个函数是类Scratch中“在（）秒内滑行到x:()，y:()”的功能。
        就是一个平滑移动的方法。
        """
        ...

    def update_animation(self) -> None:
        """
        This function is used to update the animation.
        It is called in the main loop of the game.

        
        这个函数用于更新动画。
        它会在游戏的主循环中被调用。
        """
        ...

    def update_pf(self) -> None:
        """
        Complete update method: Update animation and position. Call this function in the main loop.


        完整的更新方法：更新动画和位置
        在主循环中调用这个函数即可
        """
        ...

    def get_position(self) -> str:
        """
        Gets the world coordinates of this sprite and return a JSON-formatted string.


        获取该 sprite 的世界坐标，并返回 json 格式的字符串。
        """
        ...

class AnimationBackground:
    """
    This class is a parent class provided by the 2D-Animation-lib. 
    Inheriting this class can achieve the movement, rotation, and scaling of the background.
    # It is recommended to write:
    class Background(pygame.sprite.Sprite, AnimationBackground):
        def __init__(self, x, y, w, h):
            AnimationBackground.__init__(self, x, y, w, h)
            pygame.sprite.Sprite.__init__(self)

            self.original_image = pygame.Surface((w, h))
            self.original_image.fill((0, 0, 0))
            self.image = self.original_image.copy()
            self.rect = self.image.get_rect(center=(x, y))

    
    这个类是 2D-Animation-lib 提供的背景类，继承这个类可以实现背景的移动、旋转、缩放等功能。
    # 建议这么写：
    class Background(pygame.sprite.Sprite, AnimationBackground):
        def __init__(self, x, y, w, h):
            AnimationBackground.__init__(self, x, y, w, h)
            pygame.sprite.Sprite.__init__(self)

            self.original_image = pygame.Surface((w, h))
            self.original_image.fill((0, 0, 0))
            self.image = self.original_image.copy()
            self.rect = self.image.get_rect(center=(x, y))
    """
    @dataclass
    class Data:
        can_rotate : bool
        can_go_with_camera : bool
        can_change_size : bool
        is_center_window : bool

    def __init__(self, x, y, w, h): ...
            

    def update(self):
        """
        This function is used to update the background's position, size, and rotation.
        It is called in the main loop of the game.
        

        这个函数用于更新背景的位置、大小、旋转等。
        """
        ...

    def set_background_move_speed(self, speed):
        """
        This function is used to set the background's move speed.
        The larger the speed, the slower it will move.
        

        设置背景移动速度。越大越慢
        """
        ...