Esempio n. 1
0
def hu_pai(ro, data):
    '''
    胡牌
    :return:
    '''
    print u"hu_pai:"
    obj=Parser(data)
    tableid=obj.read_ubyte()
    str1=obj.read_string()
    pai=obj.read_ubyte()
    int1=obj.read_short()
    int2=obj.read_short()
    int3=obj.read_short()
    int4=obj.read_short()
    flag=obj.read_string()
    yield msg_notify(ro,'hu_pai',tableid,pai)
Esempio n. 2
0
def gm_register(ro, data):
    '''
    GM注册
    :param ro:连接
    :param data:客户端数据包
    :return:
    '''
    print 'GM_register:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        print u'register successed!'
        GM_login()
    else:
        print u'register failed!', obj.read_string()
    yield
Esempio n. 3
0
def gm_login(ro, data):
    '''
    GM登录
    :param ro:连接
    :param data:客户端数据包
    :return:
    '''
    print 'GM_login:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        print u'GM login successed!list room...'
        GM_list_rooms()
    else:
        GM_register(gm)
    yield
Esempio n. 4
0
def list_rooms(ro, data):
    '''
    获取大厅房间列表;
    :param ro:
    :param data:
    :return:
    '''
    print 'list_rooms:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        print u'lobby enter!'
        dat=obj.read_string()
        print dat
        yield msg_notify(ro,'lobby_enter')
    yield
Esempio n. 5
0
def user_register(ro, data):
    '''
    玩家注册
    :param ro:连接
    :param data:客户端数据包
    :return:
    '''
    print 'user_register:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        print u'register successed!'
        yield msg_notify(ro,'register_success')
    else:
        print u'register failed!', obj.read_string()
    yield
Esempio n. 6
0
def list_rooms(ro, data):
    '''
    获取大厅房间列表(创建机器人);
    :param ro:
    :param data:
    :return:
    '''
    print 'list_rooms:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        print u'lobby enter!'
        dat=obj.read_string()
        arr=[]
        for i in range(10):
            arr.append({'uid':'robot'+str(i),'pwd':'111','roomid':int(i/3),'tableid':i%3})
        GM_swap_robot(arr)
    yield
Esempio n. 7
0
def auth_login(ro, data):
    '''
    用户登录
    :param ro:连接
    :param data:客户端数据包
    :return:
    '''
    print 'auth_login:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        print u'login successed!'
        avatar=obj.read_ushort()
        yield msg_notify(ro,'login_success',avatar)
    else:
        yield msg_notify(ro,'login_failed')
        print u'login failed!', obj.read_string()
    yield
Esempio n. 8
0
def enter_room(ro, data):
    '''
    加入游戏房间;
    :param ro:
    :param data:
    :return:
    '''
    print 'enter_room:::::::::::'
    obj=Parser(data)
    sign=obj.read_short()
    if sign==1:
        roomid=obj.read_ushort()
        tableid=obj.read_ubyte()
        print u'room enter!', roomid,  tableid
        yield msg_notify(ro,'room_enter',roomid,tableid)
    else:
        print u'room enter failed!', obj.read_string()
    yield