资源简介
参考幼麒麟家的达达麻将,cocos官方商店里面的棋牌游戏参考,有修改部分。可以跑起来看看。
前端:cocos creator + js
后端:nodejs
数据库:MySQL
代码片段和文件信息
#!python
import ossys
from xml.etree import ElementTree
from PIL import Image
def tree_to_dict(tree):
d = {}
for index item in enumerate(tree):
if item.tag == ‘key‘:
if tree[index+1].tag == ‘string‘:
d[item.text] = tree[index + 1].text
elif tree[index + 1].tag == ‘true‘:
d[item.text] = True
elif tree[index + 1].tag == ‘false‘:
d[item.text] = False
elif tree[index+1].tag == ‘dict‘:
d[item.text] = tree_to_dict(tree[index+1])
return d
def gen_png_from_plist(plist_filename png_filename):
file_path = plist_filename.replace(‘.plist‘ ‘‘)
big_image = Image.open(png_filename)
root = ElementTree.fromstring(open(plist_filename ‘r‘).read())
plist_dict = tree_to_dict(root[0])
to_list = lambda x: x.replace(‘{‘‘‘).replace(‘}‘‘‘).split(‘‘)
for kv in plist_dict[‘frames‘].items():
rectlist = to_list(v[‘frame‘])
width = int( rectlist[3] if v[‘rotated‘] else rectlist[2] )
height = int( rectlist[2] if v[‘rotated‘] else rectlist[3] )
box=(
int(rectlist[0])
int(rectlist[1])
int(rectlist[0]) + width
int(rectlist[1]) + height
)
sizelist = [ int(x) for x in to_list(v[‘sourceSize‘])]
rect_on_big = big_image.crop(box)
if v[‘rotated‘]:
rect_on_big = rect_on_big.rotate(90)
result_image = Image.new(‘RGBA‘ sizelist (0000))
if v[‘rotated‘]:
result_box=(
( sizelist[0] - height )/2
( sizelist[1] - width )/2
( sizelist[0] + height )/2
( sizelist[1] + width )/2
)
else:
result_box=(
( sizelist[0] - width )/2
( sizelist[1] - height )/2
( sizelist[0] + width )/2
( sizelist[1] + height )/2
)
result_image.paste(rect_on_big result_box mask=0)
if not os.path.isdir(file_path):
os.mkdir(file_path)
outfile = (file_path+‘/‘ + k).replace(‘gift_‘ ‘‘)
print outfile “generated“
result_image.save(outfile)
if __name__ == ‘__main__‘:
filename = sys.argv[1]
plist_filename = filename + ‘.plist‘
png_filename = filename + ‘.png‘
if (os.path.exists(plist_filename) and os.path.exists(png_filename)):
gen_png_from_plist( plist_filename png_filename )
else:
print “make sure you have boith plist and png files in the same directory“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-01-27 05:26 js麻将\
目录 0 2017-01-27 05:26 js麻将\ddmj_20161230\
目录 0 2017-01-27 05:26 js麻将\ddmj_20161230\client\
文件 1482 2016-12-02 00:32 js麻将\ddmj_20161230\client\.gitignore
文件 48 2016-12-02 00:28 js麻将\ddmj_20161230\client\README.md
文件 747 2016-12-02 00:27 js麻将\ddmj_20161230\client\README_copy.md
目录 0 2017-01-27 05:25 js麻将\ddmj_20161230\client\assets\
文件 260070 2016-12-02 00:32 js麻将\ddmj_20161230\client\assets\Icon.png
文件 677 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\Icon.png.me
目录 0 2017-01-27 05:25 js麻将\ddmj_20161230\client\assets\anims\
文件 1594 2016-08-28 22:51 js麻将\ddmj_20161230\client\assets\anims\angry.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\angry.anim.me
文件 870 2016-12-25 12:55 js麻将\ddmj_20161230\client\assets\anims\dingque_tuijian.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\dingque_tuijian.anim.me
文件 939 2016-08-28 22:52 js麻将\ddmj_20161230\client\assets\anims\fennu.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\fennu.anim.me
文件 1601 2016-10-30 19:39 js麻将\ddmj_20161230\client\assets\anims\guafeng.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\guafeng.anim.me
文件 616 2016-08-28 22:52 js麻将\ddmj_20161230\client\assets\anims\han.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\han.anim.me
文件 618 2016-08-28 22:53 js麻将\ddmj_20161230\client\assets\anims\happy.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\happy.anim.me
文件 1597 2016-08-28 22:53 js麻将\ddmj_20161230\client\assets\anims\huaixiao.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\huaixiao.anim.me
文件 1258 2016-08-28 22:48 js麻将\ddmj_20161230\client\assets\anims\jiong.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\jiong.anim.me
文件 2402 2016-08-28 22:49 js麻将\ddmj_20161230\client\assets\anims\lihai.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\lihai.anim.me
文件 2802 2016-12-06 21:00 js麻将\ddmj_20161230\client\assets\anims\play_gang.anim
文件 88 2017-01-18 18:24 js麻将\ddmj_20161230\client\assets\anims\play_gang.anim.me
文件 2630 2016-12-08 20:21 js麻将\ddmj_20161230\client\assets\anims\play_guafeng.anim
............此处省略8190个文件信息
- 上一篇:activiti Spring boot 整合
- 下一篇:SQL.rar
评论
共有 条评论