def render_player(self): ModelInput("hp", "生命") self.maxhp_view = ModelInput("maxhp", "最大生命") ModelInput("ap", "防弹衣") ModelInput("rotation", "旋转") self.coord_view = ModelCoordWidget("coord", "坐标", savable=True, preset=coords) ModelCoordWidget("speed", "速度") ModelInput("weight", "重量") ProxyInput("wanted_level", "通缉等级", self.get_wanted_level, self.set_wanted_level) ui.Hr() with ui.Vertical(className="fill"): with ui.GridLayout(cols=5, vgap=10, className="expand"): ui.Button(label="车坐标->人坐标", onclick=self.from_vehicle_coord) ui.Button(label="从地图读取坐标", onclick=self.playerCoordFromMap) ui.ToggleButton(label="切换无伤状态", onchange=self.set_ped_invincible) ui.Text("防止主角受到来自以下的伤害") with ui.Horizontal(className="fill"): self.player_proof_views = [ ui.CheckBox("爆炸", className="vcenter", onchange=partial(self.set_player_proof, bitindex=Player.SPECIAL_EP)), ui.CheckBox("碰撞", className="vcenter", onchange=partial(self.set_player_proof, bitindex=Player.SPECIAL_DP)), ui.CheckBox("子弹", className="vcenter", onchange=partial(self.set_player_proof, bitindex=Player.SPECIAL_BP)), ui.CheckBox("火焰", className="vcenter", onchange=partial(self.set_player_proof, bitindex=Player.SPECIAL_FP)), ] ui.Button("全部", style=btn_md_style, onclick=self.player_proof_all) ui.Button("再次应用", style=btn_md_style, onclick=self.player_proof_apply).setToolTip( "死亡或者重新读档后需要再次应用")
def render(self): with self.render_win() as win: with ui.Vertical(): with ui.Horizontal(className="expand padding"): ui.Button("检测", className="vcenter", onclick=self.check_attach) self.render_top_button() self.attach_status_view = ui.Text( "", className="vcenter grow padding_left") ui.CheckBox("保持最前", className="vcenter", onchange=self.swith_keeptop) with ui.Notebook(className="fill") as book: book.setOnPageChange(self.onNotePageChange) self.begin_group() try: self.render_main() self.onNotePageChange(book) except Exception: win.close() raise self.end_group() return win
def render_cheat(self): with ui.Vertical(className="fill padding"): with ui.GridLayout(cols=4, vgap=10, className="expand"): self.cheat_views = [ ui.CheckBox(label, onchange=partial(self.toggle_cheat, index=i)) for i, label in enumerate(('不被通缉', '决不会饿', '无限健康', '无限氧气', '无限弹药', '坦克模式', '超级攻击', '超级跳跃', '最大威望', '最大引力', '满街跑车', '满街破车', '无限奔跑', '主角防火', '完美操控', '交通通畅', '超级兔跳', '液压装置', '船可以飞', '车可以飞')) ] ui.CheckBox("冻结任务计时", onchange=self.freeze_timer) ui.CheckBox("一击必杀", onchange=self.one_hit_kill) with ui.Horizontal(className="padding"): ui.Button("同步", onclick=self.cheat_sync)
def render_one_list(self, group): """渲染其中一个列表""" li = ui.ListView(className="fill") li.enableCheckboxes() li.appendColumns(*group['head']) if group['hascount']: li.appendColumn('数量') li.insertItems(group['items']) with ui.Horizontal(className="expand"): uncheck_action = ui.CheckBox(label="不选中表示移除该物品", className="vcenter") if group['hascount']: ui.Text("数量 ", className="vcenter") input_num = ui.SpinCtrl(className="vcenter") ui.Text(" ") ui.Button(label="修改数量", className="button", onclick=partial( self.set_count, view=li, group=group, input_num=input_num)).setToolTip('勾选高亮选中的项的数量') ui.Button(label="勾选选中", className="button", onclick=partial(self.list_view_check_select, view=li)).setToolTip('勾选高亮选中的项') ui.Button(label="全选", className="button", onclick=partial(self.list_view_checkall, view=li)) ui.Button(label="全不选", className="button", onclick=partial(self.list_view_uncheckall, view=li)) ui.Button(label="读取", className="button", onclick=partial(self.list_view_read, view=li, group=group)) ui.Button(label="写入", className="button", onclick=partial(self.list_view_write, view=li, group=group, uncheck_action=uncheck_action))
def render(self): ui.Hr() self.view = ui.CheckBox(self.label, onchange=self.weak.write)
def render_vehicle(self): vehicle = self.weak._vehicle ModelInput("hp", "HP") ModelCoordWidget("dir", "方向") self.vehicle_grad_view = ModelCoordWidget("grad", "旋转") self.vehicle_coord_view = ModelCoordWidget("coord", "坐标", savable=True, preset=coords) ModelCoordWidget("speed", "速度") ModelInput("weight", "重量") ui.Text("") with ui.Vertical(className="fill"): with ui.GridLayout(cols=5, vgap=10, className="expand"): ui.Button(label="人坐标->车坐标", onclick=self.from_player_coord) ui.Button(label="从地图读取坐标", onclick=self.vehicleCoordFromMap) ui.ToggleButton(label="切换无伤状态", onchange=self.set_vehicle_invincible) ui.Button(label="锁车", onclick=self.vehicle_lock_door) ui.Button(label="开锁", onclick=partial(self.vehicle_lock_door, lock=False)) ui.Hr() ui.Text("防止当前载具受到来自以下的伤害") with ui.Horizontal(className="fill"): self.vehicle_proof_views = [ ui.CheckBox("爆炸", className="vcenter", onchange=partial(self.set_vehicle_proof, bitindex=Vehicle.SPECIAL_EP)), ui.CheckBox("碰撞", className="vcenter", onchange=partial(self.set_vehicle_proof, bitindex=Vehicle.SPECIAL_DP)), ui.CheckBox("子弹", className="vcenter", onchange=partial(self.set_vehicle_proof, bitindex=Vehicle.SPECIAL_BP)), ui.CheckBox("火焰", className="vcenter", onchange=partial(self.set_vehicle_proof, bitindex=Vehicle.SPECIAL_FP)), ] ui.Button("全部", style=btn_md_style, onclick=self.vehicle_proof_all) ui.Button( "再次应用", style=btn_md_style, onclick=self.vehicle_proof_apply).setToolTip("切换载具后需要再次应用") ui.Text("颜色") with ui.Horizontal(className="fill"): self.vehicle_body_color_view = ColorWidget("body_color", "车身1", vehicle, "body_color", datasets.COLOR_LIST) self.vehicle_body2_color_view = ColorWidget( "body2_color", "车身2", vehicle, "body2_color", datasets.COLOR_LIST) self.vehicle_stripe_color_view = ColorWidget( "stripe_color", "条纹1", vehicle, "stripe_color", datasets.COLOR_LIST) self.vehicle_stripe2_color_view = ColorWidget( "stripe2_color", "条纹2", vehicle, "stripe2_color", datasets.COLOR_LIST)
def get_chariot_item_dialog(self, name, label, head, items): """战车物品预设对话框""" dialog = getattr(self, name, None) if dialog is None: chariot_equips = self.chariot_equips datasets = self.datasets with exui.StdDialog(label, style={ 'width': 1400, 'height': 900 }, cancel=False, closable=False) as dialog: with ui.Horizontal(className="expand"): dialog.search = ui.ComboBox( wxstyle=wxconst.CB_DROPDOWN, className="fill", onselect=partial( __class__.on_chariot_item_preset_search_select, self.weak, dialog=dialog)) ui.Button("搜索", onclick=partial( __class__.on_chariot_item_preset_search, self.weak, dialog=dialog)) dialog.listview = listview = ui.ListView(className="fill") with ui.Horizontal(className="expand"): dialog.use_max = ui.CheckBox(label="最大", className="vcenter", checked=True) dialog.use_weight = ui.CheckBox(label="重量", className="vcenter", checked=True) dialog.use_attr2 = ui.CheckBox(label="武器弹舱/C装置回避", className="vcenter", checked=True) dialog.listview.appendColumns(*head) dialog.data_list = [] # 读取预设数据时的列表 dialog.name_list = [] # 搜索时用的名称列表 for item in items: item_name = datasets.ITEMS[item[0]] part_name = (item_name, ) # 名称元祖 if isinstance(item[1], tuple): # 多个星级 part_id = item[:1] for sub in item[1]: listview.insertItems([part_name + sub + item[2:]]) dialog.data_list.append(part_id + sub) dialog.name_list.append(item_name) else: listview.insertItems([part_name + item[1:]]) dialog.data_list.append(item) dialog.name_list.append(item_name) listview.setOnItemActivated( partial(__class__.on_chariot_item_preset_selected, self.weak, dialog=dialog)) setattr(self, name, dialog) return dialog