Beispiel #1
0
def handle_first_kiss(character_id: int, add_time: int, change_data: game_type.CharacterStatusChange):
    """
    记录初吻
    Keyword arguments:
    character_id -- 角色id
    add_time -- 结算时间
    change_data -- 状态变更信息记录对象
    """
    if not add_time:
        return
    character_data: game_type.Character = cache.character_data[character_id]
    target_data: game_type.Character = cache.character_data[character_data.target_character_id]
    target_data.social_contact_data.setdefault(character_id, 0)
    if target_data.social_contact_data[character_id] >= 3:
        if character_data.first_kiss == -1:
            character_data.first_kiss = target_data.cid
            if (not character_id) or (not target_data.cid):
                now_draw = draw.NormalDraw()
                now_draw.text = _("{character_name}失去了初吻\n").format(character_name=character_data.name)
                now_draw.width = window_width
                now_draw.draw()
        if target_data.first_kiss == -1:
            target_data.first_kiss = character_id
            if (not character_id) or (not target_data.cid):
                now_draw = draw.NormalDraw()
                now_draw.text = _("{character_name}失去了初吻\n").format(character_name=target_data.name)
                now_draw.width = window_width
                now_draw.draw()
def input_name_panel() -> bool:
    """
    输入角色名面板
    Return arguments:
    bool -- 完成角色创建校验
    """
    character_data = cache.character_data[0]
    ask_name_panel = panel.AskForOneMessage()
    ask_name_panel.set(_("请问能告诉我你的名字吗?"), 10)
    line_feed_draw.draw()
    line.draw()
    not_num_error = draw.NormalDraw()
    not_num_error.text = _("角色名不能为纯数字,请重新输入\n")
    not_system_error = draw.NormalDraw()
    not_system_error.text = _("角色名不能为系统保留字,请重新输入\n")
    not_name_error = draw.NormalDraw()
    not_name_error.text = _("已有角色使用该姓名,请重新输入\n")
    create_judge = 0
    while 1:
        now_name = ask_name_panel.draw()
        if now_name.isdigit():
            not_num_error.draw()
            continue
        if now_name in get_text.translation_values or now_name in get_text.translation._catalog:
            not_system_error.draw()
            continue
        if now_name in cache.npc_name_data:
            not_name_error.draw()
            continue
        character_data.name = now_name
        create_judge = input_nick_name_panel()
        break
    return create_judge
def input_nick_name_panel() -> bool:
    """
    输入角色昵称面板
    Return arguments:
    bool -- 完成角色创建校验
    """
    create_judge = 0
    character_data = cache.character_data[0]
    ask_nick_name_panel = panel.AskForOneMessage()
    now_text = _("该怎么称呼{character_name}好呢?")
    ask_nick_name_panel.set(
        _("该怎么称呼{character_name}好呢?").format(
            character_name=character_data.name), 10)
    line_feed_draw.draw()
    line.draw()
    not_num_error = draw.NormalDraw()
    not_num_error.text = _("角色昵称不能为纯数字,请重新输入")
    not_system_error = draw.NormalDraw()
    not_system_error.text = _("角色昵称不能为系统保留字,请重新输入")
    while 1:
        nick_name = ask_nick_name_panel.draw()
        if nick_name.isdigit():
            not_num_error.draw()
            continue
        if nick_name in get_text.translation_values or nick_name in get_text.translation._catalog:
            not_system_error.draw()
            continue
        character_data.nick_name = nick_name
        create_judge = input_sex_panel()
        break
    return create_judge
Beispiel #4
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]
     self.experience_text_data = {
         0: _("嘴部开发度:"),
         1: _("胸部开发度:"),
         2: _("阴蒂开发度:"),
         3: _("阴茎开发度:"),
         4: _("阴道开发度:"),
         5: _("肛门开发度:"),
     }
     """ 性器官开发度描述 """
     self.draw_list: List[draw.NormalDraw()] = []
     """ 绘制对象列表 """
     sex_tem = character_data.sex in (0, 3)
     organ_list = game_config.config_organ_data[
         sex_tem] | game_config.config_organ_data[2]
     for organ in organ_list:
         now_draw = draw.NormalDraw()
         now_draw.text = self.experience_text_data[organ]
         now_draw.width = width / len(organ_list)
         now_exp = 0
         if organ in character_data.sex_experience:
             now_exp = character_data.sex_experience[organ]
         level_draw = draw.ExpLevelDraw(now_exp)
         new_draw = draw.CenterMergeDraw(width / len(organ_list))
         new_draw.draw_list.append(now_draw)
         new_draw.draw_list.append(level_draw)
         self.draw_list.append(new_draw)
Beispiel #5
0
 def __init__(self, width: int):
     """ 初始化绘制对象 """
     self.width = width
     """ 面板的最大宽度 """
     now_width = 0
     now_draw = draw.CenterMergeDraw(self.width)
     date_draw = draw.NormalDraw()
     date_draw.width = self.width
     date_draw.text = f"{game_time.get_date_text()} {game_time.get_week_day_text()} "
     now_draw.draw_list.append(date_draw)
     now_width += len(date_draw)
     solar_period = game_time.get_solar_period(cache.game_time)
     season = game_config.config_solar_period[solar_period].season
     season_config = game_config.config_season[season]
     season_draw = draw.NormalDraw()
     season_draw.text = f"{season_config.name} "
     season_draw.style = "season"
     season_draw.width = self.width - now_width
     now_draw.draw_list.append(season_draw)
     now_width += len(season_draw)
     judge, solar_period = game_time.judge_datetime_solar_period(
         cache.game_time)
     if judge:
         solar_period_config = game_config.config_solar_period[solar_period]
         solar_period_draw = draw.NormalDraw()
         solar_period_draw.text = f"{solar_period_config.name} "
         solar_period_draw.width = self.width - now_width
         solar_period_draw.style = "solarperiod"
         now_draw.draw_list.append(solar_period_draw)
         now_width += len(solar_period_draw)
     sun_time = game_time.get_sun_time(cache.game_time)
     sun_time_config = game_config.config_sun_time[sun_time]
     sun_time_draw = draw.NormalDraw()
     sun_time_draw.text = f"{sun_time_config.name} "
     sun_time_draw.width = self.width - now_width
     now_draw.draw_list.append(sun_time_draw)
     now_width += len(sun_time_draw)
     if sun_time <= 2 or sun_time >= 10:
         moon_phase = game_time.get_moon_phase(cache.game_time)
         moon_phase_config = game_config.config_moon[moon_phase]
         moon_phase_draw = draw.NormalDraw()
         moon_phase_draw.text = f"{moon_phase_config.name} "
         moon_phase_draw.width = self.width - now_width
         moon_phase_draw.style = "moon"
         now_draw.draw_list.append(moon_phase_draw)
         now_width += len(moon_phase_draw)
     self.width = now_width
     now_draw.width = self.width
     self.now_draw: draw.NormalDraw = now_draw
     """ 当前面板绘制对象 """
Beispiel #6
0
 def set(self, button_list: List[str], message: str, start_id=0):
     """
     设置要绘制的信息
     Keyword arguments:
     button_list -- 监听的按钮列表
     message -- 绘制的消息
     start_id -- id的起始位置
     """
     new_button_list = []
     return_list = []
     for i in range(len(button_list)):
         now_id = text_handle.id_index(i + start_id)
         now_id_text = now_id + button_list[i]
         new_button_list.append(now_id_text)
         now_i_str = str(start_id + i)
         return_list.append(now_i_str)
     width = normal_config.config_normal.text_width
     self.message = draw.NormalDraw()
     self.message.text = message
     self.message.width = width
     self.button_panel = SingleColumnButton()
     self.button_panel.width = width
     self.button_panel.max_height = len(return_list)
     self.button_panel.set(new_button_list, return_list)
     self.button_panel.return_list = dict(zip(return_list, button_list))
Beispiel #7
0
 def set(self, message: str, input_max: int):
     """
     设置要绘制的消息和允许玩家输入的长度
     Keyword arguments:
     message -- 绘制的消息
     input_max -- 允许玩家输入的最大长度
     """
     self.message = draw.NormalDraw()
     self.message.text = message
     self.message.width = normal_config.config_normal.text_width
     self.input_max = input_max
Beispiel #8
0
 def draw(self):
     """ 绘制道具 """
     if self.is_button:
         now_draw = draw.Button(self.draw_text,
                                self.button_return,
                                cmd_func=self.draw_item_info)
     else:
         now_draw = draw.NormalDraw()
         now_draw.text = self.draw_text
     now_draw.width = self.width
     now_draw.draw()
Beispiel #9
0
 def draw(self):
     """ 绘制对象 """
     if self.is_button and (self.save_exist_judge or self.write_save):
         now_draw = draw.Button(self.draw_text,
                                self.button_return,
                                cmd_func=self.draw_save_handle)
     else:
         now_draw = draw.NormalDraw()
         now_draw.text = self.draw_text
     now_draw.width = self.width
     now_draw.draw()
Beispiel #10
0
 def draw(self):
     """ 绘制道具信息 """
     py_cmd.clr_cmd()
     item_config = game_config.config_item[self.cid]
     item_draw = draw.WaitDraw()
     item_draw.text = f"{item_config.name}:{item_config.info}"
     item_draw.width = self.width
     item_draw.draw()
     line_feed = draw.NormalDraw()
     line_feed.text = "\n"
     line_feed.width = 1
     line_feed.draw()
Beispiel #11
0
 def draw(self):
     """ 绘制对象 """
     new_group = itertools.zip_longest(*self.draw_list)
     for draw_list in new_group:
         now_width = int(self.width / len(draw_list))
         for value in draw_list:
             if value != None:
                 value.draw()
             else:
                 now_draw = draw.NormalDraw()
                 now_draw.text = " " * now_width
                 now_draw.draw()
         io_init.era_print("\n")
Beispiel #12
0
 def draw(self):
     self.text_list[1] = text_handle.align(self.text_list[1], "center", 0, 1, self.width - self.id_width)
     text_width = text_handle.get_text_index(self.text_list[0])
     if text_width < self.id_width:
         self.text_list[0] += " " * (self.id_width - text_width)
     now_text = f"{self.text_list[0]}{self.text_list[1]}"
     if self.draw_button:
         now_draw = draw.Button(now_text, str(self.button_id), cmd_func=self.see_clothing_info)
     else:
         now_draw = draw.NormalDraw()
         now_draw.text = now_text
     now_draw.width = self.width
     now_draw.draw()
Beispiel #13
0
 def __init__(self, text: Tuple[str, UUID], width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.text: UUID = text[1]
     """ 食物uid """
     self.cid: str = text[0]
     """ 食物商店索引id """
     self.draw_text: str = ""
     """ 食物名字绘制文本 """
     self.width: int = width
     """ 最大宽度 """
     self.num_button: bool = num_button
     """ 绘制数字按钮 """
     self.button_id: int = str(button_id)
     """ 按钮返回值 """
     self.button_return: str = str(button_id)
     """ 按钮返回值 """
     name_draw = draw.NormalDraw()
     food_data: game_type.Food = cache.restaurant_data[self.cid][self.text]
     quality_text_data = [_("垃圾"), _("饲料"), _("粮食"), _("美味"), _("春药")]
     food_name = ""
     if isinstance(self.cid, str):
         food_recipe: game_type.Recipes = cache.recipe_data[int(self.cid)]
         food_name = food_recipe.name
     else:
         food_config = game_config.config_food[self.cid]
         food_name = food_config.name
     hunger_text = _("热量:")
     if 27 in food_data.feel:
         hunger_text = f"{hunger_text}{round(food_data.feel[27],2)}"
     else:
         hunger_text = f"{hunger_text}0.00"
     thirsty_text = _("水份:")
     if 28 in food_data.feel:
         thirsty_text = f"{thirsty_text}{round(food_data.feel[28],2)}"
     else:
         thirsty_text = f"{thirsty_text}0.00"
     price = round(1 + sum(food_data.feel.values()) * food_data.quality, 2)
     food_name = (food_name + f" {hunger_text} {thirsty_text} " + _("重量:") +
                  str(round(food_data.weight, 2)) + _("克") + " " +
                  _("品质:") + quality_text_data[food_data.quality] + " " +
                  _("售价:" + str(price)))
     index_text = text_handle.id_index(button_id)
     button_text = f"{index_text}{food_name}"
     name_draw = draw.LeftButton(button_text,
                                 self.button_return,
                                 self.width,
                                 cmd_func=self.buy_food)
     self.now_draw = name_draw
     """ 绘制的对象 """
 def __init__(self, text: str, width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.character_id: int = int(text)
     """ 角色id """
     self.draw_text: str = ""
     """ 角色名绘制文本 """
     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)
     """ 按钮返回值 """
     character_data: game_type.Character = cache.character_data[
         self.character_id]
     sex_text = game_config.config_sex_tem[character_data.sex].name
     character_name = character_data.name + f"({sex_text})"
     name_draw = draw.NormalDraw()
     if is_button:
         if num_button:
             index_text = text_handle.id_index(button_id)
             button_text = f"{index_text} {character_name}"
             name_draw = draw.CenterButton(button_text,
                                           self.button_return,
                                           self.width,
                                           cmd_func=self.see_character)
         else:
             button_text = f"[{character_name}]"
             name_draw = draw.CenterButton(button_text,
                                           character_name,
                                           self.width,
                                           cmd_func=self.see_character)
             self.button_return = character_name
         self.draw_text = button_text
     else:
         character_name = f"[{character_name}]"
         character_name = text_handle.align(character_name, "center", 0, 1,
                                            self.width)
         name_draw.text = character_name
         self.draw_text = character_name
     name_draw.width = self.width
     self.now_draw = name_draw
     """ 绘制的对象 """
Beispiel #15
0
 def __init__(self, text: UUID, width: int, is_button: bool,
              num_button: bool, button_id: int):
     self.text: UUID = text
     """ 食物id """
     self.draw_text: str = ""
     """ 食物名字绘制文本 """
     self.width: int = width
     """ 最大宽度 """
     self.num_button: bool = num_button
     """ 绘制数字按钮 """
     self.button_id: int = str(button_id)
     """ 按钮返回值 """
     self.button_return: str = str(button_id)
     """ 按钮返回值 """
     name_draw = draw.NormalDraw()
     food_data: game_type.Food = cache.character_data[0].food_bag[self.text]
     quality_text_data = [_("垃圾"), _("饲料"), _("粮食"), _("美味"), _("春药")]
     food_name = ""
     if food_data.recipe != -1:
         food_recipe: game_type.Recipes = cache.recipe_data[
             food_data.recipe]
         food_name = food_recipe.name
     else:
         food_config = game_config.config_food[food_data.id]
         food_name = food_config.name
     hunger_text = _("热量:")
     if 27 in food_data.feel:
         hunger_text = f"{hunger_text}{round(food_data.feel[27],2)}"
     else:
         hunger_text = f"{hunger_text}0.00"
     thirsty_text = _("水份:")
     if 28 in food_data.feel:
         thirsty_text = f"{thirsty_text}{round(food_data.feel[28],2)}"
     else:
         thirsty_text = f"{thirsty_text}0.00"
     food_name = (food_name + f" {hunger_text} {thirsty_text} " + _("重量:") +
                  str(round(food_data.weight, 2)) + _("克") + " " +
                  _("品质:") + quality_text_data[food_data.quality])
     index_text = text_handle.id_index(button_id)
     button_text = f"{index_text}{food_name}"
     name_draw = draw.LeftButton(button_text,
                                 self.button_return,
                                 self.width,
                                 cmd_func=self.eat_food)
     self.now_draw = name_draw
     """ 绘制的对象 """
Beispiel #16
0
 def __init__(self, text: str, width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.language_id: int = text[0]
     """ 语言id """
     self.language_exp: int = text[1]
     """ 语言经验 """
     self.draw_text: str = ""
     """ 语言名绘制文本 """
     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] = []
     """ 绘制的对象列表 """
     language_config = game_config.config_language[self.language_id]
     language_name = language_config.name
     name_draw = draw.NormalDraw()
     name_draw.width = self.width
     if is_button:
         button_text = ""
         if num_button:
             index_text = text_handle.id_index(button_id)
             button_text = f"{index_text} {language_name}:"
             name_draw = draw.Button(button_text,
                                     self.button_return,
                                     cmd_func=self.see_language_info)
         else:
             button_text = f"{language_name}:"
             name_draw = draw.Button(button_text,
                                     language_name,
                                     cmd_func=self.see_language_info)
             self.button_return = language_name
     else:
         name_draw.text = f"{language_name}:"
     level_draw = draw.ExpLevelDraw(self.language_exp)
     name_draw.width = self.width - len(level_draw)
     self.draw_list = [name_draw, level_draw]
Beispiel #17
0
 def __init__(self, text: Tuple[str, str], width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.text = text[1]
     """ 食物名字 """
     self.cid = text[0]
     """ 食物在食堂内的表id """
     self.draw_text: str = ""
     """ 食物名字绘制文本 """
     self.width: int = width
     """ 最大宽度 """
     self.num_button: bool = num_button
     """ 绘制数字按钮 """
     self.button_id: int = button_id
     """ 数字按钮的id """
     self.button_return: str = str(button_id)
     """ 按钮返回值 """
     name_draw = draw.NormalDraw()
     if is_button:
         if num_button:
             index_text = text_handle.id_index(button_id)
             button_text = f"{index_text}{self.text}"
             name_draw = draw.LeftButton(
                 button_text,
                 self.button_return,
                 self.width,
                 cmd_func=self.see_food_shop_food_list)
         else:
             button_text = f"[{self.text}]"
             name_draw = draw.CenterButton(
                 button_text,
                 self.text,
                 self.width,
                 cmd_func=self.see_food_shop_food_list)
             self.button_return = text
         self.draw_text = button_text
     else:
         name_draw = draw.CenterDraw()
         name_draw.text = f"[{self.text}]"
         name_draw.width = self.width
         self.draw_text = name_draw.text
     self.now_draw = name_draw
     """ 绘制的对象 """
Beispiel #18
0
 def __init__(self, text: int, width: int, is_button: bool,
              num_button: bool, button_id: int):
     """ 初始化绘制对象 """
     self.text = text
     """ 道具id """
     self.draw_text: str = ""
     """ 道具名字绘制文本 """
     self.width: int = width
     """ 最大宽度 """
     self.num_button: bool = num_button
     """ 绘制数字按钮 """
     self.button_id: int = button_id
     """ 数字按钮的id """
     self.button_return: str = str(button_id)
     """ 按钮返回值 """
     name_draw = draw.NormalDraw()
     item_config = game_config.config_item[self.text]
     if is_button:
         if num_button:
             index_text = text_handle.id_index(button_id)
             button_text = f"{index_text}{item_config.name}"
             name_draw = draw.LeftButton(button_text,
                                         self.button_return,
                                         self.width,
                                         cmd_func=self.buy_item)
         else:
             button_text = f"[{item_config.name}]"
             name_draw = draw.CenterButton(button_text,
                                           item_config.name,
                                           self.width,
                                           cmd_func=self.buy_item)
             self.button_return = item_config.name
         self.draw_text = button_text
     else:
         name_draw = draw.CenterDraw()
         name_draw.text = f"[{item_config.name}]"
         name_draw.width = self.width
         self.draw_text = name_draw.text
     self.now_draw = name_draw
     """ 绘制的对象 """
Beispiel #19
0
def title_panel():
    """ 绘制游戏标题菜单 """
    clear_screen = panel.ClearScreenPanel()
    clear_screen.draw()
    width = config_normal.text_width
    title_info = panel.TitleAndRightInfoListPanel()
    game_name = config_normal.game_name
    info_list = [
        config_normal.author, config_normal.verson, config_normal.verson_time
    ]
    title_info.set(config_normal.game_name, info_list, width)
    title_info.draw()
    lineFeed = draw.NormalDraw()
    lineFeed.width = 1
    lineFeed.text = "\n"
    info = _("人类是可以被驯化的")
    lineFeed.draw()
    info_draw = draw.CenterDraw()
    info_draw.text = info
    info_draw.width = width
    info_draw.draw()
    lineFeed.draw()
    lineFeed.draw()
    line = draw.LineDraw("=", width)
    line.draw()
    now_list = [_("开始游戏"), _("读取存档"), _("退出游戏")]
    button_panel = panel.OneMessageAndSingleColumnButton()
    button_panel.set(now_list, "", 0)
    button_panel.draw()
    return_list = button_panel.get_return_list()
    ans = flow_handle.askfor_all(return_list.keys())
    py_cmd.clr_cmd()
    now_key = return_list[ans]
    if now_key == now_list[0]:
        cache.now_panel_id = constant.Panel.CREATOR_CHARACTER
    elif now_key == now_list[1]:
        now_panel = see_save_info_panel.SeeSaveListPanel(width, 0)
        now_panel.draw()
    elif now_key == now_list[2]:
        os._exit(0)
Beispiel #20
0
 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)
Beispiel #21
0
from types import FunctionType
from Script.Core import cache_control, game_type, text_handle, get_text, flow_handle, py_cmd, constant
from Script.Design import map_handle
from Script.Config import game_config, normal_config
from Script.UI.Moudle import panel, draw

cache: game_type.Cache = cache_control.cache
""" 游戏缓存数据 """
_: FunctionType = get_text._
""" 翻译api """
window_width: int = normal_config.config_normal.text_width
""" 窗体宽度 """
line_feed = draw.NormalDraw()
""" 换行绘制对象 """
line_feed.text = "\n"
line_feed.width = 1


class ItemShopPanel:
    """
    用于查看道具商店界面面板对象
    Keyword arguments:
    width -- 绘制宽度
    """
    def __init__(self, width: int):
        """ 初始化绘制对象 """
        self.width: int = width
        """ 绘制的最大宽度 """

    def draw(self):
        """ 绘制对象 """
Beispiel #22
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()
Beispiel #23
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()
Beispiel #24
0
 def draw(self):
     """ 绘制操作菜单面板 """
     self.return_list = []
     line = draw.LineDraw("-.-", self.width)
     line.draw()
     fix_draw = draw.NormalDraw()
     fix_width = int(
         (self.width - int(self.width / len(cache.instruct_filter)) * len(cache.instruct_filter)) / 2
     )
     fix_draw.width = fix_width
     fix_draw.text = " " * fix_width
     fix_draw.draw()
     for now_type in cache.instruct_filter:
         now_config = game_config.config_instruct_type[now_type]
         if cache.instruct_filter[now_type]:
             now_button = draw.CenterButton(
                 f"[{now_config.name}]",
                 now_config.name,
                 self.width / len(cache.instruct_filter),
                 " ",
                 "onbutton",
                 "standard",
                 cmd_func=self.change_filter,
                 args=(now_type,),
             )
         else:
             now_button = draw.CenterButton(
                 f"[{now_config.name}]",
                 now_config.name,
                 self.width / len(cache.instruct_filter),
                 cmd_func=self.change_filter,
                 args=(now_type,),
             )
         now_button.width = int(self.width / len(cache.instruct_filter))
         self.return_list.append(now_button.return_text)
         now_button.draw()
     line_feed.draw()
     line = draw.LineDraw("~..", self.width)
     line.draw()
     now_instruct_list = []
     now_premise_data = {}
     for now_type in cache.instruct_filter:
         if cache.instruct_filter[now_type] and now_type in constant.instruct_type_data:
             for instruct in constant.instruct_type_data[now_type]:
                 premise_judge = 0
                 if instruct in constant.instruct_premise_data:
                     for premise in constant.instruct_premise_data[instruct]:
                         if premise in now_premise_data:
                             if now_premise_data[premise]:
                                 continue
                             premise_judge = 1
                             break
                         else:
                             now_premise_value = handle_premise.handle_premise(premise, 0)
                             now_premise_data[premise] = now_premise_value
                             if not now_premise_value:
                                 premise_judge = 1
                                 break
                 if premise_judge:
                     continue
                 now_instruct_list.append(instruct)
     now_instruct_list.sort()
     instruct_group = value_handle.list_of_groups(now_instruct_list, 3)
     now_draw_list = []
     for instruct_list in instruct_group:
         for instruct_id in instruct_list:
             instruct_name = constant.handle_instruct_name_data[instruct_id]
             id_text = text_handle.id_index(instruct_id)
             now_text = f"{id_text}{instruct_name}"
             now_draw = draw.LeftButton(
                 now_text,
                 str(instruct_id),
                 int(self.width / len(instruct_group)),
                 cmd_func=self.handle_instruct,
                 args=(instruct_id,),
             )
             now_draw_list.append(now_draw)
             self.return_list.append(now_draw.return_text)
     now_draw = panel.VerticalDrawTextListGroup(self.width)
     now_group = value_handle.list_of_groups(now_draw_list, 3)
     now_draw.draw_list = now_group
     now_draw.draw()
Beispiel #25
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()
Beispiel #26
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()
Beispiel #27
0
 def update(self):
     """ 更新绘制对象 """
     self.return_list = []
     start_id = self.now_page * self.limit
     total_page = int((len(self.text_list) - 1) / self.limit)
     if start_id >= len(self.text_list):
         self.now_page = total_page
         start_id = self.now_page * self.limit
     now_page_list = []
     for i in range(start_id, len(self.text_list)):
         if len(now_page_list) >= self.limit:
             break
         now_page_list.append(self.text_list[i])
     draw_text_group = value_handle.list_of_groups(now_page_list, self.column)
     draw_list: List[draw.NormalDraw] = []
     self.end_index = self.button_start_id
     index = self.button_start_id
     line_feed = draw.NormalDraw()
     line_feed.text = "\n"
     line_feed.width = 1
     for draw_text_list in draw_text_group:
         if self.row_septal_lines != "" and index:
             line_draw = draw.LineDraw(self.row_septal_lines, self.width)
             draw_list.append(line_draw)
         now_width = self.width
         if self.col_septal_lines != "":
             col_index = len(draw_text_list) + 1
             col_width = text_handle.get_text_index(self.col_septal_lines)
             now_width -= col_width * col_index
         value_width = int(now_width / self.column)
         col_fix_draw = draw.NormalDraw()
         col_fix_draw.text = self.col_septal_lines
         col_fix_draw.width = 1
         draw_list.append(col_fix_draw)
         for value in draw_text_list:
             is_button = 1
             if value == self.null_button_text:
                 is_button = 0
             value_draw = self.draw_type(value, value_width, is_button, self.num_button, index)
             value_draw.draw_text = text_handle.align(value_draw.draw_text, "center", 0, 1, value_width)
             if self.num_button:
                 self.return_list.append(str(index))
             else:
                 self.return_list.append(value_draw.button_return)
             index += 1
             draw_list.append(value_draw)
             draw_list.append(col_fix_draw)
         draw_list.append(line_feed)
     if self.num_button:
         self.end_index = index
     if total_page:
         now_line = draw.LineDraw("-", self.width)
         draw_list.append(now_line)
         page_change_start_id = self.button_start_id
         if self.num_button:
             page_change_start_id = index
         old_page_index_text = text_handle.id_index(page_change_start_id)
         old_page_button = draw.CenterButton(
             _("{old_page_index_text} 上一页").format(old_page_index_text=old_page_index_text),
             str(page_change_start_id),
             int(self.width / 3),
             cmd_func=self.old_page,
         )
         self.return_list.append(str(page_change_start_id))
         draw_list.append(old_page_button)
         page_text = f"({self.now_page}/{total_page})"
         page_draw = draw.CenterDraw()
         page_draw.width = int(self.width / 3)
         page_draw.text = page_text
         draw_list.append(page_draw)
         next_page_index_text = text_handle.id_index(page_change_start_id + 1)
         next_page_button = draw.CenterButton(
             _("{next_page_index_text} 下一页").format(next_page_index_text=next_page_index_text),
             str(page_change_start_id + 1),
             int(self.width / 3),
             cmd_func=self.next_page,
         )
         self.end_index = page_change_start_id + 1
         self.return_list.append(str(page_change_start_id + 1))
         draw_list.append(next_page_button)
         draw_list.append(line_feed)
     self.draw_list = draw_list
Beispiel #28
0
 def draw(self):
     """ 绘制对象 """
     move_menu_panel_data = {
         0: MapSceneNameDraw(self.now_map, self.width),
         1: GlobalSceneNamePanel(self.now_map, self.width),
         2: SocialSceneNamePanel(self.now_map, self.width),
         3: CollectionSceneNamePanel(self.now_map, self.width),
     }
     move_menu_panel = MoveMenuPanel(self.width)
     while 1:
         line_feed.draw()
         if cache.now_panel_id != constant.Panel.SEE_MAP:
             break
         map_path_str = map_handle.get_map_system_path_str_for_list(
             self.now_map)
         map_data: game_type.Map = cache.map_data[map_path_str]
         map_name = attr_text.get_map_path_text(self.now_map)
         title_draw = draw.TitleLineDraw(_("移动:") + map_name, self.width)
         title_draw.draw()
         now_draw_list: game_type.MapDraw = map_data.map_draw
         character_data: game_type.Character = cache.character_data[0]
         character_scene_id = map_handle.get_map_scene_id_for_scene_path(
             self.now_map, character_data.position)
         return_list = []
         index = 0
         for now_draw_line in now_draw_list.draw_text:
             fix_width = int((self.width - now_draw_line.width) / 2)
             fix_text = " " * fix_width
             fix_draw = draw.NormalDraw()
             fix_draw.text = fix_text
             fix_draw.width = fix_width
             fix_draw.draw()
             for draw_text in now_draw_line.draw_list:
                 if draw_text.is_button and draw_text.text != character_scene_id:
                     scene_path = map_handle.get_scene_path_for_map_scene_id(
                         self.now_map, draw_text.text)
                     now_draw = draw.Button(draw_text.text,
                                            draw_text.text,
                                            cmd_func=self.move_now,
                                            args=(scene_path, ))
                     now_draw.width = self.width
                     now_draw.draw()
                     return_list.append(now_draw.return_text)
                 else:
                     now_draw = draw.NormalDraw()
                     now_draw.text = draw_text.text
                     now_draw.width = self.width
                     if draw_text.is_button and draw_text.text == character_scene_id:
                         now_draw.style = "nowmap"
                     now_draw.draw()
             line_feed.draw()
         path_edge = map_data.path_edge
         scene_path = path_edge[character_scene_id].copy()
         if character_scene_id in scene_path:
             del scene_path[character_scene_id]
         scene_path_list = list(scene_path.keys())
         if len(scene_path_list):
             line = draw.LineDraw(".", self.width)
             line.draw()
             message_draw = draw.NormalDraw()
             message_draw.text = _("你可以从这里前往:\n")
             message_draw.width = self.width
             message_draw.draw()
             draw_list = []
             for scene in scene_path_list:
                 load_scene_data = map_handle.get_scene_data_for_map(
                     map_path_str, scene)
                 now_scene_path = map_handle.get_map_system_path_for_str(
                     load_scene_data.scene_path)
                 now_draw = draw.CenterButton(
                     f"[{load_scene_data.scene_name}]",
                     load_scene_data.scene_name,
                     self.width / 4,
                     cmd_func=self.move_now,
                     args=(now_scene_path, ),
                 )
                 return_list.append(now_draw.return_text)
                 draw_list.append(now_draw)
             draw_group = value_handle.list_of_groups(draw_list, 4)
             for now_draw_list in draw_group:
                 for now_draw in now_draw_list:
                     now_draw.draw()
                 line_feed.draw()
         scene_id_list = list(path_edge.keys())
         now_index = len(scene_id_list)
         index = now_index
         move_menu_panel.update()
         move_menu_panel.draw()
         return_list.extend(move_menu_panel.return_list)
         if move_menu_panel.now_type in move_menu_panel_data:
             now_move_menu = move_menu_panel_data[move_menu_panel.now_type]
             now_move_menu.update(self.now_map, index)
             now_move_menu.draw()
             now_index = now_move_menu.end_index + 1
             return_list.extend(now_move_menu.return_list)
         line = draw.LineDraw("=", self.width)
         line.draw()
         if self.now_map != []:
             now_id = text_handle.id_index(now_index)
             now_text = now_id + _("查看上级地图")
             up_button = draw.CenterButton(now_text,
                                           str(now_index),
                                           self.width / 3,
                                           cmd_func=self.up_map)
             up_button.draw()
             return_list.append(up_button.return_text)
             now_index += 1
         else:
             now_draw = draw.NormalDraw()
             now_draw.text = " " * int(self.width / 3)
             now_draw.width = self.width / 3
             now_draw.draw()
         back_id = text_handle.id_index(now_index)
         now_text = back_id + _("返回")
         back_button = draw.CenterButton(now_text, str(now_index),
                                         self.width / 3)
         back_button.draw()
         return_list.append(back_button.return_text)
         now_index += 1
         character_map = map_handle.get_map_for_path(
             character_data.position)
         if character_map != self.now_map:
             now_id = text_handle.id_index(now_index)
             now_text = now_id + _("查看下级地图")
             down_button = draw.CenterButton(now_text,
                                             str(now_index),
                                             self.width / 3,
                                             cmd_func=self.down_map)
             down_button.draw()
             return_list.append(down_button.return_text)
         line_feed.draw()
         yrn = flow_handle.askfor_all(return_list)
         py_cmd.clr_cmd()
         if yrn == back_button.return_text:
             cache.now_panel_id = constant.Panel.IN_SCENE
             break
    cooking,
    map_handle,
    interest,
    clothing,
)
from Script.UI.Moudle import panel, draw
from Script.UI.Panel import see_character_info_panel
from Script.Config import normal_config, game_config

cache: game_type.Cache = cache_control.cache
""" 游戏缓存数据 """
_: FunctionType = get_text._
""" 翻译api """
width = normal_config.config_normal.text_width
""" 屏幕宽度 """
line_feed_draw = draw.NormalDraw()
""" 绘制换行对象 """
line_feed_draw.text = "\n"
line = draw.LineDraw("=", width)
""" 标题线绘制对象 """


@handle_panel.add_panel(constant.Panel.CREATOR_CHARACTER)
def creator_character_panel():
    """ 创建角色面板 """
    cache.character_data[0] = game_type.Character()
    character_handle.init_character_list()
    while 1:
        if input_name_panel():
            character.init_attr(0)
            game_start()