Example #1
0
def process_chat(session_id, msg):
    content = msg[0]#.encode('utf8')
    if content == 'reload':
	ffext.reload('main')#重载此脚本
        ffext.broadcast_msg_session(1, '<b><font color="#ff0000"> main.py已完成重载</font></b>')
        return

    print("process_chat", session_id, content, type(content))

    ret = '<font color="#008000">[%s %s]:</font>%s'%(session_id, GetNowTime(), content)
    ffext.broadcast_msg_session(1, ret)
Example #2
0
def process_chat(session_id, msg):
    content = msg[0]
    if content == 'reload':
        os.system('./update_code.sh')
        ret = ffext.reload('main')  #重载此脚本
        ffext.broadcast_msg_session(1, '<b><font color="#ff0000"> main.py已完成重载'\
                                       '%s</font></b>'%(str(ret)))
        return

    print("process_chat session_id=%s content=%s" % (session_id, content))

    ret = '<font color="#008000">[%s %s]:</font>%s' % (session_id,
                                                       GetNowTime(), content)
    ffext.broadcast_msg_session(1, ret)
Example #3
0
def process_chat(session_id, msg):
    content = msg.value
    if content == 'reload':
        os.system('./update_code.sh')
        ret = ffext.reload('main')  #重载此脚本
        ffext.broadcast_msg_session(1, '<b><font color="#ff0000"> main.py已完成重载'\
                                       '%s</font></b>'%(str(ret)))
        return

    #print("process_chat session_id=%s content=%s"%(session_id, content))

    ret = '<font color="#008000">[%s %s]:</font>%s' % (session_id,
                                                       GetNowTime(), content)
    ret_msg = chat_msg_t()
    ret_msg.value = ret
    ffext.broadcast_msg_session(2, ret_msg)

    player = ffext.singleton(player_mgr_t).get(session_id)
    player.inc_chat_times()
    if player.get_chat_times() > 1000:
        ffext.close_session(session_id)
Example #4
0
def my_session_offline(session_id, online_time):
    content = '<font color="#ff0000">[%s %s] offline </font>' % (session_id,
                                                                 GetNowTime())
    ffext.broadcast_msg_session(1, content)
    ffext.singleton(player_mgr_t).remove(session_id)
    ffext.broadcast_msg_session(1, '<font color="#ff0000">当前在线:</font>')
    ffext.broadcast_msg_session(1, ffext.singleton(player_mgr_t).idlist())
Example #5
0
def my_session_enter(session_id, from_scene, extra_data):
    content = '<font color="#ff0000">[%s %s] online </font>'%(session_id, GetNowTime())
    ffext.broadcast_msg_session(1, content)
    player = player_t(session_id)
    ffext.singleton(player_mgr_t).add(session_id, player)
    ffext.broadcast_msg_session(1, '<font color="#ff0000">当前在线:</font>')
    ffext.broadcast_msg_session(1, ffext.singleton(player_mgr_t).idlist())
Example #6
0
def my_session_offline(session_id, online_time):
    content = '<font color="#ff0000">[%s %s] offline </font>'%(session_id, GetNowTime())
    ffext.broadcast_msg_session(1, content)
    ffext.singleton(player_mgr_t).remove(session_id)
    ffext.broadcast_msg_session(1, '<font color="#ff0000">当前在线:</font>')
    ffext.broadcast_msg_session(1, ffext.singleton(player_mgr_t).idlist())