コード例 #1
0
 def __init__(self, cid, name=u'城管', dynamicId=-1, status=1):
     '''构造方法
     @dynamicId (int) 角色登陆的动态ID socket连接产生的id
     '''
     Character.__init__(self, cid, name)
     self.setCharacterType(Character.PLAYERTYPE)  #设置角色类型为玩家角色
     self.dynamicId = dynamicId  #角色登陆服务器时的动态id
     #--------角色的各个组件类------------
     self.level = CharacterLevelComponent(self)  #角色等级
     self.finance = CharacterFinanceComponent(self)  #角色资产
     self.profession = CharacterProfessionComponent(self)  #角色职业
     self.pack = CharacterPackageComponent(self)  #角色包裹
     self.attribute = CharacterAttributeComponent(self)  #角色属性
     self.matrix = CharacterMatrixComponent(self)  #阵法摆放信息
     self.zhanyi = CharacterZhanYiComponent(self)  #角色的战役信息
     if status:
         self.initPlayerInfo()  #初始化角色