本文整理汇总了Python中Resources.getOptionValue方法的典型用法代码示例。如果您正苦于以下问题:Python Resources.getOptionValue方法的具体用法?Python Resources.getOptionValue怎么用?Python Resources.getOptionValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources.getOptionValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self):
screenWidth = 1000
screenHeight = 600
pygame.init()
if(Resources.getOptionValue("fullscreen") == 1):
pygame.display.set_mode((screenWidth, screenHeight), FULLSCREEN)
else:
pygame.display.set_mode((screenWidth, screenHeight))
pygame.display.set_caption("Bump'N'Jump")
pygame.mixer.music.load("resources/sound/music.wav")
pygame.mixer.music.set_volume(float(Resources.getOptionValue("music"))/100)
pygame.mixer.music.play(-1)
currentScene = MainMenu()
clock = pygame.time.Clock()
game = True
while game:
game, currentScene = currentScene.update()
clock.tick(60)
示例2: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, level):
self.screen = pygame.display.get_surface()
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill((50, 50, 50))
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.level = level
self.buttons = {}
pos = 25
for f in glob.glob("save/maps/*.mabbit"):
name = f.split("\\")[-1].split(".")[0]
if(name != "last"):
self.buttons[name] = Button(self.screen.get_width()/2 - 200/2, pos, 200, 40, name.upper())
pos +=100
self.buttons["new"] = Button(self.screen.get_width()/2 - 200/2, pos, 200, 40, "NEW")
self.buttons["back"] = Button(self.screen.get_width()/2 - 200/2, pos + 100, 200, 40, "BACK")
pygame.display.flip()
示例3: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self):
self.screen = pygame.display.get_surface()
if pygame.font:
self.font = pygame.font.Font(None, 22)
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill((50, 50, 50))
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.sliders = {}
self.sliders["music"] = Slider(self.screen.get_width()/2 - 200/2, 100, 200, 100)
self.sliders["sound"] = Slider(self.screen.get_width()/2 - 200/2, 200, 200, 100)
self.currentSlider = None
self.checkboxes = {}
self.checkboxes["blood"] = Checkbox(self.screen.get_width()/2 - 50, 300, "Blood", True)
self.checkboxes['fullscreen'] = Checkbox(self.screen.get_width()/2 - 50, 350, "Fullscreen", False)
self.loadOptions()
self.buttons = {}
self.buttons["save"] = Button(self.screen.get_width() - self.screen.get_width()/4 - 200/2, 450, 200, 40, "SAVE")
self.buttons["back"] = Button(self.screen.get_width()/4 - 200/2, 450, 200, 40, "BACK")
pygame.display.flip()
示例4: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, server = False):
self.screen = pygame.display.get_surface()
self.server = server
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill((50, 50, 50))
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.sliders = {}
self.sliders["red"] = Slider(self.screen.get_width()/2 - 200/2, 100, 200, 200, 255)
self.sliders["green"] = Slider(self.screen.get_width()/2 - 200/2, 150, 200, 50, 255)
self.sliders["blue"] = Slider(self.screen.get_width()/2 - 200/2, 200, 200, 50, 255)
self.currentSlider = None
self.rabbit1 = Animation("rabbit", 30)
self.rabbit1.updateColor((self.sliders["red"].getValue(), self.sliders["green"].getValue(), self.sliders["blue"].getValue()))
self.rabbit1.setFrameRange(1, 8);
self.rabbit1.flipAnim()
self.rabbit1.setPos(self.screen.get_width()/2 - 21, 300)
self.rabbit1Sprite = pygame.sprite.RenderPlain(self.rabbit1)
self.buttons = {}
self.buttons["play"] = Button(self.screen.get_width() - self.screen.get_width()/4 - 200/2, 450, 200, 40, "PLAY")
self.buttons["back"] = Button(self.screen.get_width()/4 - 200/2, 450, 200, 40, "BACK")
pygame.display.flip()
示例5: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, levelPreset = "empty"):
self.screen = pygame.display.get_surface()
self.backgroundImage, self.backgroundRect = loadPNG("background.png")
self.blockList = [Object(type = "earth"), Object(type = "boing"), Object(type = "ice")]
self.currentBlockNumber = 0
self.currentBlock = self.blockList[self.currentBlockNumber]
self.currentSpriteBlock = pygame.sprite.RenderPlain(self.currentBlock)
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.grid = False
self.level = Map(True)
self.active = True
self.pauseMenu = PauseEditorMenu()
self.toolbar = EditorToolbar()
if levelPreset != "empty":
self.level.load(levelPreset)
pygame.display.flip()
示例6: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, server, color, levelPreset = "empty"):
self.server = server
self.butterflies = []
self.screen = pygame.display.get_surface()
self.backgroundImage, self.backgroundRect = loadPNG("background.png")
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.active = True
if levelPreset == "empty":
self.level = Map()
else:
self.level = Map(True)
self.toolbar = GameToolbar()
self.regis = Rabbit(1, "regis" , color, self.level.objectList, self.level.objectSpritesList)
self.server.accept()
self.server.send(b"connexion avec client : OK")
msg = self.server.recieve()
mapStr = self.level.getMapStr()
#MAP STRING SEND
self.server.send(struct.pack(str(len(mapStr)) + "s", mapStr))
#SERVER RABBIT COLOR SEND
self.server.send(struct.pack("iii", self.regis.color[0], self.regis.color[1], self.regis.color[2]))
#CLIENT RABBIT COLOR RECIEVE
clientCol = self.server.recieve()
clientCol = struct.unpack("iii", clientCol)
#CREATE CLIENT RABBIT
self.john = Rabbit(2, "john" , clientCol, self.level.objectList, self.level.objectSpritesList, True)
self.regis.appendRabbit(self.john)
self.john.appendRabbit(self.regis)
self.pauseMenu = PauseGameMenu()
self.deltaCarrot = 0
self.timeCarrot = random.randint(1, 4)
# for l in range(0, 6):
# while True:
# randPos = random.randint(0, 16)
# if not self.level.isInBlock(self.level.objectList[randPos].getX() + 10, self.level.objectList[randPos].getY() - 26):
# break
# butterfly = Butterfly(self.level.objectList[randPos].getX() + 10, self.level.objectList[randPos].getY() - 26, (255, 10, 100), self.level.objectList, self.level.objectSpritesList)
# self.butterflies.append(butterfly)
pygame.display.flip()
示例7: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, color):
self.butterflies = []
self.screen = pygame.display.get_surface()
self.backgroundImage, self.backgroundRect = loadPNG("background.png")
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.active = True
self.level = Map(True)
self.toolbar = GameToolbar()
self.client = Client('localhost')
self.client.connect()
self.client.recieve()
self.client.send(b"connexion avec serveur : OK")
#MAP STRING RECIEVE
mapStr = self.client.recieve(4096)
mapStr = struct.unpack(str(len(mapStr)) + "s", mapStr)[0]
#LOAD MAP FROM STRING
self.level.saveFromStr("tempClient", mapStr)
self.level.load("tempClient")
#CREATE CLIENT RABBIT
self.regis = Rabbit(1, "regis" , color, self.level.objectList, self.level.objectSpritesList)
#SERVER RABBIT COLOR RECIEVE
serverCol = self.client.recieve()
serverCol = struct.unpack("iii", serverCol)
#CLIENT RABBIT COLOR SEND
self.client.send(struct.pack("iii", self.regis.color[0], self.regis.color[1], self.regis.color[2]))
#CREATE SERVER RABBIT
self.john = Rabbit(2, "john" , serverCol, self.level.objectList, self.level.objectSpritesList, True)
self.regis.appendRabbit(self.john)
self.john.appendRabbit(self.regis)
self.pauseMenu = PauseGameMenu()
# for l in range(0, 6):
# while True:
# randPos = random.randint(0, 16)
# if not self.level.isInBlock(self.level.objectList[randPos].getX() + 10, self.level.objectList[randPos].getY() - 26):
# break
# butterfly = Butterfly(self.level.objectList[randPos].getX() + 10, self.level.objectList[randPos].getY() - 26, (255, 10, 100), self.level.objectList, self.level.objectSpritesList)
# self.butterflies.append(butterfly)
pygame.display.flip()
示例8: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self):
self.screen = pygame.display.get_surface()
self.backgroundRect = pygame.Rect(0, 0, 250, 400)
self.backgroundRect.center = (self.screen.get_rect().center)
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.buttons = {}
self.buttons["resume"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_rect().h/2 - 170, 200, 40, "RESUME")
self.buttons["save"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_rect().h/2 - 70, 200, 40, "SAVE")
self.buttons["load"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_rect().h/2 + 30, 200, 40, "LOAD")
self.buttons["mainMenu"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_rect().h/2 + 130, 200, 40, "MAIN MENU")
示例9: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self):
self.screen = pygame.display.get_surface()
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill((50, 50, 50))
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.buttons = {}
self.buttons["local"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_height()/2 - 150 - 40/2, 200, 40, "LOCAL")
self.buttons["network"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_height()/2 - 50 - 40/2, 200, 40, "NETWORK")
self.buttons["back"] = Button(self.screen.get_width()/2 - 200/2, self.screen.get_height()/2 + 50 - 40/2, 200, 40, "BACK")
pygame.display.flip()
示例10: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self):
self.screen = pygame.display.get_surface()
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
self.background.fill((50, 50, 50))
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.buttons = {}
menuPos = 175
self.buttons["play"] = Button(self.screen.get_width()/2 - 200/2, menuPos, 200, 40, "PLAY")
self.buttons["editor"] = Button(self.screen.get_width()/2 - 200/2, menuPos + 100, 200, 40, "EDITOR")
self.buttons["option"] = Button(self.screen.get_width()/2 - 200/2, menuPos + 200, 200, 40, "OPTION")
self.buttons["quit"] = Button(self.screen.get_width()/2 - 200/2, menuPos + 300, 200, 40, "QUIT")
pygame.display.flip()
示例11: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, color1, color2, levelPreset = "empty"):
self.butterflies = []
self.screen = pygame.display.get_surface()
self.backgroundImage, self.backgroundRect = loadPNG("background.png")
self.buttonSound = pygame.mixer.Sound("resources/sound/button.wav")
self.buttonSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.active = True
if levelPreset == "empty":
self.level = Map()
else:
self.level = Map(True)
self.toolbar = GameToolbar()
self.regis = Rabbit(1, "regis", color1, self.level.objectList, self.level.objectSpritesList)
self.john = Rabbit(2, "john", color2, self.level.objectList, self.level.objectSpritesList)
self.john.appendRabbit(self.regis)
self.regis.appendRabbit(self.john)
self.pauseMenu = PauseGameMenu()
self.deltaCarrot = 0
self.timeCarrot = random.randint(1, 4)
for l in range(0, 6):
while True:
randPos = random.randint(0, 16)
if not self.level.isInBlock(self.level.objectList[randPos].getX() + 10, self.level.objectList[randPos].getY() - 26):
break
butterfly = Butterfly(self.level.objectList[randPos].getX() + 10, self.level.objectList[randPos].getY() - 26, (255, 10, 100), self.level.objectList, self.level.objectSpritesList)
self.butterflies.append(butterfly)
pygame.display.flip()
示例12: __init__
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getOptionValue [as 别名]
def __init__(self, id = -1, name = "", color = (255, 255, 255), objectList = [], spriteList = [], fake = False, x = 0, y = 0):
self.objectList = objectList
self.spriteList = spriteList
self.rabbitList = []
self.fake = fake
self.color = color
self.rect = pygame.Rect(x, y, 43, 32)
self.rabbitAnim = Animation("rabbit", 30)
self.rabbitAnim.updateColor(self.color)
self.rabbitAnim.setFrameRange(1, 8);
self.sprite = pygame.sprite.RenderPlain(self.rabbitAnim)
self.rabbitAnim.stopAnim()
self.screen = pygame.display.get_surface()
self.area = self.screen.get_rect()
self.area.h += 500
self.area.y -= 550
self.area.w -= 200
self.floorLevel = self.screen.get_height() - self.rect.h
self.explosion = Explosion()
self.movingLeft = False
self.movingRight = False
self.movingUp = False
self.movingDown = False
self.isJumping = False
self.isOnBlock = False
self.direction = "left"
self.collide = False
self.touched = False
self.touchDelay = 0
self.id = id
self.name = name
self.jumpSound = pygame.mixer.Sound("resources/sound/jump.wav")
self.splashSound = pygame.mixer.Sound("resources/sound/splash.wav")
self.carrotSound = pygame.mixer.Sound("resources/sound/carrot.wav")
self.jumpSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.splashSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.carrotSound.set_volume(float(Resources.getOptionValue("sound"))/100)
self.velocity = 5
self.gravity = 0.6
self.movePos = [0,0.01]
self.replaceRabbit()
self.points = 0
self.carrots = 0
self.currentFriction = self.getFloorFriction()
self.thrownCarrots = []
self.blood = Resources.getOptionValue("blood")