コード例 #1
0
ファイル: handlers.py プロジェクト: sujubaima/gmproj
def handler_map_resize_control(ctrl):
    if not ui.blankline():
        ui.echo()
    ui.menu(resize_menu(ctrl), goback=True, backmethod=ctrl.close)
    ui.echo()
    ret = ui.read("请输入需要扩展或剪裁的值):")
    ctrl.input(ret)
コード例 #2
0
def world_menu(team):
    title = ui.colored("队员一览:%s队" % team.leader.name,
                       color="yellow",
                       attrs=["bold"])
    ret = [
        ui.menuitem("移动", goto=lambda x: WorldMovePositionOrder()),
        ui.menuitem("交谈", goto=lambda x: WorldTalkPositionOrder()),
        ui.menuitem("赠与", goto=lambda x: WorldGivePositionOrder()),
        ui.menuitem("探索", goto=lambda x: WorldExplorePositionOrder()),
        ui.menuitem("建设", goto=lambda x: WorldBuildPositionOrder()),
        ui.menuitem("攻击", goto=lambda x: WorldAttackPositionOrder()),
        ui.menuitem("休息", goto=lambda x: WorldRestOrder()),
        ui.menuitem(
            "队伍",
            goto=lambda x: ui.menu(member_menu(),
                                   title=title,
                                   goback=True,
                                   backmethod=lambda: WorldPlayerOrder())),
        ui.menuitem(
            "系统",
            goto=lambda x: ui.menu(system_menu,
                                   columns=2,
                                   width=15,
                                   goback=True,
                                   backmethod=lambda: WorldPlayerOrder()))
    ]
    return ret
コード例 #3
0
ファイル: handlers.py プロジェクト: sujubaima/gmproj
def load_map(arg):
    ret = [ui.menuitem("另存为")]
    for file in os.listdir("%s/../../data/maps" % os.path.dirname(__file__)):
        if not file.endswith(".py") or file.startswith("__init__.py"):
            continue
        ret.append(ui.menuitem(file[:-3], goto=lambda x: load_map_module(x)))
    ui.menu(ret, goback=True)
コード例 #4
0
ファイル: main.py プロジェクト: sujubaima/gmproj
def main(stdscr=None):
    if stdscr is not None:
        scr.stdscr = stdscr
    load_mod()
    ui.echo()
    ui.echo("欢迎体验简易粗糙无界面的上班开会摸鱼专用游戏!")
    ui.echo()
    ui.menu(main_menu, title=main_title())
コード例 #5
0
def task_method(x):
    context.tasks_status[x[0]] = False
    ui.menu([],
            title="事件:%s" % x[0],
            inpanel=x[1],
            shownone=False,
            goback=True,
            backmethod=lambda: show_tasks(back=True))
コード例 #6
0
ファイル: scene.py プロジェクト: sujubaima/gmproj
def handler_explore_tool_select_control(ctrl):
    i_menu = item_menu(ctrl)
    i_menu.insert(
        0, ui.menuitem("徒手", value=(None, ctrl.team.leader), goto=ctrl.select))
    ui.menu(i_menu,
            title=ui.byellow(ctrl.title),
            goback=True,
            backmethod=ctrl.close)
コード例 #7
0
ファイル: team.py プロジェクト: sujubaima/gmproj
def handler_team_control(ctrl):
    title = ui.byellow("当前队伍:%s队" % ctrl.team.leader.name)
    ui.menu(team_menu(ctrl),
            title=title,
            columns=2,
            width=15,
            goback=True,
            backmethod=ctrl.close)
コード例 #8
0
def handler_world_clash(ctx):
    map = ctx.map
    ui.echo()
    ui.map(map, entities=team_info(ctx.map), show_trace=True)
    ui.echo()
    ui.warn("移动过程中发生路径冲突,移动已中断!")
    ui.echo()
    ui.read("(回车继续)")
    ui.menu(world_menu(ctx.subject), title="请选择你的行动方针:", columns=5, width=15)
コード例 #9
0
ファイル: main.py プロジェクト: sujubaima/gmproj
def change_mod(new_mod):
    f = modules.__file__
    if f.endswith(".pyc"):
        f = f[:-1]
    with open(f, "w") as fd:
        fd.write("CURRENT = \"%s\"" % new_mod)
    modules.CURRENT = new_mod
    load_mod()
    ui.menu(main_menu, title=main_title(), title_color="red")
コード例 #10
0
ファイル: battle.py プロジェクト: sujubaima/gmproj
def handler_battle_player(ac):
    map = ac.battle.map
    if ac.back:
        ui.echo()
        ui.map(map, entities=battle_person_handler(ac.snapshot))
    ui.cleanmenu()
    ui.menu(battle_menu(),
            title="请选择%s的行动方针:" % ac.battle.current.name,
            columns=2,
            width=15)
コード例 #11
0
def handler_equip_control(ctrl):
    panel = ["", ui.byellow("装备一览:%s" % ctrl.person.name), ""]
    panel.extend(equipment(ctrl.person))
    ui.menu(equip_menu(ctrl),
            title="请选择你要进行的操作:",
            uppanel=panel,
            columns=2,
            width=19,
            goback=True,
            backmethod=ctrl.close)
コード例 #12
0
def handler_world_player(ctx):
    map = ctx.map
    ui.cleanmenu()
    recenter(ctx.subject)
    if not ui.blankline():
        ui.echo()
    ui.echo("当前回合:%s" % context.timestamp)
    ui.echo()
    ui.map(map, entities=team_info(ctx.map), show_trace=True)
    ui.menu(world_menu(ctx.subject), title="请选择你的行动方针:", columns=5, width=15)
コード例 #13
0
ファイル: special.py プロジェクト: sujubaima/gmproj
def handler_superskill_select_control(ctrl):
    skmenu = []
    for sk in ctrl.superskills:
        comments = [Item.one("ITEM_%s" % sk.tpl_id[11:]).description]
        skmenu.append(
            ui.menuitem(ui.rank(sk),
                        value=sk,
                        comments=comments,
                        goto=ctrl.select))
    skmenu.append(ui.menuitem("离开", value='', goto=ctrl.select))
    ui.menu(skmenu, title=ctrl.title)
コード例 #14
0
ファイル: battle.py プロジェクト: sujubaima/gmproj
def handler_battle_control(ctrl):
    map = ctrl.battle.map
    if not ui.blankline():
        ui.echo()
    ui.map(map, entities=battle_person_handler(ctrl.snapshot))
    ui.cleanmenu()
    ui.menu(battle_menu(ctrl),
            title="请选择%s的行动方针:" % ctrl.battle.current.name,
            macros=ctrl.macs,
            columns=2,
            width=15)
コード例 #15
0
ファイル: editor.py プロジェクト: sujubaima/gmproj
def list_modules(arg, map_func, newbuild=False):
    ret = []
    if newbuild:
        ret.append(ui.menuitem("新建地图组",
                               goto=lambda x: new_module(x, map_func)))
    for file in os.listdir("%s/../../data/maps" % os.path.dirname(__file__)):
        if not file.endswith(".py") or file.startswith("__init__.py"):
            continue
        ret.append(
            ui.menuitem(file[:-3],
                        goto=lambda x: list_maps(x, map_func, newbuild)))
    ui.echo()
    ui.menu(ret, title="请选择目标地图组:", goback=True)
コード例 #16
0
def build_menu(person, pos):
    bmenu = [
        ui.menuitem(
            "建造建筑",
            goto=lambda x: ui.menu(buildings_menu(person, pos), goback=True)),
        ui.menuitem(
            "拆除建筑",
            goto=lambda x: ui.menu(buildings_menu(person, pos), goback=True)),
        ui.menuitem(
            "改造地形",
            goto=lambda x: ui.menu(terran_menu(person, pos), goback=True))
    ]
    return bmenu
コード例 #17
0
ファイル: main.py プロジェクト: sujubaima/gmproj
def show_files(arg):
    load_menu = []
    loaddir = options.SAVEFILE_PATH
    for itm in os.listdir(loaddir):
        apath = loaddir + "/" + itm
        if not apath.endswith(".savefile"):
            continue
        mtime = os.stat(apath).st_mtime
        mtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(mtime))
        showword = "%s (%s)" % (itm, mtime)
        load_menu.append(
            menuitem(showword, value=apath, goto=lambda x: load_file(x)))
    ui.menu(load_menu, title="当前可用存档:", goback=True)
コード例 #18
0
def handler_skill_control(ctrl):
    panel = ["", ui.byellow("技能一览:%s" % ctrl.person.name), ""]
    panel.extend(skill_equipped(ctrl))
    ui.menu(skill_equip_menu(ctrl),
            title="请选择你要进行的操作:",
            uppanel=panel,
            keylist=[chr(i) for i in range(ord('a'),
                                           ord('a') + 26)],
            pagesize=26,
            columns=2,
            width=23,
            goback=True,
            backmethod=ctrl.close)
コード例 #19
0
ファイル: editor.py プロジェクト: sujubaima/gmproj
def list_maps(arg, map_func, newbuild=False):
    ret = []
    if newbuild:
        ret.append(ui.menuitem("新建地图", goto=lambda x: new_map(x, map_func)))
    nomod = False
    try:
        globals.MAP_MODULE = importlib.import_module("proj.data.maps.%s" % arg)
    except Exception as e:
        nomod = True
    if not nomod:
        for m in dir(globals.MAP_MODULE):
            if not m.startswith("MAP_"):
                continue
            ret.append(ui.menuitem(m, value=m, goto=lambda x: map_func(x)))
    ui.echo()
    ui.menu(ret, title="请选择目标地图:", goback=True)
コード例 #20
0
ファイル: trade.py プロジェクト: sujubaima/gmproj
def handler_item_inlay_select_control(ctrl):
    imenu = []
    for idx, inlay in enumerate(ctrl.item.inlays):
        enabled = "filled" not in inlay
        if enabled:
            name_str = inlay["name"]
            comments = [
                "接受材料:%s" % "、".join([ui.tag(acp) for acp in inlay["accept"]])
            ]
            validator = lambda x: True
        else:
            name_str = inlay["name"]
            comments = ["已强化:%s" % ui.rank(inlay["filled"])]
            comments.extend([
                ui.effect(effe, grey=True) for effe in inlay["filled"].effects
                if effe.name is not None
            ])
            validator = lambda x: False
        imenu.append(
            ui.menuitem(name_str,
                        value=idx,
                        comments=comments,
                        validator=validator,
                        goto=ctrl.select))
    ret = ui.menu(imenu,
                  title="请选择你要强化的部位:",
                  goback=True,
                  backmethod=ctrl.close)
    return ret
コード例 #21
0
ファイル: handlers.py プロジェクト: sujubaima/gmproj
def handler_map_element_control(ctrl):
    if not ui.blankline():
        ui.echo()
    ret = ui.read("输入你想要设置的实体名称:")
    ctrl.elename(ret)
    ui.menu(element_menu(ctrl), goback=True, backmethod=ctrl.close)
    ui.echo()
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    ret = ui.read("请输入需要添加元素的坐标(x与y用空格分隔,多个坐标用半角逗号分隔):",
                  handler=lambda x: validate_positions(x, ctrl.map))
    ctrl.input(ret)
コード例 #22
0
ファイル: special.py プロジェクト: sujubaima/gmproj
def handler_superskill_control(ctrl):
    if not ui.blankline():
        ui.echo()
    ui.superskill(ctrl.superskill)
    ui.echo()
    for idx, nd in enumerate(ctrl.superskill.nodes):
        comments = [nd.description]
        for nt in nd.tags:
            if nt.startswith("SKILL_"):
                sk = Skill.one(nt)
                if "Neigong" not in sk.style:
                    comments.append("%s" % ui.skill(sk))
                    for effe in sk.effects:
                        comments.append(ui.effect(effe))
                else:
                    for effe in sk.effects:
                        comments.append(ui.effect(effe.exertion))
        ui.echo(ui.colored("【%s】- " % (idx + 1) + nd.name, attrs=["bold"]))
        for c in comments:
            ui.echo("       " + c)
    ret = ui.menu([],
                  title=ctrl.title,
                  shownone=False,
                  goback=True,
                  backmethod=ctrl.close)
    return ret
コード例 #23
0
def handler_skill_node_select_control(ctrl):
    ui.echo()
    ui.superskill(ctrl.superskill, ctrl.person)
    ui.echo()
    ret = ui.menu(superskill_menu(ctrl),
                  title="请选择你要学习的节点:",
                  goback=True,
                  backmethod=ctrl.close)
コード例 #24
0
def handler_world_attack_select(ctx):
    ret = ui.menu([ui.menuitem(m.name, value=m) for m in ctx.subject.members],
                  title=ui.colored("请选择需要出战的角色:",
                                   color="yellow",
                                   attrs=["bold"]),
                  multiple=True,
                  multiple_range=[1, ctx.number])
    return ret
コード例 #25
0
def handler_world_explore_tool(ctx):
    itm_menu = [ui.menuitem("徒手", value="")]
    itm_menu.extend(item_menu(ctx.subject.members, None, filter=ctx.filter))
    if len(itm_menu) == 1:
        ret = itm_menu[0].value
    else:
        ret = ui.menu(itm_menu, title="以下工具可用于该地块探索:", goback=True)
    return ret
コード例 #26
0
def handler_person_item_object(ctx):
    person_menu = []
    for c in ctx.candidates:
        person_menu.append(ui.menuitem(c.name, value=c))
    if len(person_menu) == 1:
        return person_menu[0].value
    else:
        ret = ui.menu(person_menu, title="你选择你要作用的人物:", goback=True)
        return ret
コード例 #27
0
def handler_person_recipe_ensure(ctx):
    showname = "当前配方含有可选材料,请选择本次使用的材料:"
    ret = ui.menu(recipe_menu(ctx.subject,
                              persons=ctx.persons,
                              recipes=ctx.recipes,
                              sub=True),
                  title=showname,
                  goback=True)
    return ret
コード例 #28
0
def handler_person_study_skill(ctx):
    ui.echo()
    ui.superskill(ctx.superskill, ctx.subject)
    ui.echo()
    ret = ui.menu(superskill_menu(ctx.superskill, ctx.subject),
                  title="请选择你要学习的节点:",
                  goback=True,
                  backmethod=ctx.backmethod)
    return ret
コード例 #29
0
ファイル: handlers.py プロジェクト: sujubaima/gmproj
def handler_map_terran_control(ctrl):
    ui.menu(terran_menu(ctrl),
            keylist=[chr(i) for i in range(ord('a'),
                                           ord('a') + 26)],
            columns=6,
            width=15,
            pagesize=26,
            goback=True,
            backmethod=ctrl.close)
    ui.echo()
    ui.map(map=ctrl.map,
           coordinates=[{
               "positions": ctrl.map.all()
           }],
           entities=entity_info(ctrl.map))
    ui.echo()
    ret = ui.read("请输入需要添加地形的坐标(x与y用空格分隔,多个坐标用半角逗号分隔):",
                  handler=lambda x: validate_positions(x, ctrl.map))
    ctrl.input(ret)
コード例 #30
0
def handler_person_equipment(ctx):
    panel = [
        "",
        ui.colored("装备一览:%s" % ctx.subject.name,
                   color="yellow",
                   attrs=["bold"]), ""
    ]
    panel.extend(equipment(ctx.subject))
    if ctx.fromoff:
        ui.popmenu()
    elif ctx.fromon:
        ui.popmenu()
        ui.popmenu()
    ui.menu(equip_menu(ctx.subject),
            title="请选择你要进行的操作:",
            uppanel=panel,
            goback=True,
            columns=2,
            width=19)