Exemplo n.º 1
0
    def render(self):
        this = self.weak
        with ui.SplitterWindow(False, 220, styles=styles) as panel:
            with ui.Vertical():
                self.listbox = ui.RearrangeList(className="fill",
                                                onselect=this.onListSelect)
                with ui.Horizontal(className="expand"):
                    ui.Text("Ctrl+↑↓ 上移/下移当前项")
                with ui.Horizontal(className="expand"):
                    ui.Button(label="添加",
                              className="button",
                              onclick=this.onAdd)
                    ui.Button(label="删除",
                              className="button",
                              onclick=this.onDel)
            with ui.Vertical():
                self.render_main()
        ui.AuiItem(panel, caption=self.unique_title, onclose=self.onClose)

        self.listbox.setOnKeyDown(this.onListBoxKey)

        contextmenu = self.render_contextmenu()
        if contextmenu:
            self.listbox.setContextMenu(contextmenu)
        return panel
Exemplo n.º 2
0
 def render(self):
     super().render()
     with ui.Horizontal(className="fill"):
         self.view = ui.ColorPicker(className="expand",
                                    onchange=lambda v: self.write())
         self.render_btn()
         ui.Button("清除", style=btn_sm_style, onclick=self.clear_color)
Exemplo n.º 3
0
    def render_drop_rates(self):
        self._drop_rates_scan_data = (b'\x00\x00\x00????????????????????\x00\x00\x00\x00\x01\x00\x00\x00????'
            b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x3F\x00\x00\x80\x3F')

        self._drop_rates_table = (
            (b'\x2D', 'very_common', '药'),
            (b'\x2F', 'common', '白'),
            (b'\x32', 'uncommon', '绿'),
            (b'\x33', 'very_uncommon', '月'),
            (b'\x34', 'rare', '蓝'),
            (b'\x35', 'very_rare', '紫'),
            (b'\x36', 'legendary', '橙/珠光')
        )

        self._drop_rates_preset = (
            ('原始', (200, 100, 10, 5, 1, 0.1, 0.01)),
            ('仅橙', (0.001, 0.001, 0.001, 0.001, 0.001, 100, 10000)),
            ('仅紫', (0.001, 0.001, 0.001, 0.001, 0.001, 1000, 0.001)),
            ('仅蓝', (0.001, 0.001, 0.001, 0.001, 1000, 0.001, 0.001)),
            ('10x橙', (200, 100, 10, 5, 1, 0.1, 0.1)),
            ('100x橙', (200, 100, 10, 5, 1, 0.1, 1)),
            ('1000x橙', (200, 100, 10, 5, 1, 0.1, 10)),
        )

        self._drop_rates = types.SimpleNamespace()

        ui.Hr()
        with ui.Horizontal(className='expand'):
            ui.Button('读取地址', onclick=self.read_drop_rates)
            for i, item in enumerate(self._drop_rates_preset):
                ui.Button(item[0], className='btn_md', onclick=partial(self.set_drop_rates_preset, index=i))
        self._drop_rates_views = [Input(key, label, addr=partial(__class__.get_drop_rates_item, self.weak, key=key),
            type=float) for _id, key, label in self._drop_rates_table]
Exemplo n.º 4
0
    def __init__(self,
                 *args,
                 cancel=True,
                 ok=True,
                 closable=True,
                 scrollable=False,
                 **kwargs):
        kwargs.setdefault('style', dialog_style)
        kwargs.setdefault('styles', styles)
        super().__init__(*args, **kwargs)
        self.weak = WeakBinder(self)

        super().__enter__()
        with ui.Vertical(className="fill"):
            self.view = (ui.ScrollView if scrollable else ui.Vertical)(
                className="fill padding")

            with ui.Horizontal(className="padding right") as footer:
                if cancel:
                    ui.Button(label="取消").id = wxconst.ID_CANCEL
                if ok:
                    ui.Button(label="确定").id = wxconst.ID_OK
            self.footer = footer
        super().__exit__()

        if not closable:
            self.setOnClose(self.prevent_close)
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
 def render_global(self):
     ModelInput("game_hour", "当前小时")
     ModelInput("game_minute", "当前分钟")
     exui.Label("日期")
     with ui.Horizontal(className="expand"):
         ui.Button("回退一天", onclick=self.day_back)
         ui.Button("前进一天", onclick=self.day_forward)
Exemplo n.º 7
0
 def render_hotkey(self):
     with ui.Horizontal(className="fill padding"):
         self.spawn_vehicle_id_view = ui.ListBox(
             className="expand",
             onselect=self.on_spawn_vehicle_id_change,
             choices=(item[0] for item in VEHICLE_LIST))
         with ui.ScrollView(className="fill padding"):
             self.render_common_text()
Exemplo n.º 8
0
 def render_vehicle_model(self):
     with ui.Horizontal(className="fill"):
         self.vehicle_model_book = ui.Notebook(className="fill",
                                               wxstyle=0x0200)
         with self.vehicle_model_book:
             for category in datasets.VEHICLE_LIST:
                 ui.Item(ui.ListBox(className="expand",
                                    choices=(item[0]
                                             for item in category[1])),
                         caption=category[0])
Exemplo n.º 9
0
 def render_chariot_special_bullets(self):
     datasets = self.datasets
     for i in range(self.chariot.special_bullets.length):
         exui.Label("特殊炮弹%d" % (i + 1))
         with ui.Horizontal(className="fill"):
             ModelSelect("special_bullets.%d.item" % i,
                         "",
                         choices=datasets.SPECIAL_BULLETS.choices,
                         values=datasets.SPECIAL_BULLETS.values)
             ModelInput("special_bullets.%d.count" % i, "数量")
Exemplo n.º 10
0
    def render_drop_rates(self):
        self._drop_rates_scan_data = (
            b'\xFF\xFF\xFF\xFF', b'\x00\x00\x00????????????????????'
            b'\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
        )

        self._drop_rates_table = (
            (b'\x4C', 'chest_awesome_ini', 'ChestAwesomeIni'),
            (b'\x53', 'verycommon', '遍地'),
            (b'\x54', 'verycommon_lower', '遍地 lower'),
            (b'\x55', 'common', '普通'),
            (b'\x57', 'uncommon', '罕见'),
            (b'\x58', 'uncommoner', '更罕见'),
            (b'\x59', 'rare', '稀有'),
            (b'\x5A', 'veryrare', '非常稀有'),
            (b'\x5B', 'awesome_verycommon', '特殊遍地'),
            (b'\x5C', 'awesome_common', '特殊普通'),
            (b'\x5D', 'awesome_uncommon', '特殊罕见'),
            (b'\x5E', 'awesome_uncommoner', '特殊更罕见'),
            (b'\x5F', 'awesome_rare', '特殊稀有'),
            (b'\x60', 'awesome_veryrare', '特殊非常稀有'),
            (b'\x61', 'awesome_legendary', '特殊传说'),
        )

        self._drop_rates_preset = (
            ('原始', (1, 200, 100, 10, 5, 1, 0.1, 0.05, 1, 1, 1, 1, 1, 0.1,
                    0.01)),
            ('更好', (10, 40, 20, 5, 2.5, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 0.5)),
            ('最好', (1, 0.01, 0.01, 0.01, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 1,
                    25, 50, 100)),
            ('5x橙', (1, 200, 100, 10, 5, 1, 0.1, 0.05, 1, 1, 1, 1, 1, 0.1,
                     0.05)),
            ('10x橙', (1, 200, 100, 10, 5, 1, 0.2, 0.1, 1, 1, 1, 1, 1, 0.2,
                      0.1)),
            ('50x橙', (1, 200, 100, 10, 5, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 0.5)),
        )

        self._drop_rates = types.SimpleNamespace()

        ui.Hr()
        with ui.Horizontal(className='expand'):
            ui.Button('读取地址', onclick=self.read_drop_rates)
            for i, item in enumerate(self._drop_rates_preset):
                ui.Button(item[0],
                          className='btn_md',
                          onclick=partial(self.set_drop_rates_preset, index=i))
        self._drop_rates_views = [
            Input(key,
                  label,
                  addr=partial(__class__.get_drop_rates_item,
                               self.weak,
                               key=key),
                  type=float) for _id, key, label in self._drop_rates_table
        ]
Exemplo n.º 11
0
 def render(self):
     super().render()
     with ui.Horizontal(className="fill"):
         if self.has_ammo:
             self.ammo_view = ui.SpinCtrl(className="fill",
                                          min=0,
                                          max=9999,
                                          initial=0)
             ui.Button("最大", style=btn_sm_style, onclick=self.max_ammo)
         ui.Button("移除", style=btn_sm_style, onclick=self.remove_weapon)
         self.render_btn()
Exemplo n.º 12
0
 def render(self):
     with self.render_win() as win:
         with ui.Vertical():
             with ui.Vertical(className="fill padding"):
                 self.textinput = ui.TextInput(className="expand fill",
                                               multiline=True,
                                               style=textstyle)
                 self.textoutput = ui.TextInput(className="expand fill",
                                                multiline=True,
                                                style=textstyle)
             with ui.Horizontal(className="padding"):
                 ui.Button("分析", onclick=self.weak.analyse)
     return win
Exemplo n.º 13
0
 def render_hotkey(self):
     with ui.Horizontal(className="fill padding"):
         self.spawn_vehicle_id_view = ui.ListBox(
             className="expand",
             onselect=self.on_spawn_vehicle_id_change,
             choices=(item[0] for item in VEHICLE_LIST))
         with ui.ScrollView(className="fill padding"):
             self.render_common_text()
             ui.Text("根据左边列表生产载具: alt+V\n"
                     "瞬移到地图指针处: ctrl+alt+g\n"
                     "瞬移到标记点: alt+shift+g\n"
                     "切换转向并加速: alt+shift+m\n"
                     "附近的车大风车: alt+r\n"
                     "附近的人大风车: alt+shift+r")
Exemplo n.º 14
0
    def __init__(self, title, onselect, onsearch=None, *args, **kwargs):
        kwargs.setdefault('style', dialog_style)
        self.onsearch = onsearch
        super().__init__(title, *args, **kwargs)

        with self:
            with ui.Horizontal(className='expand'):
                self.input = ui.TextInput(className='fill',
                                          wxstyle=wxconst.TE_PROCESS_ENTER)
                ui.Button(label="搜索",
                          className='btn_sm',
                          onclick=self.weak.onenter)
            self.listbox = ui.ListBox(className='fill', onselect=onselect)
            self.input.setOnEnter(self.weak.onenter)
Exemplo n.º 15
0
    def __init__(self, *args, **kwargs):
        listbox_opt = kwargs.pop('listbox', {})
        kwargs.setdefault('style', dialog_style)
        super().__init__(*args, **kwargs)

        with self:
            with ui.Vertical(styles=styles, style=styles['class']['fill']):
                self.listbox = ui.CheckListBox(className='fill', **listbox_opt)
                with ui.Horizontal(className="expand"):
                    ui.Button(label="全选",
                              className="button",
                              onclick=self.weak.checkAll)
                    ui.Button(label="反选",
                              className="button",
                              onclick=self.weak.reverseCheck)
Exemplo n.º 16
0
    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(
                              "死亡或者重新读档后需要再次应用")
Exemplo n.º 17
0
 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)
Exemplo n.º 18
0
 def render_vehicle(self):
     ModelInput("hp", "HP")
     ModelCoordWidget("roll", "滚动")
     ModelCoordWidget("dir", "方向")
     self.vehicle_coord_view = ModelCoordWidget("coord",
                                                "坐标",
                                                savable=True,
                                                preset=coords)
     ModelCoordWidget("speed", "速度")
     ModelInput("weight", "重量")
     ui.Text("")
     with ui.Horizontal(className="expand"):
         ui.Button(label="人坐标->车坐标", onclick=self.from_player_coord)
         ui.Button(label="从标记点读取坐标",
                   onclick=self.vehicle_coord_from_waypoint)
         ui.Button(label="锁车", onclick=self.vehicle_lock_door)
         ui.Button(label="开锁",
                   onclick=partial(self.vehicle_lock_door, lock=False))
Exemplo n.º 19
0
    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))
Exemplo n.º 20
0
    def render_pokemon(self):
        # pokemon = self.weak._pokemon
        active_pokemon = self._active_pokemon

        ui.RadioBox("带着的宝可梦",
                    className="expand",
                    choices=tuple(str(i) for i in range(1, 7)),
                    onselect=self.on_active_pokemo_swith)

        with Groups(None, self.weak.onNotePageChange):
            with Group("basic", "基本", active_pokemon):
                ModelInput("breedInfo.bIntimate", "亲密度", spin=True, max=255)
                ModelSelect("breedInfo.wBreed",
                            "种族",
                            choices=self.datasets.BREED_NAMES)
                ModelInput("Header.dwChar", "性格值", hex=True)
                ModelInput("Header.dwID", "ID", hex=True)
                ModelSelect("personality",
                            "性格",
                            choices=self.datasets.PERSONALITYS,
                            onselect=self.on_personality_select)
                ui.Text("性格描述", className="vcenter")
                self.personality_desc = ui.Text("", className="vcenter")
                ModelSelect("breedInfo.wItem",
                            "手持道具",
                            choices=self.datasets.ITEMS)
                ModelInput("breedInfo.dwExp", "经验值")
            with Group("basic", "能力", active_pokemon):
                pass
            with Group("basic", "技能", active_pokemon):
                pass
            with Group("basic", "缎带", active_pokemon):
                pass
            with Group("basic", "其它", active_pokemon):
                pass

        with ui.Horizontal(className="expand"):
            ui.Button("读入",
                      className="btn_sm",
                      onclick=self.read_active_pokemon)
            ui.Button("写回",
                      className="btn_sm",
                      onclick=self.write_active_pokemon)
Exemplo n.º 21
0
    def render_main(self):
        with ui.FlexGridLayout(cols=2, vgap=10,
                               className="expand padding") as infobar:
            ui.Text("地址", className="vcenter input_label")
            self.addr_view = ui.TextInput(readonly=True, className="expand")
            ui.Text("代码", className="vcenter input_label")
            self.code_view = ui.TextInput(readonly=True,
                                          multiline=True,
                                          className="expand")

            infobar.AddGrowableCol(1)
            infobar.AddGrowableRow(1)

        self.textarea = ui.TextInput(multiline=True, className="fill")
        with ui.Horizontal(className="expand"):
            ui.ComboBox(wxstyle=wxconst.CB_READONLY, className="fill")
            ui.Button(label="保存该项", className="button", onclick=self.onSaveIt)
            ui.Button(label="保存文件", className="button", onclick=self.onSave)
            ui.Button(label="另存为", className="button", onclick=self.onSaveAs)
Exemplo n.º 22
0
 def dialog(self):
     """对话框"""
     dialog = getattr(self, '_dialog', None)
     if dialog is None:
         weak = WeakBinder(self)
         with exui.StdDialog(self.label,
                             style={
                                 'width': 1300,
                                 'height': 900
                             },
                             closable=False,
                             cancel=False) as dialog:
             with ui.Horizontal(className="expand"):
                 dialog.search = ui.ComboBox(wxstyle=wxconst.CB_DROPDOWN,
                                             className="fill",
                                             onselect=weak.on_search_select)
                 ui.Button("搜索", onclick=weak.on_search)
             dialog.listview = listview = ui.ListView(className="fill")
             dialog.listview.appendColumns(*self.head)
             listview.insertItems(self.items)
             listview.setOnItemActivated(weak.on_item_selected)
         self._dialog = dialog
     return dialog
Exemplo n.º 23
0
    def render_iteminfos(self):
        datasets = self.datasets
        Choice("物品", datasets.ITEMS, self.on_item_change)
        Label("复制属性")
        with ui.Horizontal(className="fill"):
            self.copy_iteminfo_view = ui.Choice(className="fill",
                                                choices=datasets.ITEMS)
            ui.Button("复制", onclick=self.copy_iteminfo)
        ModelInput("addr_hex", "地址", readonly=True)
        ModelInput("name_ptr", "名称指针", hex=True)
        ModelInput("desc_ptr", "介绍文本", hex=True)
        ModelInput("icon", "图标序号")
        ModelSelect("type", "类型", choices=datasets.WEAPONTYPES)
        ModelInput("level", "要求熟练度", hex=True,
                   size=1).set_help(datasets.PROFICIENCY_HINT)
        ModelInput("power", "威力")
        ModelInput("hit", "命中")
        ModelInput("kill", "必杀")
        ModelInput("weight", "重量")
        ModelInput("range_min", "最小射程")
        ModelInput("range_max", "最大射程")
        ModelInput("move_add", "移动+")
        ModelInput("hp_add", "HP+")
        ModelInput("power_add", "力量+")
        ModelInput("magic_add", "魔力+")
        ModelInput("skill_add", "技巧+")
        ModelInput("speed_add", "速度+")
        ModelInput("lucky_add", "幸运+")
        ModelInput("defense_add", "防御+")
        ModelInput("magicdef_add", "魔防+")

        i = 0
        for item in datasets.ITEM_ATTRS:
            hint, labels = item
            i += 1
            ModelFlagWidget("attr%d" % i, hint or "属性%d" % i, labels=labels)
Exemplo n.º 24
0
 def render(self):
     self.render_lable()
     with ui.Horizontal(className="fill"):
         self.view = ui.TextInput(className="fill", wxstyle=wxconst.TE_PROCESS_ENTER)
         self.render_btn()
     self.view.setOnKeyDown(self.weak.onKey)
Exemplo n.º 25
0
    def render_chariot_items(self):
        datasets = self.datasets

        def detail_keep_click(key):
            return partial(__class__.show_chariot_item_info,
                           self.weak,
                           key=key,
                           read=False)

        def detail_click(key):
            return partial(__class__.show_chariot_item_info,
                           self.weak,
                           key=key)

        def preset_click(key):
            return partial(__class__.show_chariot_item_preset,
                           self.weak,
                           dialog_name='chariot_weapon_dialog',
                           key=key)

        def preset_ci_click(key):
            return partial(__class__.show_chariot_item_preset,
                           self.weak,
                           dialog_name='chariot_ci_dialog',
                           key=key)

        item_choices = self.datasets.CHARIOT_ALL_ITEM.choices
        item_values = self.datasets.CHARIOT_ALL_ITEM.values

        with ModelChoiceDisplay("equips.0.equip",
                                "C装置",
                                choices=item_choices,
                                values=item_values).container:
            ui.Button("上次",
                      className="btn_sm",
                      onclick=detail_keep_click("equips.0"))
            ui.Button("详情",
                      className="btn_sm",
                      onclick=detail_click("equips.0"))
            ui.Button("预设",
                      className="btn_sm",
                      onclick=preset_ci_click("equips.0"))
        with ModelChoiceDisplay("equips.1.equip",
                                "引擎",
                                choices=item_choices,
                                values=item_values).container:
            ui.Button("上次",
                      className="btn_sm",
                      onclick=detail_keep_click("equips.1"))
            ui.Button("详情",
                      className="btn_sm",
                      onclick=detail_click("equips.1"))
            ui.Button("预设",
                      className="btn_sm",
                      onclick=preset_ci_click("equips.1"))
        with ModelChoiceDisplay("equips.2.equip",
                                "C装置2/引擎2",
                                choices=item_choices,
                                values=item_values).container:
            ui.Button("上次",
                      className="btn_sm",
                      onclick=detail_keep_click("equips.2"))
            ui.Button("详情",
                      className="btn_sm",
                      onclick=detail_click("equips.2"))
            ui.Button("预设",
                      className="btn_sm",
                      onclick=preset_ci_click("equips.2"))
        for i in range(5):
            key = "equips.%d" % (i + 3)
            exui.Label("炮穴%d" % (i + 1))
            with ui.Horizontal(className="fill"):
                if self.has_holes:
                    ModelSelect("hole_type.%d" % i,
                                "类型",
                                choices=datasets.HOLE_TYPE,
                                values=datasets.HOLE_TYPE_VALUES)
                ModelChoiceDisplay(key + '.equip',
                                   "",
                                   choices=item_choices,
                                   values=item_values)
                ui.Button("上次",
                          className="btn_sm",
                          onclick=detail_keep_click(key))
                ui.Button("详情", className="btn_sm", onclick=detail_click(key))
                ui.Button("预设", className="btn_sm", onclick=preset_click(key))
        for i in range(self.chariot.items.length):
            key = "items.%d" % i
            with ModelChoiceDisplay(key + '.item',
                                    "物品%d" % (i + 1),
                                    choices=item_choices,
                                    values=item_values).container:
                ui.Button("上次",
                          className="btn_sm",
                          onclick=detail_keep_click(key))
                ui.Button("详情", className="btn_sm", onclick=detail_click(key))
                ui.Button("C装置/引擎", onclick=preset_ci_click(key))
                ui.Button("武器", className="btn_sm", onclick=preset_click(key))
        with Group.active_group().footer:
            ui.Button("导入字段", onclick=self.weak.load_chariot_fields)
            ui.Button("导出字段", onclick=self.weak.dump_chariot_fields)
Exemplo n.º 26
0
    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
Exemplo n.º 27
0
 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)