• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python thrift.TSerialization类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中thrift.TSerialization的典型用法代码示例。如果您正苦于以下问题:Python TSerialization类的具体用法?Python TSerialization怎么用?Python TSerialization使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TSerialization类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: playing_guild_on_event_skill_attack_hit

def playing_guild_on_event_skill_attack_hit(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.skill.ttypes.EventSkillAttackHit()
  # 反序列化
  TSerialization.deserialize(message, serialize)

  if message.dest_type_ != ccentity.entity.ttypes.EntityType.TYPE_NPC:
    return
  if message.type_ != ccentity.entity.ttypes.EntityType.TYPE_ACTOR:
    return
  if message.hurt_type_ != ccentity.skill.ttypes.SkillHurtType.PHYSICS_ATTACK and \
     message.hurt_type_ != ccentity.skill.ttypes.SkillHurtType.MAGIC_ATTACK and \
     message.hurt_type_ != ccentity.skill.ttypes.SkillHurtType.REDUCE_HP:
    return

  # 获取玩家所在副本对象
  playing = guild_types.PlayingManager.get_actor_playing(message.id_)
  if playing is None:
    proxy.Logging.error("[guild] PlayingManager.get_actor_playing(%d) failed" % message.id_)
    return

  # 获取副本玩家对象
  actor = playing.get_actor(message.id_)
  if actor is None:
    proxy.Logging.error("[guild] playing.get_actor(%d) failed" % message.id_)
    return

  # 增加伤害
  actor.add_damage(message.value_)
  # 同步伤害排行
  playing.broadcast_damage_ranking()
开发者ID:tonyhack,项目名称:buzz-server,代码行数:31,代码来源:guild_event.py


示例2: playing_idol_on_event_playing_actor_leave

def playing_idol_on_event_playing_actor_leave(message_type, channel, channel_type, serialize):
  # 获取事件交互代理
  communicator_proxy = variable_table.get_variable(ccvariable.ttypes.Variable.COMMUNICATOR_PROXY)

  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingActorLeave()
  # 反序列化
  TSerialization.deserialize(message, serialize)

  # 取消关注玩家杀死NPC事件、角色被杀死事件
  communicator_proxy.unfollow(ccevent.ttypes.EventType.EVENT_ROLE_KILLED, \
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR, \
      "playing_idol_on_event_actor_killed")
  communicator_proxy.unfollow(ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC, \
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR, \
      "playing_idol_on_event_actor_kill_npc")
  communicator_proxy.unfollow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_REQUEST_COMPLETE,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_idol_on_event_playing_actor_request_complete")

  # 副本管理器中删除玩家对象
  idol_types.PlayingManager.remove_actor(message.actor_)

  log.log_debug("玩家(%d) 离开 idol副本(id=%d,template=%d)" % \
      (message.actor_, message.playing_, message.template_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:25,代码来源:idol_event.py


示例3: playing_soul_on_event_playing_actor_enter

def playing_soul_on_event_playing_actor_enter(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingActorEnter()
  TSerialization.deserialize(message, serialize)

  # 关注玩家杀死NPC事件、请求完成副本事件
  proxy.Communicator.follow(ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_soul_on_event_actor_kill_npc")

  playing = soul_types.PlayingManager.get(message.playing_)
  if playing == None:
    return None

  actor = playing.get_actor(message.actor_)
  if actor == None:
    actor = soul_types.Actor(message.actor_)
    playing.add_actor(actor)

  # 副本管理器中建立一个玩家ID和副本ID的映射关系
  soul_types.PlayingManager.add_actor(message.actor_, message.playing_)

  now = time.time()

  # 请求初始化玩家
  request = ccrequest.playing.ttypes.RequestPlayingInitializeActor()
  request.actor_ = message.actor_
  request.spend_time_ = now - playing.get_start_time()
  request.datas_ = []
  request.scores_ = []
  # 发送请求
  proxy.Request.request(ccrequest.ttypes.RequestType.REQUEST_PLAYING_INITIALIZE_ACTOR,\
      request)

  proxy.Logging.debug("[soul] actor(%d) enter into playing" % message.actor_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:35,代码来源:soul_event.py


示例4: playing_unreal_soul_on_event_role_leave_fighting_status

def playing_unreal_soul_on_event_role_leave_fighting_status(message_type, channel, channel_type, serialize):
    message = ccevent.role.ttypes.EventRoleLeaveFightingStatus()
    TSerialization.deserialize(message, serialize)

    proxy.Logging.debug("[unreal_soul] EventRoleLeaveFightingStatus")

    if message.type_ != ccentity.entity.ttypes.EntityType.TYPE_NPC:
        return None

    playing_id = unreal_soul_types.PlayingManager.get_monster_playing(message.id_)
    if playing_id == 0:
        proxy.Logging.error("[unreal_soul] PlayingManager.get_monster_playing(%d) failed." % message.id_)
        return None

    playing = unreal_soul_types.PlayingManager.get(playing_id)
    if playing == None:
        proxy.Logging.error("[unreal_soul] PlayingManager.get(%d) failed." % playing_id)
        return None

    monster = playing.get_monster(message.id_)
    if monster == None:
        proxy.Logging.error("[unreal_soul] Playing.get_monster(%d) failed." % message.id_)
        return None

    monster.fighting_status_ = False

    proxy.Logging.debug("[unreal_soul] monster(%d) out of fighting status" % message.id_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:27,代码来源:unreal_soul_event.py


示例5: playing_unreal_soul_on_event_playing_actor_leave

def playing_unreal_soul_on_event_playing_actor_leave(message_type, channel, channel_type, serialize):
    message = ccevent.playing.ttypes.EventPlayingActorLeave()
    TSerialization.deserialize(message, serialize)

    proxy.Communicator.unfollow(
        ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,
        message.actor_,
        ccevent.ttypes.ChannelType.CHANNEL_ACTOR,
        "playing_unreal_soul_on_event_actor_kill_npc",
    )

    unreal_soul_types.PlayingManager.remove_actor(message.actor_)

    playing = unreal_soul_types.PlayingManager.get(message.playing_)
    if playing == None:
        proxy.Logging.error("[unreal_soul] PlayingManager.get(%d) failed." % message.playing_)
        return None

    actor = playing.get_actor(message.actor_)
    if actor == None:
        proxy.Logging.error("[unreal_soul] Playing.get_actor(%d) failed." % message.actor_)
        return None

    actor.set_leave(True)

    proxy.Logging.debug("[unreal_soul] actor(%d) leave from playing" % message.actor_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:26,代码来源:unreal_soul_event.py


示例6: playing_guild_on_event_playing_actor_leave

def playing_guild_on_event_playing_actor_leave(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingActorLeave()
  # 反序列化
  TSerialization.deserialize(message, serialize)

  # 取消关注事件
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,
      "playing_guild_on_event_actor_kill_npc")
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_SKILL_ATTACK_HIT,
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,
      "playing_guild_on_event_skill_attack_hit")

  # 获取副本对象
  playing = guild_types.PlayingManager.get(message.playing_)
  if playing is None:
    proxy.Logging.error("[guild] PlayingManager.get(%d) failed" % message.playing_)
    return

  # 获取副本玩家对象
  actor = playing.get_actor(message.actor_)
  if actor is None:
    proxy.Logging.error("[guild] playing.get_actor(%d) failed" % message.actor_)
    return

  # 设置玩家离线
  actor.set_leave(True)
  # 副本管理器中删除玩家ID和副本ID的映射关系
  guild_types.PlayingManager.remove_actor(message.actor_)

  proxy.Logging.debug("[guild] actor(%d) leave from playing" % message.actor_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:32,代码来源:guild_event.py


示例7: playing_slime_on_event_playing_actor_leave

def playing_slime_on_event_playing_actor_leave(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingActorLeave()
  # 反序列化
  TSerialization.deserialize(message, serialize)

  # 取消关注玩家杀死NPC事件
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_slime_on_event_actor_kill_npc")
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_REQUEST_COMPLETE,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_slime_on_event_playing_actor_request_complete")

  # 副本管理器中删除玩家ID和副本ID的映射关系
  slime_types.PlayingManager.remove_actor(message.actor_)

  # 移除临时技能
  facade_request.remove_temp_skill(ccentity.entity.ttypes.EntityType.TYPE_ACTOR,\
      message.actor_, 100)
  facade_request.remove_temp_skill(ccentity.entity.ttypes.EntityType.TYPE_ACTOR,\
      message.actor_, 200)
  facade_request.remove_temp_skill(ccentity.entity.ttypes.EntityType.TYPE_ACTOR,\
      message.actor_, 300)
  # 转为普通技能形态
  facade_request.change_skill_form(ccentity.entity.ttypes.EntityType.TYPE_ACTOR,\
      message.actor_, ccentity.skill.ttypes.SkillFormType.COMMON)

  proxy.Logging.debug("[slime] actor(%d) leave from playing" % message.actor_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:29,代码来源:slime_event.py


示例8: playing_coliseum_on_event_playing_create

def playing_coliseum_on_event_playing_create(message_type, channel, channel_type, serialize):
    # 事件消息
    message = ccevent.playing.ttypes.EventPlayingCreate()
    # 反序列化
    TSerialization.deserialize(message, serialize)

    # 关注玩家进入/退出副本事件
    proxy.Communicator.follow(
        ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_ENTER,
        message.template_,
        ccevent.ttypes.ChannelType.CHANNEL_PLAYING,
        "playing_coliseum_on_event_playing_actor_enter",
    )
    proxy.Communicator.follow(
        ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_LEAVE,
        message.template_,
        ccevent.ttypes.ChannelType.CHANNEL_PLAYING,
        "playing_coliseum_on_event_playing_actor_leave",
    )

    # 创建副本对象并加入副本管理器
    playing = coliseum_types.Playing(message.playing_, message.template_, message.scene_)
    coliseum_types.PlayingManager.add(playing)

    proxy.Logging.debug("[coliseum] playing(%d,%d,%d) create" % (message.playing_, message.template_, message.scene_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:25,代码来源:coliseum_event.py


示例9: playing_on_event_playing_request_update_record

def playing_on_event_playing_request_update_record(message_type, channel, channel_type, serialize):
  # 事件对象
  message = ccevent.playing.ttypes.EventPlayingRequestUpdateRecord()
  # 反序列化
  TSerialization.deserialize(message, serialize)
  if message.template_ >= 1 and message.template_ <= 6:
    plot.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ >= 7 and message.template_ <= 14:
    idol.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ == 15:
    slime.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ == 16:
    coliseum.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ == 17:
    unreal_soul.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ == 18 and message.template_ <= 21:
    slaughter_house.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ >= 100 and message.template_ <= 107:
    team.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  elif message.template_ >= 201 and message.template_ <= 224:
    guild.update_record(message.actor_, message.template_,
        message.result_, message.record_)
  else:
    None
开发者ID:tonyhack,项目名称:buzz-server,代码行数:31,代码来源:playing_event.py


示例10: main

def main():

	myapp = thrift.App(ap_name="iperf", binary_path="/usr/bin/iperf", description="Hello World Application")
	myapp.parameters =  ([thrift.Parameter(name="server", cmd='-s', type= "Flag", default_value="False"), 
		thrift.Parameter(name="client", cmd='-c', type= "String")] )


	send('def_application', TSerialization.serialize(myapp))
	send('def_group', "Servers", "kali")


	app_inst = thrift.AppInstance()
	app_inst.inst_name = "iperf_client"
	app_inst.app_name = "iperf"
	# app_inst.arguments = {"server": ""}
	app_inst.arguments = {"client": "192.168.1.37"}
	# app_inst.environment =
	# app_inst.clean_env =					
	# app_inst.map_err_to_out =

	# my_iface = thrift.Iface(if_name= "wlan0") 	# MOCKUP: This is obviously incomplete

	send('add_application', "kali", TSerialization.serialize(app_inst))
	# api_server.add_application("kali", app_inst)

	event_trigger = thrift.EventTrigger(name="kali_installed" ,enabled=True)
	event_trigger.conditions = {'kali.iperf_client': 'Installed'}

	send('def_event',TSerialization.serialize(event_trigger))


	send('start_experiment')

	# 
	time.sleep(60)
开发者ID:munozropero,项目名称:management_framework,代码行数:35,代码来源:experiment_description.py


示例11: playing_unreal_soul_on_event_playing_actor_enter

def playing_unreal_soul_on_event_playing_actor_enter(message_type, channel, channel_type, serialize):
    message = ccevent.playing.ttypes.EventPlayingActorEnter()
    TSerialization.deserialize(message, serialize)

    proxy.Communicator.follow(
        ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,
        message.actor_,
        ccevent.ttypes.ChannelType.CHANNEL_ACTOR,
        "playing_unreal_soul_on_event_actor_kill_npc",
    )

    playing = unreal_soul_types.PlayingManager.get(message.playing_)
    if playing == None:
        proxy.Logging.error("[unreal_soul] PlayingManager.get(%d) failed." % message.playing_)
        return None

    actor = playing.get_actor(message.actor_)
    if actor == None:
        actor = unreal_soul_types.Actor(message.actor_)
        playing.add_actor(actor)
        increase_actor_playing_complete(message.actor_, playing.template_)

    actor.set_leave(False)

    unreal_soul_types.PlayingManager.add_actor(message.actor_, message.playing_)

    now = time.time()

    # 初始化玩家
    request = ccrequest.playing.ttypes.RequestPlayingInitializeActor()
    request.actor_ = message.actor_
    request.spend_time_ = now - playing.start_time_
    request.datas_ = []
    request.scores_ = []
    proxy.Request.request(ccrequest.ttypes.RequestType.REQUEST_PLAYING_INITIALIZE_ACTOR, request)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:35,代码来源:unreal_soul_event.py


示例12: message_handler

	def message_handler(self, msg):	# CHECK: IS IT NECESSARY TO HAVE IT DECLARED IN THE SUPERCLASS IF YOU HAVE IT IN THE SUBCLASS?
		logging.debug ("Entered function")
		if len(msg) < 3:
			logging.error("ERROR", "Received message is incomplete (topic, header or bodymsg may be missing)")
			# ERROR
		else:
			topic = msg[0]
			msg_header = TSerialization.deserialize(thrift.MsgHeader(), msg[1])
	
			messagetype = ('CREATE', 'CONFIGURE', 'REQUEST', 'RELEASE', 'INFORM')	## DEBUGGING ONLY. ERASE AFTERWARDS!
			logging.info("Got a message of type:%s", messagetype[msg_header.mtype])
			function_mapper = ('CreateMsg', 'ConfigMsg', 'RequestMsg', 'ReleaseMsg')
			# decoding_base = globals()["thrift."+function_mapper[msg_header.mtype]] ## REMOVE. This would produce a key error
			decoding_base = getattr(thrift, function_mapper[msg_header.mtype])
			bodymsg = TSerialization.deserialize(decoding_base(), msg[2])	
			coded_attachments = msg[3:len(msg)]
			if topic != self.name and topic in self.topics: # Then it should be addressed to a group the node is member of
				group = topic.split(".#")[0]	# Since all topics end in ".#", it must be removed to get the group name.
			else:
				group = None
			# TODO: Keep working on making it more generic later
			if msg_header.mtype == thrift.MessageType.CREATE:
				self.create (bodymsg.child_type, group, coded_attachments)
			elif msg_header.mtype == thrift.MessageType.CONFIGURE:	
				self.configure(bodymsg)
			elif msg_header.mtype == thrift.MessageType.REQUEST:	#MOCKUP
				body_base = thrift.RequestMsg()
			elif msg_header.mtype == thrift.MessageType.RELEASE:	#MOCKUP
				body_base = thrift.ReleaseMsg()
			else:
				logging.error("ERROR", "Wrong MessageType: {0}".format(msg_header.mtype))
开发者ID:munozropero,项目名称:management_framework,代码行数:31,代码来源:common.py


示例13: playing_team_on_event_playing_actor_leave

def playing_team_on_event_playing_actor_leave(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingActorLeave()
  TSerialization.deserialize(message, serialize)

  # 取消关注玩家杀死NPC事件
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_team_on_event_actor_kill_npc")
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_SKILL_ATTACK_HIT,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_team_on_event_skill_attack_hit")

  playing = team_types.PlayingManager.get(message.playing_)
  if playing == None:
    return None

  actor = playing.get_actor(message.actor_)
  if actor == None:
    proxy.Logging.debug("[team] playing.get_actor(%d) failed." % message.actor_)
    return None

  actor.set_leave(True)

  # 副本管理器中删除玩家ID和副本ID的映射关系
  team_types.PlayingManager.remove_actor(message.actor_)

  proxy.Logging.debug("[team] actor(%d) leave from playing" % message.actor_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:28,代码来源:team_event.py


示例14: playing_plot_on_event_actor_killed

def playing_plot_on_event_actor_killed(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.role.ttypes.EventRoleKilled()

  # 消息反序列化
  TSerialization.deserialize(message, serialize)

  # 主角类型只能是玩家
  if message.type_ != ccentity.entity.ttypes.EntityType.TYPE_ACTOR:
    return None

  # 根据玩家ID获取所在副本ID
  playing_id = plot_types.PlayingManager.get_actor_playing(message.id_)
  if playing_id == None or playing_id == 0:
    proxy.Logging.error("plot_types.PlayingManager.get_actor_playing(%d) failed." % message.id_)
    return None

  # 获取副本对象
  playing = plot_types.PlayingManager.get(playing_id)
  if playing == None:
    proxy.Logging.error("plot_types.PlayingManager.get(%d) failed." % playing_id)
    return None

  # 获取玩家对象
  actor = playing.get_actor(message.id_)
  if actor == None:
    proxy.Logging.error("playing.get_actor(%d) failed." % message.id_)
    return None

  # 玩家死亡次数增加
  actor.inc_dead_count(1)

  log.log_debug("玩家(%d) 死亡次数(%d)" % (message.id_, actor.get_dead_count()))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:33,代码来源:plot_event.py


示例15: playing_team_on_event_playing_create

def playing_team_on_event_playing_create(message_type, channel, channel_type, serialize):
  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingCreate()
  TSerialization.deserialize(message, serialize)

  playing_config = team_types.Config.get(message.template_)
  if playing_config == None:
    proxy.Logging.error("[team] team_types.Config.get(%d) failed." % message.template_)
    return None

  playing = team_types.Playing(message.playing_, message.template_, message.scene_)
  team_types.PlayingManager.add(playing)

  if playing_config.summon_next_npc(message.scene_, playing.get_next_pos()) == False:
    proxy.Logging.error("[team] playing_config.summon_next_npc(%d) failed." % message.scene_)
    return None

  playing.next_pos()

  proxy.Communicator.follow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_ENTER,\
      message.template_, ccevent.ttypes.ChannelType.CHANNEL_PLAYING,\
      "playing_team_on_event_playing_actor_enter")
  proxy.Communicator.follow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_LEAVE,\
      message.template_, ccevent.ttypes.ChannelType.CHANNEL_PLAYING,\
      "playing_team_on_event_playing_actor_leave")

  # 定时器,副本时间
  proxy.Timer.add(message.playing_, playing_config.get_playing_time() * 1000, 1,\
      "playing_team_on_timer_playing")

  proxy.Timer.add(message.playing_, 2000, -1, "playing_team_on_timer_sync_ranking")

  proxy.Logging.debug("[team] playing(%d,%d,%d) create"\
      % (message.playing_, message.template_, message.scene_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:34,代码来源:team_event.py


示例16: playing_slaughter_house_on_event_playing_create

def playing_slaughter_house_on_event_playing_create(message_type, channel, channel_type, serialize):
  message = ccevent.playing.ttypes.EventPlayingCreate()
  TSerialization.deserialize(message, serialize)

  playing_config = slaughter_house_types.Config.get(message.template_)
  if playing_config == None:
    proxy.Logging.error("[slaughter_house] slaughter_house_types.Config.get(%d) failed."\
        % message.template_)
    return None

  playing = slaughter_house_types.Playing(message.playing_, message.template_, message.scene_)
  slaughter_house_types.PlayingManager.add(playing)

  proxy.Communicator.follow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_ENTER,\
      message.template_, ccevent.ttypes.ChannelType.CHANNEL_PLAYING,\
      "playing_slaughter_house_on_event_playing_actor_enter")
  proxy.Communicator.follow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_LEAVE,\
      message.template_, ccevent.ttypes.ChannelType.CHANNEL_PLAYING,\
      "playing_slaughter_house_on_event_playing_actor_leave")

  # 副本开始后进行30秒倒计时
  proxy.Timer.add(message.playing_, 30 * 1000, 1, "playing_slaughter_house_on_timer_start")
  proxy.Timer.add(message.playing_, 3000, -1, "playing_slaughter_house_on_timer_sync_ranking")

  proxy.Logging.debug("[slaughter_house] playing(%d,%d,%d) create"\
      % (message.playing_, message.template_, message.scene_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:26,代码来源:slaughter_house_event.py


示例17: playing_slaughter_house_on_event_actor_killed

def playing_slaughter_house_on_event_actor_killed(message_type, channel, channel_type, serialize):
  message = ccevent.role.ttypes.EventRoleKilled()
  TSerialization.deserialize(message, serialize)

  if message.attacker_type_ != ccentity.entity.ttypes.EntityType.TYPE_ACTOR:
    return None;

  playing_id = slaughter_house_types.PlayingManager.get_actor_playing(message.id_)
  if playing_id == None or playing_id == 0:
    proxy.Logging.error("[slaughter_house] PlayingManager.get_actor_playing(%d) failed."\
        % message.id_)
    return None

  playing = slaughter_house_types.PlayingManager.get(playing_id)
  if playing == None:
    proxy.Logging.error("[slaughter_house] PlayingManager.get(%d) failed." % playing_id)
    return None

  playing_config = slaughter_house_types.Config.get(playing.get_template())
  if playing_config == None:
    proxy.Logging.error("[slaughter_house] slaughter_house_types.Config.get(%d) failed."\
        % playing.get_template())
    return None

  attacker_actor = playing.get_actor(message.attacker_id_)
  if attacker_actor == None:
    proxy.Logging.error("[slaughter_house] playing.get_actor(%d) failed."\
        % message.attacker_id_)
    return None

  attacker_actor.score_ += playing_config.kill_actor_score_
  playing.ranking_.add_score(message.attacker_id_, playing_config.kill_actor_score_)

  proxy.Logging.debug("[slaughter_house] actor(%d) killed by actor(%d)"\
      % (message.id_, message.attacker_id_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:35,代码来源:slaughter_house_event.py


示例18: playing_slaughter_house_on_event_playing_actor_leave

def playing_slaughter_house_on_event_playing_actor_leave(message_type, channel, channel_type, serialize):
  message = ccevent.playing.ttypes.EventPlayingActorLeave()
  TSerialization.deserialize(message, serialize)

  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_ROLE_KILLED,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_slaughter_house_on_event_actor_killed")
  proxy.Communicator.unfollow(ccevent.ttypes.EventType.EVENT_ACTOR_KILL_NPC,\
      message.actor_, ccevent.ttypes.ChannelType.CHANNEL_ACTOR,\
      "playing_slaughter_house_on_event_actor_kill_npc")

  playing = slaughter_house_types.PlayingManager.get(message.playing_)
  if playing == None:
    return None

  actor = playing.get_actor(message.actor_)
  if actor == None:
    proxy.Logging.error("[slaughter_house] playing.get_actor(%d) failed." % message.actor_)
    return None

  actor.leaving_ = True;

  slaughter_house_types.PlayingManager.remove_actor(message.actor_)

  proxy.Logging.debug("[slaughter_house] actor(%d) leave from playing" % message.actor_)
开发者ID:tonyhack,项目名称:buzz-server,代码行数:25,代码来源:slaughter_house_event.py


示例19: playing_coliseum_on_event_playing_destroy

def playing_coliseum_on_event_playing_destroy(message_type, channel, channel_type, serialize):
    # 事件消息
    message = ccevent.playing.ttypes.EventPlayingDestory()
    # 反序列化
    TSerialization.deserialize(message, serialize)

    # 移除定时器
    proxy.Timer.remove(message.playing_, "playing_coliseum_on_timer_playing_start")
    proxy.Timer.remove(message.playing_, "playing_coliseum_on_timer_summon_next_wave")
    proxy.Timer.remove(message.playing_, "playing_coliseum_on_timer_remove_rune")
    proxy.Timer.remove(message.playing_, "playing_coliseum_on_timer_expired")

    # 取消关注玩家进入/退出副本
    proxy.Communicator.unfollow(
        ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_ENTER,
        message.template_,
        ccevent.ttypes.ChannelType.CHANNEL_PLAYING,
        "playing_coliseum_on_event_playing_actor_enter",
    )
    proxy.Communicator.unfollow(
        ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_LEAVE,
        message.template_,
        ccevent.ttypes.ChannelType.CHANNEL_PLAYING,
        "playing_coliseum_on_event_playing_actor_leave",
    )

    # 从副本管理器中删除副本对象
    coliseum_types.PlayingManager.remove(message.playing_)

    proxy.Logging.debug("[coliseum] playing(%d,%d) destroy" % (message.playing_, message.template_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:30,代码来源:coliseum_event.py


示例20: playing_idol_on_event_playing_create

def playing_idol_on_event_playing_create(message_type, channel, channel_type, serialize):
  # 获取事件交互代理
  communicator_proxy = variable_table.get_variable(ccvariable.ttypes.Variable.COMMUNICATOR_PROXY)

  # 事件消息
  message = ccevent.playing.ttypes.EventPlayingCreate()
  # 反序列化
  TSerialization.deserialize(message, serialize)

  # 关注玩家进入/退出副本事件
  communicator_proxy.follow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_ENTER, \
      message.template_, ccevent.ttypes.ChannelType.CHANNEL_PLAYING, \
      "playing_idol_on_event_playing_actor_enter")
  communicator_proxy.follow(ccevent.ttypes.EventType.EVENT_PLAYING_ACTOR_LEAVE, \
      message.template_, ccevent.ttypes.ChannelType.CHANNEL_PLAYING, \
      "playing_idol_on_event_playing_actor_leave")

  # 创建副本对象并加入管理器中
  playing = idol_types.Playing(message.playing_, message.template_, message.scene_)
  idol_types.PlayingManager.add(playing)

  # 获取副本配置
  playing_config = idol_types.Config.get(message.template_)
  if playing_config == None:
    log.log_error("获取 副本配置失败(%d)" % message.template_)
    return None

  # 召唤一个BOSS
  facade_request.summon_npc(message.scene_, playing_config.get_pass_kill_npc(),\
      playing_config.get_pass_npc_x(), playing_config.get_pass_npc_y());

  log.log_debug("idol副本(id=%d,template=%d) 创建成功" % (message.playing_, message.template_))
开发者ID:tonyhack,项目名称:buzz-server,代码行数:32,代码来源:idol_event.py



注:本文中的thrift.TSerialization类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python TSerialization.serialize函数代码示例发布时间:2022-05-27
下一篇:
Python logger.warn函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap