def __init__(self): super().__init__() ws = director.get_window_size() color_fill = ColorLayer(0, 191, 255, 255, height = 800, width = 800) color_fill.position = (250, 0) self.add(color_fill) self.add(Label("REPORT OF THE NEXT WAVE", font_size = 34, x = 320, y = 700)) self.add(Label("Vagabonds: ", color = (255, 255, 255, 255), font_size = 32, x = 400, y = 600)) self.add(Label("Militiars: ", color = (255, 255, 255, 255), font_size = 32, x = 400, y = 550)) self.add(Label("Looters: ", color = (255, 255, 255, 255), font_size = 32, x = 400, y = 500)) self.add(Label("Defendors: ", color = (255, 255, 255, 255), font_size = 32, x = 400, y = 450)) self.add(Label("Agressors: ", color = (255, 255, 255, 255), font_size = 32, x = 400, y = 400)) self.add(Label("Champions: ", color = (255, 255, 255, 255), font_size = 32, x = 400, y = 350)) self.vaga_count = Label("0", font_size = 32, x = 750, y = 600) self.mili_count = Label("0", font_size = 32, x = 750, y = 550) self.loot_count = Label("0", font_size = 32, x = 750, y = 500) self.defe_count = Label("0", font_size = 32, x = 750, y = 450) self.agre_count = Label("0", font_size = 32, x = 750, y = 400) self.cham_count = Label("0", font_size = 32, x = 750, y = 350) self.add(self.vaga_count) self.add(self.mili_count) self.add(self.loot_count) self.add(self.defe_count) self.add(self.agre_count) self.add(self.cham_count)
def __init__(self): Layer.__init__(self) menu = Menu("") menu_items = [] black_lyr = ColorLayer(0, 0, 0,0) self.add(black_lyr) black_lyr.width = int(director.window.width) black_lyr.height = int(director.window.height) black_lyr.position = (0, 0) black_lyr.opacity = 140 item = MenuItem('Continuar', self.on_quit) menu_items.append(item) menu.position = ( 0, -120) item.position = ( 0, 150) menu.font_title["font_name"] = "Tetrominoes" menu.font_title["color"] = (214, 178, 152, 255) menu.font_item["font_name"] = "Ravie" menu.font_item["font_size"] = 19 menu.font_item_selected["font_name"] = "Ravie" menu.font_item_selected["font_size"] = 22 menu.title = "PAUSADO" menu.create_menu( menu_items ) menu.on_quit = self.on_quit self.add(menu)
def __init__(self): super().__init__() ws = director.get_window_size() color_fill = ColorLayer(0, 191, 255, 255, height=800, width=800) color_fill.position = (250, 0) self.add(color_fill) self.add(Label("REPORT OF THE NEXT WAVE", font_size=34, x=320, y=700)) self.add( Label("Vagabonds: ", color=(255, 255, 255, 255), font_size=32, x=400, y=600)) self.add( Label("Militiars: ", color=(255, 255, 255, 255), font_size=32, x=400, y=550)) self.add( Label("Looters: ", color=(255, 255, 255, 255), font_size=32, x=400, y=500)) self.add( Label("Defendors: ", color=(255, 255, 255, 255), font_size=32, x=400, y=450)) self.add( Label("Agressors: ", color=(255, 255, 255, 255), font_size=32, x=400, y=400)) self.add( Label("Champions: ", color=(255, 255, 255, 255), font_size=32, x=400, y=350)) self.vaga_count = Label("0", font_size=32, x=750, y=600) self.mili_count = Label("0", font_size=32, x=750, y=550) self.loot_count = Label("0", font_size=32, x=750, y=500) self.defe_count = Label("0", font_size=32, x=750, y=450) self.agre_count = Label("0", font_size=32, x=750, y=400) self.cham_count = Label("0", font_size=32, x=750, y=350) self.add(self.vaga_count) self.add(self.mili_count) self.add(self.loot_count) self.add(self.defe_count) self.add(self.agre_count) self.add(self.cham_count)
def build(self, width, height): self.width, self.height = width, height self.x, self.y = (director.window.width - width) // 2, (director.window.height - height) // 2 title_label = Label(self.popup_ctrl.title, font_name='Calibri', color=rgba_colors["black"], font_size=23, anchor_x='center', anchor_y='center') title_label.x = width // 2 title_label.y = height - 50 self.add(title_label) message_label = Label(self.popup_ctrl.message, font_name='Calibri', color=rgba_colors["black"], font_size=16, anchor_x='center', anchor_y='center') message_label.x = width // 2 message_label.y = height - 100 self.add(message_label) for i, button in enumerate(self.popup_ctrl.buttons): padding = 20 button_container = ColorLayer(*rgba_colors["popup_button_background"], width=(width - padding) // len(self.popup_ctrl.buttons) - padding, height=40) button_container.position = padding * (i + 1) + button_container.width * i, 30 self.add(button_container) self.buttons_container.append(button_container) button_text = Label(button.text, font_name='Calibri', color=rgba_colors["white"], font_size=18, anchor_x='center', anchor_y='center') button_text.position = button_container.x + button_container.width / 2, button_container.y + button_container.height / 2 + 3 self.add(button_text) director.window.push_handlers(self.popup_ctrl)
def __init__(self, is_game_over=False): Layer.__init__(self) self.position = Vector2() self.anchor = Vector2() self.fs = file_saver.File_Saver( "rankings.txt") #nome para o arquivo de ranking self.rank_dict = {} menu = Menu("") menu_items = [] item = MenuItem('Voltar', self.on_quit) menu_items.append(item) item.position = (0, -210) if (is_game_over): menu.title = "GAME OVER" black_lyr = ColorLayer(0, 0, 0, 0) self.add(black_lyr) black_lyr.width = int(director.window.width) black_lyr.height = int(director.window.height) black_lyr.position = (0, 0) black_lyr.opacity = 120 input_item = EntryMenuItem('Insira o nome:', self.on_text, "", 6) menu_items.append(input_item) input_item.position = (0, -90) else: menu.title = "RANKING" menu.font_title["font_name"] = "Tetrominoes" menu.font_title["color"] = (214, 178, 152, 255) menu.font_item["font_name"] = "Ravie" menu.font_item["font_size"] = 19 menu.font_item_selected["font_name"] = "Ravie" menu.font_item_selected["font_size"] = 22 menu.create_menu(menu_items) menu.on_quit = self.on_quit self.add(menu)
def on_enter(self): super(StartPrize, self).on_enter() bgcolor = ColorLayer(255, 255, 255, 255, consts_window['width'], consts_window['height']) bgcolor.position = (-320, -320) # 背景颜色 self.add(bgcolor) # 标题 self.add(self.top_label) self.add(self.top_notice) # 转动的背景图 self.add(self.sprite, z=3) self.add(self.alread_prize_sprite, z=3) # 人名图 self.add(self.prizesprite, z=4) # 背景图 self.add(self.bgsprite, z=1) self.add(self.pressbgsprite, z=1) self.position = 320, 320
def __init__(self): self.screen = director.get_window_size() super(AgarLayer, self).__init__(255, 255, 255, 255, self.screen[0], self.screen[1]) #self.position = ((self.screen[0]-self.screen[1])/2,0) self.imgs = { 'cell': resource.image("cell.png"), 'virus': resource.image("virus.png"), 'agitated': resource.image("agitated.png") } self.circles = [] self.sprite_pool = [CellSprite(self.imgs) for _ in xrange(2500)] self.sprites = {} self.name_pool = [Label("", font_name='DejaVu Mono', font_size=6, bold=True, color=(255, 255, 255, 255), anchor_x='center', anchor_y='center') for _ in xrange(500)] self.names = {} self.score = 0 # self.leaders = [] self.win_size = Vec(self.screen[0], self.screen[1]) self.screen_center = self.win_size / 2 self.screen_scale = 1 self.world_center = Vec(0, 0) self.mouse_pos = Vec(0, 0) self.movement_delta = Vec() # self.names_batch = BatchNode() # self.add(self.names_batch) self.leaders_batch = BatchNode() diff = int(self.screen[1]*.01) text.Label("Leaderboard", font_size=24, font_name='DejaVu Mono Bold', x=self.screen[0]-160, y=self.screen[1]-30, bold=True, color=(255, 255, 255, 255), anchor_x='center', anchor_y='top', width=150, batch=self.leaders_batch.batch) self.leaders = [text.Label("%d. An unnamed cell" % (i+1), font_size=14, font_name='DejaVu Mono', x=self.screen[0]-160, y=self.screen[1]-40-30-i*22, color=(255, 255, 255, 255), anchor_x='center', anchor_y='top', width=150, batch=self.leaders_batch.batch) for i in xrange(10)] self.add(self.leaders_batch, z=100) self.sprite_batch = BatchNode() self.add(self.sprite_batch) self.scoreSprite = None self.proto = None leaderBG = ColorLayer(0,0,0,64,280,280) leaderBG.position = (self.screen[0]-300,self.screen[1]-300) self.add(leaderBG,z=50)