本文整理汇总了Python中src.controller.GlobalServices类的典型用法代码示例。如果您正苦于以下问题:Python GlobalServices类的具体用法?Python GlobalServices怎么用?Python GlobalServices使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GlobalServices类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: tpmasterroom
def tpmasterroom(storage, m, obj):
storage._go()
retval = True
if not storage._getData('atrium_masterroom_firstentered'):
storage._toggleCutscene(True)
tr = GlobalServices.getTextRenderer()
tr.write("The lever in the library has moved the shelf out of the way.", 3)
storage._wait(3000)
tr.write("This means that I can enter the master office.", 3)
storage._wait(3000)
tr.write("I'm barely awake right now. What does all of this mean?", 3)
storage._wait(3000)
m.getPlayer().setDirection([0,1])
m.getOverlay("_flashlight").point("down")
tr.deleteAll()
storage._wait(2000)
m.getPlayer().setDirection([0,-1])
m.getOverlay("_flashlight").point("up")
tr.write("...", 3)
storage._wait(3000)
storage._toggleCutscene(False)
ad = GlobalServices.getAudioDevice()
ad.stop(MUSIC, 5000)
storage._setData('atrium_masterroom_firstentered', True)
storage._halt()
return retval
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:27,代码来源:atrium.py
示例2: teleport
def teleport(self, source, obj, target, destination):
self._go()
if self._playerInDistance(source.getPlayer().position, obj.rect):
# Play the sound of this TeleportClickable object
# (if there is one; could be a door squeaking etc)
if hasattr(obj, 'sound'):
GlobalServices.getAudioDevice().play(SOUND, obj.sound, 0.8)
self.teleport_in_progress = True
set_property(PLAYER_MOVEMENT_ENABLED, False)
# Save the state of the current map's properties to the persistent shelf
# before teleporting to the new map
update_persistent_map_properties(source, get_savegame())
dur = 1000
fadeout = OverlayFactory.create_animated_color((0,0,0), dur, 0, True, 0, 255)
source.addOverlay(fadeout)
self._wait(dur)
source.rendering_enabled = False
GlobalServices.getEventManager().post(MapChangeRequestEvent((target, destination)))
source.removeOverlay(fadeout)
source.flushOverlayQueue()
set_property(PLAYER_MOVEMENT_ENABLED, True)
self.teleport_in_progress = False
self._halt()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:29,代码来源:ObjectEngine.py
示例3: __init__
def __init__(self):
ViewInterface.__init__(self)
# Renderer object that displays the map
self.renderer = tiledtmxloader.helperspygame.RendererPygame()
self.renderer.set_camera_position_and_size(200, 300, SCREEN_WIDTH, SCREEN_HEIGHT)
# Reference to current map to be rendered (will be updated whenever the Game object posts a MapChangeEvent)
self.currentmap = None
# Reference to currently highlighted object (will be set by the view controller whenever that actually happens)
self.highlighted = None
# Reference to currently highlighted inventory item (only relevant when it's actually open)
self.invitem = None
# Boolean switch that depicts if the inventory is open or not
self.inventory_open = False
# Boolean switch that depicts if the game menu is open or not
self.gamemenu_open = False
self.darkened = OverlayFactory.create_by_color((0,0,0), 0, 200)
self.backtogame = [GlobalServices.getTextRenderer().writeAsSurface(\
"Back to Game", COLOR_TEXT, FONTSTYLE_CAPTION),\
(100,300)]
self.backtomainmenu = [GlobalServices.getTextRenderer().writeAsSurface(\
"Back to Main menu", COLOR_TEXT, FONTSTYLE_CAPTION),\
(100,328)]
self.selected = None
# Screen handle, used for screenshot saving
self.screen_surface = None
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:25,代码来源:GameView.py
示例4: openNewGame
def openNewGame(self):
# Reset the highlighted object
self.mouseover = None
# Init new game menu stuff
self.newgame_open = True
self.newgame_name = []
GlobalServices.getTextRenderer().deleteAll()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:7,代码来源:MainMenuView.py
示例5: tpstorage
def tpstorage(storage, m, obj):
storage._go()
tr = GlobalServices.getTextRenderer()
ad = GlobalServices.getAudioDevice()
inv = m.getPlayer().inventory
retval = False
if storage._playerInDistance(m.getPlayer().position, obj.rect):
if storage._getData('storage_open'):
retval = True
elif inv.containsName(INVENTORY_ITEM_STORAGE_KEY):
storage._toggleCutscene(True)
ad.play(SOUND, "keypickup", VOLUME_SOUND)
tr.write("I can use the storage key here.", 3)
storage._wait(3000)
key = inv.get(INVENTORY_ITEM_STORAGE_KEY)
key.subQty(1)
storage._setData('storage_open', True)
storage._toggleCutscene(False)
retval = True
else:
ad.play(SOUND, "lockeddoor", VOLUME_SOUND)
tr.write("The storage has been locked for as long as I can remember. I have never been in there.", 4)
retval = False
storage._halt()
return retval
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:32,代码来源:righthallway.py
示例6: tplibrary
def tplibrary(storage, m, obj):
storage._go()
retval = False
tr = GlobalServices.getTextRenderer()
ad = GlobalServices.getAudioDevice()
if storage._playerInDistance(m.getPlayer().position, obj.rect):
if storage._getData('library_open'):
retval = True
else:
inventory = m.getPlayer().inventory
if inventory.containsName(INVENTORY_ITEM_LIBRARY_KEY):
storage._toggleCutscene(True)
ad.play(SOUND, "pick_key", VOLUME_SOUND)
tr.write("The library key fits into the lock.", 3)
storage._wait(3000)
key = inventory.get(INVENTORY_ITEM_LIBRARY_KEY)
key.subQty(1)
storage._setData('library_open', True)
storage._toggleCutscene(False)
retval = True
else:
ad.play(SOUND, "lockeddoor", VOLUME_SOUND)
tr.write("The door is locked. 'Library' is spelt on the door frame.", 3)
storage._halt()
return retval
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:30,代码来源:atrium.py
示例7: switch
def switch(storage, obj, m):
storage._go()
tr = GlobalServices.getTextRenderer()
ad = GlobalServices.getAudioDevice()
if storage._playerInDistance(m.getPlayer().position, obj.rect):
if storage._getData('guestroom_switch_pressed'):
tr.write("I pulled the lever. It won't budge now.", 3)
else:
storage._toggleCutscene(True)
tr.write("It's... a lever?", 3)
storage._wait(3000)
if storage._getData('guestroom_foundshelf'):
tr.write("Does this do something with the hinges on that bookshelf?", 3)
storage._wait(3000)
ad.play(SOUND, 'pull_switch', VOLUME_SOUND)
# Change graphics
downswitch = os.path.join(PATH_GRAPHICS_TILES,'switch_down.png')
obj.changeImage(downswitch)
shelfchange = os.path.join(PATH_GRAPHICS_TILES,'shelf_atriumkey_inside.png')
shelf_object = m.getObjectByName('keyshelf')
shelf_object.changeImage(shelfchange, True)
ad.play(SOUND, 'shelf', VOLUME_SOUND)
storage._setData('guestroom_switch_pressed', True)
storage._toggleCutscene(False)
else:
tr.write("I can't reach that from here.", 3)
storage._halt()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:30,代码来源:guestroom.py
示例8: note
def note(storage, obj, m):
storage._go()
if storage._playerInDistance(m.getPlayer().position, obj.rect):
# Cutscene toggle: Disable user input
storage._toggleCutscene(True)
tr = GlobalServices.getTextRenderer()
ad = GlobalServices.getAudioDevice()
tr.deleteAll()
# Overlays
note = OverlayFactory.create("note_big.png")
togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
m.addOverlay(note)
m.addOverlay(togray)
# Play sound
ad.play(SOUND, 'journal_page', VOLUME_SOUND)
# Text of the note
y = 140
ofs = 18
tr.write("Who would have done something like this?!",\
0, COLOR_TEXT, (100, y + (ofs*0)))
tr.write("My little girl... you shouldn't have had to suffer through this.",\
0, COLOR_TEXT, (100, y + (ofs*1)))
tr.write("After I found your lifeless body, I took it to your most favourite place.",\
0, COLOR_TEXT, (100, y + (ofs*2)))
tr.write("Surely you will find peace among there.",\
0, COLOR_TEXT, (100, y + (ofs*3)))
tr.write("I looked at your picture today.",\
0, COLOR_TEXT, (100, y + (ofs*5)))
tr.write("I do not know if it is just me, but your mother's expression changed.",\
0, COLOR_TEXT, (100, y + (ofs*6)))
tr.write("There she sits, to your right, and what appears to be a sole tear runs down her cheek.",\
0, COLOR_TEXT, (100, y + (ofs*7)))
tr.write("Can a painting feel emotions?",\
0, COLOR_TEXT, (100, y + (ofs*9)))
tr.write("Now I am surely being silly.",\
0, COLOR_TEXT, (100, y + (ofs*10)))
tr.write("I will miss you, big sister.",\
0, COLOR_TEXT, (100, y + (ofs*11)))
tr.write("- J",\
0, COLOR_TEXT, (100, y + (ofs*13)))
# Wait for user input
storage._pauseUntilClick()
GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
# Delete note overlay
m.removeOverlay(note)
m.removeOverlay(togray)
# Play sound
ad.play(SOUND, 'journal_page', VOLUME_SOUND)
# Delete texts
tr.deleteAll()
storage._toggleCutscene(False)
storage._halt()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:60,代码来源:leftwing.py
示例9: save
def save(self, disp=False):
# Get the savegame data
temp = get_savegame()
# Open the "real" shelf (the one the player can load up again)!
save = shelve.open(CURRENT_SHELF_FILENAME[0])
# Save persistent data that needs to be stored in order to retrieve the game state.
# All data that is used to do that is actually the player's current position,
# the current map where this position applies, and the currently playing background
# music.
# Pre-defined keys for the dict
save['player_position'] = self.player.position
save['current_map'] = self.currentmap.properties['key_name']
save['player_inventory'] = self.player.inventory
save['current_sounds'] = GlobalServices.getAudioDevice().getPlayingSounds()
temp['global_overlays'] = get_global_overlays()
# Update the persistent map properties for the current map
update_persistent_map_properties(self.currentmap, temp)
# Copy the rest of the shelf data to the "correct" save file
copy_to_shelve(temp, save)
# Close the shelves again; that's it!
save.close()
if disp:
# Display the optional success message using the TextRenderer module
tr = GlobalServices.getTextRenderer()
tr.write("Game saved.", 3)
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:30,代码来源:Game.py
示例10: post
def post(self, event):
# Check if it is an event or a subclass thereof, otherwise, don't post it
if isinstance(event, Event):
for listener in self.listeners.keys():
listener.notify(event)
else:
GlobalServices.getLogger().log("Can't post this object: %s" % event)
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:7,代码来源:EventManager.py
示例11: __init__
def __init__(self):
# Initialize via superclass constructor
ViewInterface.__init__(self)
# Write out the logo and menu items using the TextRenderer module
self.writeTexts()
# Menu item highlighted by the user, or "None"
self.mouseover = None
# BG image
self.bg = pygame.transform.smoothscale(
pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "main_menu_bg.png")), (SCREEN_WIDTH, SCREEN_HEIGHT)
).convert()
# Title image
self.title = pygame.image.load(os.path.join(PATH_GRAPHICS_SPRITES, "title.png"))
# Load menu stuff. First, Boolean if it is open
self.loadmenu_open = False
tr = GlobalServices.getTextRenderer()
self.loadmenu_caption = tr.writeAsSurface("Where do you want to pick up?", COLOR_TEXT, FONTSTYLE_CAPTION)
back = tr.writeAsSurface("Back", COLOR_TEXT, FONTSTYLE_CAPTION)
self.menu_backbutton = (back, pygame.Rect((500, 20), back.get_rect().size))
# The list of save game folders to choose from
self.loadmenu_saves = []
# New game menu stuff. Boolean if it is open
self.newgame_open = False
self.newgame_caption = tr.writeAsSurface(
"Enter a save game name. Proceed with Enter...", COLOR_TEXT, FONTSTYLE_CAPTION
)
# List of characters that make up the save game name
self.newgame_name = []
self.newgame_surf = tr.writeAsSurface("_")
# Play BGM
self.ad = GlobalServices.getAudioDevice()
self.ad.play(MUSIC, "maincredit", VOLUME_MUSIC + 0.2, -1)
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:32,代码来源:MainMenuView.py
示例12: tpatrium
def tpatrium(storage, m, obj):
storage._go()
ad = GlobalServices.getAudioDevice()
tr = GlobalServices.getTextRenderer()
retval = False
if storage._playerInDistance(m.getPlayer().position, obj.rect):
# Key
if storage._getData('atrium_open'):
retval = True
else:
inventory = m.getPlayer().inventory
if inventory.containsName(INVENTORY_ITEM_ATRIUM_KEY):
storage._toggleCutscene(True)
ad.play(SOUND, "pick_key", VOLUME_SOUND)
tr.write("I can use the atrium key here.", 3)
storage._wait(3000)
key = inventory.get(INVENTORY_ITEM_ATRIUM_KEY)
key.subQty(1)
storage._setData('atrium_open', True)
storage._toggleCutscene(False)
retval = True
else:
ad.play(SOUND, "lockeddoor", VOLUME_SOUND)
tr.write("The door to the atrium... it's locked? That's weird, it shouldn't be.", 3)
storage._halt()
return retval
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:33,代码来源:righthallway.py
示例13: init
def init(storage, m):
storage._go()
storage._toggleCutscene(True)
ad = GlobalServices.getAudioDevice()
tr = GlobalServices.getTextRenderer()
ad.stop(MUSIC, 5000)
ad.stop(SOUND, 5000, 'amb_guardian')
# Make the overlay
darktrans = OverlayFactory.create_animated_color((20,0,0),\
5000, 0, True, 0, 220)
dark = OverlayFactory.create_by_color((20,0,0), 0, 220)
fog = OverlayFactory.create("fog.png", pygame.BLEND_MULT)
white = OverlayFactory.create("noise.png", pygame.BLEND_MULT)
m.clearOverlays()
m.addOverlay(darktrans)
m.addOverlay(fog)
player = m.getPlayer()
shadow = m.getShadow()
shadow.setPosition(conv_tile_pixel((8,10),m))
player.setDirection([0,-1])
player.halfSpeed()
# Here be dragons
storage._wait(5000)
m.rendering_enabled = True
m.addOverlay(dark)
m.removeOverlay(darktrans)
ad.play(MUSIC, 'bgm_4', VOLUME_MUSIC, -1)
ad.play(SOUND, 'flashlight_toggle', VOLUME_SOUND)
storage._wait(2000)
tr.write("What is this place?", 3)
storage._wait(3000)
tr.write("It feels... strangely familiar.", 3)
storage._wait(2000)
ad.play(SOUND, 'noise', VOLUME_SOUND_AMBIENT + 0.3, -1)
m.addOverlay(white)
shadow.setVisible(True)
storage._wait(300)
m.removeOverlay(white)
ad.stop(SOUND, 0, 'noise')
shadow.setVisible(False)
shadow.setPosition(conv_tile_pixel((8,12),m))
storage._wait(1500)
m.addOverlay(white)
ad.play(SOUND, 'noise', VOLUME_SOUND_AMBIENT + 0.3, -1)
shadow.setVisible(True)
shadow.moveBy((0, 15), 500)
storage._wait(450)
m.removeOverlay(white)
ad.stop(SOUND, 0, 'noise')
shadow.setVisible(False)
storage._toggleCutscene(False)
set_property(SAVE_ENABLED, False)
storage._halt()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:59,代码来源:attic.py
示例14: startAmbientSounds
def startAmbientSounds(self):
for s in self.ambient_sounds:
kind = s[0]
key = s[1][0]
vol = s[1][1]
loop = s[1][2]
fadein = s[1][3]
GlobalServices.getAudioDevice().play(kind, key, vol, loop, fadein)
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:8,代码来源:Map.py
示例15: get
def get(methodname):
try:
return getattr(storage, methodname)
except AttributeError as e:
# If the method could not be found, inform the
# logger to print it out and return a dummy method
GlobalServices.getLogger().log(e)
return dummymethod
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:8,代码来源:ObjectEngine.py
示例16: switch
def switch(storage, obj, m, index):
# (Extra "index" parameter depicts the # of the switch that was triggered
# from 1 (far left) to 5 (far right))
storage._go()
if not storage._getData('lefthallway_puzzle_solved'):
if storage._playerInDistance(m.getPlayer().position, obj.rect):
ad = GlobalServices.getAudioDevice()
# Initialize the persistent representation of this puzzle if it doesn't exist yet
states = storage._getData('lefthallway_switches')
if states is None:
# -1: down, 0: middle, 1: up
states = [0, 0, 0, 0, 0]
# Change the state of the switch that was passed in
# (subtract 1 from the index b/c computer scientists love to start at 0!)
state = states[index-1]
state += 1
if state > 1:
state = -1
states[index-1] = state
storage._setData('lefthallway_switches', states)
# Change graphic for that switch
if state == -1:
image = 'switch_down.png'
elif state == 0:
image = 'switch_mid.png'
else:
image = 'switch_up.png'
gfx = os.path.join(PATH_GRAPHICS_TILES, image)
ad.play(SOUND, 'pull_switch', VOLUME_SOUND)
obj.changeImage(gfx)
# Solution to the switch puzzle (from left to right):
# up down down up up
# (The gender of the five people on the portrait
# are mapped to the positioning of the switches.
# The encoding of gender is hinted at in the abandoned chamber.)
solution = [1, -1, -1, 1, 1]
if states == solution:
# Puzzle solved
storage._toggleCutscene(True)
ad.play(SOUND, 'doorstop3', VOLUME_SOUND)
lastdir = m.getPlayer().getDirection()
m.getPlayer().setDirection(string_to_direction("up-right"))
storage._wait(250)
ad.play(SOUND, '07_pick_lock', VOLUME_SOUND)
storage._wait(500)
tr = GlobalServices.getTextRenderer()
tr.write("Something has happened. I think this is the correct combination.", 3)
m.getPlayer().setDirection(string_to_direction(lastdir))
storage._setData('lefthallway_puzzle_solved', True)
storage._toggleCutscene(False)
storage._halt()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:56,代码来源:lefthallway.py
示例17: render
def render(self, screen):
# Draw a temp text
GlobalServices.getTextRenderer().write("Inventory", 0, COLOR_TEXT,\
(100,100), FONTSTYLE_CAPTION)
# Draw background image
screen.blit(self.bg, (0,0))
# Order every item to draw itself properly on a 4x2 grid
l = ((x,y) for y in range(2) for x in range(4))
for i in self.items:
i.render(screen, next(l))
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:10,代码来源:Inventory.py
示例18: switchToMainMenu
def switchToMainMenu(self):
# Pause all things
GlobalServices.getAudioDevice().stopAll()
# Close and delete the temporary shelf
reset_savegame()
# Delete the Map cache as well
MapFactory.clearMaps()
# Change state
self.state = STATE_MAIN_MENU
self.evManager.post(GameStateChangedEvent(self.state))
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:10,代码来源:Game.py
示例19: tpupperbalcony
def tpupperbalcony(storage, source, obj):
storage._go()
retval = False
tr = GlobalServices.getTextRenderer()
ad = GlobalServices.getAudioDevice()
if storage._playerInDistance(source.getPlayer().position, obj.rect):
ad.play(SOUND, "lockeddoor", VOLUME_SOUND)
tr.write("The door won't budge.", 3)
storage._halt()
return retval
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:10,代码来源:lefthallway.py
示例20: officenote
def officenote(storage, obj, m):
storage._go()
if storage._playerInDistance(m.getPlayer().position, obj.rect):
# Cutscene toggle: Disable user input
storage._toggleCutscene(True)
tr = GlobalServices.getTextRenderer()
ad = GlobalServices.getAudioDevice()
tr.deleteAll()
# Overlays
note = OverlayFactory.create("note_big.png")
togray = OverlayFactory.create_animated_color((0,0,0), 1000, 0, True, 0, 200)
m.addOverlay(note)
m.addOverlay(togray)
# Play sound
ad.play(SOUND, 'journal_page', VOLUME_SOUND)
# Text of the note
y = 150
ofs = 18
tr.write("The doctor's said that everything is going to be fine.",\
0, COLOR_TEXT, (100, y + (ofs*0)))
tr.write("I won't give my offspring away only because your senile self",\
0, COLOR_TEXT, (100, y + (ofs*1)))
tr.write("blames everything on him! How dare you speak those insults!",\
0, COLOR_TEXT, (100, y + (ofs*2)))
tr.write("Cly has NOTHING to do with any of the disappearances of our family.",\
0, COLOR_TEXT, (100, y + (ofs*3)))
tr.write("I mean, God, why do you keep saying that?! Haven't you heard",\
0, COLOR_TEXT, (100, y + (ofs*4)))
tr.write("the inspector's words? He's innocent!",\
0, COLOR_TEXT, (100, y + (ofs*5)))
tr.write("I took your key to where you wrongfully locked my son, you monster.",\
0, COLOR_TEXT, (100, y + (ofs*7)))
tr.write("This will be hard to forgive, father.",\
0, COLOR_TEXT, (100, y + (ofs*8)))
tr.write("- M",\
0, COLOR_TEXT, (100, y + (ofs*10)))
# Wait for user input
storage._pauseUntilClick()
GlobalServices.getEventManager().post(ObjectHighlightedEvent(None))
# Delete note overlay
m.removeOverlay(note)
m.removeOverlay(togray)
# Play sound
ad.play(SOUND, 'journal_page', VOLUME_SOUND)
# Delete texts
tr.deleteAll()
storage._toggleCutscene(False)
storage._halt()
开发者ID:aurae,项目名称:Clydes-Fate--Indie-Horror-Game-,代码行数:55,代码来源:libraryupstairs.py
注:本文中的src.controller.GlobalServices类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论