예제 #1
0
 def draw(self):
     """ 绘制对象 """
     title_draw = draw.TitleLineDraw(_("人物性格"), self.width)
     title_draw.draw()
     for value in self.draw_list:
         if isinstance(value, list):
             now_draw = panel.VerticalDrawTextListGroup(self.width)
             now_group = value_handle.list_of_groups(value, 1)
             now_draw.draw_list = now_group
             now_draw.draw()
         else:
             value.draw()
예제 #2
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()