def __init__(self, character_id: int, width: int): """ 初始化绘制对象 """ self.character_id: int = character_id """ 要绘制的角色id """ self.width: int = width """ 面板最大宽度 """ self.draw_list: List[draw.NormalDraw] = [] """ 绘制的文本列表 """ self.return_list: List[str] = [] """ 当前面板监听的按钮列表 """ character_data = cache.character_data[self.character_id] for social_type in game_config.config_social_type: type_config = game_config.config_social_type[social_type] type_draw = draw.LittleTitleLineDraw(type_config.name, self.width, ":") self.draw_list.append(type_draw) now_draw = draw.CenterDraw() if social_type in character_data.social_contact and len( character_data.social_contact[social_type]): character_list = list( character_data.social_contact[social_type]) now_draw = panel.PageHandlePanel(character_list, SeeCharacterInfoByNameDraw, 10, 5, self.width, 1, 1, 0) else: now_draw.text = _("空无一人") now_draw.width = self.width self.draw_list.append(now_draw)
def draw(self): """ 绘制面板 """ character_data = cache.character_data[self.character_id] title_draw = draw.TitleLineDraw(_("人物服装"), self.width) title_draw.draw() draw_list = [] self.return_list = [] id_width = 0 for clothing_type in game_config.config_clothing_type: type_data = game_config.config_clothing_type[clothing_type] type_draw = draw.LittleTitleLineDraw(type_data.name, self.width, ":") draw_list.append(type_draw) if clothing_type in character_data.put_on and isinstance( character_data.put_on[clothing_type], UUID): now_draw = ClothingInfoDrawPanel( self.character_id, clothing_type, character_data.put_on[clothing_type], self.width, 1, len(self.return_list), ) self.return_list.append(str(len(self.return_list))) now_id_width = text_handle.get_text_index( now_draw.text_list[0]) if now_id_width > id_width: id_width = now_id_width else: now_text = _("未穿戴") if not self.character_id: now_id = len(self.return_list) now_id_text = text_handle.id_index(now_id) now_width = self.width - len(now_id_text) now_text = text_handle.align(now_text, "center", text_width=now_width) now_text = f"{now_id_text}{now_text}" now_draw = draw.Button(now_text, str(now_id), cmd_func=self.see_clothing_list, args=(clothing_type, )) self.return_list.append(str(now_id)) else: now_draw = draw.CenterDraw() now_draw.text = now_text now_draw.width = self.width draw_list.append(now_draw) draw_list.append(line_feed) for value in draw_list: if "id_width" in value.__dict__: value.id_width = id_width value.draw()
def __init__(self, character_id: int, width: int, column: int, center_status: bool = True): """ 初始化绘制对象 """ self.character_id = character_id """ 要绘制的角色id """ self.width = width """ 面板最大宽度 """ self.column = column """ 每行状态最大个数 """ self.draw_list: List[draw.NormalDraw] = [] """ 绘制的文本列表 """ self.return_list: List[str] = [] """ 当前面板监听的按钮列表 """ self.center_status: bool = center_status """ 居中绘制状态文本 """ character_data = cache.character_data[character_id] for status_type in game_config.config_character_state_type_data: type_data = game_config.config_character_state_type[status_type] type_line = draw.LittleTitleLineDraw(type_data.name, width, ":") self.draw_list.append(type_line) type_set = game_config.config_character_state_type_data[ status_type] status_text_list = [] for status_id in type_set: if status_type == 0: if character_data.sex == 0: if status_id in {2, 3, 6}: continue elif character_data.sex == 1: if status_id == 5: continue elif character_data.sex == 3: if status_id in {2, 3, 5, 6}: continue status_text = game_config.config_character_state[ status_id].name status_value = 0 if status_id in character_data.status: status_value = character_data.status[status_id] status_value = round(status_value) status_value = attr_text.get_value_text(status_value) now_text = f"{status_text}:{status_value}" status_text_list.append(now_text) if self.center_status: now_draw = panel.CenterDrawTextListPanel() else: now_draw = panel.LeftDrawTextListPanel() now_draw.set(status_text_list, self.width, self.column) self.draw_list.extend(now_draw.draw_list)
def __init__(self, character_id: int, width: int, column: int): """ 初始化绘制对象 """ self.character_id: int = character_id """ 要绘制的角色id """ self.width: int = width """ 当前最大可绘制宽度 """ self.column: int = column """ 每行服装最大个数 """ character_data: game_type.Character = cache.character_data[ character_id] describe_list = [ _("可爱的"), _("性感的"), _("帅气的"), _("清新的"), _("典雅的"), _("清洁的"), _("保暖的") ] clothing_info_list = [] title_draw = draw.LittleTitleLineDraw(_("衣着"), width, ":") self.draw_list = [title_draw] """ 绘制的对象列表 """ for clothing_type in game_config.config_clothing_type: if clothing_type in character_data.put_on and isinstance( character_data.put_on[clothing_type], UUID): now_id = character_data.put_on[clothing_type] now_clothing: game_type.Clothing = character_data.clothing[ clothing_type][now_id] value_list = [ now_clothing.sweet, now_clothing.sexy, now_clothing.handsome, now_clothing.fresh, now_clothing.elegant, now_clothing.cleanliness, now_clothing.warm, ] describe_id = value_list.index(max(value_list)) describe = describe_list[describe_id] now_clothing_config = game_config.config_clothing_tem[ now_clothing.tem_id] clothing_name = f"[{now_clothing.evaluation}{describe}{now_clothing_config.name}]" clothing_info_list.append(clothing_name) now_draw = panel.CenterDrawTextListPanel() now_draw.set(clothing_info_list, self.width, self.column) self.draw_list.extend(now_draw.draw_list)
def __init__(self, character_id: int, width: int): """ 初始化绘制对象 """ self.character_id: int = character_id """ 要绘制的角色id """ self.width: int = width """ 面板最大宽度 """ self.draw_list: List[draw.NormalDraw] = [] """ 绘制的文本列表 """ self.return_list: List[str] = [] """ 当前面板监听的按钮列表 """ character_data = cache.character_data[character_id] for nature_type in game_config.config_nature_tag: type_config = game_config.config_nature_tag[nature_type] nature_set = game_config.config_nature_tag_data[nature_type] type_value = 0 nature_draw_list = [] nature_group = value_handle.list_of_groups(list(nature_set), 1) for nature_list in nature_group: for nature_id in nature_list: nature_config = game_config.config_nature[nature_id] nature_value = 0 if nature_id in character_data.nature: nature_value = character_data.nature[nature_id] type_value += nature_value good_judge = False if nature_value >= 50: good_judge = True nature_draw = draw.CenterDraw() if good_judge: nature_draw.text = nature_config.good else: nature_draw.text = nature_config.bad nature_draw.width = int(self.width / len(nature_group)) nature_draw_list.append(nature_draw) judge_value = len(nature_set) * 100 / 2 nature_type_text = "" if type_value >= judge_value: nature_type_text = type_config.good else: nature_type_text = type_config.bad nature_draw = draw.LittleTitleLineDraw(nature_type_text, self.width, ":") self.draw_list.append(nature_draw) self.draw_list.append(nature_draw_list)
def draw(self): """ 绘制面板 """ while 1: line_feed.draw() title_draw = draw.TitleLineDraw(_("主页"), self.width) character_data = cache.character_data[0] title_draw.draw() game_time_draw = game_info_panel.GameTimeInfoPanel(self.width / 2) game_time_draw.now_draw.width = len(game_time_draw) game_time_draw.draw() line_feed.draw() line_feed.draw() player_info_draw = see_character_info_panel.CharacterInfoHead( 0, self.width) player_info_draw.draw_title = 0 player_info_draw.draw() line_feed.draw() game_menu_titie = draw.LittleTitleLineDraw(_("游戏菜单"), self.width) game_menu_titie.draw() get_up_button = draw.CenterButton(_("[000]睁眼起床"), "0", self.width / 3) get_up_button.draw() see_character_list_button = draw.CenterButton( _("[001]查看属性"), "1", self.width / 3, cmd_func=self.see_character_list) see_character_list_button.draw() save_button = draw.CenterButton(_("[002]读写存档"), "2", self.width / 3, cmd_func=self.see_save_handle) save_button.draw() line_feed.draw() return_list = [ get_up_button.return_text, see_character_list_button.return_text, save_button.return_text, ] yrn = flow_handle.askfor_all(return_list) if yrn == "0": cache.now_panel_id = constant.Panel.IN_SCENE break
def __init__(self, character_id: int, width: int): """ 初始化绘制对象 """ self.character_id = character_id """ 要绘制的角色id """ self.width = width """ 面板最大宽度 """ self.draw_list: List[draw.NormalDraw] = [] """ 绘制的文本列表 """ self.return_list: List[str] = [] """ 当前面板监听的按钮列表 """ character_data = cache.character_data[character_id] for skill_type in game_config.config_knowledge_type_data: skill_set = game_config.config_knowledge_type_data[skill_type] type_config = game_config.config_knowledge_type[skill_type] type_draw = draw.LittleTitleLineDraw(type_config.name, self.width, ":") self.draw_list.append(type_draw) now_list = [] skill_group = value_handle.list_of_groups(list(skill_set), 3) for skill_list in skill_group: for skill in skill_list: skill_config = game_config.config_knowledge[skill] skill_draw = draw.CenterMergeDraw( int(self.width / len(skill_group))) now_text_draw = draw.NormalDraw() now_text_draw.text = skill_config.name now_text_draw.width = text_handle.get_text_index( skill_config.name) now_exp = 0 if skill in character_data.knowledge: now_exp = character_data.knowledge[skill] now_level_draw = draw.ExpLevelDraw(now_exp) skill_draw.draw_list.append(now_text_draw) skill_draw.draw_list.append(now_level_draw) skill_draw.width = int(self.width / len(skill_group)) now_list.append(skill_draw) self.draw_list.append(now_list)