示例#1
0
文件: terrain.py 项目: jjtj/l2
def createFromObject(svgfn, objinfo, worldsize, outfolder):
    outname = objinfo['id']

    sx = objinfo['x']
    sy = objinfo['y']
    w = objinfo['w']
    h = objinfo['h']

    fn = inkscape.exportObject(svgfn, objinfo['id'], outfolder)
    json = createTerrain(fn, sx, sy, w, h, outfolder, outname)
    return dict(fn=fn, json=json)
示例#2
0
文件: level-gen.py 项目: jjtj/l2
def generateLevelCheckPoint(svgfn,
                            root,
                            lvl,
                            worldSize,
                            outfolder):
    chkpts = lvl['checkPoints']
    for c in chkpts:
        cid = c['id']
        el = findElementById(root, cid)

        if el == None:
            continue

        isLine = el.get('isLine', '0')
        c['isLine'] = (isLine == '1')

        if c['isLine']:
            # We just need a png file
            fn = inkscape.exportObject(svgfn, cid, outfolder)
            c['imgfile'] = fn
        else:
            terrainResult = terrain.createFromObject(svgfn, c, worldSize, outfolder)
            c['imgfile'] = terrainResult['fn']
            c['terrainjson'] = terrainResult['json']
示例#3
0
文件: level-gen.py 项目: jjtj/l2
def generateLevelTitle(svgfn, root, lvl, outfolder):
    t = lvl['title']
    tid = t['id']

    fn = inkscape.exportObject(svgfn, tid, outfolder)
    t['imgfile'] = fn