加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
res_config.py 16.24 KB
一键复制 编辑 原始数据 按行查看 历史
执明神君 提交于 2022-07-24 23:27 . 新增素材
'''
该模块定义了资源路径
'''
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from PySide2.QtGui import *
import os, sys, platform, ctypes
from plistlib import load
if platform.system() == 'Windows':
ctypes.windll.kernel32.SetDllDirectoryW(None)
if getattr(sys, 'frozen', False):
path = os.path.dirname(sys.executable) + '/res'
elif __file__:
path = os.path.dirname(__file__) + '/res'
def extractPlist(path):
with open(path, 'rb') as f:
f = load(f)
rect = []
for info in f['frames'].values():
rect.append(list(map(lambda x: int(x), info['textureRect'].replace('{', '').replace('}', '').split(','))))
return rect
def joinPath(source):
_path = os.path.join(path, source)
if os.path.isfile(_path):
return _path
elif os.path.isdir(_path):
if 'KeyFrame.plist' in os.listdir(_path):
return {'plist': os.path.join(_path, 'KeyFrame.plist'), 'png': os.path.join(_path, 'KeyFrame.png')}
else:
return [os.path.join(_path, x) for x in os.listdir(_path)] # 如果传入文件夹则读取里面所有文件
else:
print(path)
print(source)
raise OSError
qss = joinPath("qlight.qss")
logo = joinPath(r"images\logo\logo.png")
brand = joinPath(r"images\logo\brand.png")
menu_zombie = joinPath(r"images\menu\zombie.png")
menu_miner = joinPath(r"images\menu\miner.png")
mvz_logo = joinPath(r"images\menu\mvz_logo.png")
grass_day = joinPath(r"images\stage\grass_day.jpg")
grass_day_three = joinPath(r"images\stage\grass_day_three.jpg")
grass_day_two = joinPath(r"images\stage\grass_day_two.jpg")
grass_night = joinPath(r"images\stage\grass_night.jpg")
store_background = joinPath(r"images\stage\Store_Background.png")
top = joinPath(r"images\stage\top.png")
status_bar = joinPath(r"images\stage\statusbar.png")
miner_drop = joinPath(r"images\miner\drop")
miner_pull = joinPath(r"images\miner\pull")
miner_explode = joinPath(r"images\miner\explode")
hook_empty = joinPath(r"images\miner\hook_empty.png")
hook_catch_left = joinPath(r"images\miner\hook_catch_left.png")
hook_catch_right = joinPath(r"images\miner\hook_catch_right.png")
large_hook_empty = joinPath(r"images\miner\large_hook_empty.png")
large_hook_catch_left = joinPath(r"images\miner\large_hook_catch_left.png")
large_hook_catch_right = joinPath(r"images\miner\large_hook_catch_right.png")
hook_explode = joinPath(r"images\miner\explode.png")
portal1 = joinPath(r"images\stage\portal1.png")
portal2 = joinPath(r"images\stage\portal2.png")
zombieKeyFrame = joinPath(r"images\zombies\zombie")
coneKeyFrame = joinPath(r"images\zombies\cone")
bucketKeyFrame = joinPath(r"images\zombies\bucket")
zombieDoorKeyFrame = joinPath(r"images\zombies\zombie_door")
zombieDoorHandKeyFrame = joinPath(r"images\zombies\hand_door")
zombieDoorUmbrellaKeyFrame = joinPath(r"images\zombies\hand_umbrella")
doorKeyFrame = joinPath(r"images\zombies\door")
# bagKeyFrame = joinPath(r"images\zombies\bag")
# tntKeyFrame = joinPath(r"images\zombies\tnt")
zombiePaperKeyFrame = joinPath(r"images\zombies\zombie_paper")
paperKeyFrame = joinPath(r"images\zombies\paper")
# aliceKeyFrame = joinPath(r"images\zombies\paper_alice")
zombiePaperHandKeyFrame = joinPath(r"images\zombies\hand_paper")
zombiePolevaultKeyFrame1 = joinPath(r"images\zombies\zombie_polevault_1")
zombiePolevaultKeyFrame2 = joinPath(r"images\zombies\zombie_polevault_2")
zombieFootballKeyFrame = joinPath(r"images\zombies\zombie_football")
helmetKeyFrame = joinPath(r"images\zombies\helmet")
zombieGargantuarKeyFrame1 = joinPath(r"images\zombies\zombie_gargantuar_1")
zombieGargantuarKeyFrame2 = joinPath(r"images\zombies\zombie_gargantuar_2")
impKeyFrame = joinPath(r"images\zombies\imp")
gargantuarHelmetKeyFrame1 = joinPath(r"images\zombies\gargantuar_helmet_1")
gargantuarHelmetKeyFrame2 = joinPath(r"images\zombies\gargantuar_helmet_2")
zombieImpKeyFrame = joinPath(r"images\zombies\zombie_imp")
telephonepoleKeyFrame1 = joinPath(r"images\zombies\hand_telephonepole_1")
telephonepoleKeyFrame2 = joinPath(r"images\zombies\hand_telephonepole_2")
zombiezamboniKeyFrame = joinPath(r"images\zombies\zombie_zamboni")
zambonitntKeyFrame = joinPath(r"images\zombies\zamboni_tnt")
tombKeyFrame = joinPath(r"images\zombies\tomb")
dirtKeyFrames = joinPath(r"images\particles\dirt")
peashooterKeyFrame = joinPath(r"images\plants\peashooter")
snowpeashooterKeyFrame = joinPath(r"images\plants\snowpeashooter")
multipeashooterKeyFrame = joinPath(r"images\plants\multipeashooter")
gatlingpeashooterKeyFrame = joinPath(r"images\plants\gatlingpeashooter")
peaKeyFrame = joinPath(r"images\particles\pea")
snowpeaKeyFrame = joinPath(r"images\particles\snowpea")
puffKeyFrame = joinPath(r"images\particles\puff")
smallshroomKeyFrame = joinPath(r"images\plants\smallshroom")
scaredyshroomKeyFrame = joinPath(r"images\plants\scaredyshroom")
largeshroomKeyFrame = joinPath(r"images\plants\largeshroom")
gloomshroomKeyFrame = joinPath(r"images\plants\gloomshroom")
nutKeyFrame = joinPath(r"images\plants\nut")
bowlingnutKeyFrame = joinPath(r"images\plants\bowlingnut")
tallnutKeyFrame = joinPath(r"images\plants\tallnut")
flamenutKeyFrame = joinPath(r"images\plants\flamenut")
chomperFrame = joinPath(r"images\plants\chomper")
zombieItems = joinPath(r"images\particles\zombieItems")
diamondItems = joinPath(r"images\particles\diamond")
explosionItems = joinPath(r"images\particles\explosion")
cabbagepultKeyFrame = joinPath(r"images\plants\cabbagepult")
cabbageKeyFrame = joinPath(r"images\particles\cabbage")
cornpultKeyFrame = joinPath(r"images\plants\cornpult")
butterKeyFrame = joinPath(r"images\particles\butter")
melonpultKeyFrame = joinPath(r"images\plants\melonpult")
melonKeyFrame = joinPath(r"images\particles\melon")
wintermelonpultFrame = joinPath(r"images\plants\wintermelonpult")
wintermelonKeyFrame = joinPath(r"images\particles\wintermelon")
sunflowerKeyFrame = joinPath(r"images\plants\sunflower")
twinsunflowerKeyFrame = joinPath(r"images\plants\twinsunflower")
cherryKeyFrame = joinPath(r"images\plants\cherry")
pumpkinKeyFrame = joinPath(r"images\plants\pumpkin")
iceshroomKeyFrame = joinPath(r"images\plants\iceshroom")
icetrapKeyFrame = joinPath(r"images\particles\icetrap\icetrap.png")
lawnmowerKeyFrame = joinPath(r"images\particles\lawnmower")
davidKeyFrame = joinPath(r"images\david")
bowlingnuthookFrame = joinPath(r"images\particles\bowlingnut\nut.png")
hammerFrames = joinPath(r"images\particles\hammer")
speechBubble = joinPath(r"images\store\Store_SpeechBubble.png")
goldensheildFrame = joinPath(r"images\store\goldensheild.png")
potionFrame = joinPath(r"images\store\potion.png")
laserFrame = joinPath(r"images\store\laser.png")
zombiebookFrame = joinPath(r"images\store\zombiebook.png")
lawnmowerFrame = joinPath(r"images\store\lawnmower.png")
detonatorFrame = joinPath(r"images\store\detonator.png")
largehookFrame = joinPath(r"images\store\largehook.png")
startReady = joinPath(r"images\stage\StartReady.png")
startSet = joinPath(r"images\stage\StartSet.png")
startPlant = joinPath(r"images\stage\StartPlant.png")
hugeWave = joinPath(r"images\stage\HugeWave.png")
finalWave = joinPath(r"images\stage\FinalWave.png")
shadow = joinPath(r"images\stage\shadow.png")
bgm_start = joinPath(r"sound\BGM\Grazy Dave.mp3")
bgm_prepare = joinPath(r"sound\BGM\Choose your seeds.mp3")
bgm_grass_day = joinPath(r"sound\BGM\Grasswalk.mp3")
bgm_grass_day_drum = joinPath(r"sound\BGM\Grasswalk_drum.mp3")
winmusic = joinPath(r"sound\BGM\winmusic.mp3")
minigame = joinPath(r"sound\BGM\minigame.mp3")
# ultimate_battle = joinPath(r"sound\BGM\output.mp3")
# ultimate_battle_pattern = joinPath(r"sound\BGM\pattern\UltimateBattle")
# graze_the_roof = joinPath(r"sound\BGM\Graze the Roof.mp3")
# graze_the_roof_pattern = joinPath(r"sound\BGM\pattern\Graze the Roof")
readySetPlant = joinPath(r"sound\sounds\readysetplant.mp3")
hugeWaveSound = joinPath(r"sound\sounds\hugewave.mp3")
finalWaveSound = joinPath(r"sound\sounds\finalwave.mp3")
lawnmowerSound = joinPath(r"sound\sounds\lawnmower.mp3")
losemusic = joinPath(r"sound\sounds\losemusic.mp3")
awooga = joinPath(r"sound\sounds\awooga.mp3")
throw1 = joinPath(r"sound\sounds\throw1.mp3")
throw2 = joinPath(r"sound\sounds\throw2.mp3")
throw_snow = joinPath(r"sound\sounds\throw_snow.mp3")
splat1 = joinPath(r"sound\sounds\splat1.mp3")
splat2 = joinPath(r"sound\sounds\splat2.mp3")
splat3 = joinPath(r"sound\sounds\splat3.mp3")
frozen = joinPath(r"sound\sounds\frozen.mp3")
# firepea = joinPath(r"sound\sounds\firepea.mp3")
# fire_splat1 = joinPath(r"sound\sounds\fire_splat1.mp3")
# fire_splat2 = joinPath(r"sound\sounds\fire_splat2.mp3")
# frozen = joinPath(r"sound\sounds\frozen.mp3")
shieldhit1 = joinPath(r"sound\sounds\shieldhit1.mp3")
shieldhit2 = joinPath(r"sound\sounds\shieldhit2.mp3")
boing = joinPath(r"sound\sounds\boing.mp3")
puff_sound = joinPath(r"sound\sounds\puff.mp3")
fume = joinPath(r"sound\sounds\fume.mp3")
big_chomp = joinPath(r"sound\sounds\bigchomp.mp3")
butter_sound = joinPath(r"sound\sounds\butter.mp3")
melonimpact1 = joinPath(r"sound\sounds\melonimpact1.mp3")
melonimpact2 = joinPath(r"sound\sounds\melonimpact2.mp3")
gulp = joinPath(r"sound\sounds\gulp.mp3")
chomp1 = joinPath(r"sound\sounds\chomp1.mp3")
chomp2 = joinPath(r"sound\sounds\chomp2.mp3")
chompSoft = joinPath(r"sound\sounds\chompsoft.mp3")
bowling = joinPath(r"sound\sounds\bowling.mp3")
bowlingimpact1 = joinPath(r"sound\sounds\bowlingimpact1.mp3")
bowlingimpact2 = joinPath(r"sound\sounds\bowlingimpact2.mp3")
limbs_pop = joinPath(r"sound\sounds\limbs_pop.mp3")
pause_sound = joinPath(r"sound\sounds\pause_sound.mp3")
buzzer_sound = joinPath(r"sound\sounds\buzzer.mp3")
seedlift = joinPath(r"sound\sounds\seedlift.mp3")
set_plant_sound = joinPath(r"sound\sounds\plant.mp3")
floop = joinPath(r"sound\sounds\floop.mp3")
danger = joinPath(r"sound\sounds\danger.mp3")
anger1 = joinPath(r"sound\sounds\anger1.mp3")
anger2 = joinPath(r"sound\sounds\anger2.mp3")
polevault = joinPath(r"sound\sounds\polevault.mp3")
bonk = joinPath(r"sound\sounds\bonk.mp3")
explosion_sound = joinPath(r"sound\sounds\explosion.mp3")
cherrybomb = joinPath(r"sound\sounds\cherrybomb.mp3")
lowgroan1 = joinPath(r"sound\sounds\lowgroan1.mp3")
lowgroan2 = joinPath(r"sound\sounds\lowgroan2.mp3")
impthrow1 = joinPath(r"sound\sounds\imp1.mp3")
impthrow2 = joinPath(r"sound\sounds\imp2.mp3")
gargantuar_thump = joinPath(r"sound\sounds\gargantuar_thump.mp3")
gargantuar_death = joinPath(r"sound\sounds\gargantuar_death.mp3")
points = joinPath(r"sound\sounds\points.mp3")
shovel = joinPath(r"sound\sounds\shovel.mp3")
dropCoin = joinPath(r"sound\sounds\moneyfalls.mp3")
pickCoin = joinPath(r"sound\sounds\coin.mp3")
dropDiamond = joinPath(r"sound\sounds\chime.mp3")
pickDiamond = joinPath(r"sound\sounds\diamond.mp3")
zamboni = joinPath(r"sound\sounds\zamboni.mp3")
swing = joinPath(r"sound\sounds\swing.mp3")
bonk = joinPath(r"sound\sounds\bonk.mp3")
add_money = joinPath(r"sound\sounds\add_money.mp3")
catch_diamond = joinPath(r"sound\sounds\catch_diamond.mp3")
catch_item = joinPath(r"sound\sounds\catch_item.mp3")
catch_stone = joinPath(r"sound\sounds\catch_stone.mp3")
drop_hook = joinPath(r"sound\sounds\slotmachine.mp3")
miner_boom = joinPath(r"sound\sounds\miner_boom.mp3")
pull_hook = joinPath(r"sound\sounds\pull_hook.mp3")
show_money = joinPath(r"sound\sounds\show_money.mp3")
buy_item = joinPath(r"sound\sounds\buy_item.mp3")
detonator = joinPath(r"sound\sounds\detonator.mp3")
minigame_cover_bowling1 = joinPath(r"images\minigame\bowling1.png")
minigame_cover_rhythmaster = joinPath(r"images\minigame\rhythmaster.png")
minigame_cover_kingdomrush1 = joinPath(r"images\minigame\kingdomrush1.png")
minigame_cover_kingdomrush2 = joinPath(r"images\minigame\kingdomrush2.png")
# KR
build_terrain = joinPath(r"images\stage\build_terrain.png")
build_terrain_night = joinPath(r"images\stage\build_terrain_night.png")
defense_flag = joinPath(r"images\stage\defense_flag.png")
archerKeyFrames = joinPath(r"images\towers\archer")
arrowKeyFrames = joinPath(r"images\particles\arrow")
forestTrapKeyFrames = joinPath(r"images\particles\foresttrap")
mageKeyFrames = joinPath(r"images\towers\mage")
mageboltKeyFrames = joinPath(r"images\particles\magebolt")
barrackKeyFrames = joinPath(r"images\towers\barrack")
artilleryKeyFrames = joinPath(r"images\towers\artillery")
bombKeyFrames = joinPath(r"images\particles\bomb")
fireballKeyFrames = joinPath(r"images\particles\fireball")
fireballPointer = joinPath(r"images\stage\fireball_pointer.png")
loose_life = joinPath(r"sound\kr_sounds\Sound_LooseLife.mp3")
tower_building = joinPath(r"sound\kr_sounds\Sound_TowerBuilding.mp3")
mouse_over_tower = joinPath(r"sound\kr_sounds\Sound_GUIMouseOverTowerIcon.mp3")
open_tower_menu = joinPath(r"sound\kr_sounds\Sound_GUIOpenTowerMenu.mp3")
archer_ready = joinPath(r"sound\kr_sounds\Archer_Ready.mp3")
archer_taunt1 = joinPath(r"sound\kr_sounds\Archer_Taunt1.mp3")
archer_taunt2 = joinPath(r"sound\kr_sounds\Archer_Taunt2.mp3")
arrow_release1 = joinPath(r"sound\kr_sounds\Sound_ArrowRelease1.mp3")
arrow_release2 = joinPath(r"sound\kr_sounds\Sound_ArrowRelease2.mp3")
ranger_ready = joinPath(r"sound\kr_sounds\Ranger_Ready.mp3")
ranger_taunt1 = joinPath(r"sound\kr_sounds\Ranger_Taunt1.mp3")
ranger_taunt2 = joinPath(r"sound\kr_sounds\Ranger_Taunt2.mp3")
ranger_forest = joinPath(r"sound\kr_sounds\Sound_Thorn.mp3")
mage_ready = joinPath(r"sound\kr_sounds\Mage_Ready.mp3")
mage_taunt1 = joinPath(r"sound\kr_sounds\Mage_Taunt1.mp3")
mage_taunt2 = joinPath(r"sound\kr_sounds\Mage_Taunt2.mp3")
mage_sorcerer = joinPath(r"sound\kr_sounds\Sound_Sorcerer.mp3")
arcane_ready = joinPath(r"sound\kr_sounds\Arcane_Ready.mp3")
arcane_taunt1 = joinPath(r"sound\kr_sounds\Arcane_Taunt2.mp3")
arcane_taunt2 = joinPath(r"sound\kr_sounds\Arcane_Taunt1.mp3")
arcane_ray = joinPath(r"sound\kr_sounds\Sound_RayArcane.mp3")
death_ray = joinPath(r"sound\kr_sounds\Sound_ArcaneDesintegrate.mp3")
teleport = joinPath(r"sound\kr_sounds\Sound_Teleport.mp3")
barrack_move = joinPath(r"sound\kr_sounds\Barrack_Move.mp3")
barrack_ready = joinPath(r"sound\kr_sounds\Barrack_Ready.mp3")
barrack_taunt1 = joinPath(r"sound\kr_sounds\Barrack_Taunt1.mp3")
barrack_taunt2 = joinPath(r"sound\kr_sounds\Barrack_Taunt2.mp3")
rally_point_placed = joinPath(r"sound\kr_sounds\Sound_RallyPointPlaced.mp3")
tower_open_door = joinPath(r"sound\kr_sounds\Sound_TowerOpenDoor.mp3")
soldier_fighting1 = joinPath(r"sound\kr_sounds\Sound_SoldiersFighting-01.mp3")
soldier_fighting2 = joinPath(r"sound\kr_sounds\Sound_SoldiersFighting-02.mp3")
soldier_fighting3 = joinPath(r"sound\kr_sounds\Sound_SoldiersFighting-03.mp3")
soldier_fighting4 = joinPath(r"sound\kr_sounds\Sound_SoldiersFighting-04.mp3")
soldier_fighting5 = joinPath(r"sound\kr_sounds\Sound_SoldiersFighting-05.mp3")
paladin_move = joinPath(r"sound\kr_sounds\Paladin_Move.mp3")
paladin_ready = joinPath(r"sound\kr_sounds\Paladin_Ready.mp3")
paladin_taunt1 = joinPath(r"sound\kr_sounds\Paladin_Taunt1.mp3")
paladin_taunt2 = joinPath(r"sound\kr_sounds\Paladin_Taunt2.mp3")
paladin_heal = joinPath(r"sound\kr_sounds\Sound_PaladinHeal.mp3")
artillery_ready = joinPath(r"sound\kr_sounds\Artillery_Ready.mp3")
artillery_taunt1 = joinPath(r"sound\kr_sounds\Archer_Taunt1.mp3")
artillery_taunt2 = joinPath(r"sound\kr_sounds\Archer_Taunt2.mp3")
artillery_shoot = joinPath(r"sound\kr_sounds\Sound_EngineerShot.mp3")
bomb1 = joinPath(r"sound\kr_sounds\Sound_Bomb1.mp3")
bfg_ready = joinPath(r"sound\kr_sounds\BFG_Ready.mp3")
bfg_taunt1 = joinPath(r"sound\kr_sounds\BFG_Taunt1.mp3")
bfg_taunt2 = joinPath(r"sound\kr_sounds\BFG_Taunt2.mp3")
rocketLauncher = joinPath(r"sound\kr_sounds\Sound_RocketLaunt.mp3")
fireballHit = joinPath(r"sound\kr_sounds\Sound_FireballHit.mp3")
fireballUnleash = joinPath(r"sound\kr_sounds\Sound_FireballUnleash.mp3")
battle_prepare_forest = joinPath(r"sound\kr_BGM\MusicBattlePreparationsForest.mp3")
battle_forest = joinPath(r"sound\kr_BGM\MusicBattleUnderAttackForest.mp3")
battle_boss = joinPath(r"sound\kr_BGM\MusicBossFight.mp3")
battle_wasteland = joinPath(r"sound\kr_BGM\MusicBattleUnderAttackWastelands.mp3")
battle_prepare_wasteland = joinPath(r"sound\kr_BGM\MusicBattlePreparationsWastelands.mp3")
battle_veznan = joinPath(r"sound\kr_BGM\KingdomRushWastelandVeznanCastle.mp3")
kingdomRushIcon = joinPath(r"images\stage\kingdom_rush.png")
skillIcons = joinPath(r"images\towers\skills")
soldierFlagIcon = joinPath(r"images\stage\soldier_flag.png")
soldierFlagCursor = joinPath(r"images\stage\soldier_flag_cursor.png")
error_feedback = joinPath(r"images\particles\error_feedback")
rally_feedback = joinPath(r"images\particles\rally_feedback")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化