示例#1
0
def save(scene_option, values):
    syslog().debug('scene save start')

    with proxy.connection().atomic() as tx:
        port.scene_save(values)

    syslog().debug('scene save end')
示例#2
0
def cmd(ctx, profile, database, file):
    syslog().debug(
        f"profile=[{profile}]. database=[{database}]. file=[{file}]")

    if database == 'sqlite':
        proxy.initialize(profile, SqliteConfig(file))
    else:
        raise click.BadParameter(
            f'Not supported database. database={database}')

    if ctx.invoked_subcommand is None:
        __list()
示例#3
0
def save(scene, section, _range, config):
    syslog().debug('mob save start')
    syslog().debug(f"scene=[{scene}]. range=[{_range}]. config=[{config}]")

    with proxy.connection().atomic() as tx:
        with config as fc:
            c = yaml.safe_load(fc)
            mobs = c['mob']['names']
            positions = []
            scene_game_objects = []
            count = 0
            for mob in mobs:
                count += 1
                x = random.uniform(_range[0], _range[1])
                y = random.uniform(_range[2], _range[3])
                direction = random.randint(0, 3)
                positions.append(port.Position(x, y, 0.0))
                scene_game_objects.append(
                    port.SceneGameObject(scene_code=scene,
                                         scene_section=section,
                                         game_object_name=mob,
                                         scene_point=count,
                                         direction=direction))

            port.scene_point_save(scene, positions)
            port.scene_game_object_save(scene_game_objects)

    syslog().debug('mob save end')
示例#4
0
def __list(scene_option):
    syslog().debug('scene list start')

    records = port.scene_list()
    for r in records:
        syslog().debug(f'{r.id}, {r.code}')

    syslog().debug('scene list end')
示例#5
0
def __list():
    syslog().debug('mob list start')

    records = port.scene_game_object_list()
    for r in records:
        syslog().debug(
            f'{r.id}, {r.scene_code}, {r.scene_section}, {r.game_object_name}, {r.scene_point}, {r.direction}'
        )

    syslog().debug('mob list end')