Beispiel #1
0
from gfirefly.utils.services import CommandService
from gfirefly.server.globalobject import GlobalObject
from gfirefly.server.logobj import logger
from gfirefly.server.globalobject import remoteserviceHandle
from app.gate.core.virtual_character_manager import VCharacterManager

remoteservice = CommandService('transitremote')
GlobalObject().remote['transit']._reference.addService(remoteservice)
groot = GlobalObject().root


@remoteserviceHandle('transit')
def pull_message_remote(key, character_id, args):
    oldvcharacter = VCharacterManager().get_by_id(character_id)
    logger.debug("pull_message_remote =============,args:%s", args)
    if oldvcharacter:
        if isinstance(args, tuple):
            args = (key, oldvcharacter.dynamic_id) + args + (False, )
        else:
            args = (key, oldvcharacter.dynamic_id, args, False)
        logger.debug(args)
        logger.debug(oldvcharacter.node)
        child_node = groot.child(oldvcharacter.node)
        result = child_node.callbackChild(*args)
        # logger('gate found character to pull message:%s %s %s',
        #        oldvcharacter.__dict__, args, result)
        return result
    else:
        return False
Beispiel #2
0
# -*- coding:utf-8 -*-
'''
created by server on 14-5-19下午8:51.
'''
from gfirefly.server.globalobject import GlobalObject
from gfirefly.utils.services import CommandService


nodeservice = CommandService('nodeservice')


def nodeservice_handle(target):
    """服务处理,添加处理函数
    @param target: func Object
    """
    nodeservice.mapTarget(target)

noderemote = GlobalObject().remote['gate']
noderemote._reference.addService(nodeservice)
Beispiel #3
0
# -*- coding:utf-8 -*-
"""
created by sphinx on 
"""
from gfirefly.server.globalobject import GlobalObject
from gfirefly.utils.services import CommandService


login_service = CommandService("LoginService")
GlobalObject().netfactory.addServiceChannel(login_service)
Beispiel #4
0
#coding:utf8
'''
Created on 2014-1-17

@author: CC
'''

from gfirefly.server.globalobject import GlobalObject
from gfirefly.utils.services import CommandService

remoteservice = CommandService("gateremote")
GlobalObject().remote['gate']._reference.addService(remoteservice)


def remoteserviceHandle(target):
    """
	"""
    remoteservice.mapTarget(target)
#coding=utf-8
from gfirefly.server.globalobject import GlobalObject
from gfirefly.utils.services import CommandService
from gfirefly.server.logobj import log
from app.game_node.core.playermanager import PlayerManager

#自定义服务器通道
gamecommandservice = CommandService("gamecommandservice")
setattr(GlobalObject(), "gamecommandservice", gamecommandservice)

#导入逻辑接口
from api import common_api

def stopHandler():
    """
    服务器关闭处理
    :return:
    """
    log.msg(u'server %s is stop ing...' % GlobalObject().json_config['name'])
    log.msg(u'syncdb...')
    for player in PlayerManager().getAllPlayers().values():
        log.msg("%s sync player %s" % (GlobalObject().json_config['name'], player.uid))
        player.saveDataToDb()


GlobalObject().stophandler = stopHandler

log.msg("game api: %s" % gamecommandservice._targets.keys())