本文整理汇总了Python中fofix.core.Log.warn方法的典型用法代码示例。如果您正苦于以下问题:Python Log.warn方法的具体用法?Python Log.warn怎么用?Python Log.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fofix.core.Log
的用法示例。
在下文中一共展示了Log.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getAvailableMods
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def getAvailableMods(engine):
modPath = _getModPath(engine)
try:
dirList = os.listdir(modPath)
except OSError:
Log.warn("Could not find mods directory")
return []
return [m for m in dirList if os.path.isdir(os.path.join(modPath, m)) and not m.startswith(".")]
示例2: multisampleReset
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def multisampleReset(self, resolution):
Log.warn("Video setup failed. Trying without antialiasing.")
pygame.display.gl_set_attribute(pygame.GL_MULTISAMPLEBUFFERS, 0)
pygame.display.gl_set_attribute(pygame.GL_MULTISAMPLESAMPLES, 0)
self.multisamples = 0
try:
self.screen = pygame.display.set_mode(resolution, self.flags)
except Exception, e:
if "video mode" in str(e):
self.resolutionReset()
else:
self.screenError()
示例3: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def __init__(self, guitarScene, configFileName):
self.scene = guitarScene
self.engine = guitarScene.engine
self.config = LinedConfigParser()
self.backgroundLayers = []
self.foregroundLayers = []
self.textures = {}
self.reset()
self.wFull = None #MFH - needed for new stage background handling
self.hFull = None
# evilynux - imported myfingershurt stuff from GuitarScene
self.mode = self.engine.config.get("game", "stage_mode")
self.songStage = self.engine.config.get("game", "song_stage")
self.animatedFolder = self.engine.config.get("game", "animated_stage_folder")
# evilynux - imported myfingershurt stuff from GuitarScene w/ minor modifs
#MFH TODO - alter logic to accommodate separated animation and slideshow
# settings based on selected animated stage folder
animationMode = self.engine.config.get("game", "stage_animate")
slideShowMode = self.engine.config.get("game", "rotate_stages")
if self.animatedFolder == _("None"):
self.rotationMode = 0 #MFH: if no animated stage folders are available, disable rotation.
elif self.animatedFolder == "Normal":
self.rotationMode = slideShowMode
else:
self.rotationMode = animationMode
self.imgArr = [] #QQstarS:random
self.imgArrScaleFactors = [] #MFH - for precalculated scale factors
self.rotateDelay = self.engine.config.get("game", "stage_rotate_delay") #myfingershurt - user defined stage rotate delay
self.animateDelay = self.engine.config.get("game", "stage_animate_delay") #myfingershurt - user defined stage rotate delay
self.animation = False
self.indexCount = 0 #QQstarS:random time counter
self.arrNum = 0 #QQstarS:random the array num
self.arrDir = 1 #forwards
self.config.read(configFileName)
# evilynux - Improved stage error handling
self.themename = self.engine.data.themeLabel
self.path = os.path.join("themes",self.themename,"backgrounds")
self.pathfull = self.engine.getPath(self.path)
if not os.path.exists(self.pathfull): # evilynux
Log.warn("Stage folder does not exist: %s" % self.pathfull)
self.mode = 1 # Fallback to song-specific stage
self.loadLayers(configFileName)
示例4: init_oneshot
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def init_oneshot(self):
""" Determine if oneshot mode is valid. """
# I think this code can be moved elsewhere...
self.engine.cmdPlay = 0
# Check for a valid invocation of one-shot mode.
if self.playing is not None:
Log.debug("Validating song directory for one-shot mode.")
library = Config.get("setlist", "base_library")
basefolder = os.path.join(Version.dataPath(), library, "songs", self.playing)
if not os.path.exists(os.path.join(basefolder, "song.ini")):
if not (
os.path.exists(os.path.join(basefolder, "notes.mid"))
or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))
):
if not (
os.path.exists(os.path.join(basefolder, "song.ogg"))
or os.path.exists(os.path.join(basefolder, "guitar.ogg"))
):
Log.warn(
"Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode."
% self.playing
)
self.engine.startupMessages.append(
_(
"Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode."
)
% self.playing
)
return
# Set up one-shot mode
Log.debug("Entering one-shot mode.")
Config.set("setlist", "selected_song", playing)
self.engine.cmdPlay = 1
if diff is not None:
self.engine.cmdDiff = int(diff)
if part is not None:
self.engine.cmdPart = int(part)
if players == 1:
self.engine.cmdMode = players, mode, 0
else:
self.engine.cmdMode = players, 0, mode
示例5: resolutionReset
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def resolutionReset(self):
Log.warn("Video setup failed. Trying default windowed resolution.")
self.error.append(_("Video setup failed with your resolution settings, and so were reset to defaults."))
if self.fullscreen:
self.flags ^= pygame.FULLSCREEN
self.fullscreen = False
try:
self.screen = pygame.display.set_mode((800,600), self.flags)
self.default = True
except Exception:
if self.multisamples:
self.multisampleReset((800, 600))
else:
self.screenError()
示例6: open
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def open(self, frequency = 22050, bits = 16, stereo = True, bufferSize = 1024):
try:
pygame.mixer.quit()
except:
pass
try:
pygame.mixer.init(frequency, -bits, stereo and 2 or 1, bufferSize)
except:
Log.warn("Audio setup failed. Trying with default configuration.")
pygame.mixer.init()
Log.debug("Audio configuration: %s" % str(pygame.mixer.get_init()))
#myfingershurt: ensuring we have enough audio channels!
pygame.mixer.set_num_channels(10)
return True
示例7: loadImage
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def loadImage(self, image):
"""Load the texture from a PIL image"""
image = image.transpose(Image.FLIP_TOP_BOTTOM)
if image.mode == "RGBA":
string = image.tostring('raw', 'RGBA', 0, -1)
self.loadRaw(image.size, string, GL_RGBA, 4)
elif image.mode == "RGB":
string = image.tostring('raw', 'RGB', 0, -1)
self.loadRaw(image.size, string, GL_RGB, 3)
elif image.mode == "L":
string = image.tostring('raw', 'L', 0, -1)
self.loadRaw(image.size, string, GL_LUMINANCE, 1)
else:
try:
image = image.convert('RGB')
Log.warn("Unsupported image mode '%s' converted to 'RGB'. May have unexpected results." % image.mode)
string = image.tostring('raw', 'RGB', 0, -1)
self.loadRaw(image.size, string, GL_RGB, 3)
except:
raise TextureException("Unsupported image mode '%s'" % image.mode)
示例8: loadVideo
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def loadVideo(self, libraryName, songName):
vidSource = None
if self.songStage == 1:
songBackgroundVideoPath = os.path.join(libraryName, songName, "background.ogv")
if os.path.isfile(songBackgroundVideoPath):
vidSource = songBackgroundVideoPath
loop = False
else:
Log.warn("Video not found: %s" % songBackgroundVideoPath)
if vidSource is None:
vidSource = os.path.join(self.pathfull, "default.ogv")
loop = True
if not os.path.isfile(vidSource):
Log.warn("Video not found: %s" % vidSource)
Log.warn("Falling back to default stage mode.")
self.mode = 1 # Fallback
return
try: # Catches invalid video files or unsupported formats
Log.debug("Attempting to load video: %s" % vidSource)
self.vidPlayer = VideoLayer(self.engine, vidSource,
mute = True, loop = loop)
self.engine.view.pushLayer(self.vidPlayer)
except (IOError, VideoPlayerError):
self.mode = 1
Log.error("Failed to load song video (falling back to default stage mode):")
示例9: getImgDrawing
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def getImgDrawing(self, fileName, openImage=True):
imgDrawing = None
for dataPath in self.resource.dataPaths:
fileName1 = os.path.join(dataPath, fileName)
if self.logLoadings == 1:
if openImage:
Log.notice("Trying to load image: %s" % fileName1)
else:
Log.notice("Checking image: %s" % fileName1)
#check if fileName1 exists (has extension)
if os.path.exists(fileName1):
if openImage == True:
try:
imgDrawing = ImgDrawing(self.svg, fileName1)
return imgDrawing
except IOError:
Log.warn("Unable to load image file: %s" % fileName1)
except OverflowError:
Log.warn("Unable to read image file: %s" % fileName1)
else:
return True
else:
#find extension
fileName1 = os.path.splitext(fileName1)[0]
files = glob.glob('%s.*' % fileName1)
if openImage == True:
for i in range(len(files)):
try:
imgDrawing = ImgDrawing(self.svg, files[i])
return imgDrawing
except IOError:
Log.warn("Unable to load image file: %s" % files[i])
elif len(files) > 0:
return True
#image not found
if self.logImageNotFound:
Log.debug("Image not found: %s" % fileName)
return False
示例10: set
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def set(self, dir):
"""Do all shader setup.
dir = directory to load shaders from
"""
#stump: check whether all needed extensions are actually supported
if not glInitShaderObjectsARB():
Log.warn('OpenGL extension ARB_shader_objects not supported - shaders disabled')
return
if not glInitVertexShaderARB():
Log.warn('OpenGL extension ARB_vertex_shader not supported - shaders disabled')
return
if not glInitFragmentShaderARB():
Log.warn('OpenGL extension ARB_fragment_shader not supported - shaders disabled')
return
if not glInitMultitextureARB():
Log.warn('OpenGL extension ARB_multitexture not supported - shaders disabled')
return
if not glInitTexture3DEXT():
if sys.platform != 'darwin':
Log.warn('OpenGL extension EXT_texture3D not supported - shaders disabled')
return
self.workdir = dir
# Load textures needed by the shaders.
try:
self.noise3D = self.loadTex3D("noise3d.dds")
self.outline = self.loadTex2D("outline.tga")
except:
Log.error('Could not load shader textures - shaders disabled: ')
return
self.multiTex = (GL_TEXTURE0_ARB,GL_TEXTURE1_ARB,GL_TEXTURE2_ARB,GL_TEXTURE3_ARB)
self.enabled = True
self.turnon = True
# Compile the shader objects that we are going to use.
# Also set uniform shader variables to default values.
try:
self.make("lightning","stage")
except:
Log.error("Error compiling lightning shader: ")
else:
self.enable("stage")
self.setVar("ambientGlowHeightScale",6.0)
self.setVar("color",(0.0,0.0,0.0,0.0))
self.setVar("glowFallOff",0.024)
self.setVar("height",0.44)
self.setVar("sampleDist",0.0076)
self.setVar("speed",1.86)
self.setVar("vertNoise",0.78)
self.setVar("fading",1.0)
self.setVar("solofx",False)
self.setVar("scalexy",(5.0,2.4))
self.setVar("fixalpha",True)
self.setVar("offset",(0.0,-2.5))
self.disable()
try:
self.make("lightning","sololight")
except:
Log.error("Error compiling lightning shader: ")
else:
self.enable("sololight")
self.setVar("scalexy",(5.0,1.0))
self.setVar("ambientGlow",0.5)
self.setVar("ambientGlowHeightScale",6.0)
self.setVar("solofx",True)
self.setVar("height",0.3)
self.setVar("glowFallOff",0.024)
self.setVar("sampleDist",0.0076)
self.setVar("fading",4.0)
self.setVar("speed",1.86)
self.setVar("vertNoise",0.78)
self.setVar("solofx",True)
self.setVar("color",(0.0,0.0,0.0,0.0))
self.setVar("fixalpha",True)
self.setVar("glowStrength",100.0)
self.disable()
try:
self.make("lightning","tail")
except:
Log.error("Error compiling lightning shader: ")
else:
self.enable("tail")
self.setVar("scalexy",(5.0,1.0))
self.setVar("ambientGlow",0.1)
self.setVar("ambientGlowHeightScale",6.0)
self.setVar("solofx",True)
self.setVar("fading",4.0)
self.setVar("height",0.0)
self.setVar("glowFallOff",0.024)
self.setVar("sampleDist",0.0076)
self.setVar("speed",1.86)
self.setVar("vertNoise",0.78)
self.setVar("solofx",True)
self.setVar("color",(0.3,0.7,0.9,0.6))
self.setVar("glowStrength",70.0)
#.........这里部分代码省略.........
示例11: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def __init__(self, engine, choices, name = None, onClose = None, onCancel = None, pos = (.2, .31), viewSize = 6, fadeScreen = False, font = "font", mainMenu = None, textColor = None, selectedColor = None, append_submenu_char = True, selectedIndex = None, showTips = True, selectedBox = False):
self.engine = engine
self.logClassInits = self.engine.config.get("game", "log_class_inits")
if self.logClassInits == 1:
Log.debug("Menu class init (Menu.py)...")
#Get theme
self.themename = self.engine.data.themeLabel
self.theme = self.engine.data.theme
self.choices = []
self.currentIndex = 0
#MFH
if selectedIndex:
self.currentIndex = selectedIndex
self.time = 0
self.onClose = onClose
self.onCancel = onCancel
self.viewOffset = 0
self.name = name # akedrou - for graphical support
self.mainMenu = False
self.graphicMenu = False
self.useSelectedBox = selectedBox
self.useGraphics = self.engine.config.get("game", "use_graphical_submenu")
self.gfxText = None
self.scrolling = 0
self.delay = 0
self.rate = 0
self.scroller = [0, self.scrollUp, self.scrollDown, self.scrollLeft, self.scrollRight]
self.textColor = textColor
self.selectedColor = selectedColor
self.tipColor = self.engine.theme.menuTipTextColor
self.drumNav = self.engine.config.get("game", "drum_navigation") #MFH
if self.name and self.useGraphics > 0:
try:
if self.engine.loadImgDrawing(self, "menuBackground", os.path.join("themes",self.themename,"menu","%s.png" % self.name)):
if self.menuBackground.height1() == 1:
raise KeyError
else:
raise KeyError
self.gfxText = "%stext%d" % (self.name, len(choices))
if not self.engine.loadImgDrawing(self, "menuText", os.path.join("themes",self.themename,"menu","%s.png" % self.gfxText)):
raise KeyError
self.graphicMenu = True
self.menux = self.engine.theme.submenuX[self.gfxText]
self.menuy = self.engine.theme.submenuY[self.gfxText]
self.menuScale = self.engine.theme.submenuScale[self.gfxText]
self.vSpace = self.engine.theme.submenuVSpace[self.gfxText]
if str(self.menux) != "None" and str(self.menuy) != "None":
self.menux = float(self.menux)
self.menuy = float(self.menuy)
else:
self.menux = .4
self.menuy = .4
if str(self.menuScale) != "None":
self.menuScale = float(self.menuScale)
else:
self.menuScale = .5
if str(self.vSpace) != "None":
self.vSpace = float(self.vSpace)
else:
self.vSpace = .08
Log.debug("Graphic menu enabled for submenu: %s" % self.name)
except KeyError:
Log.warn("Your theme does not appear to properly support the %s graphical submenu. Check to be sure you have the latest version of your theme." % self.name)
self.menuBackground = None
self.menuText = None
if pos == (.2, .66 - .35): #MFH - default position, not called with a special one - this is a submenu:
self.sub_menu_x = self.engine.theme.sub_menu_xVar
self.sub_menu_y = self.engine.theme.sub_menu_yVar
if engine.data.theme == 0:
if self.sub_menu_x is None:
self.sub_menu_x = .44
if self.sub_menu_y is None:
self.sub_menu_y = .14
elif engine.data.theme == 1:
if self.sub_menu_x is None:
self.sub_menu_x = .38
if self.sub_menu_y is None:
self.sub_menu_y = .15
elif engine.data.theme == 2:
if self.sub_menu_x is None:
self.sub_menu_x = .25
if self.sub_menu_y is None:
self.sub_menu_y = .14
pos = (self.sub_menu_x, self.sub_menu_y)
if viewSize == 6: #MFH - default viewsize
if self.theme in [0, 1, 2]:#8bit
viewSize = 10
#.........这里部分代码省略.........
示例12: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
#.........这里部分代码省略.........
# load all the data in parallel
# asciiOnly = not bool(Language.language) or Language.language == "Custom"
# reversed = _("__lefttoright__") == "__righttoleft__" and True or False
asciiOnly = True
reversed = False
scale = 1
# evilynux - Load bigger fonts so they're nicer when scaled, scaling readjusted
fontSize = [44, 132, 34, 32, 30]
w, h = [int(s) for s in Config.get("video", "resolution").split("x")]
aspectRatio = float(w)/float(h)
self.fontList = [
["font1","font","default.ttf",fontSize[4]],
["font2","bigFont","title.ttf",fontSize[1]],
["font3","pauseFont","pause.ttf",fontSize[2]],
["font4","scoreFont","score.ttf",fontSize[3]],
["font5","streakFont","streak.ttf",fontSize[3]],
["font6","loadingFont","loading.ttf",fontSize[3]],
["font7","songFont","song.ttf",fontSize[4]],
["font8","songListFont","songlist.ttf",fontSize[3]],
["font9","shadowFont","songlist.ttf",fontSize[3]],
["font10","streakFont2","streakphrase.ttf",fontSize[2]]
]
for f in self.fontList:
if self.fileExists(os.path.join("themes",themename,"fonts",f[2])):
fn = resource.fileName(os.path.join("themes",themename,"fonts",f[2]))
f[0] = lambda: Font(fn, f[3], scale = scale*.5, reversed = reversed, systemFont = not asciiOnly, outline = False, aspectRatio = aspectRatio)
resource.load(self,f[1],f[0], synch = True)
elif self.fileExists(os.path.join("themes",themename,"fonts","default.ttf")):
Log.debug("Theme font not found: " + f[2])
fn = resource.fileName(os.path.join("themes",themename,"fonts","default.ttf"))
f[0] = lambda: Font(fn, f[3], scale = scale*.5, reversed = reversed, systemFont = not asciiOnly, outline = False, aspectRatio = aspectRatio)
resource.load(self,f[1],f[0], synch = True)
else:
Log.debug("Default theme font not found: %s - using built-in default" % str(f[2]))
fn = resource.fileName(os.path.join("fonts","default.ttf"))
f[0] = lambda: Font(fn, f[3], scale = scale*.5, reversed = reversed, systemFont = not asciiOnly, outline = False, aspectRatio = aspectRatio)
resource.load(self,f[1],f[0], synch = True)
self.fontDict = {"font": self.font, "bigFont": self.bigFont, "pauseFont": self.pauseFont, "scoreFont": self.scoreFont, \
"streakFont": self.streakFont, "songFont": self.songFont, "streakFont2": self.streakFont2, \
"songListFont": self.songListFont, "shadowFont": self.shadowFont, "loadingFont": self.loadingFont}
assert self.fontDict['font'] == self.font
# load sounds asynchronously
resource.load(self, "screwUpsounds", self.loadScrewUpsounds)
resource.load(self, "screwUpsoundsBass", self.loadScrewUpsoundsBass)
resource.load(self, "screwUpsoundsDrums", self.loadScrewUpsoundsDrums)
resource.load(self, "acceptSounds", self.loadAcceptSounds)
resource.load(self, "cancelSounds", self.loadBackSounds)
# loadSoundEffect asynchronously
self.syncSounds = [
["bassDrumSound","bassdrum.ogg"],
["battleUsedSound","battleused.ogg"],
["CDrumSound","crash.ogg"],
["clapSound","clapsound.ogg"],
["coOpFailSound","coopfail.ogg"],
#["crowdSound","crowdcheers.ogg"],
["failSound","failsound.ogg"],
["rescueSound","rescue.ogg"],
["rockSound","rocksound.ogg"],
["selectSound1","select1.ogg"],
["selectSound2","select2.ogg"],
["selectSound3","select3.ogg"],
["starActivateSound","staractivate.ogg"],
["starDeActivateSound","stardeactivate.ogg"],
["starDingSound","starding.ogg"],
["starLostSound","starlost.ogg"],
["starReadySound","starpowerready.ogg"],
["starSound","starpower.ogg"],
["startSound","start.ogg"],
["T1DrumSound","tom01.ogg"],
["T2DrumSound","tom02.ogg"],
["T3DrumSound","tom03.ogg"]
]
for self.sounds in self.syncSounds:
if self.fileExists(os.path.join("themes",themename,"sounds",self.sounds[1])):
self.loadSoundEffect(self, self.sounds[0], os.path.join("themes",themename,"sounds",self.sounds[1]))
elif self.fileExists(os.path.join("sounds", self.sounds[1])):
Log.debug("Theme sound not found: " + self.sounds[1])
self.loadSoundEffect(self, self.sounds[0], os.path.join("sounds",self.sounds[1]))
else:
Log.warn("File " + self.sounds[1] + " not found using default instead.")
self.loadSoundEffect(self, self.sounds[0], os.path.join("sounds","default.ogg"))
#TODO: Simplify crowdSound stuff so it can join the rest of us.
#MFH - fallback on sounds/crowdcheers.ogg, and then starpower.ogg. Note if the fallback crowdcheers was used or not.
if self.fileExists(os.path.join("themes",themename,"sounds","crowdcheers.ogg")):
self.loadSoundEffect(self, "crowdSound", os.path.join("themes",themename,"sounds","crowdcheers.ogg"), crowd = True)
self.cheerSoundFound = 2
elif self.fileExists(os.path.join("sounds","crowdcheers.ogg")):
self.loadSoundEffect(self, "crowdSound", os.path.join("sounds","crowdcheers.ogg"), crowd = True)
self.cheerSoundFound = 1
Log.warn(themename + "/sounds/crowdcheers.ogg not found -- using data/sounds/crowdcheers.ogg instead.")
else:
self.cheerSoundFound = 0
Log.warn("crowdcheers.ogg not found -- no crowd cheering.")
示例13: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def __init__(self, engine):
self.engine = engine
self.logClassInits = Config.get("game", "log_class_inits")
if self.logClassInits == 1:
Log.debug("MainMenu class init (MainMenu.py)...")
self.time = 0.0
self.nextLayer = None
self.visibility = 0.0
self.active = False
self.showStartupMessages = False
self.gfxVersionTag = Config.get("game", "gfx_version_tag")
self.chosenNeck = Config.get("game", "default_neck")
exists = 0
if engine.loadImgDrawing(self, "ok", os.path.join("necks",self.chosenNeck+".png")):
exists = 1
elif engine.loadImgDrawing(self, "ok", os.path.join("necks","Neck_"+self.chosenNeck+".png")):
exists = 1
#MFH - fallback logic now supports a couple valid default neck filenames
#MFH - check for Neck_1
if exists == 0:
if engine.loadImgDrawing(self, "ok", os.path.join("necks","Neck_1.png")):
Config.set("game", "default_neck", "1")
Log.warn("Default chosen neck not valid; fallback Neck_1.png forced.")
exists = 1
#MFH - check for defaultneck
if exists == 0:
if engine.loadImgDrawing(self, "ok", os.path.join("necks","defaultneck.png")):
Log.warn("Default chosen neck not valid; fallback defaultneck.png forced.")
Config.set("game", "default_neck", "defaultneck")
exists = 1
else:
Log.error("Default chosen neck not valid; fallbacks Neck_1.png and defaultneck.png also not valid!")
#Get theme
self.theme = self.engine.data.theme
self.themeCoOp = self.engine.data.themeCoOp
self.themename = self.engine.data.themeLabel
self.useSoloMenu = self.engine.theme.use_solo_submenu
allowMic = True
self.menux = self.engine.theme.menuPos[0]
self.menuy = self.engine.theme.menuPos[1]
self.rbmenu = self.engine.theme.menuRB
#MFH
self.main_menu_scale = self.engine.theme.main_menu_scaleVar
self.main_menu_vspacing = self.engine.theme.main_menu_vspacingVar
if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"menu","mainbg.png")):
self.background = None
self.engine.loadImgDrawing(self, "BGText", os.path.join("themes",self.themename,"menu","maintext.png"))
self.engine.loadImgDrawing(self, "optionsBG", os.path.join("themes",self.themename,"menu","optionsbg.png"))
self.engine.loadImgDrawing(self, "optionsPanel", os.path.join("themes",self.themename,"menu","optionspanel.png"))
#racer: added version tag
if self.gfxVersionTag or self.engine.theme.versiontag:
if not self.engine.loadImgDrawing(self, "version", os.path.join("themes",self.themename,"menu","versiontag.png")):
if not self.engine.loadImgDrawing(self, "version", "versiontag.png"): #falls back on default versiontag.png in data\ folder
self.version = None
else:
self.version = None
#myfingershurt: random main menu music function, menu.ogg and menuXX.ogg (any filename with "menu" as the first 4 letters)
self.files = None
filepath = self.engine.getPath(os.path.join("themes",self.themename,"sounds"))
if os.path.isdir(filepath):
self.files = []
allfiles = os.listdir(filepath)
for name in allfiles:
if os.path.splitext(name)[1] == ".ogg":
if string.find(name,"menu") > -1:
self.files.append(name)
if self.files:
i = random.randint(0,len(self.files)-1)
filename = self.files[i]
sound = os.path.join("themes",self.themename,"sounds",filename)
self.menumusic = True
engine.menuMusic = True
self.song = Audio.Music(self.engine.resource.fileName(sound))
self.song.setVolume(self.engine.config.get("audio", "menu_volume"))
self.song.play(0) #no loop
else:
self.menumusic = False
self.opt_text_color = self.engine.theme.opt_text_colorVar
self.opt_selected_color = self.engine.theme.opt_selected_colorVar
#.........这里部分代码省略.........
示例14: load
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def load(self, libraryName, songName, practiceMode = False):
if self.scene.coOpType:
rm = os.path.join("themes", self.themename, "rockmeter_coop.ini")
elif self.scene.battle or self.scene.battleGH:
rm = os.path.join("themes", self.themename, "rockmeter_profaceoff.ini")
elif self.scene.gamePlayers > 1:
rm = os.path.join("themes", self.themename, "rockmeter_faceoff.ini")
else:
rm = os.path.join("themes", self.themename, "rockmeter.ini")
if os.path.exists(os.path.join("..", "data", rm)):
rockmeter = self.engine.resource.fileName(rm)
else:
rockmeter = self.engine.resource.fileName(os.path.join("themes", self.themename, "rockmeter.ini"))
self.rockmeter = Rockmeter.Rockmeter(self.scene, rockmeter, self.scene.coOpType)
# evilynux - Fixes a self.background not defined crash
self.background = None
#MFH - new background stage logic:
if self.mode == 2: #blank / no stage
self.songStage = 0
self.rotationMode = 0
elif practiceMode: #check for existing practice stage; always disable stage rotation here
self.songStage = 0
self.rotationMode = 0
self.mode = 1
#separated practice stages for the instruments by k.i.d
if self.scene.instruments[0].isDrum:
background = "practicedrum"
elif self.scene.instruments[0].isBassGuitar:
background = "practicebass"
else:
background = "practice"
if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"backgrounds",background)):
#MFH - must first fall back on the old practice.png before forcing blank stage mode!
if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"backgrounds","practice")):
Log.warn("No practice stage, falling back on a forced Blank stage mode") # evilynux
self.mode = 2 #if no practice stage, just fall back on a forced Blank stage mode
elif self.songStage == 1: #check for song-specific background
test = True
if not self.engine.loadImgDrawing(self, "background", os.path.join(libraryName, songName, "background")):
Log.notice("No song-specific stage found") # evilynux
test = False
if test: #does a song-specific background exist?
self.rotationMode = 0
self.mode = 1
else:
self.songStage = 0
#MFH - now, after the above logic, we can run the normal stage mode logic
# only worrying about checking for Blank, song-specific and
# practice stage modes
if self.mode != 2 and self.mode != 3 and self.songStage == 0 and not practiceMode: #still need to load stage(s)
#myfingershurt: assign this first
if self.mode == 1: #just use Default.png
if not self.engine.loadImgDrawing(self, "background", os.path.join(self.path, "default")):
Log.warn("No default stage; falling back on a forced Blank stage mode") # evilynux
self.mode = 2 #if no practice stage, just fall back on a forced Blank stage mode
##This checks how many Stage-background we have to select from
if self.mode == 0 and self.rotationMode == 0: #MFH: just display a random stage
files = []
fileIndex = 0
allfiles = os.listdir(self.pathfull)
for name in allfiles:
if os.path.splitext(name)[0].lower() != "practice" and os.path.splitext(name)[0].lower() != "practicedrum" and os.path.splitext(name)[0].lower() != "practicebass" and name != ".svn":
Log.debug("Valid background found, index (" + str(fileIndex) + "): " + name)
files.append(name)
fileIndex += 1
else:
Log.debug("Practice background filtered: " + name)
# evilynux - improved error handling, fallback to blank background if no background are found
if fileIndex == 0:
Log.warn("No valid stage found!")
self.mode = 2;
else:
i = random.randint(0,len(files)-1)
filename = files[i]
##End check number of Stage-backgrounds
if not self.engine.loadImgDrawing(self, "background", os.path.join(self.path, filename)):
self.mode = 2;
elif self.rotationMode > 0 and self.mode != 2:
files = []
fileIndex = 0
if self.animatedFolder == "Random": #Select one of the subfolders under stages\ to animate randomly
numAniStageFolders = len(self.engine.stageFolders)
if numAniStageFolders > 0:
self.animatedFolder = random.choice(self.engine.stageFolders)
else:
self.animatedFolder = "Normal"
elif self.animatedFolder == "None":
self.mode = 2
if self.animatedFolder != "Normal" and self.mode != 2: #just use the base Stages folder for rotation
#.........这里部分代码省略.........
示例15: checkControls
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import warn [as 别名]
def checkControls(self):
if self.controls.isKeyMappingOK() is False:
Log.warn("Conflicting player controls, resetting to defaults")
self.controls.restoreDefaultKeyMappings()
self.reloadControls()