当前位置: 首页>>代码示例>>Python>>正文


Python Resources.textures_for_army方法代码示例

本文整理汇总了Python中Resources.textures_for_army方法的典型用法代码示例。如果您正苦于以下问题:Python Resources.textures_for_army方法的具体用法?Python Resources.textures_for_army怎么用?Python Resources.textures_for_army使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Resources的用法示例。


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

示例1: Window

# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import textures_for_army [as 别名]
class Window():
     
    def __init__(self,map_name):
        pygame.init()
        self.core = Core()
        self.mode = Event_Handler()
        self.file = 'ingame_temp'#заміна self.file в Core.py
        #self.map_type - треба замінити в Core.py
        #self.x_coord_start self.x_coord_end - замінити в Core.py
        self.battle = Battle('1')
        self.resources = Resources()
        self.graphical_logic = Graphical_logic()
        self.w_event = Events()
        self.minimap_x =0
        self.minimap_y =0
        self.count = 0
        self.days = 0
        self.fraction = 1 # першими ходять червоні
        self.map_name = map_name
        self.stage = 0
        self.save_load_name = ''
        self.fractions = [[1, 1, 0, 0, 3, 1],[2, 1, 0, 0, 0, 0]]
        
    def Main_Window(self):
        self.display = pygame.display.set_mode((1280,720))
        manager = ResManager()
        pygame.display.set_icon(manager.get_image('icon.png'))
        pygame.display.set_caption("War for cookies")
        self.map_type = self.core.load_file(self.map_name,self.file)
        self.display.fill((220,220,250))
        pygame.display.flip()
        i = 0
        
    def Maps_grid(self):
        self.big_step = 50
        self.big_steps =14
        pygame.display.flip()# лол, костЫль

    def Minimaps_grid(self):
        if self.map_type == 0:  
           self.step_p = 6
           self.steps = 50
        elif self.map_type == 1:
            self.step_p = 3
            self.steps = 100
        elif self.map_type == 2:
            self.step_p = 2
            self.steps = 150
        cell = Rect((800,0),(300,300))
        pygame.draw.rect(self.display,(0,0,0),cell,2)
        pygame.display.flip()
        
    def load_cells_list(self):
        self.cells_list = self.core.load_minimap_cells(self.file)

    def Minimap(self):
        colour = self.resources.colours()
        for i in range(self.steps):
            for j in range(self.steps):
                cell = Rect((800+self.step_p*i,self.step_p*j),(self.step_p,self.step_p))
                cell_type = self.cells_list[i*self.steps+j][2]
                pygame.draw.rect(self.display,colour[cell_type],cell,0)
        pygame.display.flip()
        self.Minimaps_grid()
        
    def game_buttons(self):
        textures = self.resources.textures_for_menu()
        for i in range(4):
            first_textures =textures[i].get_rect()
            first_textures.center=(1215,90+180*i)
            self.display.blit(textures[i],first_textures)  
        pygame.display.update()

    def reload_window(self,x,y):
        self.Maps_grid()
        self.Minimaps_grid()
        self.Minimap()
        self.Load_part_of_map(x,y)
        self.game_buttons()
        pygame.display.flip()
    
    def status_army(self,id_army):
        cell = Rect((900,350),(225,400))
        pygame.draw.rect(self.display,(220,220,250),cell,0)
        textures_default = self.resources.textures_for_army()
        fraction = self.fraction
        textures = []
        list_army = self.core.load_army(self.file, id_army)
        for i in range(5):
            textures.append(textures_default[fraction*5+fraction+i+1])
            first_texture = textures[i].get_rect()
            first_texture.center=(932,370+64*i)
            self.display.blit(textures[i],first_texture)
            try:
                font1 = pygame.font.SysFont("Monospace", 40, bold=True, italic=False)
                item = str(list_army[i+1])
                font1 = font1.render(item,0,(20,20,20))
                self.display.blit(font1,(964,350+64*i))
            except TypeError:         
                pass
#.........这里部分代码省略.........
开发者ID:Heiker,项目名称:War-for-cookies,代码行数:103,代码来源:Window.py


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