AcWing
  • 首页
  • 课程
  • 题库
  • 更多
    • 竞赛
    • 题解
    • 分享
    • 问答
    • 应用
    • 校园
  • 关闭
    历史记录
    清除记录
    猜你想搜
    AcWing热点
  • App
  • 登录/注册

终极特效病毒(对计算机不会产生永久性危害)

作者: 作者的头像   钱泓谷 ,  2025-07-06 16:52:52 · 江苏 ,  所有人可见 ,  阅读 8


0


想要试试的同学们点个赞吧🙏

👇想要代码的下面复制👇

visual_effects.py
Python

安装依赖:
Windows cmd

pip install pygame numpy

import pygame
import random
import sys
import time
import ctypes
import math
import numpy as np
from pygame import gfxdraw

# 禁用任务管理器和Alt+Tab
try:
    ctypes.windll.user32.BlockInput(True)
    ctypes.windll.kernel32.SetConsoleTitleW("System Critical Process")
except:
    pass

# 初始化pygame
pygame.init()

# 设置屏幕尺寸
info = pygame.display.Info()
screen_width, screen_height = info.current_w, info.current_h
screen = pygame.display.set_mode((screen_width, screen_height), pygame.FULLSCREEN | pygame.NOFRAME)
pygame.display.set_caption("System Critical Process")

# 创建一个用于旋转和反色效果的表面
effect_surface = pygame.Surface((screen_width, screen_height))

# 隐藏系统鼠标
pygame.mouse.set_visible(False)

# 颜色定义
RED = (255, 50, 50)
YELLOW = (255, 255, 50)
BLUE = (50, 150, 255)
GREEN = (50, 255, 100)
PURPLE = (180, 70, 255)
CYAN = (0, 255, 255)
BACKGROUND = (10, 10, 20)

# 图标类型
WARNING = 0
ERROR = 1
INFO = 2
SUCCESS = 3
QUESTION = 4

# 弹窗类
class PopupWindow:
    def __init__(self):
        self.width = random.randint(300, 500)
        self.height = random.randint(150, 250)
        self.x = random.randint(0, screen_width - self.width)
        self.y = random.randint(0, screen_height - self.height)
        self.created_time = time.time()
        self.lifetime = random.uniform(8.0, 15.0)  # 弹窗显示时间
        self.alpha = 255
        self.type = random.choice([WARNING, ERROR, INFO, SUCCESS, QUESTION])
        self.title = self.generate_title()
        self.message = self.generate_message()

    def generate_title(self):
        titles = {
            WARNING: ["Security Alert", "Permission Required", "System Warning", "Attention Needed"],
            ERROR: ["Critical Error", "Operation Failed", "System Failure", "Access Denied"],
            INFO: ["Information Notice", "System Update", "Notification", "Status Report"],
            SUCCESS: ["Operation Complete", "Task Successful", "Process Finished"],
            QUESTION: ["Confirmation Required", "User Input Needed", "Question"]
        }
        return random.choice(titles[self.type])

    def generate_message(self):
        messages = {
            WARNING: [
                "Unusual activity detected in system processes.",
                "Your system may be vulnerable to security threats.",
                "Warning: High memory usage detected.",
                "This action requires administrator privileges."
            ],
            ERROR: [
                "Error code 0x80070005: Access is denied.",
                "Failed to complete the requested operation.",
                "Critical system file missing or corrupted.",
                "Unable to connect to required service."
            ],
            INFO: [
                "Your system is up to date. No action is required.",
                "New features are available for your review.",
                "System scan completed with no issues found.",
                "Backup process completed successfully."
            ],
            SUCCESS: [
                "Operation completed successfully!",
                "All tasks have been executed without errors.",
                "Your changes have been saved.",
                "Verification process passed with no issues."
            ],
            QUESTION: [
                "Do you want to save changes before closing?",
                "Are you sure you want to delete this file?",
                "Would you like to install recommended updates?",
                "Do you grant permission for this application to make changes?"
            ]
        }
        return random.choice(messages[self.type])

    def get_color(self):
        colors = {
            WARNING: (255, 200, 50),
            ERROR: (255, 100, 100),
            INFO: (100, 180, 255),
            SUCCESS: (100, 220, 100),
            QUESTION: (200, 150, 255)
        }
        return colors[self.type]

    def update(self):
        # 更新透明度
        elapsed = time.time() - self.created_time
        if elapsed > self.lifetime * 0.8:  # 最后20%时间开始淡出
            self.alpha = max(0, int(255 * (1 - (elapsed - self.lifetime * 0.8) / (self.lifetime * 0.2))))

        # 如果弹窗消失,返回True表示需要移除
        return elapsed > self.lifetime

    def draw(self, surface):
        # 创建弹窗表面
        popup_surface = pygame.Surface((self.width, self.height), pygame.SRCALPHA)

        # 绘制弹窗背景
        bg_color = (*self.get_color(), min(230, self.alpha))
        pygame.draw.rect(popup_surface, bg_color, (0, 0, self.width, self.height), border_radius=10)
        pygame.draw.rect(popup_surface, (255, 255, 255, self.alpha), (0, 0, self.width, self.height), 2, border_radius=10)

        # 绘制标题栏
        title_color = (*self.get_color(), self.alpha)
        pygame.draw.rect(popup_surface, title_color, (0, 0, self.width, 30), border_radius=10)
        pygame.draw.rect(popup_surface, (255, 255, 255, self.alpha), (0, 0, self.width, 30), 2, border_radius=10)

        # 绘制标题
        title_font = pygame.font.SysFont('Arial', 16, bold=True)
        title_text = title_font.render(self.title, True, (0, 0, 0, self.alpha))
        popup_surface.blit(title_text, (10, 7))

        # 绘制消息
        message_font = pygame.font.SysFont('Arial', 14)
        message_lines = self.wrap_text(self.message, message_font, self.width - 40)

        for i, line in enumerate(message_lines):
            text_surface = message_font.render(line, True, (0, 0, 0, self.alpha))
            popup_surface.blit(text_surface, (20, 50 + i * 25))

        # 绘制按钮
        button_color = (200, 200, 200, self.alpha)
        pygame.draw.rect(popup_surface, button_color, (self.width - 100, self.height - 40, 80, 30), border_radius=5)
        pygame.draw.rect(popup_surface, (0, 0, 0, self.alpha), (self.width - 100, self.height - 40, 80, 30), 1, border_radius=5)

        button_font = pygame.font.SysFont('Arial', 14)
        button_text = button_font.render("OK", True, (0, 0, 0, self.alpha))
        popup_surface.blit(button_text, (self.width - 70 - button_text.get_width()//2, self.height - 35))

        # 绘制弹窗到主屏幕
        surface.blit(popup_surface, (self.x, self.y))

    def wrap_text(self, text, font, max_width):
        words = text.split(' ')
        lines = []
        current_line = words[0]

        for word in words[1:]:
            test_line = current_line + " " + word
            text_width, _ = font.size(test_line)

            if text_width < max_width:
                current_line = test_line
            else:
                lines.append(current_line)
                current_line = word

        lines.append(current_line)
        return lines

# 图标类
class NotificationIcon:
    def __init__(self, x, y, icon_type):
        self.x = x
        self.y = y
        self.type = icon_type
        self.size = random.randint(40, 70)
        self.created_time = time.time()
        self.lifetime = random.uniform(3.0, 6.0)  # 图标显示时间
        self.alpha = 255
        self.angle = 0
        self.spin_speed = random.uniform(-1.5, 1.5)
        self.float_speed = random.uniform(0.2, 0.8)

        # 根据类型设置颜色
        if icon_type == WARNING:
            self.color = YELLOW
            self.text = random.choice(["Warning: Low Memory", "Security Alert", "Permission Required", 
                                      "Unverified Source", "High CPU Usage"])
        elif icon_type == ERROR:
            self.color = RED
            self.text = random.choice(["Error: File Not Found", "Access Denied", "System Failure", 
                                      "Critical Error", "Operation Failed"])
        elif icon_type == INFO:
            self.color = BLUE
            self.text = random.choice(["Information: Update Available", "New Message", "System Notice", 
                                      "Process Complete", "Status: Online"])
        elif icon_type == SUCCESS:
            self.color = GREEN
            self.text = random.choice(["Success: Operation Complete", "Verified", "Task Finished", 
                                      "All Systems OK", "Connection Established"])
        else:  # QUESTION
            self.color = PURPLE
            self.text = random.choice(["Question: Proceed?", "Confirm Action", "Unknown File Type", 
                                      "Requires Attention", "Review Settings?"])

    def update(self):
        # 更新透明度和位置
        elapsed = time.time() - self.created_time
        self.alpha = max(0, int(255 * (1 - elapsed/self.lifetime)))

        # 旋转和浮动效果
        self.angle += self.spin_speed
        self.y -= self.float_speed

        # 如果图标消失,返回True表示需要移除
        return elapsed > self.lifetime

    def draw(self, surface):
        # 创建临时表面绘制图标
        icon_surface = pygame.Surface((self.size * 2, self.size * 2), pygame.SRCALPHA)

        # 绘制图标背景
        pygame.draw.circle(icon_surface, (*self.color, self.alpha), 
                          (self.size, self.size), self.size)
        pygame.draw.circle(icon_surface, (255, 255, 255, self.alpha), 
                          (self.size, self.size), self.size, 3)

        # 根据图标类型绘制符号
        if self.type == WARNING:
            # 感叹号
            pygame.draw.rect(icon_surface, (0, 0, 0, self.alpha), 
                            (self.size - 4, self.size - 20, 8, 20))
            pygame.draw.circle(icon_surface, (0, 0, 0, self.alpha), 
                              (self.size, self.size + 10), 4)
        elif self.type == ERROR:
            # X符号
            pygame.draw.line(icon_surface, (0, 0, 0, self.alpha),
                            (self.size - 12, self.size - 12),
                            (self.size + 12, self.size + 12), 4)
            pygame.draw.line(icon_surface, (0, 0, 0, self.alpha),
                            (self.size + 12, self.size - 12),
                            (self.size - 12, self.size + 12), 4)
        elif self.type == INFO:
            # i符号
            pygame.draw.circle(icon_surface, (0, 0, 0, self.alpha),
                              (self.size, self.size - 8), 5)
            pygame.draw.rect(icon_surface, (0, 0, 0, self.alpha),
                            (self.size - 3, self.size + 5, 6, 15))
        elif self.type == SUCCESS:
            # 勾号
            points = [
                (self.size - 15, self.size),
                (self.size - 5, self.size + 15),
                (self.size + 15, self.size - 10)
            ]
            pygame.draw.lines(icon_surface, (0, 0, 0, self.alpha), False, points, 5)
        else:  # QUESTION
            # 问号
            pygame.draw.circle(icon_surface, (0, 0, 0, self.alpha),
                              (self.size, self.size - 8), 5)
            pygame.draw.arc(icon_surface, (0, 0, 0, self.alpha),
                           (self.size - 15, self.size - 5, 30, 25), 0.2, 3.0, 4)
            pygame.draw.circle(icon_surface, (0, 0, 0, self.alpha),
                              (self.size, self.size + 15), 3)

        # 旋转图标
        rotated_icon = pygame.transform.rotate(icon_surface, self.angle)
        rot_rect = rotated_icon.get_rect(center=(self.x, self.y))

        # 绘制图标
        surface.blit(rotated_icon, rot_rect)

        # 绘制文本
        if self.alpha > 100:  # 只在图标较明显时显示文本
            font = pygame.font.SysFont('Arial', 16)
            text_surface = font.render(self.text, True, (200, 200, 200, self.alpha))
            text_rect = text_surface.get_rect(center=(self.x, self.y + self.size + 25))

            # 文本背景
            text_bg = pygame.Surface((text_rect.width + 20, text_rect.height + 10), pygame.SRCALPHA)
            text_bg.fill((0, 0, 0, min(180, self.alpha)))
            surface.blit(text_bg, (text_rect.x - 10, text_rect.y - 5))

            # 绘制文本
            surface.blit(text_surface, text_rect)

# 数字雨效果类
class DigitalRain:
    def __init__(self):
        self.x = random.randint(0, screen_width)
        self.y = random.randint(-50, -10)
        self.speed = random.uniform(2.0, 8.0)
        self.lifetime = random.uniform(5.0, 15.0)
        self.created_time = time.time()
        self.value = random.choice(["0101", "1010", "0011", "1100", "1001", "0110", "1111", "0000"])
        self.size = random.randint(14, 24)
        self.color = (random.randint(0, 100), random.randint(200, 255), random.randint(100, 200))
        self.alpha = 255

    def update(self):
        # 更新位置
        self.y += self.speed

        # 更新透明度
        elapsed = time.time() - self.created_time
        self.alpha = max(0, int(255 * (1 - elapsed/self.lifetime)))

        # 如果数字消失或移出屏幕,返回True表示需要移除
        return elapsed > self.lifetime or self.y > screen_height + 50

    def draw(self, surface):
        font = pygame.font.SysFont('Courier New', self.size, bold=True)
        text_surface = font.render(self.value, True, (*self.color, self.alpha))
        surface.blit(text_surface, (self.x, self.y))

# 创建自定义鼠标
class CustomMouse:
    def __init__(self):
        self.x = screen_width // 2
        self.y = screen_height // 2
        self.size = 15
        self.color = (200, 200, 255)
        self.trail = []
        self.max_trail = 20
        self.trail_colors = [
            (200, 200, 255, 200),
            (180, 180, 255, 180),
            (160, 160, 255, 160),
            (140, 140, 255, 140),
            (120, 120, 255, 120)
        ]

    def update(self, pos):
        # 更新位置
        self.x, self.y = pos

        # 更新轨迹
        self.trail.append((self.x, self.y))
        if len(self.trail) > self.max_trail:
            self.trail.pop(0)

    def draw(self, surface):
        # 绘制轨迹
        for i, (tx, ty) in enumerate(self.trail):
            if i > 0:
                prev_x, prev_y = self.trail[i-1]
                alpha = int(255 * (i / len(self.trail)))
                color = (150, 150, 255, alpha)
                pygame.draw.line(surface, color, (prev_x, prev_y), (tx, ty), 3)

        # 绘制鼠标
        pygame.draw.circle(surface, self.color, (self.x, self.y), self.size)
        pygame.draw.circle(surface, (255, 255, 255), (self.x, self.y), self.size, 2)

        # 绘制鼠标中心
        pygame.draw.circle(surface, (100, 100, 255), (self.x, self.y), 5)

        # 绘制鼠标指针
        points = [
            (self.x + self.size, self.y),
            (self.x + self.size + 20, self.y - 10),
            (self.x + self.size + 25, self.y),
            (self.x + self.size + 20, self.y + 10)
        ]
        pygame.draw.polygon(surface, self.color, points)
        pygame.draw.polygon(surface, (255, 255, 255), points, 2)

# 屏幕效果管理器
class ScreenEffectManager:
    def __init__(self):
        self.rotation_angle = 0
        self.target_angle = 0
        self.rotating = False
        self.rotation_start_time = 0
        self.rotation_duration = 0
        self.rotation_direction = 1

        self.inverted = False
        self.invert_start_time = 0
        self.invert_duration = 0
        self.inverting = False

    def start_rotation(self):
        if not self.rotating:
            self.rotating = True
            self.rotation_start_time = time.time()
            self.rotation_duration = random.uniform(0.8, 2.0)
            self.target_angle = random.uniform(-15, 15)
            self.rotation_direction = 1 if self.target_angle > 0 else -1

    def start_invert(self):
        if not self.inverting:
            self.inverting = True
            self.invert_start_time = time.time()
            self.invert_duration = random.uniform(0.5, 1.5)

    def update(self):
        # 更新旋转效果
        if self.rotating:
            elapsed = time.time() - self.rotation_start_time

            if elapsed < self.rotation_duration / 2:
                # 加速旋转
                progress = elapsed / (self.rotation_duration / 2)
                self.rotation_angle = self.target_angle * progress
            elif elapsed < self.rotation_duration:
                # 减速旋转回正
                progress = (elapsed - self.rotation_duration / 2) / (self.rotation_duration / 2)
                self.rotation_angle = self.target_angle * (1 - progress)
            else:
                # 结束旋转
                self.rotation_angle = 0
                self.rotating = False

        # 更新反色效果
        if self.inverting:
            elapsed = time.time() - self.invert_start_time
            if elapsed > self.invert_duration:
                self.inverted = False
                self.inverting = False
            else:
                self.inverted = True

    def apply_effects(self, surface, target_surface):
        # 应用旋转效果
        if self.rotation_angle != 0:
            # 旋转表面
            rotated_surface = pygame.transform.rotate(surface, self.rotation_angle)
            rot_rect = rotated_surface.get_rect(center=(screen_width//2, screen_height//2))

            # 绘制到目标表面
            target_surface.fill((0, 0, 0))
            target_surface.blit(rotated_surface, rot_rect)
        else:
            # 如果没有旋转,直接复制到目标表面
            target_surface.blit(surface, (0, 0))

        # 应用反色效果
        if self.inverted:
            # 创建反色表面
            inverted_surface = pygame.Surface((screen_width, screen_height))
            inverted_surface.fill((255, 255, 255))

            # 使用减法混合模式创建反色效果
            target_surface.blit(inverted_surface, (0, 0), special_flags=pygame.BLEND_RGB_SUB)

# Windows 7蓝屏模拟器
class BSODSimulator:
    def __init__(self):
        self.active = False
        self.start_time = 0
        self.blue_color = (10, 10, 140)  # Windows 7蓝屏颜色
        self.error_code = "0x0000007B"
        self.error_name = "INACCESSIBLE_BOOT_DEVICE"
        self.file_name = "\\SystemRoot\\system32\\ntoskrnl.exe"
        self.progress = 0
        self.dots = 0
        self.dot_timer = 0

    def activate(self):
        self.active = True
        self.start_time = time.time()
        self.progress = 0

    def update(self):
        if not self.active:
            return

        # 更新进度
        elapsed = time.time() - self.start_time
        self.progress = min(100, int(elapsed * 1.5))  # 1.5秒完成100%

        # 更新点动画
        self.dot_timer += 1
        if self.dot_timer >= 10:
            self.dot_timer = 0
            self.dots = (self.dots + 1) % 4

    def draw(self, surface):
        if not self.active:
            return

        # 填充蓝色背景
        surface.fill(self.blue_color)

        # 绘制悲伤表情
        pygame.draw.circle(surface, (200, 200, 255), (screen_width//2, screen_height//3), 60)
        pygame.draw.circle(surface, (0, 0, 0), (screen_width//2 - 20, screen_height//3 - 10), 10)
        pygame.draw.circle(surface, (0, 0, 0), (screen_width//2 + 20, screen_height//3 - 10), 10)
        pygame.draw.arc(surface, (0, 0, 0), 
                      (screen_width//2 - 30, screen_height//3 - 10, 60, 60), 
                      math.pi, 2 * math.pi, 3)

        # 绘制错误信息
        title_font = pygame.font.SysFont('Arial', 36, bold=True)
        error_font = pygame.font.SysFont('Arial', 24)
        detail_font = pygame.font.SysFont('Arial', 18)
        small_font = pygame.font.SysFont('Arial', 14)

        # 主标题
        title = title_font.render("A problem has been detected and Windows has been shut down", True, WHITE)
        surface.blit(title, (screen_width//2 - title.get_width()//2, screen_height//2 - 100))

        # 错误代码
        error_text = error_font.render(f"STOP: {self.error_code} ({self.error_name})", True, WHITE)
        surface.blit(error_text, (screen_width//2 - error_text.get_width()//2, screen_height//2 - 40))

        # 错误详情
        detail1 = detail_font.render("If this is the first time you've seen this Stop error screen,", True, WHITE)
        detail2 = detail_font.render("restart your computer. If this screen appears again, follow", True, WHITE)
        detail3 = detail_font.render("these steps:", True, WHITE)
        detail4 = detail_font.render("Check for viruses on your computer. Remove any newly installed", True, WHITE)
        detail5 = detail_font.render("hard drives or hard drive controllers. Check your hard drive", True, WHITE)
        detail6 = detail_font.render("to make sure it is properly configured and terminated.", True, WHITE)
        detail7 = detail_font.render(f"Run CHKDSK /F to check for hard drive corruption, and then", True, WHITE)
        detail8 = detail_font.render("restart your computer.", True, WHITE)

        surface.blit(detail1, (screen_width//2 - detail1.get_width()//2, screen_height//2 + 20))
        surface.blit(detail2, (screen_width//2 - detail2.get_width()//2, screen_height//2 + 50))
        surface.blit(detail3, (screen_width//2 - detail3.get_width()//2, screen_height//2 + 80))
        surface.blit(detail4, (screen_width//2 - detail4.get_width()//2, screen_height//2 + 120))
        surface.blit(detail5, (screen_width//2 - detail5.get_width()//2, screen_height//2 + 150))
        surface.blit(detail6, (screen_width//2 - detail6.get_width()//2, screen_height//2 + 180))
        surface.blit(detail7, (screen_width//2 - detail7.get_width()//2, screen_height//2 + 210))
        surface.blit(detail8, (screen_width//2 - detail8.get_width()//2, screen_height//2 + 240))

        # 技术信息
        tech_info = detail_font.render(f"Technical information:", True, WHITE)
        tech_detail = detail_font.render(f"*** STOP: {self.error_code} ({self.error_name})", True, WHITE)
        tech_file = detail_font.render(f"*** {self.file_name}", True, WHITE)

        surface.blit(tech_info, (screen_width//2 - tech_info.get_width()//2, screen_height//2 + 290))
        surface.blit(tech_detail, (screen_width//2 - tech_detail.get_width()//2, screen_height//2 + 320))
        surface.blit(tech_file, (screen_width//2 - tech_file.get_width()//2, screen_height//2 + 350))

        # 进度条
        bar_width = 500
        pygame.draw.rect(surface, (50, 50, 120), (screen_width//2 - bar_width//2, screen_height - 100, bar_width, 20))
        pygame.draw.rect(surface, (150, 150, 255), (screen_width//2 - bar_width//2, screen_height - 100, bar_width * self.progress // 100, 20))
        pygame.draw.rect(surface, WHITE, (screen_width//2 - bar_width//2, screen_height - 100, bar_width, 20), 2)

        # 进度文本
        progress_text = detail_font.render(f"Collecting data for crash dump {'.' * self.dots}", True, WHITE)
        surface.blit(progress_text, (screen_width//2 - progress_text.get_width()//2, screen_height - 130))

        # 重启提示
        if self.progress == 100:
            restart_text = title_font.render("Please restart your computer", True, YELLOW)
            surface.blit(restart_text, (screen_width//2 - restart_text.get_width()//2, screen_height - 70))
        else:
            percent_text = detail_font.render(f"{self.progress}% complete", True, WHITE)
            surface.blit(percent_text, (screen_width//2 - percent_text.get_width()//2, screen_height - 70))

# 创建初始对象
icons = []
popups = []
digital_rains = []
custom_mouse = CustomMouse()
screen_effects = ScreenEffectManager()
bsod = BSODSimulator()

last_icon_time = 0
last_popup_time = 0
last_digital_time = 0
last_rotation_time = 0
last_invert_time = 0

icon_delay = 0.1  # 图标生成间隔(秒)
popup_delay = 1.5  # 弹窗生成间隔(秒)
digital_delay = 0.05  # 数字雨生成间隔(秒)
rotation_delay = 8.0  # 屏幕旋转间隔(秒)
invert_delay = 5.0   # 反色效果间隔(秒)

# 创建文本表面
title_font = pygame.font.SysFont('Arial', 36, bold=True)
info_font = pygame.font.SysFont('Arial', 24)
warning_font = pygame.font.SysFont('Arial', 28, bold=True)

# 主循环
clock = pygame.time.Clock()
start_time = time.time()
running = True

# 创建背景网格
grid_size = 40
grid_points = []
for x in range(0, screen_width, grid_size):
    for y in range(0, screen_height, grid_size):
        grid_points.append((x, y))

# 创建浮动粒子
particles = []
for _ in range(100):
    particles.append({
        'x': random.randint(0, screen_width),
        'y': random.randint(0, screen_height),
        'size': random.uniform(0.5, 3),
        'speed': random.uniform(0.1, 0.5),
        'color': (
            random.randint(50, 100),
            random.randint(50, 150),
            random.randint(200, 255)
        )
    })

# 创建扫描线
scan_line_y = 0
scan_line_speed = 3

# 计时器
timer_start = time.time()

while running:
    current_time = time.time()
    elapsed_time = current_time - timer_start

    # 处理事件
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        elif event.type == pygame.KEYDOWN:
            # 忽略所有按键
            pass

    # 检查是否应该激活蓝屏
    if elapsed_time >= 120 and not bsod.active:
        bsod.activate()

    # 蓝屏状态下只更新蓝屏
    if bsod.active:
        bsod.update()
        bsod.draw(screen)
        pygame.display.flip()
        clock.tick(60)
        continue

    # 更新鼠标位置
    mouse_pos = pygame.mouse.get_pos()
    custom_mouse.update(mouse_pos)

    # 在鼠标位置生成新图标
    if current_time - last_icon_time > icon_delay:
        icon_type = random.choice([WARNING, ERROR, INFO, SUCCESS, QUESTION])
        icons.append(NotificationIcon(mouse_pos[0], mouse_pos[1], icon_type))
        last_icon_time = current_time

    # 生成新弹窗
    if current_time - last_popup_time > popup_delay:
        popups.append(PopupWindow())
        last_popup_time = current_time

    # 生成新数字雨
    if current_time - last_digital_time > digital_delay:
        digital_rains.append(DigitalRain())
        last_digital_time = current_time

    # 触发屏幕旋转
    if current_time - last_rotation_time > rotation_delay:
        screen_effects.start_rotation()
        last_rotation_time = current_time

    # 触发反色效果
    if current_time - last_invert_time > invert_delay:
        screen_effects.start_invert()
        last_invert_time = current_time

    # 更新屏幕效果状态
    screen_effects.update()

    # 更新扫描线位置
    scan_line_y = (scan_line_y + scan_line_speed) % screen_height

    # 清除效果表面
    effect_surface.fill(BACKGROUND)

    # 绘制背景网格
    for point in grid_points:
        pygame.draw.circle(effect_surface, (30, 30, 60), point, 1)

    # 更新并绘制所有图标
    for icon in icons[:]:
        if icon.update():
            icons.remove(icon)
        else:
            icon.draw(effect_surface)

    # 更新并绘制所有弹窗
    for popup in popups[:]:
        if popup.update():
            popups.remove(popup)
        else:
            popup.draw(effect_surface)

    # 更新并绘制所有数字雨
    for rain in digital_rains[:]:
        if rain.update():
            digital_rains.remove(rain)
        else:
            rain.draw(effect_surface)

    # 绘制自定义鼠标
    custom_mouse.draw(effect_surface)

    # 更新并绘制浮动粒子
    for particle in particles:
        particle['y'] -= particle['speed']
        if particle['y'] < -10:
            particle['y'] = screen_height + 10
            particle['x'] = random.randint(0, screen_width)

        pygame.draw.circle(effect_surface, particle['color'], 
                          (int(particle['x']), int(particle['y'])), 
                          particle['size'])

    # 绘制扫描线
    pygame.draw.line(effect_surface, (0, 200, 100, 100), 
                   (0, scan_line_y), (screen_width, scan_line_y), 2)

    # 绘制标题
    title = title_font.render("System Critical Process", True, (200, 200, 255))
    effect_surface.blit(title, (screen_width // 2 - title.get_width() // 2, 20))

    # 绘制状态信息
    status_text = info_font.render(f"Icons: {len(icons)}  |  Popups: {len(popups)}  |  Digital Rain: {len(digital_rains)}", True, (180, 180, 200))
    effect_surface.blit(status_text, (screen_width // 2 - status_text.get_width() // 2, 70))

    # 绘制时间倒计时
    time_left = max(0, 120 - int(elapsed_time))
    time_text = warning_font.render(f"System Shutdown in: {time_left} seconds", True, RED)
    effect_surface.blit(time_text, (screen_width // 2 - time_text.get_width() // 2, 110))

    # 绘制警告信息
    warning = warning_font.render("WARNING: Critical system instability detected", True, YELLOW)
    effect_surface.blit(warning, (screen_width // 2 - warning.get_width() // 2, screen_height - 100))

    # 绘制退出提示
    exit_info = info_font.render("This is a critical system service. Do not attempt to terminate.", True, (150, 150, 180))
    effect_surface.blit(exit_info, (screen_width // 2 - exit_info.get_width() // 2, screen_height - 60))

    # 应用屏幕效果(旋转和反色)
    screen_effects.apply_effects(effect_surface, screen)

    # 添加一些浮动粒子增强效果
    for _ in range(5):
        x = random.randint(0, screen_width)
        y = random.randint(0, screen_height)
        size = random.randint(1, 3)
        color = random.choice([(100, 100, 200), (150, 150, 255), (200, 200, 255)])
        pygame.draw.circle(screen, color, (x, y), size)

    pygame.display.flip()
    clock.tick(60)

# 程序理论上永远不会执行到这里
try:
    ctypes.windll.user32.BlockInput(False)
except:
    pass
pygame.quit()
sys.exit()

1 评论


用户头像
6NT天星-SKYSTAR   4天前 · 福建         踩      回复

《理论上不会执行到这里》


App 内打开
你确定删除吗?
1024
x

© 2018-2025 AcWing 版权所有  |  京ICP备2021015969号-2
用户协议  |  隐私政策  |  常见问题  |  联系我们
AcWing
请输入登录信息
更多登录方式: 微信图标 qq图标 qq图标
请输入绑定的邮箱地址
请输入注册信息