Пример #1
0
 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)
Пример #2
0
 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.LeftDrawTextListPanel()
     now_draw.set(clothing_info_list, self.width, self.column)
     self.draw_list.extend(now_draw.draw_list)
Пример #3
0
def handle_settle_behavior(character_id: int, now_time: datetime.datetime):
    """
    处理结算角色行为
    Keyword arguments:
    character_id -- 角色id
    now_time -- 结算时间
    """
    status_data: game_type.CharacterStatusChange = cache.settle_behavior_data[
        cache.character_data[character_id].behavior.behavior_id](character_id,
                                                                 now_time)
    now_judge = False
    if status_data == None:
        return
    if status_data.mana_point:
        now_judge = True
    if status_data.hit_point:
        now_judge = True
    if len(status_data.knowledge):
        now_judge = True
    if len(status_data.language):
        now_judge = True
    if len(status_data.status):
        now_judge = True
    if len(status_data.favorability) and not character_id:
        now_judge = True
    if now_judge:
        if not character_id or character_id == cache.character_data[
                0].target_character_id:
            now_character_data = cache.character_data[character_id]
            now_draw = draw.NormalDraw()
            now_draw.text = "\n" + now_character_data.name + "\n"
            now_draw.width = width
            now_draw.draw()
            now_text_list = []
            if status_data.hit_point:
                now_text_list.append(
                    _("体力:") + str(round(status_data.hit_point, 2)))
            if status_data.mana_point:
                now_text_list.append(
                    _("气力:") + str(round(status_data.mana_point, 2)))
            if len(status_data.status):
                now_text_list.extend([
                    f"{game_config.config_character_state[i].name}:{round(status_data.status[i],2)}"
                    for i in status_data.status
                ])
            if len(status_data.knowledge):
                now_text_list.extend([
                    f"{game_config.config_knowledge[i].name}:{round(status_data.knowledge[i],2)}"
                    for i in status_data.knowledge
                ])
            if len(status_data.language):
                now_text_list.extend([
                    f"{game_config.config_language[i].name}:{round(status_data.language[i],2)}"
                    for i in status_data.language
                ])
            if len(status_data.favorability) and not character_id:
                now_text_list.extend([
                    _("{target_name}对{character_name}好感").format(
                        target_name=cache.character_data[i].name,
                        character_name=now_character_data.name) +
                    text_handle.number_to_symbol_string(
                        round(status_data.favorability[i], 2))
                    for i in status_data.favorability
                ])
            now_panel = panel.LeftDrawTextListPanel()
            now_panel.set(now_text_list, width, 8)
            now_panel.draw()
            wait_draw = draw.WaitDraw()
            wait_draw.draw()
Пример #4
0
def handle_settle_behavior(character_id: int, now_time: datetime.datetime):
    """
    处理结算角色行为
    Keyword arguments:
    character_id -- 角色id
    now_time -- 结算时间
    """
    now_character_data: game_type.Character = cache.character_data[
        character_id]
    status_data = game_type.CharacterStatusChange()
    start_time = now_character_data.behavior.start_time
    add_time = int((now_time - start_time).seconds / 60)
    behavior_id = now_character_data.behavior.behavior_id
    if behavior_id in game_config.config_behavior_effect_data:
        for effect_id in game_config.config_behavior_effect_data[behavior_id]:
            constant.settle_behavior_effect_data[effect_id](character_id,
                                                            add_time,
                                                            status_data)
    change_character_social(character_id, status_data)
    now_judge = False
    if character_id:
        return
    if status_data == None:
        return
    if status_data.mana_point:
        now_judge = True
    if status_data.hit_point:
        now_judge = True
    if len(status_data.knowledge):
        now_judge = True
    if len(status_data.language):
        now_judge = True
    if len(status_data.status):
        now_judge = True
    if len(status_data.sex_experience):
        now_judge = True
    if len(status_data.target_change) and not character_id:
        now_judge = True
    if now_judge:
        now_text_list = []
        now_draw = draw.NormalDraw()
        now_draw.text = "\n" + now_character_data.name + ": "
        now_draw.width = width
        now_draw.draw()
        if status_data.hit_point:
            now_text_list.append(
                _("体力:") + str(round(status_data.hit_point, 2)))
        if status_data.mana_point:
            now_text_list.append(
                _("气力:") + str(round(status_data.mana_point, 2)))
        if len(status_data.status):
            now_text_list.extend([
                f"{game_config.config_character_state[i].name}:{text_handle.number_to_symbol_string(round(status_data.status[i],2))}"
                for i in status_data.status
            ])
        if len(status_data.knowledge):
            now_text_list.extend([
                f"{game_config.config_knowledge[i].name}:{text_handle.number_to_symbol_string(round(status_data.knowledge[i],2))}"
                for i in status_data.knowledge
            ])
        if len(status_data.language):
            now_text_list.extend([
                f"{game_config.config_language[i].name}:{text_handle.number_to_symbol_string(round(status_data.language[i],2))}"
                for i in status_data.language
            ])
        if len(status_data.sex_experience):
            now_text_list.extend([
                game_config.config_organ[i].name + _("经验:") +
                text_handle.number_to_symbol_string(
                    round(status_data.sex_experience[i], 2))
                for i in status_data.sex_experience
            ])
        if len(status_data.target_change):
            for target_character_id in status_data.target_change:
                if character_id and target_character_id:
                    continue
                target_change: game_type.TargetChange = status_data.target_change[
                    target_character_id]
                target_data: game_type.Character = cache.character_data[
                    target_character_id]
                now_text = f"\n{target_data.name}:"
                judge = 0
                if target_change.favorability:
                    now_text += _(" 对{character_name}好感").format(
                        character_name=now_character_data.name
                    ) + text_handle.number_to_symbol_string(
                        round(target_change.favorability, 2))
                    judge = 1
                if target_change.new_social != target_change.old_social:
                    now_text += (" " + game_config.config_social_type[
                        target_change.old_social].name + "->" +
                                 game_config.config_social_type[
                                     target_change.new_social].name)
                    judge = 1
                if len(target_change.status):
                    for status_id in target_change.status:
                        if target_change.status[status_id]:
                            now_text += (
                                " " + game_config.
                                config_character_state[status_id].name +
                                text_handle.number_to_symbol_string(
                                    round(target_change.status[status_id], 2)))
                            judge = 1
                if len(target_change.sex_experience):
                    for organ in target_change.sex_experience:
                        if target_change.sex_experience[organ]:
                            now_text += (
                                " " + game_config.config_organ[organ].name +
                                _("经验:") + text_handle.number_to_symbol_string(
                                    round(status_data.sex_experience[organ],
                                          2)))
                            judge = 1
                if judge:
                    now_text_list.append(now_text)
        now_panel = panel.LeftDrawTextListPanel()
        now_panel.set(now_text_list, width, 8)
        now_panel.draw()
        wait_draw = draw.WaitDraw()
        wait_draw.draw()
Пример #5
0
    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