0

よし、ディズニーの現在は閉鎖されたゲーム、トゥーンタウン オンラインのサーバーを作っている。しかし、このコーディングを追加した後に問題が発生した。ゲームにはこの部分が必要だ。クライアント「AvatarChooser.enter」を送信しないと、プレイヤーはキャラクターを作成できません! 必要に応じてさらにコードを出しますが、今のところはこれだけです。

class DistributedDistrict(DistributedObject):
__module__ = __name__
notify = directNotify.newCategory('DistributedDistrict')
neverDisable = 1

def __init__(self, cr):
    print 'DistributedDistrict: BlankTest Canvas is now Online..'
    DistributedObject.__init__(self, cr)
    self.name = 'BlankTest Canvas'
    self.available = 0
    self.avatarCount = 0
    self.newAvatarCount = 0

def announceGenerate(self):
    DistributedObject.announceGenerate(self)
    self.cr.activeDistrictMap[self.doId] = self
    messenger.send('shardInfoUpdated')

def delete(self):
    if base.cr.distributedDistrict is self:
        base.cr.distributedDistrict = None
    if self.cr.activeDistrictMap.has_key(self.doId):
        del self.cr.activeDistrictMap[self.doId]
    DistributedObject.delete(self)
    messenger.send('shardInfoUpdated')
    return

def setAvailable(self, available):
    self.available = available
    messenger.send('shardInfoUpdated')

def setName(self, name):
    self.name = name
    messenger.send('shardInfoUpdated')

simbase = DistributedDistrict()
#run() # Initialize the Panda3D API.

次のエラーが表示されます。

TypeError: __ init __() は正確に 2 つの引数を取ります (1 つ指定)

どんな助けでも大歓迎です!!

エラーが発生する場所:

simbase = DistributedDistrict()
#run() # Initialize the Panda3D API.
4

3 に答える 3

1

「5に設定するとうまくいきました」

に設定しないでください5cr引数にはClientRepository引数が必要です。

于 2013-12-29T15:23:50.080 に答える