示例#1
0
 def draw(self):
     """ 绘制面板 """
     line = draw.LineDraw(".", self.width)
     line.draw()
     info_draw = panel.CenterDrawTextListPanel()
     info_draw.set(self.info_list, self.width, 3)
     info_draw.draw()
示例#2
0
 def draw(self):
     """ 绘制面板 """
     line = draw.LineDraw(".", self.width)
     line.draw()
     info_draw = panel.CenterDrawTextListPanel()
     info_draw.set(
         [self.dormitory_text, self.classroom_text, self.officeroom_text],
         self.width, 3)
     info_draw.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 draw(self):
        """ 绘制对象 """
        school_id, phase = course.get_character_school_phase(0)
        time_table = cache.course_time_table_data[school_id][phase]
        weekday_text_list = [
            game_config.config_week_day[i].name
            for i in game_config.config_week_day
        ]
        character_data: game_type.Character = cache.character_data[0]
        now_time_value = cache.game_time.hour * 100 + cache.game_time.minute
        while 1:
            now_week_text = game_config.config_week_day[self.now_week].name
            title_draw = draw.TitleLineDraw(_("课程表"), self.width)
            title_draw.draw()
            index = 0
            return_list = []
            for week_text in weekday_text_list:
                if week_text == now_week_text:
                    if index == cache.game_time.weekday():
                        week_text = week_text + _("(今日)")
                    now_draw = draw.CenterDraw()
                    now_draw.text = f"[{week_text}]"

                    now_draw.style = "onbutton"
                    now_draw.width = self.width / len(weekday_text_list)
                    now_draw.draw()
                else:
                    if index == cache.game_time.weekday():
                        week_text = week_text + _("(今日)")
                    now_draw = draw.CenterButton(
                        f"[{week_text}]",
                        week_text,
                        self.width / len(weekday_text_list),
                        cmd_func=self.change_now_week,
                        args=(index, ),
                    )
                    now_draw.draw()
                    return_list.append(now_draw.return_text)
                index += 1
            line_feed.draw()
            line = draw.LineDraw("+", self.width)
            line.draw()
            title_list = [_("课时"), _("科目"), _("教师"), _("上课时间"), _("下课时间")]
            title_list_draw = panel.CenterDrawTextListPanel()
            title_list_draw.set(title_list, self.width, 5)
            title_list_draw.draw()
            now_text_list = []
            times_judge = 1
            if self.now_week not in time_table:
                now_text_list.append(_("休息日"))
            else:
                for times in range(0, len(time_table[self.now_week]) + 1):
                    course_time_id = game_config.config_school_session_data[
                        school_id][times]
                    course_time_config = game_config.config_school_session[
                        course_time_id]
                    course_time = str(course_time_config.start_time)
                    minute = course_time[-2:]
                    hour = course_time[:-2]
                    course_time_text = f"{hour}:{minute}"
                    course_end_time = str(course_time_config.end_time)
                    end_minute = course_end_time[-2:]
                    end_hour = course_end_time[:-2]
                    course_end_time_text = f"{end_hour}:{end_minute}"
                    now_time_judge = 0
                    if times_judge:
                        if self.now_week == cache.game_time.weekday():
                            if now_time_value < course_time_config.end_time:
                                now_time_judge = 1
                                times_judge = 0
                    if not times:
                        now_class_text = _("早读课")
                        if now_time_judge:
                            now_class_text += _("(当前)")
                        now_text = [
                            now_class_text, "", "", course_time_text,
                            course_end_time_text
                        ]
                        now_text_list.append(now_text)
                        continue
                    cache.class_timetable_teacher_data.setdefault(
                        school_id, {})
                    cache.class_timetable_teacher_data[school_id].setdefault(
                        phase, {})
                    cache.class_timetable_teacher_data[school_id][
                        phase].setdefault(character_data.classroom, {})
                    cache.class_timetable_teacher_data[school_id][phase][
                        character_data.classroom].setdefault(
                            self.now_week, {})
                    course_id = time_table[self.now_week][times]
                    course_config = game_config.config_course[course_id]
                    course_name = course_config.name
                    times_text = _("第{times}节").format(times=times)
                    if now_time_judge:
                        times_text += _("(当前)")
                    if (times in cache.class_timetable_teacher_data[school_id]
                        [phase][character_data.classroom][self.now_week]):
                        teacher_id = cache.class_timetable_teacher_data[
                            school_id][phase][character_data.classroom][
                                self.now_week][times]
                        teacher_data: game_type.Character = cache.character_data[
                            teacher_id]
                        teacher_name = teacher_data.name
                        now_text = [
                            times_text,
                            course_name,
                            teacher_name,
                            course_time_text,
                            course_end_time_text,
                        ]
                    else:
                        now_text = [
                            times_text,
                            course_name,
                            _("自习"),
                            course_time_text,
                            course_end_time_text,
                        ]
                    now_text_list.append(now_text)
            for now_text in now_text_list:
                now_draw = panel.LeftDrawTextListPanel()
                now_draw.set(now_text, self.width, 5)
                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.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
                break