Exemple #1
0
 def __init__(self, character_id: int, width: int):
     """ 初始化绘制对象 """
     self.character_id = character_id
     """ 要绘制的角色id """
     self.width = width
     """ 当前最大可绘制宽度 """
     character_data = cache.character_data[self.character_id]
     dormitory = character_data.dormitory
     dormitory_text = ""
     if dormitory == "":
         dormitory_text = _("暂无")
     else:
         dormitory_path = map_handle.get_map_system_path_for_str(dormitory)
         dormitory_text = attr_text.get_scene_path_text(dormitory_path)
     self.dormitory_text = _("宿舍位置:") + dormitory_text
     """ 宿舍位置文本 """
     classroom = character_data.classroom
     now_classroom_text = _("教室位置:")
     if classroom != "":
         classroom_path = map_handle.get_map_system_path_for_str(classroom)
         classroom_text = attr_text.get_scene_path_text(classroom_path)
         now_classroom_text += classroom_text
     else:
         now_classroom_text += _("暂无")
     self.classroom_text = now_classroom_text
     """ 教室位置文本 """
     officeroom = character_data.officeroom
     now_officeroom_text = _("办公室位置:")
     if len(officeroom):
         officeroom_text = attr_text.get_scene_path_text(officeroom)
         now_officeroom_text += officeroom_text
     else:
         now_officeroom_text += _("暂无")
     self.officeroom_text = now_officeroom_text
     """ 办公室位置文本 """
Exemple #2
0
 def __init__(self, text: int, width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.draw_text = ""
     """ 场景路径绘制文本 """
     self.width: int = width
     """ 最大宽度 """
     self.is_button: bool = is_button
     """ 绘制按钮 """
     self.num_button: bool = num_button
     """ 绘制数字按钮 """
     self.button_id: int = button_id
     """ 数字按钮的id """
     self.button_return: str = str(button_id)
     """ 按钮返回值 """
     self.draw_list: List[draw.NormalDraw] = []
     """ 绘制的对象列表 """
     character_data: game_type.Character = cache.character_data[text]
     self.scene_path: List[str] = character_data.position
     """ 角色所在场景 """
     path_text = attr_text.get_scene_path_text(self.scene_path)
     button_text = f"{character_data.name}:[{path_text}]"
     button_text = text_handle.align(button_text, text_width=width)
     name_draw = draw.Button(button_text,
                             character_data.name,
                             cmd_func=self.move_now)
     name_draw.width = width
     self.now_draw = name_draw
     """ 绘制的对象 """
     self.button_return = character_data.name
Exemple #3
0
 def __init__(self, text: List[str], width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.draw_text = ""
     """ 场景路径绘制的文本 """
     self.width: int = width
     """ 最大宽度 """
     self.is_button: bool = is_button
     """ 绘制按钮 """
     self.num_button: bool = num_button
     """ 绘制数字按钮 """
     self.button_id: int = button_id
     """ 数字按钮的id """
     self.button_return: str = str(button_id)
     """ 按钮返回值 """
     self.draw_list: List[draw.NormalDraw] = []
     """ 绘制的对象列表 """
     self.scene_path: List[str] = text
     """ 对应场景路径 """
     path_text = attr_text.get_scene_path_text(text)
     button_text = f"[{path_text}]"
     button_text = text_handle.align(button_text, text_width=width)
     name_draw = draw.Button(button_text, path_text, cmd_func=self.move_now)
     self.draw_text = button_text
     name_draw.width = width
     self.now_draw = name_draw
     """ 绘制的对象 """
     self.button_return = path_text
 def draw(self):
     """ 绘制对象 """
     timetable_list: List[
         game_type.TeacherTimeTable] = cache.teacher_school_timetable[0]
     text_list = []
     args_list = []
     line_feed.draw()
     title_draw = draw.TitleLineDraw(_("课程表"), self.width)
     title_draw.draw()
     for timetable in timetable_list:
         class_name = attr_text.get_scene_path_text(timetable.class_room)
         now_time = str(timetable.time)
         minute = now_time[-2:]
         hour = now_time[:-2]
         now_time_text = f"{hour}:{minute}"
         now_text = _(
             "{weekday} 第{times}节 班级:{class_name} 科目:{course} 上课时间:{time}"
         ).format(
             weekday=game_config.config_week_day[timetable.week_day].name,
             times=timetable.class_times,
             class_name=class_name,
             course=game_config.config_course[timetable.course].name,
             time=now_time_text,
         )
         text_list.append(now_text)
         args_list.append(timetable.class_room)
     now_draw = panel.LeftDrawIDButtonListPanel()
     now_draw.set(text_list, 0, self.width, 1, "", self.move_now, args_list)
     now_draw.draw()
     line_draw = draw.LineDraw("-", self.width)
     line_draw.draw()
     back_draw = draw.CenterButton(_("[返回]"), _("返回"), self.width)
     back_draw.draw()
     line_feed.draw()
     return_list = now_draw.return_list
     return_list.append(back_draw.return_text)
     yrn = flow_handle.askfor_all(return_list)
     if yrn == back_draw.return_text:
         cache.now_panel_id = constant.Panel.IN_SCENE
Exemple #5
0
 def draw(self):
     """ 绘制对象 """
     character_data: game_type.Character = cache.character_data[0]
     title_draw = draw.TitleLineDraw(_("场景"), self.width)
     scene_path_str = map_handle.get_map_system_path_str_for_list(character_data.position)
     scene_data: game_type.Scene = cache.scene_data[scene_path_str]
     character_handle_panel = panel.PageHandlePanel(
         [],
         see_character_info_panel.SeeCharacterInfoByNameDrawInScene,
         10,
         5,
         self.width,
         1,
         0,
         len(constant.handle_instruct_name_data),
         null_button_text=character_data.target_character_id,
     )
     while 1:
         if character_data.dead:
             cache.wframe_mouse.w_frame_skip_wait_mouse = 0
             now_draw = draw.LineFeedWaitDraw()
             now_draw.text = _("已死亡!")
             now_draw.width = self.width
             now_draw.draw()
             continue
         character_set = scene_data.character_list.copy()
         character_set.remove(0)
         if cache.is_collection:
             character_list = [i for i in character_set if i in character_data.collection_character]
         else:
             character_list = list(character_set)
         character_handle_panel.text_list = character_list
         if character_data.target_character_id not in scene_data.character_list:
             character_data.target_character_id = 0
         if not character_data.target_character_id and len(character_list):
             character_data.target_character_id = character_list[0]
         game_time_draw = game_info_panel.GameTimeInfoPanel(self.width / 2)
         game_time_draw.now_draw.width = len(game_time_draw)
         position_text = attr_text.get_scene_path_text(character_data.position)
         now_position_text = _("当前位置:") + position_text
         now_position_draw = draw.NormalDraw()
         now_position_draw.text = now_position_text
         now_position_draw.width = self.width - len(game_time_draw)
         meet_draw = draw.NormalDraw()
         meet_draw.text = _("你在这里遇到了:")
         meet_draw.width = self.width
         see_instruct_panel = SeeInstructPanel(self.width)
         cache.wframe_mouse.w_frame_skip_wait_mouse = 0
         if cache.now_panel_id != constant.Panel.IN_SCENE:
             break
         character_handle_panel.null_button_text = character_data.target_character_id
         line_feed.draw()
         title_draw.draw()
         game_time_draw.draw()
         now_position_draw.draw()
         line_feed.draw()
         ask_list = []
         if len(character_list) and character_data.target_character_id not in character_list:
             character_data.target_character_id = character_list[0]
         if not len(character_list):
             character_data.target_character_id = 0
         if len(character_list):
             meet_draw.draw()
             line_feed.draw()
             character_handle_panel.update()
             character_handle_panel.draw()
             ask_list.extend(character_handle_panel.return_list)
             line_draw = draw.LineDraw("-.-", self.width)
             line_draw.draw()
         character_info_draw_list = []
         if character_data.target_character_id:
             character_head_draw = see_character_info_panel.CharacterInfoHead(
                 character_data.cid, self.width
             )
             target_head_draw = see_character_info_panel.CharacterInfoHead(
                 character_data.target_character_id, self.width
             )
             character_head_draw_list = [y for x in character_head_draw.draw_list for y in x]
             character_head_draw_list[0].text += " " + character_head_draw_list[2].text
             del character_head_draw_list[2]
             target_head_draw_list = [y for x in target_head_draw.draw_list for y in x]
             target_head_draw_list[0].text += " " + target_head_draw_list[2].text
             del target_head_draw_list[2]
             character_info_draw_list = list(zip(character_head_draw_list, target_head_draw_list))
         else:
             character_head_draw = see_character_info_panel.CharacterInfoHead(
                 character_data.cid, self.width
             )
             character_info_draw_list = character_head_draw.draw_list
         for value_tuple in character_info_draw_list:
             for value in value_tuple:
                 value.draw()
             line_feed.draw()
         character_clothing_draw_list = []
         if character_data.target_character_id:
             character_clothing_draw = see_character_info_panel.CharacterWearClothingList(
                 0, self.width / 2, 2
             )
             target_clothing_draw = see_character_info_panel.CharacterWearClothingList(
                 character_data.target_character_id, self.width / 2 - 1, 2
             )
             now_line = len(character_clothing_draw.draw_list)
             if len(target_clothing_draw.draw_list) > now_line:
                 now_line = len(target_clothing_draw.draw_list)
             for i in range(now_line):
                 c_draw = None
                 if i in range(len(character_clothing_draw.draw_list)):
                     c_draw = character_clothing_draw.draw_list[i]
                 else:
                     c_draw = draw.NormalDraw()
                     c_draw.text = " " * int(self.width / 2)
                     c_draw.width = self.width / 2
                 t_draw = None
                 if i in range(len(target_clothing_draw.draw_list)):
                     t_draw = target_clothing_draw.draw_list[i]
                 else:
                     t_draw = draw.NormalDraw()
                     t_draw.text = " " * int(self.width / 2 - 1)
                     t_draw.width = self.width / 2 - 1
                 character_clothing_draw_list.append((c_draw, t_draw))
         else:
             character_clothing_draw_list = see_character_info_panel.CharacterWearClothingList(
                 0, self.width, 5
             ).draw_list
         for label in character_clothing_draw_list:
             if isinstance(label, tuple):
                 index = 0
                 for value in label:
                     if isinstance(value, list):
                         for value_draw in value:
                             value_draw.draw()
                     else:
                         value.line_feed = 0
                         value.draw()
                     if not index:
                         fix_draw = draw.NormalDraw()
                         fix_draw.width = 1
                         fix_draw.text = "|"
                         fix_draw.draw()
                         index = 1
                 line_feed.draw()
             elif isinstance(label, list):
                 for value in label:
                     value.draw()
                 line_feed.draw()
             else:
                 label.draw()
         character_status_draw_list = []
         if character_data.target_character_id:
             character_status_draw = see_character_info_panel.SeeCharacterStatusPanel(
                 character_data.cid, self.width / 2, 3, 0
             )
             target_status_draw = see_character_info_panel.SeeCharacterStatusPanel(
                 character_data.target_character_id, self.width / 2 - 1, 3, 0
             )
             now_line = len(character_status_draw.draw_list)
             if len(target_status_draw.draw_list) > now_line:
                 now_line = len(target_status_draw.draw_list)
             for i in range(now_line):
                 c_draw = None
                 if i in range(len(character_status_draw.draw_list)):
                     c_draw = character_status_draw.draw_list[i]
                 else:
                     c_draw = draw.NormalDraw()
                     c_draw.text = " " * int(self.width / 2)
                     c_draw.width = self.width / 2
                 t_draw = None
                 if i in range(len(target_status_draw.draw_list)):
                     t_draw = target_status_draw.draw_list[i]
                 else:
                     t_draw = draw.NormalDraw()
                     t_draw.text = " " * int(self.width / 2 - 1)
                     t_draw.width = self.width / 2 - 1
                 character_status_draw_list.append((c_draw, t_draw))
         else:
             character_status_draw = see_character_info_panel.SeeCharacterStatusPanel(
                 character_data.cid, self.width, 6
             )
             character_status_draw_list = character_status_draw.draw_list
         for label in character_status_draw_list:
             if isinstance(label, tuple):
                 index = 0
                 for value in label:
                     if isinstance(value, list):
                         for value_draw in value:
                             value_draw.draw()
                     else:
                         value.line_feed = 0
                         value.draw()
                     if not index:
                         fix_draw = draw.NormalDraw()
                         fix_draw.width = 1
                         fix_draw.text = "|"
                         fix_draw.draw()
                         index = 1
                 line_feed.draw()
             elif isinstance(label, list):
                 for value in label:
                     value.draw()
                 line_feed.draw()
             else:
                 label.draw()
         see_instruct_panel.draw()
         ask_list.extend(see_instruct_panel.return_list)
         target_id = character_data.target_character_id
         flow_handle.askfor_all(ask_list)
         py_cmd.clr_cmd()
Exemple #6
0
 def draw(self):
     """ 绘制对象 """
     title_draw = draw.TitleLineDraw(_("场景"), self.width)
     character_data: game_type.Character = cache.character_data[0]
     scene_path_str = map_handle.get_map_system_path_str_for_list(character_data.position)
     scene_data: game_type.Scene = cache.scene_data[scene_path_str]
     character_list = list(scene_data.character_list)
     character_list.remove(0)
     if not character_data.target_character_id and len(character_list):
         character_data.target_character_id = character_list[0]
     while 1:
         game_time_draw = game_info_panel.GameTimeInfoPanel(self.width / 2)
         game_time_draw.now_draw.width = len(game_time_draw)
         position_text = attr_text.get_scene_path_text(character_data.position)
         now_position_text = _("当前位置:") + position_text
         now_position_draw = draw.NormalDraw()
         now_position_draw.text = now_position_text
         now_position_draw.width = self.width - len(game_time_draw)
         meet_draw = draw.NormalDraw()
         meet_draw.text = _("你在这里遇到了:")
         meet_draw.width = self.width
         character_list = list(scene_data.character_list)
         character_list.remove(0)
         character_handle_panel = panel.PageHandlePanel(
             character_list,
             see_character_info_panel.SeeCharacterInfoByNameDrawInScene,
             10,
             5,
             self.width,
             1,
             0,
             null_button_text=character_data.target_character_id,
         )
         see_instruct_panel = SeeInstructPanel(self.width)
         cache.wframe_mouse.w_frame_skip_wait_mouse = 0
         if cache.now_panel_id != constant.Panel.IN_SCENE:
             break
         character_handle_panel.null_button_text = character_data.target_character_id
         line_feed.draw()
         title_draw.draw()
         game_time_draw.draw()
         now_position_draw.draw()
         line_feed.draw()
         ask_list = []
         if len(scene_data.character_list) > 1:
             meet_draw.draw()
             line_feed.draw()
             character_handle_panel.update()
             character_handle_panel.draw()
             ask_list.extend(character_handle_panel.return_list)
             line_draw = draw.LineDraw("-.-", self.width)
             line_draw.draw()
         character_info_draw_list = []
         if character_data.target_character_id:
             character_head_draw = see_character_info_panel.CharacterInfoHead(
                 character_data.cid, self.width
             )
             target_head_draw = see_character_info_panel.CharacterInfoHead(
                 character_data.target_character_id, self.width
             )
             character_head_draw_list = [y for x in character_head_draw.draw_list for y in x]
             character_head_draw_list[0].text += " " + character_head_draw_list[2].text
             del character_head_draw_list[2]
             target_head_draw_list = [y for x in target_head_draw.draw_list for y in x]
             target_head_draw_list[0].text += " " + target_head_draw_list[2].text
             del target_head_draw_list[2]
             character_info_draw_list = list(zip(character_head_draw_list, target_head_draw_list))
         else:
             character_head_draw = see_character_info_panel.CharacterInfoHead(
                 character_data.cid, self.width
             )
             character_info_draw_list = character_head_draw.draw_list
         for value_tuple in character_info_draw_list:
             for value in value_tuple:
                 value.draw()
             line_feed.draw()
         character_status_draw_list = []
         if character_data.target_character_id:
             character_status_draw = see_character_info_panel.SeeCharacterStatusPanel(
                 character_data.cid, self.width / 2, 3, 0
             )
             target_status_draw = see_character_info_panel.SeeCharacterStatusPanel(
                 character_data.target_character_id, self.width / 2 - 1, 3, 0
             )
             character_status_draw_list = list(
                 zip(character_status_draw.draw_list, target_status_draw.draw_list)
             )
         else:
             character_status_draw = see_character_info_panel.SeeCharacterStatusPanel(
                 character_data.cid, self.width, 5
             )
             character_status_draw_list = character_status_draw.draw_list
         for label in character_status_draw_list:
             if isinstance(label, tuple):
                 index = 0
                 for value in label:
                     if isinstance(value, list):
                         for value_draw in value:
                             value_draw.draw()
                     else:
                         value.line_feed = 0
                         value.draw()
                     if not index:
                         fix_draw = draw.NormalDraw()
                         fix_draw.width = 1
                         fix_draw.text = "|"
                         fix_draw.draw()
                         index = 1
                 line_feed.draw()
             elif isinstance(label, list):
                 for value in label:
                     value.draw()
                 line_feed.draw()
             else:
                 label.draw()
         see_instruct_panel.draw()
         ask_list.extend(see_instruct_panel.return_list)
         target_id = character_data.target_character_id
         flow_handle.askfor_all(ask_list)
         py_cmd.clr_cmd()