Python-炸弹人【附完整源码】

炸弹人

炸弹人是童年的一款经典电子游戏,玩家控制一个类似"炸弹人"的角色,这个角色可以放置炸弹,并在指定的时间内引爆它们消灭敌人以达到目标,此游戏共设有两节关卡,代码如下:

运行效果:方向键控制上下左右, 点击空格键丢炸弹
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

一:主程序:

import sys
import cfg
import random
import pygame
from modules import *'''游戏主程序'''
def main(cfg):# 初始化pygame.init()pygame.mixer.init()pygame.mixer.music.load(cfg.BGMPATH)pygame.mixer.music.play(-1, 0.0)screen = pygame.display.set_mode(cfg.SCREENSIZE)pygame.display.set_caption('炸弹人')# 开始界面Interface(screen, cfg, mode='game_start')# 游戏主循环font = pygame.font.SysFont('Consolas', 15)for gamemap_path in cfg.GAMEMAPPATHS:# -地图map_parser = mapParser(gamemap_path, bg_paths=cfg.BACKGROUNDPATHS, wall_paths=cfg.WALLPATHS, blocksize=cfg.BLOCKSIZE)# -水果fruit_sprite_group = pygame.sprite.Group()used_spaces = []for i in range(5):coordinate = map_parser.randomGetSpace(used_spaces)used_spaces.append(coordinate)fruit_sprite_group.add(Fruit(random.choice(cfg.FRUITPATHS), coordinate=coordinate, blocksize=cfg.BLOCKSIZE))# -我方Herocoordinate = map_parser.randomGetSpace(used_spaces)used_spaces.append(coordinate)ourhero = Hero(imagepaths=cfg.HEROZELDAPATHS, coordinate=coordinate, blocksize=cfg.BLOCKSIZE, map_parser=map_parser, hero_name='ZELDA')# -电脑Heroaihero_sprite_group = pygame.sprite.Group()coordinate = map_parser.randomGetSpace(used_spaces)aihero_sprite_group.add(Hero(imagepaths=cfg.HEROBATMANPATHS, coordinate=coordinate, blocksize=cfg.BLOCKSIZE, map_parser=map_parser, hero_name='BATMAN'))used_spaces.append(coordinate)coordinate = map_parser.randomGetSpace(used_spaces)aihero_sprite_group.add(Hero(imagepaths=cfg.HERODKPATHS, coordinate=coordinate, blocksize=cfg.BLOCKSIZE, map_parser=map_parser, hero_name='DK'))used_spaces.append(coordinate)# -炸弹bombbomb_sprite_group = pygame.sprite.Group()# -用于判断游戏胜利或者失败的flagis_win_flag = False# -主循环screen = pygame.display.set_mode(map_parser.screen_size)clock = pygame.time.Clock()while True:dt = clock.tick(cfg.FPS)for event in pygame.event.get():if event.type == pygame.QUIT:pygame.quit()sys.exit(-1)# --↑↓←→键控制上下左右, 空格键丢炸弹elif event.type == pygame.KEYDOWN:if event.key == pygame.K_UP:ourhero.move('up')elif event.key == pygame.K_DOWN:ourhero.move('down')elif event.key == pygame.K_LEFT:ourhero.move('left')elif event.key == pygame.K_RIGHT:ourhero.move('right')elif event.key == pygame.K_SPACE:if ourhero.bomb_cooling_count <= 0:bomb_sprite_group.add(ourhero.generateBomb(imagepath=cfg.BOMBPATH, digitalcolor=cfg.YELLOW, explode_imagepath=cfg.FIREPATH))screen.fill(cfg.WHITE)# --电脑Hero随机行动for hero in aihero_sprite_group:action, flag = hero.randomAction(dt)if flag and action == 'dropbomb':bomb_sprite_group.add(hero.generateBomb(imagepath=cfg.BOMBPATH, digitalcolor=cfg.YELLOW, explode_imagepath=cfg.FIREPATH))# --吃到水果加生命值(只要是Hero, 都能加)ourhero.eatFruit(fruit_sprite_group)for hero in aihero_sprite_group:hero.eatFruit(fruit_sprite_group)# --游戏元素都绑定到屏幕上map_parser.draw(screen)for bomb in bomb_sprite_group:if not bomb.is_being:bomb_sprite_group.remove(bomb)explode_area = bomb.draw(screen, dt, map_parser)if explode_area:# --爆炸火焰范围内的Hero生命值将持续下降if ourhero.coordinate in explode_area:ourhero.health_value -= bomb.harm_valuefor hero in aihero_sprite_group:if hero.coordinate in explode_area:hero.health_value -= bomb.harm_valuefruit_sprite_group.draw(screen)for hero in aihero_sprite_group:hero.draw(screen, dt)ourhero.draw(screen, dt)# --左上角显示生命值pos_x = showText(screen, font, text=ourhero.hero_name+'(our):'+str(ourhero.health_value), color=cfg.YELLOW, position=[5, 5])for hero in aihero_sprite_group:pos_x, pos_y = pos_x+15, 5pos_x = showText(screen, font, text=hero.hero_name+'(ai):'+str(hero.health_value), color=cfg.YELLOW, position=[pos_x, pos_y])# --我方玩家生命值小于等于0/电脑方玩家生命值均小于等于0则判断游戏结束if ourhero.health_value <= 0:is_win_flag = Falsebreakfor hero in aihero_sprite_group:if hero.health_value <= 0:aihero_sprite_group.remove(hero)if len(aihero_sprite_group) == 0:is_win_flag = Truebreakpygame.display.update()clock.tick(cfg.FPS)if is_win_flag:Interface(screen, cfg, mode='game_switch')else:breakInterface(screen, cfg, mode='game_end')'''run'''
if __name__ == '__main__':while True:main(cfg)

二:配置文件 – cfg.py

import os'''屏幕大小'''
SCREENSIZE = (640, 480)
'''块大小'''
BLOCKSIZE = 30
'''FPS'''
FPS = 30
'''游戏地图路径'''
GAMEMAPPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/maps/1.map', 'resources/maps/2.map']]
'''墙路径'''
WALLPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/images/misc/wall0.png', 'resources/images/misc/wall1.png', 'resources/images/misc/wall2.png']]
'''英雄路径'''
HERODKPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/images/dk/left.png', 'resources/images/dk/right.png', 'resources/images/dk/up.png', 'resources/images/dk/down.png']]
HEROZELDAPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/images/zelda/left.png', 'resources/images/zelda/right.png', 'resources/images/zelda/up.png', 'resources/images/zelda/down.png']]
HEROBATMANPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/images/batman/left.png', 'resources/images/batman/right.png', 'resources/images/batman/up.png', 'resources/images/batman/down.png']]
'''水果路径'''
FRUITPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/images/misc/banana.png', 'resources/images/misc/cherry.png']]
'''背景路径'''
BACKGROUNDPATHS = [os.path.join(os.getcwd(), path) for path in \['resources/images/misc/bg0.png', 'resources/images/misc/bg1.png', 'resources/images/misc/bg2.png']]
'''爆炸和发射路径'''
BOMBPATH = os.path.join(os.getcwd(), 'resources/images/misc/bomb.png')
FIREPATH = os.path.join(os.getcwd(), 'resources/images/misc/fire.png')
'''背景音乐'''
BGMPATH = os.path.join(os.getcwd(), 'resources/audio/bgm.mp3')
'''一些颜色'''
YELLOW = (255, 255, 0)
BLUE = (0, 0, 255)
RED = (255, 0, 0)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)

三:素材包 – resources

(1)audio文件:

bgm.mps音乐大家自己去找然后设置就好

(2)images文件:

图片太多了,做不到全部放置,大家根据配置文件自己去弄就好,或者私信我,我单独给大家发

(3)maps文件:

#1.map
xxxxxxxxxxxxx
x00000000000x
x0x0x0x0x0x0x
x00000000000x
x0x0x0x0x0x0x
x00000000000x
x0x0x0x0x0x0x
x00000000000x
x0x0x0x0x0x0x
x00000000000x
xxxxxxxxxxxxx
#2.map
2222222222222222222222222
2wwwww2wwwww2wwwww2wwwww2
2222222222222222222222222
2zz2zz2x1x1x1x1x1x2zz2zz2
2zz2zz2111111111112zz2zz2
2222222x1x1x1x1x1x2222222
2wwwww2111111111112wwwww2
2222222x1x1x1x1x1x2222222
2zz2zz2111111111112zz2zz2
2zz2zz2x1x1x1x1x1x2zz2zz2
2222222222222222222222222
2wwwww2wwwww2wwwww2wwwww2
2222222222222222222222222

四:文件包 – modules

(1)__init__.py

'''初始化'''
from .MAP import mapParser
from .misc import showText, Button, Interface
from .Sprites import Wall, Background, Fruit, Bomb, Hero

(2)MAP.py

import random
from .Sprites import *'''.map文件解析器'''
class mapParser():def __init__(self, mapfilepath, bg_paths, wall_paths, blocksize, **kwargs):self.instances_list = self.__parse(mapfilepath)self.bg_paths = bg_pathsself.wall_paths = wall_pathsself.blocksize = blocksizeself.height = len(self.instances_list)self.width = len(self.instances_list[0])self.screen_size = (blocksize * self.width, blocksize * self.height)'''地图画到屏幕上'''def draw(self, screen):for j in range(self.height):for i in range(self.width):instance = self.instances_list[j][i]if instance == 'w':elem = Wall(self.wall_paths[0], [i, j], self.blocksize)elif instance == 'x':elem = Wall(self.wall_paths[1], [i, j], self.blocksize)elif instance == 'z':elem = Wall(self.wall_paths[2], [i, j], self.blocksize)elif instance == '0':elem = Background(self.bg_paths[0], [i, j], self.blocksize)elif instance == '1':elem = Background(self.bg_paths[1], [i, j], self.blocksize)elif instance == '2':elem = Background(self.bg_paths[2], [i, j], self.blocksize)else:raise ValueError('instance parse error in mapParser.draw...')elem.draw(screen)'''随机获取一个空地'''def randomGetSpace(self, used_spaces=None):while True:i = random.randint(0, self.width-1)j = random.randint(0, self.height-1)coordinate = [i, j]if used_spaces and coordinate in used_spaces:continueinstance = self.instances_list[j][i]if instance in ['0', '1', '2']:breakreturn coordinate'''根据坐标获取元素类型'''def getElemByCoordinate(self, coordinate):return self.instances_list[coordinate[1]][coordinate[0]]'''解析.map文件'''def __parse(self, mapfilepath):instances_list = []with open(mapfilepath) as f:for line in f.readlines():instances_line_list = []for c in line:if c in ['w', 'x', 'z', '0', '1', '2']:instances_line_list.append(c)instances_list.append(instances_line_list)return instances_list

(3)misc.py

import sys
import pygame'''在屏幕指定位置显示文字'''
def showText(screen, font, text, color, position):text_render = font.render(text, True, color)rect = text_render.get_rect()rect.left, rect.top = positionscreen.blit(text_render, rect)return rect.right'''按钮'''
def Button(screen, position, text, buttoncolor=(120, 120, 120), linecolor=(20, 20, 20), textcolor=(255, 255, 255), bwidth=200, bheight=50):left, top = positionpygame.draw.line(screen, linecolor, (left, top), (left+bwidth, top), 5)pygame.draw.line(screen, linecolor, (left, top-2), (left, top+bheight), 5)pygame.draw.line(screen, linecolor, (left, top+bheight), (left+bwidth, top+bheight), 5)pygame.draw.line(screen, linecolor, (left+bwidth, top+bheight), (left+bwidth, top), 5)pygame.draw.rect(screen, buttoncolor, (left, top, bwidth, bheight))font = pygame.font.SysFont('Consolas', 30)text_render = font.render(text, 1, textcolor)rect = text_render.get_rect()rect.centerx, rect.centery = left + bwidth / 2, top + bheight / 2return screen.blit(text_render, rect)'''游戏开始/关卡切换/游戏结束界面'''
def Interface(screen, cfg, mode='game_start'):pygame.display.set_mode(cfg.SCREENSIZE)if mode == 'game_start':clock = pygame.time.Clock()while True:screen.fill((41, 36, 33))button_1 = Button(screen, (220, 150), 'START')button_2 = Button(screen, (220, 250), 'QUIT')for event in pygame.event.get():if event.type == pygame.QUIT:pygame.quit()sys.exit(-1)elif event.type == pygame.MOUSEBUTTONDOWN:if button_1.collidepoint(pygame.mouse.get_pos()):return Trueelif button_2.collidepoint(pygame.mouse.get_pos()):pygame.quit()sys.exit(-1)pygame.display.update()clock.tick(cfg.FPS)elif mode == 'game_switch':clock = pygame.time.Clock()while True:screen.fill((41, 36, 33))button_1 = Button(screen, (220, 150), 'NEXT')button_2 = Button(screen, (220, 250), 'QUIT')for event in pygame.event.get():if event.type == pygame.QUIT:pygame.quit()sys.exit(-1)elif event.type == pygame.MOUSEBUTTONDOWN:if button_1.collidepoint(pygame.mouse.get_pos()):return Trueelif button_2.collidepoint(pygame.mouse.get_pos()):pygame.quit()sys.exit(-1)pygame.display.update()clock.tick(cfg.FPS)elif mode == 'game_end':clock = pygame.time.Clock()while True:screen.fill((41, 36, 33))button_1 = Button(screen, (220, 150), 'RESTART')button_2 = Button(screen, (220, 250), 'QUIT')for event in pygame.event.get():if event.type == pygame.QUIT:pygame.quit()sys.exit(-1)elif event.type == pygame.MOUSEBUTTONDOWN:if button_1.collidepoint(pygame.mouse.get_pos()):return Trueelif button_2.collidepoint(pygame.mouse.get_pos()):pygame.quit()sys.exit(-1)pygame.display.update()clock.tick(cfg.FPS)else:raise ValueError('Interface.mode unsupport %s...' % mode)

(4)Sprites.py

import copy
import random
import pygame'''墙类'''
class Wall(pygame.sprite.Sprite):def __init__(self, imagepath, coordinate, blocksize, **kwargs):pygame.sprite.Sprite.__init__(self)self.image = pygame.image.load(imagepath)self.image = pygame.transform.scale(self.image, (blocksize, blocksize))self.rect = self.image.get_rect()self.rect.left, self.rect.top = coordinate[0] * blocksize, coordinate[1] * blocksizeself.coordinate = coordinateself.blocksize = blocksize'''画到屏幕上'''def draw(self, screen):screen.blit(self.image, self.rect)return True'''背景类'''
class Background(pygame.sprite.Sprite):def __init__(self, imagepath, coordinate, blocksize, **kwargs):pygame.sprite.Sprite.__init__(self)self.image = pygame.image.load(imagepath)self.image = pygame.transform.scale(self.image, (blocksize, blocksize))self.rect = self.image.get_rect()self.rect.left, self.rect.top = coordinate[0] * blocksize, coordinate[1] * blocksizeself.coordinate = coordinateself.blocksize = blocksize'''画到屏幕上'''def draw(self, screen):screen.blit(self.image, self.rect)return True'''水果类'''
class Fruit(pygame.sprite.Sprite):def __init__(self, imagepath, coordinate, blocksize, **kwargs):pygame.sprite.Sprite.__init__(self)self.kind = imagepath.split('/')[-1].split('.')[0]if self.kind == 'banana':self.value = 5elif self.kind == 'cherry':self.value = 10else:raise ValueError('Unknow fruit %s...' % self.kind)self.image = pygame.image.load(imagepath)self.image = pygame.transform.scale(self.image, (blocksize, blocksize))self.rect = self.image.get_rect()self.rect.left, self.rect.top = coordinate[0] * blocksize, coordinate[1] * blocksizeself.coordinate = coordinateself.blocksize = blocksize'''画到屏幕上'''def draw(self, screen):screen.blit(self.image, self.rect)return True'''炸弹类'''
class Bomb(pygame.sprite.Sprite):def __init__(self, imagepath, coordinate, blocksize, digitalcolor, explode_imagepath, **kwargs):pygame.sprite.Sprite.__init__(self)self.image = pygame.image.load(imagepath)self.image = pygame.transform.scale(self.image, (blocksize, blocksize))self.explode_imagepath = explode_imagepathself.rect = self.image.get_rect()# 像素位置self.rect.left, self.rect.top = coordinate[0] * blocksize, coordinate[1] * blocksize# 坐标(元素块为单位长度)self.coordinate = coordinateself.blocksize = blocksize# 爆炸倒计时self.explode_millisecond = 6000 * 1 - 1self.explode_second = int(self.explode_millisecond / 1000)self.start_explode = False# 爆炸持续时间self.exploding_count = 1000 * 1# 炸弹伤害能力self.harm_value = 1# 该炸弹是否还存在self.is_being = Trueself.font = pygame.font.SysFont('Consolas', 20)self.digitalcolor = digitalcolor'''画到屏幕上'''def draw(self, screen, dt, map_parser):if not self.start_explode:# 爆炸倒计时self.explode_millisecond -= dtself.explode_second = int(self.explode_millisecond / 1000)if self.explode_millisecond < 0:self.start_explode = Truescreen.blit(self.image, self.rect)text = self.font.render(str(self.explode_second), True, self.digitalcolor)rect = text.get_rect(center=(self.rect.centerx-5, self.rect.centery+5))screen.blit(text, rect)return Falseelse:# 爆炸持续倒计时self.exploding_count -= dtif self.exploding_count > 0:return self.__explode(screen, map_parser)else:self.is_being = Falsereturn False'''爆炸效果'''def __explode(self, screen, map_parser):explode_area = self.__calcExplodeArea(map_parser.instances_list)for each in explode_area:image = pygame.image.load(self.explode_imagepath)image = pygame.transform.scale(image, (self.blocksize, self.blocksize))rect = image.get_rect()rect.left, rect.top = each[0] * self.blocksize, each[1] * self.blocksizescreen.blit(image, rect)return explode_area'''计算爆炸区域'''def __calcExplodeArea(self, instances_list):explode_area = []# 区域计算规则为墙可以阻止爆炸扩散, 且爆炸范围仅在游戏地图范围内for ymin in range(self.coordinate[1], self.coordinate[1]-5, -1):if ymin < 0 or instances_list[ymin][self.coordinate[0]] in ['w', 'x', 'z']:breakexplode_area.append([self.coordinate[0], ymin])for ymax in range(self.coordinate[1]+1, self.coordinate[1]+5):if ymax >= len(instances_list) or instances_list[ymax][self.coordinate[0]] in ['w', 'x', 'z']:breakexplode_area.append([self.coordinate[0], ymax])for xmin in range(self.coordinate[0], self.coordinate[0]-5, -1):if xmin < 0 or instances_list[self.coordinate[1]][xmin] in ['w', 'x', 'z']:breakexplode_area.append([xmin, self.coordinate[1]])for xmax in range(self.coordinate[0]+1, self.coordinate[0]+5):if xmax >= len(instances_list[0]) or instances_list[self.coordinate[1]][xmax] in ['w', 'x', 'z']:breakexplode_area.append([xmax, self.coordinate[1]])return explode_area'''角色类'''
class Hero(pygame.sprite.Sprite):def __init__(self, imagepaths, coordinate, blocksize, map_parser, **kwargs):pygame.sprite.Sprite.__init__(self)self.imagepaths = imagepathsself.image = pygame.image.load(imagepaths[-1])self.image = pygame.transform.scale(self.image, (blocksize, blocksize))self.rect = self.image.get_rect()self.rect.left, self.rect.top = coordinate[0] * blocksize, coordinate[1] * blocksizeself.coordinate = coordinateself.blocksize = blocksizeself.map_parser = map_parserself.hero_name = kwargs.get('hero_name')# 生命值self.health_value = 50# 炸弹冷却时间self.bomb_cooling_time = 5000self.bomb_cooling_count = 0# 随机移动冷却时间(仅AI电脑用)self.randommove_cooling_time = 100self.randommove_cooling_count = 0'''角色移动'''def move(self, direction):self.__updateImage(direction)if direction == 'left':if self.coordinate[0]-1 < 0 or self.map_parser.getElemByCoordinate([self.coordinate[0]-1, self.coordinate[1]]) in ['w', 'x', 'z']:return Falseself.coordinate[0] = self.coordinate[0] - 1elif direction == 'right':if self.coordinate[0]+1 >= self.map_parser.width or self.map_parser.getElemByCoordinate([self.coordinate[0]+1, self.coordinate[1]]) in ['w', 'x', 'z']:return Falseself.coordinate[0] = self.coordinate[0] + 1elif direction == 'up':if self.coordinate[1]-1 < 0 or self.map_parser.getElemByCoordinate([self.coordinate[0], self.coordinate[1]-1]) in ['w', 'x', 'z']:return Falseself.coordinate[1] = self.coordinate[1] - 1elif direction == 'down':if self.coordinate[1]+1 >= self.map_parser.height or self.map_parser.getElemByCoordinate([self.coordinate[0], self.coordinate[1]+1]) in ['w', 'x', 'z']:return Falseself.coordinate[1] = self.coordinate[1] + 1else:raise ValueError('Unknow direction %s...' % direction)self.rect.left, self.rect.top = self.coordinate[0] * self.blocksize, self.coordinate[1] * self.blocksizereturn True'''随机行动(AI电脑用)'''def randomAction(self, dt):# 冷却倒计时if self.randommove_cooling_count > 0:self.randommove_cooling_count -= dtaction = random.choice(['left', 'left', 'right', 'right', 'up', 'up', 'down', 'down', 'dropbomb'])flag = Falseif action in ['left', 'right', 'up', 'down']:if self.randommove_cooling_count <= 0:flag = Trueself.move(action)self.randommove_cooling_count = self.randommove_cooling_timeelif action in ['dropbomb']:if self.bomb_cooling_count <= 0:flag = Trueself.bomb_cooling_count = self.bomb_cooling_timereturn action, flag'''生成炸弹'''def generateBomb(self, imagepath, digitalcolor, explode_imagepath):return Bomb(imagepath=imagepath, coordinate=copy.deepcopy(self.coordinate), blocksize=self.blocksize, digitalcolor=digitalcolor, explode_imagepath=explode_imagepath)'''画到屏幕上'''def draw(self, screen, dt):# 冷却倒计时if self.bomb_cooling_count > 0:self.bomb_cooling_count -= dtscreen.blit(self.image, self.rect)return True'''吃水果'''def eatFruit(self, fruit_sprite_group):eaten_fruit = pygame.sprite.spritecollide(self, fruit_sprite_group, True, None)for fruit in eaten_fruit:self.health_value += fruit.value'''更新角色朝向'''def __updateImage(self, direction):directions = ['left', 'right', 'up', 'down']idx = directions.index(direction)self.image = pygame.image.load(self.imagepaths[idx])self.image = pygame.transform.scale(self.image, (self.blocksize, self.blocksize))

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/202325.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python将时间戳转换为时间

python将时间戳转换为时间 import datetime timestamp 1701862813779 # 将时间戳转换为秒&#xff08;因为Python的timestamp通常是以秒为单位的&#xff09; timestamp_seconds timestamp / 1000 # 将时间戳转换为UTC时间 utc_time datetime.datetime.utcfromti…

空间金字塔池化(SPP,Spatial Pyramid Pooling)系列

空间金字塔池化的作用是解决输入图片大小不一造成的缺陷&#xff0c;同时在目标识别中增加了精度。空间金字塔池化可以使得任意大小的特征图都能够转换成固定大小的特征向量&#xff0c;下面针对一些典型的空间金字塔进行盘点。 部分图片来自blog:空间金字塔池化改进 SPP / SP…

每天一点python——day88

#每天一点Python——88 #编程两大思想【面向过程与面向对象】 #如图&#xff1a; 面向过程的线性思维&#xff1a; 类似于做菜一步步的来&#xff0c;先怎么样怎么样&#xff0c;再怎么样 如果不一步步的来&#xff0c;例如先炒菜再点火&#xff0c;这样是做不好的 面向对象&a…

IntelliJ IDE 插件开发 | (二)UI 界面与数据持久化

系列文章 IntelliJ IDE 插件开发 |&#xff08;一&#xff09;快速入门 前言 在上一篇文章中介绍了在IDEA下开发、运行和安装插件的基本步骤&#xff0c;因此创建项目等基础步骤不再赘述&#xff0c;本文则开始介绍如何进行 UI 界面的开发以及相关数据的持久化存储&#xff…

安全测试工具,自动发现网站所有URL!

作为一个安全测试人员来说&#xff0c;首先要拿到网站所有url&#xff0c;然后根据拿到的url进行渗透测试进行漏洞挖掘。本文给大家介绍的是如何拿到一个网站所有的url。 深度爬取层级控制 现在我也找了很多测试的朋友&#xff0c;做了一个分享技术的交流群&#xff0c;共享了很…

ospf选路

问题描述 R6通过主备份路径访问LSP&#xff08;R1&#xff09;&#xff0c;主为R2&#xff0c; 备为R3 解决方案 路由器1看作LSP&#xff0c;配置loopback 0 ,地址为1.1.1.1 供测试使用&#xff1b;路由器 236, LSW4和LSW5&#xff0c; 运行ospf处于相同区域&#xff0c;建立…

Redis核心知识点总结

1.Redis介绍 Redis 是 NoSQL&#xff0c;但是可处理 1 秒 10w 的并发&#xff08;数据都在内存中&#xff09; 使用 java 对 redis 进行操作类似 jdbc 接口标准对 mysql&#xff0c;有各类实现他的实现类&#xff0c;我们常用的是 druid 其中对 redis&#xff0c;我们通常用 J…

16、XSS——会话管理

文章目录 一、web会话管理概述1.1 会话管理1.2 为什么需要会话管理&#xff1f;1.3 常见的web应用会话管理的方式 二、会话管理方式2.1 基于server端的session的管理方式2.2 cookie-based的管理方式2.3 token-based的管理方式 三、安全问题 一、web会话管理概述 1.1 会话管理 …

加速度jsudo:IC商城系统4.0版正式发布 PCB计价电子元器件商城

近日&#xff0c;在加速度软件新品会发布会上&#xff0c;Mike正式公布了其4.0版本的电子元器件商城系统&#xff0c;展示了迭代后的强大新功能。在招募了数十家元器件销售、运营和老板测试体验后&#xff0c;获得了大家一致的好评。其中&#xff0c;中国电子南京某子公司董事长…

VMware虚拟机系统CentOS镜像的下载

文章目录 阿里云下载官网下载参考文档 一些小版本可能过时或者其他原因已经不能存在了&#xff0c;只有大版本号最新的&#xff0c;或者其他最新版本 阿里云下载 1-百度搜索&#xff1a;阿里云 2-找到开发者社区 3-找到下载&#xff0c;选择镜像 4-选择系统 5-点击镜像地…

vivado时序方法检查3

TIMING-7 &#xff1a; 相关时钟间无公共节点 时钟 <clock_name> 与 <clock_name> 之间相互关联 &#xff08; 一起定时 &#xff09;&#xff0c; 但两者间无公共节点。此设置在硬件中可能失败。要查找这些时钟之间的时序路径&#xff0c; 请运行以下命令 &a…

岚图追光PHEV 25.28万元起售,开卷混动豪华轿车

作者&#xff5c;Amy 编辑&#xff5c;德新 12月5日晚&#xff0c;2023岚图科技日上&#xff0c;岚图汽车正式发布了其新一代SOA电子电气架构天元架构&#xff0c;并宣布了以“新行政电动旗舰”为定位的岚图追光PHEV正式上市。 岚图追光PHEV是岚图汽车旗下首款电混轿车&#x…

selenium自动化测试:xpath八种定位方式!

01、前言 如果可以的话&#xff0c;请先关注&#xff08;专栏和账号&#xff09;&#xff0c;然后点赞和收藏&#xff0c;最后学习和进步。你的支持是我继续写下去的最大动力&#xff0c;个人定当倾囊而送&#xff0c;不负众望。谢谢&#xff01;&#xff01;&#xff01; 1.…

【springboot】整合redis和定制化

1.前提条件:docker安装好了redis,确定redis可以访问 可选软件: 2.测试代码 (1)redis依赖 org.springframework.boot spring-boot-starter-data-redis (2)配置redis &#xff08;3&#xff09; 注入 Resource StringRedisTemplate stringRedisTemplate; 这里如果用Autowi…

docker安装及简单使用(Linux版本)

文章目录 前言一、docker安装二、docker命令pull&#xff08;安装镜像&#xff09;images&#xff08;查看镜像&#xff09;run&#xff08;创建容器&#xff09;删除容器exec&#xff08;进入运行中的容器&#xff09;常用命令 总结如有启发&#xff0c;可点赞收藏哟~ 前言 ht…

Python 进阶(十三):JSON 序列化和反序列化(json 模块)

大家好&#xff0c;我是水滴~~ 本篇文章主要介绍json模块的功能&#xff0c;包括将Python对象序列化到文件、将Python对象序列化为字符串、序列化时类型的对照表、将文件中JSON数据反序列化为Python对象&#xff0c;将JSON字符串反序列化为Python对象、反序列化时类型的对照表…

2023中医药国际传承传播大会在深圳召开

12月2日&#xff0c;2023中医药国际传承传播大会在深圳召开&#xff0c;大会由世界针灸学会联合会、中新社国际传播集团、中国新闻图片网、中国民族医药学会、中国针灸学会主办&#xff0c;世界针灸学会联合会健康传播工作委员会、中新雅视文化发展有限公司公司与深圳巨邦传媒集…

播放pcap抓包文件中的amr-wb、amr-nb、evs声音

前言 由于wireshark并不能解析amr-wb、evs数据&#xff0c;所以也就没办法播放响应的音频。在遇到问题时&#xff0c;想还原抓包的数据是否正常就很难受。为了解决这个问题&#xff0c;我看了RFC4867&#xff0c;想着自己写一个解包小工具&#xff0c;最后彻底放弃。。感觉太复…

Qt Creator :Analyze heob 使用教程

功能&#xff1a;在windows系统上检测和调试软件代码的内存泄漏情况&#xff1b; 使用环境 &#xff1a;需要下载 heob和dwarfstack 把dwarfstack动态库放在heob的执行程序目录下 使用步骤&#xff1a; 第三步&#xff1a;配置启动调试程序 第四步&#xff1a;配置heob的路…

什么因素会影响葡萄酒陈酿的能力?

糖、酸和酚类与水的比例是葡萄酒陈酿程度的关键决定因素&#xff0c;收获前葡萄中的水分越少&#xff0c;产生的葡萄酒就越有可能具有一定的陈酿潜力。那么葡萄品种、气候和葡萄栽培实践的过程就相当重要了&#xff0c;对陈酿的时间发挥了重要的作用。皮较厚的葡萄品种&#xf…