• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python settingsManager.getSetting函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中settingsManager.getSetting函数的典型用法代码示例。如果您正苦于以下问题:Python getSetting函数的具体用法?Python getSetting怎么用?Python getSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getSetting函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: update

 def update(self):
     for entity in self.entity_list:
         entity.update()
     
     if self.preferred_zoomLevel != self.zoomLevel:
         diff = self.zoomLevel - self.preferred_zoomLevel
         #If the camera is too narrow
         if diff > 0: self.zoomLevel -= min([0.1,diff])
         #If the camera is too wide
         else: self.zoomLevel += min([0.1,-diff])
         self.camera_position.width  = round(float(settingsManager.getSetting('windowWidth'))  * self.zoomLevel)
         self.camera_position.height = round(float(settingsManager.getSetting('windowHeight')) * self.zoomLevel)
     
     if self.camera_position.x != self.camera_preferred_position.x:
         diff = self.camera_position.x - self.camera_preferred_position.x
         #If the camera is too far to the right
         if diff > 0: self.camera_position.x -= min([10,diff]) #otherwise, move 10 pixels closer
         #If the camera is too far to the left
         else: self.camera_position.x += min([10,-diff])
     
     if self.camera_position.y != self.camera_preferred_position.y:
         diff = self.camera_position.y - self.camera_preferred_position.y
         #If the camera is too far to the bottom
         if diff > 0: self.camera_position.y -= min([20,diff])
         #If the camera is too far to the top
         else: self.camera_position.y += min([20,-diff])
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:26,代码来源:stage.py


示例2: __init__

 def __init__(self,_playerNum):
     pygame.Surface.__init__(self,(settingsManager.getSetting('windowWidth')//2,
                             settingsManager.getSetting('windowHeight')//2))
     
     self.keys = settingsManager.getControls(_playerNum)
     self.player_num = _playerNum
     self.wheel = FighterWheel(_playerNum)
     self.active = False
     self.ready = False
     self.active_object = self.wheel
     self.chosen_fighter = None
     self.myBots = []
     
     self.wheel_increment = 0
     self.hold_time = 0
     self.hold_distance = 0
     self.wheel_offset = [(self.get_width() - 256) // 2,
                         (self.get_height() - 32)]
     self.bg_surface = None
     self.current_color = _playerNum
     self.current_costume = 0
     
     self.icon = spriteManager.ImageSprite(settingsManager.createPath('sprites/default_franchise_icon.png'))
     self.icon.rect.center = self.get_rect().center
     self.icon_color = pygame.Color('#cccccc')
     
     self.fill_color = '#000000'
     self.wheel.setFillColor(self.fill_color)
     
     self.recolorIcon()
开发者ID:eaglgenes101,项目名称:universalSmashSystem,代码行数:30,代码来源:css.py


示例3: endBattle

 def endBattle(self,_exitStatus):
     if not (_exitStatus == 1 or _exitStatus == 2 or _exitStatus == 3):
         print("An error occured that caused TUSSLE to stop working. If you can replicate this error, please file a bug report so the relevant developers can fix it. Post-mortem debugging coming soon. ")
     result_sprites = []
     width = settingsManager.getSetting('windowWidth')
     height = settingsManager.getSetting('windowHeight')
     for i in range(0,len(self.players)):
         print(self.players)
         print("player"+str(i))
         fighter = self.players[i]
         result_sprite = spriteManager.RectSprite(pygame.Rect((width / 4) * i,0,(width / 4),height), pygame.Color(settingsManager.getSetting('playerColor'+str(i))))
         result_sprite.image.set_alpha(255)
         name_sprite = spriteManager.TextSprite(fighter.name,_size=24)
         name_sprite.rect.midtop = (result_sprite.rect.width / 2,0)
         result_sprite.image.blit(name_sprite.image,name_sprite.rect.topleft)
         
         score = fighter.data_log.getData('KOs') - fighter.data_log.getData('Falls')
         text = spriteManager.TextSprite('Score: ' + str(score))
         result_sprite.image.blit(text.image,(0,32))
             
         dist = 48
         
         print(fighter.data_log.data)
         for item,val in fighter.data_log.data.items():
             text = spriteManager.TextSprite(str(item) + ': ' + str(val))
             result_sprite.image.blit(text.image,(0,dist))
             dist += 16
         result_sprites.append(result_sprite)
         confirmed_list = [False] * len(result_sprites) #This pythonic hacking will make a list of falses equal to the result panels
    
     while 1:
         for event in pygame.event.get():
             if event.type == pygame.QUIT:
                 os._exit(1)
                 return -1
             for i in range(0,len(self.players)):
                 controls = settingsManager.getControls(i)
                 k = controls.getInputs(event)
                 if k == 'attack':
                     result_sprites[i].image.set_alpha(0)
                     confirmed_list[i] = True
                 elif k == 'special':
                     result_sprites[i].image.set_alpha(255)
                     confirmed_list[i] = False
             if event.type == pygame.KEYDOWN:
                 if event.key == pygame.K_RETURN:
                     print("Saving screenshot")
                     pygame.image.save(self.screen,settingsManager.createPath('screenshot.jpg'))
                 if event.key == pygame.K_ESCAPE:
                     return
                         
         self.screen.fill((0,0,0))
         for sprite in result_sprites:
             sprite.draw(self.screen, sprite.rect.topleft, 1.0)
         
         if all(confirmed_list):
             return
         pygame.display.flip()
     return
开发者ID:eaglgenes101,项目名称:universalSmashSystem,代码行数:59,代码来源:battle.py


示例4: centerCamera

 def centerCamera(self,center):
     # First, build the rect, then center it
     self.camera_preferred_position.width  = round(settingsManager.getSetting('windowWidth')  * self.preferred_zoomLevel)
     self.camera_preferred_position.height = round(settingsManager.getSetting('windowHeight') * self.preferred_zoomLevel)
     self.camera_preferred_position.center = center
     
     # If it's too far to one side, fix it.
     if self.camera_preferred_position.left < self.camera_maximum.left: self.camera_preferred_position.left = self.camera_maximum.left
     if self.camera_preferred_position.right > self.camera_maximum.right: self.camera_preferred_position.right = self.camera_maximum.right
     if self.camera_preferred_position.top < self.camera_maximum.top: self.camera_preferred_position.top = self.camera_maximum.top
     if self.camera_preferred_position.bottom > self.camera_maximum.bottom: self.camera_preferred_position.bottom = self.camera_maximum.bottom
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:11,代码来源:stage.py


示例5: initializeCamera

 def initializeCamera(self):
     self.camera_position = pygame.Rect(24,16,settingsManager.getSetting('windowWidth'),settingsManager.getSetting('windowHeight'))
     self.camera_position.midtop = self.size.midtop
     
     self.camera_preferred_position = pygame.Rect(24,16,settingsManager.getSetting('windowWidth'),settingsManager.getSetting('windowHeight'))
     self.camera_preferred_position.midtop = self.size.midtop
     
     self.dead_zone = [64,32]
 
     self.cameraUpdate()
     self.camera_position = self.camera_preferred_position
开发者ID:sylvanelite,项目名称:universalSmashSystem,代码行数:11,代码来源:stage.py


示例6: initializeCamera

 def initializeCamera(self):
     self.camera_position = pygame.Rect(24,16,settingsManager.getSetting('windowWidth'),settingsManager.getSetting('windowHeight'))
     self.camera_position.midtop = self.size.midtop
     
     self.camera_preferred_position = pygame.Rect(24,16,settingsManager.getSetting('windowWidth'),settingsManager.getSetting('windowHeight'))
     self.camera_preferred_position.midtop = self.size.midtop
     
     #self.centerSprite = spriteObject.RectSprite([0,0],[32,32])
     self.deadZone = [64,32]
 
     self.cameraUpdate()
     self.camera_position = self.camera_preferred_position
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:12,代码来源:stage.py


示例7: zoomCamera

 def zoomCamera(self,zoomVal):
     self.zoom_level += zoomVal
     
     self.zoom_level = max(self.zoom_level,0.25)
     self.zoom_level = min(self.zoom_level,4)
     
     oldWidth = self.camera_position.width
     oldHeight = self.camera_position.height
     self.camera_position.width  = round(float(settingsManager.getSetting('windowWidth'))  * self.zoom_level)
     self.camera_position.height = round(float(settingsManager.getSetting('windowHeight')) * self.zoom_level)
     diffW = (oldWidth - self.camera_position.width)
     diffH = (oldHeight - self.camera_position.height)
     self.camera_position.x += diffW // 2
     self.camera_position.y += diffH // 2
开发者ID:eaglgenes101,项目名称:universalSmashSystem,代码行数:14,代码来源:stage.py


示例8: getScale

 def getScale(self):
     h = round(float(settingsManager.getSetting('windowHeight')) / self.camera_position.height,5)
     w = round(float(settingsManager.getSetting('windowWidth')) / self.camera_position.width,5)
     
     # If they match, the math is good and we can just pick one
     if h == w:
         return h
     # If they don't match, something might have gone wrong.
     else:
         if abs(h - w) <= 0.02:
             # Fuck it, close enough.
             return h
         print("Scaling Error", h, w, abs(h-w))
         return w
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:14,代码来源:stage.py


示例9: cameraUpdate

 def cameraUpdate(self):
     # Initialize our corner objects
     leftmost = self.follows[0]
     rightmost = self.follows[0]
     topmost = self.follows[0]
     bottommost = self.follows[0]
     
     # Iterate through all of the objects to get the cornermost objects
     for obj in self.follows:
         if obj.left < leftmost.left:
             leftmost = obj
         if obj.right > rightmost.right:
             rightmost = obj
         if obj.top < topmost.top:
             topmost = obj
         if obj.bottom > bottommost.bottom:
             bottommost = obj
     
     # Calculate the width and height between the two farthest sidewas objects (plus deadzone)
     xdist = (rightmost.right - leftmost.left) + (2*self.deadZone[0])
     ydist = (bottommost.bottom - topmost.top) + (2*self.deadZone[1])
     
     # Compare that distance with the window size to get the scale
     xZoom = xdist / float(settingsManager.getSetting('windowWidth'))
     yZoom = ydist / float(settingsManager.getSetting('windowHeight'))
     
     # Minimum Zoom level
     if xZoom < 1.0: xZoom = 1.0
     if yZoom < 1.0: yZoom = 1.0
     
     # If our new zoomed value is too big, we need to cut it down to size
     if xZoom * settingsManager.getSetting('windowWidth') > self.camera_maximum.width:
         xZoom = self.camera_maximum.width / float(settingsManager.getSetting('windowWidth'))
     if yZoom * settingsManager.getSetting('windowHeight') > self.camera_maximum.height:
         yZoom = self.camera_maximum.height / float(settingsManager.getSetting('windowHeight'))
     
     # Set the preferred zoom level and camera position to be centered on later
     self.preferred_zoomLevel = max([xZoom,yZoom])
     if self.preferred_zoomLevel > (self.camera_maximum.width/float(settingsManager.getSetting('windowWidth'))):
         self.preferred_zoomLevel = self.camera_maximum.width/float(settingsManager.getSetting('windowWidth'))
     if self.preferred_zoomLevel > (self.camera_maximum.height/float(settingsManager.getSetting('windowHeight'))):
         self.preferred_zoomLevel = self.camera_maximum.height/float(settingsManager.getSetting('windowHeight'))
 
     # Now that everything is set, we create the boundingBox around the cornermost objects, then get the center of it
     boundingBox = pygame.Rect(leftmost.left-self.deadZone[0],topmost.top-self.deadZone[1],xdist,ydist)
     center = boundingBox.center
     
     # And finally, move the camera.
     self.centerCamera(center)
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:49,代码来源:stage.py


示例10: draw

 def draw(self,screen,offset,scale):
     if (settingsManager.getSetting('showSpriteArea')): spriteManager.RectSprite(self.rect).draw(screen, offset, scale)
     self.sprite.draw(screen,offset,scale)
     
     if self.mask: self.mask.draw(screen,offset,scale)
     for art in self.articles:
         art.draw(screen,offset,scale)
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:7,代码来源:abstractFighter.py


示例11: filterHits

 def filterHits(self, _hitbox, _subactions, _forward):
     if self.damage_threshold > 0 and self.knockback_threshold > 0 and isinstance(_hitbox, hitbox.DamageHitbox) and not _hitbox.ignore_armor:
         # Calculate knockback
         percent_portion = (self.owner.damage/10.0) + (self.owner.damage*_hitbox.damage)/20.0
         weight_portion = 200.0/(self.owner.stats['weight']*settingsManager.getSetting('weight')*_hitbox.weight_influence+100)
         total_kb = (((percent_portion * weight_portion *1.4) + 5) * _hitbox.knockback_growth) + _hitbox.base_knockback
         self.damage_threshold -= _hitbox.damage
         self.knockback_threshold -= total_kb
         from engine.subactions import behavior
         if self.damage_threshold > _hitbox.damage and self.knockback_threshold > total_kb:
             _subactions = filter(lambda k: not isinstance(k, behavior.applyHitstop.applyHitstop) and not isinstance(k, behavior.dealDamage.dealDamage) and not isinstance(k, behavior.applyScaledKnockback.applyScaledKnockback) and not isinstance(k, behavior.compensateResistance.compensateResistance), _subactions)
             for subact in _subactions:
                 if isinstance(subact, behavior.dealDamage.dealDamage):
                     subact.damage *= self.armor_damage_multiplier
                 if isinstance(subact, behavior.applyScaledKnockback.applyScaledKnockback):
                     subact.base_knockback *= self.armor_knockback_multiplier
                     subact.knockback_growth *= self.armor_knockback_multiplier
                 if isinstance(subact, behavior.compensateResistance.compensateResistance):
                     subact.frames *= self.armor_knockback_multiplier
         else:
             for subact in _subactions:
                 if isinstance(subact, behavior.dealDamage.dealDamage):
                     subact.damage *= self.overflow_damage_multiplier
                 if isinstance(subact, behavior.applyScaledKnockback.applyScaledKnockback):
                     subact.base_knockback *= self.overflow_knockback_multiplier
                     subact.knockback_growth *= self.overflow_knockback_multiplier
                 if isinstance(subact, behavior.compensateResistance.compensateResistance):
                     subact.frames *= self.overflow_knockback_multiplier
                 if isinstance(subact, behavior.applyHitstun.applyHitstun):
                     subact.base_knockback *= self.overflow_knockback_multiplier
                     subact.knockback_growth *= self.overflow_knockback_multiplier
     return _forward(_hitbox, _subactions)
开发者ID:eaglgenes101,项目名称:universalSmashSystem,代码行数:32,代码来源:hurtbox.py


示例12: __init__

 def __init__(self,stages):
     self.stageGrid = []
     self.selectedStage = (0,0)
     self.stagesStriked = []
     x = 0
     y = 0
     maxX = settingsManager.getSetting('windowWidth') / 32 #the number of icons that'll fit on the screen horizontally
     print(maxX)
     stageRow = []
     strikingRow = []
     stages.append('random')
     for stage in stages:
         if x < maxX:
             stageRow.append(stage) #Put it in the row
             strikingRow.append(False)
             x += 1
         else:
             self.stageGrid.append(stageRow) #Add the row to the grid
             self.stagesStriked.append(strikingRow)
             stageRow = [] #Clear the row
             strikingRow = []
             y += 1
             stageRow.append(stage)
             strikingRow.append(False)
             x = 1
     #End of stages
     self.stageGrid.append(stageRow) #Put the last row onto the grid
     self.stagesStriked.append(strikingRow)
     print(self.stageGrid)
开发者ID:meffij,项目名称:universalSmashSystem,代码行数:29,代码来源:sss.py


示例13: onCollision

    def onCollision(self, _other):
        if 'AbstractFighter' in list(map(lambda x :x.__name__,_other.__class__.__bases__)) + [_other.__class__.__name__]:
            if _other.lockHitbox(self):
                if self.article is None:
                    self.owner.applyPushback(self.base_knockback/5.0, self.getTrajectory()+180, (self.damage / 3.0 + 3.0)*self.hitlag_multiplier)
                p = float(_other.damage)
                d = float(self.damage)
                w = float(_other.var['weight']) * settingsManager.getSetting('weight')
                s = float(self.knockback_growth)
                b = float(self.base_knockback)
                total_kb = (((((p/10) + (p*d)/20) * (200/(w*self.weight_influence+100))*1.4) + 5) * s) + b

                angle = 0
                if (self.base_knockback > 0):
                    # Calculate the resulting angle
                    knockback_ratio = total_kb*self.velocity_multiplier/self.base_knockback
                    x_val = math.sqrt(knockback_ratio**2+1)/math.sqrt(2)
                    y_val = math.sqrt(knockback_ratio**2-1)/math.sqrt(2)
                    angle = math.atan2(y_val*math.sin(float(self.trajectory)/180*math.pi),x_val*math.cos(float(self.trajectory)/180*math.pi))/math.pi*180
                self.owner.data_log.addToData('Damage Dealt',self.damage)
                _other.applyKnockback(self.damage, self.base_knockback, self.knockback_growth, angle, self.weight_influence, self.hitstun_multiplier, self.base_hitstun, self.hitlag_multiplier, self.ignore_armor)

                _other.trail_color = self.trail_color
                offset = random.randrange(0, 359)
                hit_intersection = self.rect.clip(_other.sprite.rect).center
                hitlag = (self.damage/3.0+3.0)*self.hitlag_multiplier
                from article import HitArticle
                for i in range(int(hitlag)):
                    art = HitArticle(self.owner, hit_intersection, 0.5, offset+i*360/int(hitlag), 0.5*hitlag, .4, self.trail_color)
                    self.owner.articles.add(art)
                Hitbox.onCollision(self, _other)

        if self.article and hasattr(self.article, 'onCollision'):
            self.article.onCollision(_other)
开发者ID:sylvanelite,项目名称:universalSmashSystem,代码行数:34,代码来源:hitbox.py


示例14: __init__

    def __init__(self, _rules, _players, _stage, _randomSeed=None):
        self.settings = settingsManager.getSetting().setting

        if _rules is None:
            _rules = Rules()

        self.rules = _rules
        self.players = _players
        self.controllers = []
        for player in _players:
            player.initialize()
            player.key_bindings.linkObject(player)
            self.controllers.append(player.key_bindings)

        self.stage = _stage
        self.input_buffer = None
        self.data_logs = []

        random.seed(_randomSeed)

        self.active_hitboxes = pygame.sprite.Group()
        self.active_hurtboxes = pygame.sprite.Group()

        self.track_stocks = True
        self.track_time = True
        if self.rules.stocks == 0:
            self.track_stocks = False
        if self.rules.time == 0:
            self.track_time = False
开发者ID:sylvanelite,项目名称:universalSmashSystem,代码行数:29,代码来源:battle.py


示例15: __init__

 def __init__(self,plat,side):
     pygame.sprite.Sprite.__init__(self)
     self.rect = pygame.Rect([0,0],settingsManager.getSetting('ledgeSweetspotSize'))
     self.side = side
     if side == 'left': self.rect.midtop = plat.leftPoint
     else: self.rect.midtop = plat.rightPoint
     self.fightersGrabbed = [] # this is a list in case "Ledge Conflict" is set to "share"
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:7,代码来源:stage.py


示例16: __init__

 def __init__(self,_plat,_side):
     pygame.sprite.Sprite.__init__(self)
     self.rect = pygame.Rect([0,0],settingsManager.getSetting('ledgeSweetspotSize'))
     self.side = _side
     if _side == 'left': self.rect.midtop = _plat.left_point
     else: self.rect.midtop = [_plat.right_point[0], _plat.left_point[1]]
     self.fighters_grabbed = [] # this is a list in case "Ledge Conflict" is set to "share"
     self.platform = _plat
开发者ID:eaglgenes101,项目名称:universalSmashSystem,代码行数:8,代码来源:stage.py


示例17: __init__

 def __init__(self,playerNum):
     pygame.Surface.__init__(self,(settingsManager.getSetting('windowWidth')/2,
                             settingsManager.getSetting('windowHeight')/2))
     
     self.keys = settingsManager.getControls(playerNum)
     self.playerNum = playerNum
     self.wheel = FighterWheel()
     self.active = False
     self.activeObject = self.wheel
     self.chosenFighter = None
     
     self.wheelIncrement = 0
     self.holdtime = 0
     self.holdDistance = 0
     self.wheelOffset = [(self.get_width() - 256) / 2,
                         (self.get_height() - 32)]
     self.bgSurface = None
开发者ID:meffij,项目名称:universalSmashSystem,代码行数:17,代码来源:css.py


示例18: drawFG

 def drawFG(self,screen):
     if settingsManager.getSetting('showPlatformLines'):
         for plat in self.platform_list: 
             platSprite = spriteObject.RectSprite(plat.rect.topleft,plat.rect.size)
             platSprite.draw(screen,self.stageToScreen(platSprite.rect),self.getScale())
     #for ledge in self.platform_ledges:
         #ledgeSprite = spriteObject.RectSprite(ledge.rect.topleft,ledge.rect.size,[0,0,255])
         #ledgeSprite.draw(screen,self.stageToScreen(ledge.rect),self.getScale())
     for sprite in self.foregroundSprites:
         sprite.draw(screen,self.stageToScreen(sprite.rect),self.getScale())
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:10,代码来源:stage.py


示例19: __init__

 def __init__(self,rules,players,stage):
     self.settings = settingsManager.getSetting().setting
     
     if rules == None: rules = Rules()
     
     self.rules = rules
     self.players = players
     self.stage = stage
     self.inputBuffer = None
     #TODO bring over InputBuffer from fighter.
     random.seed
     self.randomstate = random.getstate
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:12,代码来源:battle.py


示例20: rollMusic

 def rollMusic(self,setName):
     musicList = self.musicDict[setName]
     roll = random.randint(0,self.getTotalChance(setName))
     print(roll, self.getTotalChance(setName))
     for path, chance, name in musicList:
         roll -= chance
         if roll <= 0:
             pygame.mixer.music.set_volume(settingsManager.getSetting('musicVolume'))
             self.currentMusic = (path,chance,name)
             pygame.mixer.music.load(path)
             pygame.mixer.music.play(-1)
             return
开发者ID:jam1-garner,项目名称:universalSmashSystem,代码行数:12,代码来源:musicManager.py



注:本文中的settingsManager.getSetting函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python setup._test_all函数代码示例发布时间:2022-05-27
下一篇:
Python settings_base.SettingsBase类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap